UNPKG

@huggingface/tiny-agents

Version:

Lightweight, composable agents for AI applications

18 lines (16 loc) 491 B
"use strict"; // src/example.ts var import_inference = require("@huggingface/inference"); async function main() { const endpointUrl = `http://localhost:9999/v1/chat/completions`; for await (const chunk of (0, import_inference.chatCompletionStream)({ endpointUrl, model: "", messages: [{ role: "user", content: "What are the top 5 trending models on Hugging Face?" }] })) { console.log(chunk.choices[0]?.delta.content); } } if (require.main === module) { main(); }