We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7460a2b commit e8e5fa6Copy full SHA for e8e5fa6
packages/tiny-agents/src/example.ts
@@ -0,0 +1,18 @@
1
+import { chatCompletionStream } from "@huggingface/inference";
2
+
3
+async function main() {
4
+ const endpointUrl = `http://localhost:9999/v1/chat/completions`;
5
+ // launch "tiny-agents serve" before running this
6
7
+ for await (const chunk of chatCompletionStream({
8
+ endpointUrl,
9
+ model: "",
10
+ messages: [{ role: "user", content: "What are the top 5 trending models on Hugging Face?" }],
11
+ })) {
12
+ console.log(chunk.choices[0]?.delta.content);
13
+ }
14
+}
15
16
+if (require.main === module) {
17
+ main();
18
0 commit comments