const model = new Portkey({ mode: "single", llms: [ { provider: "openai", virtual_key: "open-ai-key-1234", model: "gpt-3.5-turbo-instruct", max_tokens: 2000, }, ],});// Stream the output of the model and process itconst res = await model.stream( "Question: Write a story about a king\nAnswer:");for await (const i of res) { process.stdout.write(i);} Copy
const model = new Portkey({ mode: "single", llms: [ { provider: "openai", virtual_key: "open-ai-key-1234", model: "gpt-3.5-turbo-instruct", max_tokens: 2000, }, ],});// Stream the output of the model and process itconst res = await model.stream( "Question: Write a story about a king\nAnswer:");for await (const i of res) { process.stdout.write(i);}
Optional
Example