- Python
- Javascript
Synchronous Usage
from anthropic import Anthropic
import dokumetry
client = Anthropic(
api_key="YOUR_ANTHROPIC_API_KEY",
)
# Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all Anthropic calls are automatically tracked.
dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")
message = client.messages.create(
messages=[{ "role": "user", "content": "Hello, Explain LLM Monitoring in one sentence"}],
model="claude-3-opus-20240229",
max_tokens=1024
)
print(message.content)
Asynchronous usage
import asyncio
from anthropic import AsyncAnthropic
import dokumetry
client = AsyncAnthropic(
api_key="YOUR_ANTHROPIC_API_KEY",
)
# Pass the above `client` object along with your Doku Ingester URL and API key and this will make sure that all Anthropic calls are automatically tracked.
dokumetry.init(llm=client, doku_url="YOUR_DOKU_INGESTER_URL", api_key="YOUR_DOKU_TOKEN")
async def main() -> None:
message = await client.messages.create(
messages=[{"role": "user","content": "Hello, How to monitor LLM Applications?"}],
model="claude-3-opus-20240229",
)
print(message.content)
asyncio.run(main())
import Anthropic from '@anthropic-ai/sdk';
import DokuMetry from 'dokumetry';
const anthropic = new Anthropic({
apiKey: 'my_api_key',
});
// Pass the above `anthropic` object along with your Doku Ingester URL and API key and this will make sure that all Anthropic calls are automatically tracked.
DokuMetry.init({llm: anthropic, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})
async function main() {
const message = await anthropic.messages.create({
messages: [{ role: 'user', content: 'How to monitor my LLM Applications?' }],
model: 'claude-3-opus-20240229',
});
console.log(message.content);
}
main();

