Skip to content
Closed
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
3 changes: 2 additions & 1 deletion bindings/typescript/src/generated/AssistantContentPart.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { BuiltinToolIdentity } from "./BuiltinToolIdentity";
import type { ProviderOptions } from "./ProviderOptions";
import type { TextContentPart } from "./TextContentPart";
import type { ToolCallArguments } from "./ToolCallArguments";
Expand All @@ -12,4 +13,4 @@ export type AssistantContentPart = { "type": "text" } & TextContentPart | { "typ
* Providers will occasionally return encrypted content for reasoning parts which can
* be useful when you send a follow up message.
*/
encrypted_content?: string, } | { "type": "tool_call", tool_call_id: string, tool_name: string, arguments: ToolCallArguments, status?: string, caller?: ToolCaller, encrypted_content?: string, provider_options?: ProviderOptions, provider_executed?: boolean, } | { "type": "program", call_id: string, code: string, fingerprint?: string, id?: string, } | { "type": "program_output", call_id: string, result: string, status: string, id?: string, } | { "type": "tool_discovery_call", tool_call_id: string, discovery_tool_name: string, query?: string, arguments?: unknown, status?: string, execution?: string, provider_options?: ProviderOptions, } | { "type": "tool_result", tool_call_id: string, tool_name: string, output: unknown, caller?: ToolCaller, provider_options?: ProviderOptions, };
encrypted_content?: string, } | { "type": "tool_call", tool_call_id: string, tool_name: string, arguments: ToolCallArguments, status?: string, caller?: ToolCaller, encrypted_content?: string, provider_options?: ProviderOptions, provider_executed?: boolean, } | { "type": "builtin_tool_call", tool_call_id?: string, tool_name?: string, builtin_tool: BuiltinToolIdentity, arguments?: ToolCallArguments, status?: string, encrypted_content?: string, provider_options?: ProviderOptions, provider_executed?: boolean, } | { "type": "program", call_id: string, code: string, fingerprint?: string, id?: string, } | { "type": "program_output", call_id: string, result: string, status: string, id?: string, } | { "type": "tool_discovery_call", tool_call_id: string, discovery_tool_name: string, query?: string, arguments?: unknown, status?: string, execution?: string, provider_options?: ProviderOptions, } | { "type": "tool_result", tool_call_id: string, tool_name: string, output: unknown, caller?: ToolCaller, provider_options?: ProviderOptions, };
7 changes: 7 additions & 0 deletions bindings/typescript/src/generated/BuiltinToolIdentity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { BuiltinToolProvider } from "./BuiltinToolProvider";

/**
* Stable identity for a provider-executed built-in tool call or result.
*/
export type BuiltinToolIdentity = { provider: BuiltinToolProvider, builtin_type: string, };
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { BuiltinToolIdentity } from "./BuiltinToolIdentity";
import type { ProviderOptions } from "./ProviderOptions";

/**
* Reusable result for a provider-executed built-in tool.
*/
export type BuiltinToolResultContentPart = { tool_call_id?: string, tool_name?: string, builtin_tool: BuiltinToolIdentity, output: any, provider_options?: ProviderOptions, };
3 changes: 2 additions & 1 deletion bindings/typescript/src/generated/ToolContentPart.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { BuiltinToolResultContentPart } from "./BuiltinToolResultContentPart";
import type { ToolDiscoveryResultContentPart } from "./ToolDiscoveryResultContentPart";
import type { ToolResultContentPart } from "./ToolResultContentPart";

/**
* Tool content parts - only tool results allowed
*/
export type ToolContentPart = { "type": "tool_result" } & ToolResultContentPart | { "type": "tool_discovery_result" } & ToolDiscoveryResultContentPart;
export type ToolContentPart = { "type": "tool_result" } & ToolResultContentPart | { "type": "builtin_tool_result" } & BuiltinToolResultContentPart | { "type": "tool_discovery_result" } & ToolDiscoveryResultContentPart;
2 changes: 1 addition & 1 deletion bindings/typescript/src/generated/google/Level.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

/**
* The media resolution level.
* The tokenization quality used for given media. for Gemini API support .
*/
export type Level = "MEDIA_RESOLUTION_HIGH" | "MEDIA_RESOLUTION_LOW" | "MEDIA_RESOLUTION_MEDIUM" | "MEDIA_RESOLUTION_ULTRA_HIGH" | "MEDIA_RESOLUTION_UNSPECIFIED";
4 changes: 2 additions & 2 deletions bindings/typescript/src/generated/google/MediaResolution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import type { Level } from "./Level";
/**
* Optional. Media resolution for the input media.
*
* Media resolution for the input media.
* Media resolution for tokenization.
*/
export type MediaResolution = {
/**
* The media resolution level.
* The tokenization quality used for given media. for Gemini API support .
*/
level: Level | null, };
4 changes: 4 additions & 0 deletions bindings/typescript/src/generated/google/ToolCall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ args: unknown,
* the matching `id`.
*/
id: string | null,
/**
* Optional. The name of the tool that was called.
*/
toolName: string | null,
/**
* Required. The type of tool that was called.
*/
Expand Down
8 changes: 8 additions & 0 deletions crates/coverage-report/src/requests_expected_differences.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@
}
],
"perTestCase": [
{
"testCase": "googleProviderExecutedToolRoundtrip",
"source": "Google",
"target": "*",
"errors": [
{ "pattern": "built-in tool", "reason": "Google server-side ToolCall/ToolResponse history carries a Google ToolType identity that other provider request formats cannot represent losslessly" }
]
},
{
"testCase": "openaiServiceTierFastParam",
"source": "Responses",
Expand Down
59 changes: 59 additions & 0 deletions crates/coverage-report/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,12 @@ fn merge_tool_call_deltas(
if incoming_tool_call.call_type.is_some() {
existing_tool_call.call_type = incoming_tool_call.call_type;
}
if incoming_tool_call.builtin_tool.is_some() {
existing_tool_call.builtin_tool = incoming_tool_call.builtin_tool;
}
if incoming_tool_call.encrypted_content.is_some() {
existing_tool_call.encrypted_content = incoming_tool_call.encrypted_content;
}
match (
&mut existing_tool_call.function,
incoming_tool_call.function,
Expand Down Expand Up @@ -1491,4 +1497,57 @@ mod tests {
Some("{\"q\":\"camera\"}")
);
}

#[test]
fn merge_stream_chunks_preserves_builtin_identity_and_per_call_signature() {
let merged = merge_universal_stream_chunks(vec![
stream_chunk(
0,
Some(json!({
"tool_calls": [{
"index": 0,
"type": "builtin_tool_call",
"builtin_tool": {
"provider": "google",
"builtin_type": "GOOGLE_SEARCH_WEB"
},
"encrypted_content": "search_signature"
}]
})),
None,
),
stream_chunk(
0,
Some(json!({
"tool_calls": [{
"index": 0,
"function": {
"arguments": "{\"query\":\"Lingua\"}"
}
}]
})),
Some("tool_calls"),
),
])
.expect("chunks should merge");

let delta: UniversalStreamDelta =
lingua::serde_json::from_value(merged.choices[0].delta.clone().unwrap()).unwrap();
let tool_call = &delta.tool_calls[0];
assert_eq!(
tool_call.builtin_tool.as_ref().unwrap().provider,
lingua::universal::BuiltinToolProvider::Google
);
assert_eq!(
tool_call.encrypted_content.as_deref(),
Some("search_signature")
);
assert_eq!(
tool_call
.function
.as_ref()
.and_then(|function| function.arguments.as_deref()),
Some("{\"query\":\"Lingua\"}")
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@
}
],
"perTestCase": [
{
"testCase": "audioTranscriptionConfigParam", "source": "Google", "target": "*",
"fields": [{ "pattern": "served_service_tier", "reason": "Anthropic-compatible content stream events have no message metadata envelope for Google service-tier metadata" }]
},
{
"testCase": "toolCallRequest", "source": "ChatCompletions", "target": "Responses",
"fields": [{ "pattern": "served_service_tier", "reason": "Responses tool-call stream events have no response metadata envelope" }]
Expand Down
Loading
Loading