|
1 | 1 | // Xai tests cover responses tool shared plugin behavior. |
2 | 2 | import { describe, expect, it } from "vitest"; |
3 | 3 | import { |
4 | | - buildXaiResponsesToolBody, |
5 | 4 | extractXaiWebSearchContent, |
6 | 5 | requireXaiResponseTextAndCitations, |
7 | 6 | requireXaiResponseTextCitationsAndInline, |
8 | 7 | } from "./responses-tool-shared.js"; |
9 | 8 |
|
10 | 9 | describe("xai responses tool helpers", () => { |
11 | | - it("builds the shared xAI Responses tool body", () => { |
12 | | - expect( |
13 | | - buildXaiResponsesToolBody({ |
14 | | - model: "grok-4.3", |
15 | | - inputText: "search for openclaw", |
16 | | - tools: [{ type: "x_search" }], |
17 | | - maxTurns: 2, |
18 | | - reasoningEffort: "none", |
19 | | - }), |
20 | | - ).toEqual({ |
21 | | - model: "grok-4.3", |
22 | | - input: [{ role: "user", content: "search for openclaw" }], |
23 | | - tools: [{ type: "x_search" }], |
24 | | - store: false, |
25 | | - reasoning: { effort: "none" }, |
26 | | - max_turns: 2, |
27 | | - }); |
28 | | - }); |
29 | | - |
30 | | - it("keeps custom model reasoning untouched while disabling response storage", () => { |
31 | | - expect( |
32 | | - buildXaiResponsesToolBody({ |
33 | | - model: "grok-build-0.1", |
34 | | - inputText: "run code", |
35 | | - tools: [{ type: "code_interpreter" }], |
36 | | - }), |
37 | | - ).toEqual({ |
38 | | - model: "grok-build-0.1", |
39 | | - input: [{ role: "user", content: "run code" }], |
40 | | - tools: [{ type: "code_interpreter" }], |
41 | | - store: false, |
42 | | - }); |
43 | | - }); |
44 | | - |
45 | 10 | it("falls back to annotation citations when the API omits top-level citations", () => { |
46 | 11 | expect( |
47 | 12 | requireXaiResponseTextAndCitations( |
|
0 commit comments