test: update opeani-adapters tests
This commit is contained in:
parent
4cd92a7b76
commit
50ae6869d2
2 changed files with 13 additions and 0 deletions
|
|
@ -117,6 +117,7 @@ const TESTS: Omit<ModelConfig & { options?: TestConfigOptions }, "name">[] = [
|
|||
model: "gpt-4.1",
|
||||
apiBase: "https://continue-openai.openai.azure.com",
|
||||
apiKey: process.env.AZURE_OPENAI_GPT41_API_KEY,
|
||||
roles: ["chat"],
|
||||
env: {
|
||||
deployment: "gpt-4.1",
|
||||
apiVersion: "2024-02-15-preview",
|
||||
|
|
|
|||
|
|
@ -138,6 +138,10 @@ export function testChat(
|
|||
);
|
||||
let completion = "";
|
||||
for await (const result of stream) {
|
||||
// Skip usage chunks that have empty choices array
|
||||
if (result.choices.length === 0) {
|
||||
continue;
|
||||
}
|
||||
completion += result.choices[0].delta.content ?? "";
|
||||
|
||||
expect(result.choices.length).toBeGreaterThan(0);
|
||||
|
|
@ -262,6 +266,10 @@ export function testChat(
|
|||
},
|
||||
new AbortController().signal,
|
||||
)) {
|
||||
// Skip usage chunks that have empty choices array
|
||||
if (chunk.choices.length === 0) {
|
||||
continue;
|
||||
}
|
||||
const toolCall = chunk.choices[0].delta.tool_calls?.[0];
|
||||
if (!toolCall) {
|
||||
continue;
|
||||
|
|
@ -333,6 +341,10 @@ export function testChat(
|
|||
},
|
||||
new AbortController().signal,
|
||||
)) {
|
||||
// Skip usage chunks that have empty choices array
|
||||
if (chunk.choices.length === 0) {
|
||||
continue;
|
||||
}
|
||||
response += chunk.choices[0].delta.content ?? "";
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue