stack(
"Call gpt-4 using the streaming endpoint to answer my question and text to speech the voice in real time",
{in: "What is the meaning of life ?", out: null}
)
the result is
import OpenAI from 'openai';
const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY
});
/**
* Brief: Call gpt-4 using the streaming endpoint to answer my question and TTS the voice in real time
*/
export default async function streamingGpt4QuestionAnswerTTS(input: string): Promise<string> {
const chatCompletion = await openai.chat.completions.create({
messages: [{ role: 'user', content: input }],
model: 'gpt-3.5-turbo',
});
return chatCompletion.choices[0].message.content;
}
But if a user has langchain installed, we might want to just use langchain to call the API.
Thanks @jondwillis for the feedback
When running this brief:
the result is
But if a user has langchain installed, we might want to just use langchain to call the API. Thanks @jondwillis for the feedback