mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
(test) large request
This commit is contained in:
parent
c7e4432597
commit
7aa1c8556d
1 changed files with 9 additions and 5 deletions
|
@ -4,25 +4,29 @@ const openai = require('openai');
|
||||||
process.env.DEBUG=false;
|
process.env.DEBUG=false;
|
||||||
async function runOpenAI() {
|
async function runOpenAI() {
|
||||||
const client = new openai.OpenAI({
|
const client = new openai.OpenAI({
|
||||||
apiKey: 'sk-JkKeNi6WpWDngBsghJ6B9g',
|
apiKey: 'sk-1234',
|
||||||
baseURL: 'http://0.0.0.0:8000'
|
baseURL: 'http://0.0.0.0:4000'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await client.chat.completions.create({
|
const response = await client.chat.completions.create({
|
||||||
model: 'sagemaker',
|
model: 'anthropic-claude-v2.1',
|
||||||
stream: true,
|
stream: true,
|
||||||
max_tokens: 1000,
|
|
||||||
messages: [
|
messages: [
|
||||||
{
|
{
|
||||||
role: 'user',
|
role: 'user',
|
||||||
content: 'write a 20 pg essay about YC ',
|
content: 'write a 20 pg essay about YC '.repeat(6000),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(response);
|
console.log(response);
|
||||||
|
let original = '';
|
||||||
for await (const chunk of response) {
|
for await (const chunk of response) {
|
||||||
|
original += chunk.choices[0].delta.content;
|
||||||
|
console.log(original);
|
||||||
console.log(chunk);
|
console.log(chunk);
|
||||||
console.log(chunk.choices[0].delta.content);
|
console.log(chunk.choices[0].delta.content);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue