Skip to content

Commit a413824

Browse files
committed
also stream
1 parent f1961a8 commit a413824

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/inference/test/HfInference.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,22 @@ describe.concurrent(
773773
expect(completion).toContain("two");
774774
}
775775
});
776+
it("chatCompletion sambanova stream", async () => {
777+
const hf = new HfInference(env.SAMBANOVA_KEY);
778+
const stream = hf.chatCompletionStream({
779+
model: "meta-llama/Llama-3.1-8B-Instruct",
780+
provider: "sambanova",
781+
messages: [{ role: "user", content: "Complete the equation 1 + 1 = , just the answer" }],
782+
}) as AsyncGenerator<ChatCompletionStreamOutput>;
783+
let out = "";
784+
for await (const chunk of stream) {
785+
if (chunk.choices && chunk.choices.length > 0) {
786+
out += chunk.choices[0].delta.content;
787+
}
788+
}
789+
console.warn(out);
790+
expect(out).toContain("2");
791+
});
776792
},
777793
TIMEOUT
778794
);

0 commit comments

Comments
 (0)