Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
patcher9 committed Feb 10, 2024
1 parent 8ed00fe commit 1867608
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const openai = new OpenAI({
});
// Pass the above `openai` object along with your DOKU URL and API key and this will make sure that all OpenAI calls are automatically tracked.
DokuMetry.init({llm: openai, dokuURL: "YOUR_DOKU_URL", apiKey: "YOUR_DOKU_TOKEN"})
DokuMetry.init({llm: openai, dokuUrl: "YOUR_DOKU_URL", apiKey: "YOUR_DOKU_TOKEN"})
async function main() {
const chatCompletion = await openai.chat.completions.create({
Expand All @@ -73,7 +73,7 @@ const anthropic = new Anthropic({
});
// Pass the above `anthropic` object along with your DOKU URL and API key and this will make sure that all Anthropic calls are automatically tracked.
DokuMetry.init({llm: anthropic, dokuURL: "YOUR_DOKU_URL", apiKey: "YOUR_DOKU_TOKEN"})
DokuMetry.init({llm: anthropic, dokuUrl: "YOUR_DOKU_URL", apiKey: "YOUR_DOKU_TOKEN"})
async function main() {
const completion = await anthropic.completions.create({
Expand All @@ -97,7 +97,7 @@ const cohere = new CohereClient({
});
// Pass the above `cohere` object along with your DOKU URL and API key and this will make sure that all Cohere calls are automatically tracked.
DokuMetry.init({llm: cohere, dokuURL: "YOUR_DOKU_URL", apiKey: "YOUR_DOKU_TOKEN"})
DokuMetry.init({llm: cohere, dokuUrl: "YOUR_DOKU_URL", apiKey: "YOUR_DOKU_TOKEN"})
(async () => {
const prediction = await cohere.generate({
Expand All @@ -114,7 +114,7 @@ DokuMetry.init({llm: cohere, dokuURL: "YOUR_DOKU_URL", apiKey: "YOUR_DOKU_TOKEN"
| Parameter | Description | Required |
|-------------------|-----------------------------------------------------------|---------------|
| llm | Language Learning Model (LLM) Object to track | Yes |
| dokuURL | URL of your Doku Instance | Yes |
| dokuUrl | URL of your Doku Instance | Yes |
| apiKey | Your Doku API key | Yes |
| environment | Custom environment tag to include in your metrics | Optional |
| applicationName | Custom application name tag for your metrics | Optional |
Expand Down
8 changes: 4 additions & 4 deletions src/cohere.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default function initCohere({ llm, dokuUrl, apiKey, environment, applicat
requestDuration: duration,
model: model,
prompt: prompt,
promptTokens: response.meta["billed_units"]["input_tokens"],
promptTokens: response.meta["billedUnits"]["inputTokens"],
};

await sendData(data, dokuUrl, apiKey);
Expand All @@ -118,9 +118,9 @@ export default function initCohere({ llm, dokuUrl, apiKey, environment, applicat
requestDuration: duration,
model: model,
prompt: prompt,
promptTokens: response.meta["billedUnits"]["outputTokens"],
completionTokens: response.meta["billedUnits"]["inputTokens"],
totalTokens: response.token_count["billedUnits"],
promptTokens: response.meta["billed_units"]["output_tokens"],
completionTokens: response.meta["billed_units"]["input_tokens"],
totalTokens: response.token_count["billed_units"],
response: response.text,
};

Expand Down

0 comments on commit 1867608

Please sign in to comment.