






















@@ -425,20 +425,24 @@ describe("openai transport stream", () => {
425425});
426426427427it("streams OpenAI-compatible loopback requests with the configured SDK timeout", async () => {
428-let captured: { path?: string; timeout?: string; roles?: string[] } = {};
428+let captured: { path?: string; timeout?: string; model?: string; roles?: string[] } = {};
429429const server = createServer((req, res) => {
430430let body = "";
431431req.setEncoding("utf8");
432432req.on("data", (chunk) => {
433433body += chunk;
434434});
435435req.on("end", () => {
436-const parsed = JSON.parse(body) as { messages?: Array<{ role?: string }> };
436+const parsed = JSON.parse(body) as {
437+model?: string;
438+messages?: Array<{ role?: string }>;
439+};
437440captured = {
438441path: req.url,
439442timeout: Array.isArray(req.headers["x-stainless-timeout"])
440443 ? req.headers["x-stainless-timeout"][0]
441444 : req.headers["x-stainless-timeout"],
445+model: parsed.model,
442446roles: parsed.messages?.map((message) => message.role ?? ""),
443447};
444448res.writeHead(200, {
@@ -452,7 +456,7 @@ describe("openai transport stream", () => {
452456 id: "chatcmpl-timeout-proof",
453457 object: "chat.completion.chunk",
454458 created,
455- model: "slow-local",
459+ model: "mlx-community/Qwen3-30B-A3B-6bit",
456460 choices: [
457461 {
458462 index: 0,
@@ -467,7 +471,7 @@ describe("openai transport stream", () => {
467471 id: "chatcmpl-timeout-proof",
468472 object: "chat.completion.chunk",
469473 created,
470- model: "slow-local",
474+ model: "mlx-community/Qwen3-30B-A3B-6bit",
471475 choices: [{ index: 0, delta: {}, finish_reason: "stop" }],
472476 usage: { prompt_tokens: 1, completion_tokens: 1, total_tokens: 2 },
473477 })}\n\n`,
@@ -484,10 +488,10 @@ describe("openai transport stream", () => {
484488throw new Error("Missing loopback server address");
485489}
486490const baseModel = {
487-id: "slow-local",
488-name: "Slow Local",
491+id: "mlx-community/Qwen3-30B-A3B-6bit",
492+name: "Qwen3 MLX",
489493api: "openai-completions",
490-provider: "custom-openai-compatible",
494+provider: "mlx",
491495baseUrl: `http://127.0.0.1:${address.port}/v1`,
492496reasoning: false,
493497input: ["text"],
@@ -524,6 +528,7 @@ describe("openai transport stream", () => {
524528525529expect(captured.path).toBe("/v1/chat/completions");
526530expect(captured.timeout).toBe("900");
531+expect(captured.model).toBe("mlx-community/Qwen3-30B-A3B-6bit");
527532expect(captured.roles).toEqual(["system", "user"]);
528533expect(doneReason).toBe("stop");
529534expect(text).toBe("OK");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。