Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alphaxiv/agents",
"version": "0.6.8",
"version": "0.6.9",
"license": "MIT",
"fmt": {
"lineWidth": 120
Expand Down
5 changes: 5 additions & 0 deletions src/adapters/anthropic/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ function extended<const T extends readonly [ThinkingLevel, ...ThinkingLevel[]]>(

const anthropicModelThinkingSupportDefinition = {
// Adaptive thinking only (effort controls thinking intensity)
"claude-opus-5": adaptive({
levels: ["low", "medium", "high", "xhigh", "max"],
default: "high",
}),
"claude-opus-4-8": adaptive({
levels: ["low", "medium", "high", "xhigh", "max"],
default: "high",
Expand Down Expand Up @@ -179,6 +183,7 @@ export type SupportsInterleaved<TModel extends AnthropicModels> = ModelConfig<TM
* Model support for native structured ouput.
*/
export const anthropicModelStructuredOutputSupport = {
"claude-opus-5": true,
"claude-opus-4-8": true,
"claude-opus-4-7": true,
"claude-opus-4-6": true,
Expand Down
1 change: 1 addition & 0 deletions src/adapters/anthropic/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface ExtendedThinkingSupport<T extends string> {
}

export interface AnthropicModelThinkingSupportMap {
"claude-opus-5": AdaptiveThinkingSupport<"low" | "medium" | "high" | "xhigh" | "max">;
"claude-opus-4-8": AdaptiveThinkingSupport<"low" | "medium" | "high" | "xhigh" | "max">;
"claude-opus-4-7": AdaptiveThinkingSupport<"low" | "medium" | "high" | "xhigh" | "max">;
"claude-opus-4-6": AdaptiveThinkingSupport<"low" | "medium" | "high" | "max">;
Expand Down
8 changes: 8 additions & 0 deletions src/adapters/google_genai/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ function thinkingLevel<const T extends readonly [GoogleThinkingLevel, ...GoogleT
}

const googleModelSupportedThinkingLevelsDefinition = {
"gemini-3.6-flash": thinkingLevel({
levels: ["minimal", "low", "medium", "high"],
default: "medium",
}),
"gemini-3.5-flash-lite": thinkingLevel({
levels: ["minimal", "low", "medium", "high"],
default: "minimal",
}),
"gemini-3.5-flash": thinkingLevel({
levels: ["minimal", "low", "medium", "high"],
default: "high",
Expand Down
2 changes: 2 additions & 0 deletions src/adapters/google_genai/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export interface GoogleThinkingLevelSupport<T extends string> {
}

export interface GoogleModelSupportedThinkingLevelsMap {
"gemini-3.6-flash": GoogleThinkingLevelSupport<"minimal" | "low" | "medium" | "high">;
"gemini-3.5-flash-lite": GoogleThinkingLevelSupport<"minimal" | "low" | "medium" | "high">;
"gemini-3.5-flash": GoogleThinkingLevelSupport<"minimal" | "low" | "medium" | "high">;
"gemini-3.1-flash-lite": GoogleThinkingLevelSupport<"minimal" | "low" | "medium" | "high">;
"gemini-3.1-flash-image-preview": GoogleThinkingLevelSupport<"minimal" | "high">;
Expand Down
40 changes: 40 additions & 0 deletions tests/adapters/anthropic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,34 @@ import type { Adapter } from "../../src/adapters/adapter.ts";

const HAS_ANTHROPIC_KEY = Boolean(Deno.env.get("ANTHROPIC_API_KEY"));

Deno.test({
name: "AnthropicAdapter streams a parameterized tool call (claude-opus-5, adaptive)",
ignore: !HAS_ANTHROPIC_KEY,
sanitizeOps: false,
sanitizeResources: false,
async fn(t) {
const fixtures = createToolFixtures();
const adapter = anthropicModel({
model: "claude-opus-5",
effort: "high",
});

await runAdapterToolStreamingTest(t, {
stream: adapter.stream({
history: [{
type: "input_text",
content: `Call ${fixtures.echoTool.normalizedName} exactly once with {\"query\":\"${fixtures.query}\"}.`,
}],
instructions: "You are a compliant live integration test assistant.",
tools: [fixtures.echoTool],
signal: AbortSignal.timeout(INTEGRATION_TIMEOUT_MS),
}),
toolName: fixtures.echoTool.normalizedName,
expectedContentSubstring: fixtures.query,
});
},
});

Deno.test({
name: "AnthropicAdapter streams a parameterized tool call (claude-opus-4-8, adaptive)",
ignore: !HAS_ANTHROPIC_KEY,
Expand Down Expand Up @@ -104,6 +132,18 @@ Deno.test({
},
});

Deno.test({
name: "AnthropicModel streams tools and results (claude-opus-5, adaptive-only)",
ignore: !HAS_ANTHROPIC_KEY,
sanitizeOps: false,
sanitizeResources: false,
async fn(t) {
await runAgentToolStreamingTest(t, {
model: anthropicModel({ model: "claude-opus-5", effort: "low" }),
});
},
});

Deno.test({
name: "AnthropicModel streams tools and results (claude-opus-4-8, adaptive-only)",
ignore: !HAS_ANTHROPIC_KEY,
Expand Down
104 changes: 104 additions & 0 deletions tests/adapters/gemini.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,62 @@ Deno.test({
},
});

Deno.test({
name: "GeminiAdapter streams a parameterized tool call (gemini-3.6-flash, thinking-level)",
ignore: !HAS_GEMINI_KEY,
sanitizeOps: false,
sanitizeResources: false,
async fn(t) {
const fixtures = createToolFixtures();
const adapter = googleGenerateContentAPIModel({
model: "gemini-3.6-flash",
thinkingConfig: { includeThoughts: true, thinkingLevel: GenAiThinkingLevel.LOW },
});

await runAdapterToolStreamingTest(t, {
stream: adapter.stream({
history: [{
type: "input_text",
content: `Call ${fixtures.echoTool.normalizedName} exactly once with {\"query\":\"${fixtures.query}\"}.`,
}],
instructions: "You are a compliant live integration test assistant.",
tools: [fixtures.echoTool],
signal: AbortSignal.timeout(INTEGRATION_TIMEOUT_MS),
}),
toolName: fixtures.echoTool.normalizedName,
expectedContentSubstring: fixtures.query,
});
},
});

Deno.test({
name: "GeminiAdapter streams a parameterized tool call (gemini-3.5-flash-lite, thinking-level)",
ignore: !HAS_GEMINI_KEY,
sanitizeOps: false,
sanitizeResources: false,
async fn(t) {
const fixtures = createToolFixtures();
const adapter = googleGenerateContentAPIModel({
model: "gemini-3.5-flash-lite",
thinkingConfig: { includeThoughts: true, thinkingLevel: GenAiThinkingLevel.LOW },
});

await runAdapterToolStreamingTest(t, {
stream: adapter.stream({
history: [{
type: "input_text",
content: `Call ${fixtures.echoTool.normalizedName} exactly once with {\"query\":\"${fixtures.query}\"}.`,
}],
instructions: "You are a compliant live integration test assistant.",
tools: [fixtures.echoTool],
signal: AbortSignal.timeout(INTEGRATION_TIMEOUT_MS),
}),
toolName: fixtures.echoTool.normalizedName,
expectedContentSubstring: fixtures.query,
});
},
});

Deno.test({
name: "GeminiAdapter streams a parameterized tool call (gemini-3.1-flash-lite, thinking-level)",
ignore: !HAS_GEMINI_KEY,
Expand Down Expand Up @@ -169,6 +225,30 @@ Deno.test({
},
});

Deno.test({
name: "GeminiModel streams tools and results (gemini-3.6-flash, thinking-level)",
ignore: !HAS_GEMINI_KEY,
sanitizeOps: false,
sanitizeResources: false,
async fn(t) {
await runAgentToolStreamingTest(t, {
model: geminiModel({ model: "gemini-3.6-flash", thinkingLevel: "low" }),
});
},
});

Deno.test({
name: "GeminiModel streams tools and results (gemini-3.5-flash-lite, thinking-level)",
ignore: !HAS_GEMINI_KEY,
sanitizeOps: false,
sanitizeResources: false,
async fn(t) {
await runAgentToolStreamingTest(t, {
model: geminiModel({ model: "gemini-3.5-flash-lite", thinkingLevel: "low" }),
});
},
});

Deno.test({
name: "GeminiModel streams tools and results (gemini-3.1-flash-lite, thinking-level)",
ignore: !HAS_GEMINI_KEY,
Expand Down Expand Up @@ -241,6 +321,30 @@ Deno.test({
},
});

Deno.test({
name: "GeminiModel streams structured output (gemini-3.6-flash, thinking-level)",
ignore: !HAS_GEMINI_KEY,
sanitizeOps: false,
sanitizeResources: false,
async fn(t) {
await runStructuredOutputStreamingTest(t, {
model: geminiModel({ model: "gemini-3.6-flash", thinkingLevel: "low" }),
});
},
});

Deno.test({
name: "GeminiModel streams structured output (gemini-3.5-flash-lite, thinking-level)",
ignore: !HAS_GEMINI_KEY,
sanitizeOps: false,
sanitizeResources: false,
async fn(t) {
await runStructuredOutputStreamingTest(t, {
model: geminiModel({ model: "gemini-3.5-flash-lite", thinkingLevel: "low" }),
});
},
});

Deno.test({
name: "GeminiModel streams structured output (gemini-3.1-flash-lite, thinking-level)",
ignore: !HAS_GEMINI_KEY,
Expand Down
Loading