Skip to content

Commit

Permalink
feat: add fake completion
Browse files Browse the repository at this point in the history
  • Loading branch information
kirklin committed Feb 25, 2024
1 parent 7ee48f9 commit e1e6ced
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 55 deletions.
1 change: 1 addition & 0 deletions packages/ai/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"dependencies": {
"@azure/openai": "^1.0.0-beta.11",
"@faker-js/faker": "^8.4.1",
"ai": "^2.2.36",
"gpt-tokenizer": "^2.1.2",
"openai": "^4.28.0",
Expand Down
22 changes: 22 additions & 0 deletions packages/ai/core/src/languageModelAgent/celeris/mock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { faker } from "@faker-js/faker";

// Generate a fake completion using faker
export const fakeCompletion = {
id: faker.string.uuid(),
object: "text_completion",
created: faker.date.soon,
model: "celeris-mock",
choices: [
{
text: faker.lorem.sentence({ min: 3, max: 300 }),
logprobs: null,
finish_reason: "length",
index: 0,
},
],
usage: {
prompt_tokens: 10,
completion_tokens: 20,
total_tokens: 30,
},
};
76 changes: 21 additions & 55 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e1e6ced

Please sign in to comment.