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:
2026-10-15 17:58:48 -04:00
parent 719370c8f7
commit 6081e3e325
1743 changed files with 205460 additions and 131705 deletions

View File

@@ -305,6 +305,7 @@ async function multiTurn<TApi extends Api>(model: Model<TApi>, options?: StreamO
expect(block.arguments).toBeTruthy();
const { a, b, operation } = block.arguments;
if (typeof a !== "number" || typeof b !== "number") throw new Error("Invalid math arguments");
let result: number;
switch (operation) {
case "add":
@@ -445,32 +446,29 @@ describe("Generate E2E Tests", () => {
});
});
describe.skipIf(!process.env.DEEPSEEK_API_KEY)(
"DeepSeek Provider (deepseek-v4-flash via OpenAI Completions)",
() => {
const llm = getModel("deepseek", "deepseek-v4-flash");
describe.skipIf(!process.env.DEEPSEEK_API_KEY)("DeepSeek Provider (deepseek-flash via OpenAI Completions)", () => {
const llm = getModel("deepseek", "deepseek-flash");
it("should complete basic text generation", { retry: 3 }, async () => {
await basicTextGeneration(llm);
});
it("should complete basic text generation", { retry: 3 }, async () => {
await basicTextGeneration(llm);
});
it("should handle tool calling", { retry: 3 }, async () => {
await handleToolCall(llm);
});
it("should handle tool calling", { retry: 3 }, async () => {
await handleToolCall(llm);
});
it("should handle streaming", { retry: 3 }, async () => {
await handleStreaming(llm);
});
it("should handle streaming", { retry: 3 }, async () => {
await handleStreaming(llm);
});
it("should handle thinking mode", { retry: 3 }, async () => {
await handleThinking(llm, { reasoningEffort: "high" });
});
it("should handle thinking mode", { retry: 3 }, async () => {
await handleThinking(llm, { reasoningEffort: "high" });
});
it("should handle multi-turn with thinking and tools", { retry: 3 }, async () => {
await multiTurn(llm, { reasoningEffort: "high" });
});
},
);
it("should handle multi-turn with thinking and tools", { retry: 3 }, async () => {
await multiTurn(llm, { reasoningEffort: "high" });
});
});
describe.skipIf(!process.env.OPENAI_API_KEY)("OpenAI Responses Provider (gpt-5.4)", () => {
const llm = getModel("openai", "gpt-5.4");
@@ -521,7 +519,7 @@ describe("Generate E2E Tests", () => {
});
describe.skipIf(!hasAzureOpenAICredentials())("Azure OpenAI Responses Provider (gpt-4o-mini)", () => {
const llm = getModel("azure-openai-responses", "gpt-4o-mini");
const llm = getModel("azure", "gpt-4o-mini");
const azureDeploymentName = resolveAzureDeploymentName(llm.id);
const azureOptions = azureDeploymentName ? { azureDeploymentName } : {};
@@ -542,8 +540,8 @@ describe("Generate E2E Tests", () => {
});
});
describe.skipIf(!process.env.XAI_API_KEY)("xAI Provider (grok-4.3 via OpenAI Responses)", () => {
const llm = getModel("xai", "grok-4.3");
describe.skipIf(!process.env.XAI_API_KEY)("xAI Provider (grok-4.7 via OpenAI Responses)", () => {
const llm = getModel("xai", "grok-4.7");
it("should complete basic text generation", { retry: 3 }, async () => {
await basicTextGeneration(llm);
@@ -702,9 +700,9 @@ describe("Generate E2E Tests", () => {
);
describe.skipIf(!hasCloudflareAiGatewayCredentials() || !process.env.ANTHROPIC_API_KEY)(
"Cloudflare AI Gateway → Anthropic BYOK (claude-sonnet-4.5 via /anthropic messages)",
"Cloudflare AI Gateway → Anthropic BYOK (claude-sonnet-4-5 via /anthropic messages)",
() => {
const llm = getModel("cloudflare-ai-gateway", "claude-sonnet-4.5");
const llm = getModel("cloudflare-ai-gateway", "claude-sonnet-4-5");
const options = { headers: { Authorization: `Bearer ${process.env.ANTHROPIC_API_KEY}` } };
const thinkingOptions = {
...options,
@@ -758,8 +756,8 @@ describe("Generate E2E Tests", () => {
});
});
describe.skipIf(!process.env.TOGETHER_API_KEY)("Together AI Provider (Kimi-K2.6 via OpenAI Completions)", () => {
const llm = getModel("together", "moonshotai/Kimi-K2.6");
describe.skipIf(!process.env.TOGETHER_API_KEY)("Together AI Provider (Kimi-K3 via OpenAI Completions)", () => {
const llm = getModel("together", "moonshotai/Kimi-K3");
it("should complete basic text generation", { retry: 3 }, async () => {
await basicTextGeneration(llm);
@@ -811,8 +809,8 @@ describe("Generate E2E Tests", () => {
});
});
describe.skipIf(!process.env.NVIDIA_API_KEY)("NVIDIA NIM Provider (Nemotron 3 Super via OpenAI Completions)", () => {
const llm = getModel("nvidia", "nvidia/nemotron-3-super-120b-a12b");
describe.skipIf(!process.env.NVIDIA_API_KEY)("NVIDIA NIM Provider (Nemotron 3 Ultra via OpenAI Completions)", () => {
const llm = getModel("nvidia", "nvidia/nemotron-3-ultra-550b-a55b");
it("should complete basic text generation", { retry: 3 }, async () => {
await basicTextGeneration(llm);
@@ -1043,7 +1041,7 @@ describe("Generate E2E Tests", () => {
});
describe.skipIf(!process.env.KIMI_API_KEY)(
"Kimi For Coding Provider (kimi-for-coding via Anthropic Messages)",
"Kimi For Coding Provider (kimi-for-coding via OpenAI Completions)",
() => {
const llm = getModel("kimi-coding", "kimi-for-coding");
@@ -1069,6 +1067,30 @@ describe("Generate E2E Tests", () => {
},
);
describe.skipIf(!process.env.META_API_KEY)("Meta Provider (muse-spark-1.3 via OpenAI Responses)", () => {
const llm = getModel("meta", "muse-spark-1.3");
it("should complete basic text generation", { retry: 3 }, async () => {
await basicTextGeneration(llm);
});
it("should handle tool calling", { retry: 3 }, async () => {
await handleToolCall(llm);
});
it("should handle streaming", { retry: 3 }, async () => {
await handleStreaming(llm);
});
it("should handle thinking mode", { retry: 3 }, async () => {
await handleThinking(llm, { thinkingEnabled: true, thinkingBudgetTokens: 2048 });
});
it("should handle multi-turn with thinking and tools", { retry: 3 }, async () => {
await multiTurn(llm, { thinkingEnabled: true, thinkingBudgetTokens: 2048 });
});
});
describe.skipIf(!process.env.XIAOMI_API_KEY)(
"Xiaomi MiMo (API billing) Provider (Xiaomi MiMo-V2.5-Pro via Anthropic Messages)",
() => {
@@ -1431,34 +1453,6 @@ describe("Generate E2E Tests", () => {
});
});
describe("OpenAI Codex Provider (gpt-5.4)", () => {
const llm = getModel("openai-codex", "gpt-5.4");
it.skipIf(!openaiCodexToken)("should complete basic text generation", { retry: 3 }, async () => {
await basicTextGeneration(llm, { apiKey: openaiCodexToken });
});
it.skipIf(!openaiCodexToken)("should handle tool calling", { retry: 3 }, async () => {
await handleToolCall(llm, { apiKey: openaiCodexToken });
});
it.skipIf(!openaiCodexToken)("should handle streaming", { retry: 3 }, async () => {
await handleStreaming(llm, { apiKey: openaiCodexToken });
});
it.skipIf(!openaiCodexToken)("should handle thinking", { retry: 3 }, async () => {
await handleThinking(llm, { apiKey: openaiCodexToken, reasoningEffort: "high" });
});
it.skipIf(!openaiCodexToken)("should handle multi-turn with thinking and tools", { retry: 3 }, async () => {
await multiTurn(llm, { apiKey: openaiCodexToken });
});
it.skipIf(!openaiCodexToken)("should handle image input", { retry: 3 }, async () => {
await handleImage(llm, { apiKey: openaiCodexToken });
});
});
describe("OpenAI Codex Provider (gpt-5.5)", () => {
const llm = getModel("openai-codex", "gpt-5.5");