LanguageModel API
import AI from '@aibrow/web'
const session = await AI.AIBrow.LanguageModel.create();
// Prompt the model and wait for the whole result to come back.
const result = await session.prompt("Write me a poem.");
console.log(result);
// Prompt the model and stream the result:
const stream = await session.promptStreaming("Write me an extra-long poem.");
for await (const chunk of stream) {
console.log(chunk);
}Continuing a conversation
import AI from '@aibrow/web'
const session = await AI.AIBrow.LanguageModel.create();
// Ask the intial question
const result = await session.prompt("Tell me about the weather");
console.log(result);
// Prompt the same session again to continue the same conversation
const result2 = await session.prompt("Can you expand on this?");
console.log(result2);System prompts & initial prompts
Demos
Last updated