chore(vendor): import pi 1.3.0
Imported as a linear vendor commit so forge rebases do not replay the upstream root tree. git-subtree-dir: third_party/pi git-subtree-split: 71023aec1546d6d677a65669c5665c0927ce0dd0
This commit is contained in:
1 parent
719370c8f7
commit
6081e3e325
1743 files changed
+205459
-131704
No files matched your search
+33
-6
@@ -7,6 +7,7 @@ import { getSupportedThinkingLevels } from "../src/models.ts";
|
||||
import { XAI_MODELS } from "../src/providers/xai.models.ts";
|
||||
import { xaiProvider } from "../src/providers/xai.ts";
|
||||
import type { Context, Model } from "../src/types.ts";
|
||||
import { normalizeContext } from "../src/utils/transcript.ts";
|
||||
|
||||
const PI_USER_AGENT = `pi (${platform()} ${release()}; ${arch()})`;
|
||||
|
||||
@@ -77,7 +78,7 @@ async function captureCompletionsUserAgent(headers?: Record<string, string>): Pr
|
||||
|
||||
const result = await streamOpenAICompletions(
|
||||
customCompletionsModel,
|
||||
{ messages: [{ role: "user", content: "hello", timestamp: 1 }] },
|
||||
normalizeContext({ messages: [{ role: "user", content: "hello", timestamp: 1 }] }),
|
||||
{ apiKey: "xai-test-token", headers },
|
||||
).result();
|
||||
|
||||
@@ -101,7 +102,7 @@ async function captureRequest(
|
||||
return completedResponse();
|
||||
});
|
||||
|
||||
const result = await xaiProvider().stream(model, context, options).result();
|
||||
const result = await xaiProvider().stream(model, normalizeContext(context), options).result();
|
||||
expect(result.stopReason, result.errorMessage).toBe("stop");
|
||||
expect(captured).toBeDefined();
|
||||
return captured!;
|
||||
@@ -131,9 +132,35 @@ describe("xAI Responses provider", () => {
|
||||
}
|
||||
expect(getSupportedThinkingLevels(XAI_MODELS["grok-4.5"])).toEqual(["low", "medium", "high"]);
|
||||
expect(getSupportedThinkingLevels(XAI_MODELS["grok-4.6"])).toEqual(["low", "medium", "high", "xhigh"]);
|
||||
expect(getSupportedThinkingLevels(XAI_MODELS["grok-4.7"])).toEqual(["low", "medium", "high", "xhigh"]);
|
||||
expect(getSupportedThinkingLevels(XAI_MODELS["grok-4.3"])).toEqual(["off", "low", "medium", "high"]);
|
||||
});
|
||||
|
||||
it("includes Grok 4.7 capabilities and long-context pricing", () => {
|
||||
expect(XAI_MODELS["grok-4.7"]).toMatchObject({
|
||||
api: "openai-responses",
|
||||
reasoning: true,
|
||||
input: ["text", "image"],
|
||||
contextWindow: 500000,
|
||||
maxTokens: 500000,
|
||||
cost: {
|
||||
input: 2,
|
||||
output: 6,
|
||||
cacheRead: 0.5,
|
||||
cacheWrite: 0,
|
||||
tiers: [
|
||||
{
|
||||
inputTokensAbove: 200000,
|
||||
input: 4,
|
||||
output: 12,
|
||||
cacheRead: 1,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("uses /responses with bearer auth and xAI-compatible request fields", async () => {
|
||||
const captured = await captureRequest(
|
||||
XAI_MODELS["grok-4.5"],
|
||||
@@ -187,9 +214,9 @@ describe("xAI Responses provider", () => {
|
||||
expect(captured.body).not.toHaveProperty("reasoning");
|
||||
});
|
||||
|
||||
it("uses /responses for Grok 4.6 with xhigh effort and encrypted reasoning", async () => {
|
||||
it("uses /responses for Grok 4.7 with xhigh effort and encrypted reasoning", async () => {
|
||||
const captured = await captureRequest(
|
||||
XAI_MODELS["grok-4.6"],
|
||||
XAI_MODELS["grok-4.7"],
|
||||
{
|
||||
systemPrompt: "You are a careful coding assistant.",
|
||||
messages: [{ role: "user", content: "hello", timestamp: 1 }],
|
||||
@@ -202,7 +229,7 @@ describe("xAI Responses provider", () => {
|
||||
|
||||
expect(captured.url).toBe("https://api.x.ai/v1/responses");
|
||||
expect(captured.body).toMatchObject({
|
||||
model: "grok-4.6",
|
||||
model: "grok-4.7",
|
||||
store: false,
|
||||
stream: true,
|
||||
reasoning: { effort: "xhigh" },
|
||||
@@ -245,7 +272,7 @@ describe("xAI Responses provider", () => {
|
||||
};
|
||||
const result = await streamOpenAIResponses(
|
||||
openaiModel,
|
||||
{ messages: [{ role: "user", content: "hello", timestamp: 1 }] },
|
||||
normalizeContext({ messages: [{ role: "user", content: "hello", timestamp: 1 }] }),
|
||||
{ apiKey: "test-token" },
|
||||
).result();
|
||||
|
||||
|
||||
Reference in new issue
Block a user