Browse Source

chat example

Bruce MacDonald 1 năm trước cách đây
mục cha
commit
3ee93bd701
1 tập tin đã thay đổi với 13 bổ sung0 xóa
  1. 13 0
      examples/chat/chat.ts

+ 13 - 0
examples/chat/chat.ts

@@ -0,0 +1,13 @@
+import { Ollama } from '../../src/index';
+import { Message } from '../../src/interfaces';
+
+async function main(): Promise<void> {
+    const client: Ollama = new Ollama();
+    const messages: Message[] = [
+        { role: "user", content: "Why is the sky blue?" },
+    ];
+    const response = await client.chat({model: "mistral", messages});
+    console.log(response.message.content);
+}
+
+await main();