stackwiseai / stackwise

The open source AI app collection
https://www.stackwise.ai/stacks
MIT License
151 stars 30 forks source link

Prioritize libraries installed when possible #4

Open waynehamadi opened 7 months ago

waynehamadi commented 7 months ago

When running this brief:

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

waynehamadi commented 7 months ago

for this particular brief, @AssemblyAI seems to be supported by langchain: https://js.langchain.com/docs/integrations/document_loaders/web_loaders/assemblyai_audio_transcription