MAttila42 / falcon-hackathon

0 stars 0 forks source link

Basic LLM Workflow to Create lessons #1

Open Rettend opened 3 months ago

Rettend commented 3 months ago

Image

Raffy27 commented 3 months ago

Minimal thingy

import OpenAI from 'openai';

const client = new OpenAI({
    apiKey: 'bdfjlskdjfld',
    baseURL: 'https://api.ai71.ai/v1'
});

async function main() {
    const chatCompletion = await client.chat.completions.create({
        messages: [{ role: 'user', content: 'Say this is a test' }],
        model: 'tiiuae/falcon-180B-chat',
        stream: true
    });

    for await (const message of chatCompletion) {
        console.log(message.choices[0].delta.content);
    }
}

main();