-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
213 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
OPENAI_API_KEY=<Your OpenAI API key> | ||
COHERE_API_KEY=<Your Cohere API key> | ||
ANTHROPIC_API_KEY=<Your Anthropic API key> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,4 +39,6 @@ lib/*.js | |
test/*.js | ||
*.map | ||
|
||
dist | ||
dist | ||
|
||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { completion } from '../src'; | ||
import { ResultStreaming } from '../src/types'; | ||
|
||
const PROMPT = 'How are you today?'; | ||
const MODELS = [ | ||
{ | ||
model: 'gpt-3.5-turbo', | ||
}, | ||
{ | ||
model: 'ollama/llama2', | ||
}, | ||
{ | ||
model: 'command-nightly', | ||
}, | ||
]; | ||
/** | ||
* Admin dashboard tests | ||
* | ||
* @group e2e | ||
*/ | ||
describe('e2e', () => { | ||
it.each(MODELS)( | ||
'gets response from supported model $model', | ||
async ({ model }) => { | ||
jest.setTimeout(10000); | ||
const result = await completion({ | ||
model, | ||
messages: [{ role: 'user', content: PROMPT }], | ||
stream: false, | ||
}); | ||
expect(result).toBeTruthy(); | ||
expect(result); | ||
}, | ||
); | ||
|
||
it.each(MODELS)( | ||
'gets streaming response from supported model $model', | ||
async ({ model }) => { | ||
jest.setTimeout(10000); | ||
const result: ResultStreaming = await completion({ | ||
model, | ||
messages: [{ role: 'user', content: PROMPT }], | ||
stream: true, | ||
}); | ||
|
||
for await (const chunk of result) { | ||
expect(chunk.choices[0].delta.content).not.toBeNull(); | ||
} | ||
}, | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { completion } from '../src'; | ||
import { ResultStreaming } from '../src/types'; | ||
|
||
const PROMPT = 'How are you today?'; | ||
const MODELS = [ | ||
{ | ||
model: 'gpt-3.5-turbo', | ||
}, | ||
{ | ||
model: 'ollama/llama2', | ||
}, | ||
{ | ||
model: 'command-nightly', | ||
}, | ||
]; | ||
/** | ||
* Admin dashboard tests | ||
* | ||
* @group e2e | ||
*/ | ||
describe('e2e', () => { | ||
it.each(MODELS)( | ||
'gets response from supported model $model', | ||
async ({ model }) => { | ||
jest.setTimeout(10000); | ||
const result = await completion({ | ||
model, | ||
messages: [{ role: 'user', content: PROMPT }], | ||
stream: false, | ||
}); | ||
expect(result).toBeTruthy(); | ||
expect(result); | ||
}, | ||
); | ||
|
||
it.each(MODELS)( | ||
'gets streaming response from supported model $model', | ||
async ({ model }) => { | ||
jest.setTimeout(10000); | ||
const result: ResultStreaming = await completion({ | ||
model, | ||
messages: [{ role: 'user', content: PROMPT }], | ||
stream: true, | ||
}); | ||
|
||
for await (const chunk of result) { | ||
expect(chunk.choices[0].delta.content).not.toBeNull(); | ||
} | ||
}, | ||
); | ||
}); |