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
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ describe('Google GenAI integration', () => {
});
});

const EXPECTED_AVAILABLE_TOOLS_JSON =
'[{"name":"controlLight","parametersJsonSchema":{"type":"object","properties":{"brightness":{"type":"number"},"colorTemperature":{"type":"string"}},"required":["brightness","colorTemperature"]}}]';

const EXPECTED_TRANSACTION_TOOLS = {
transaction: 'main',
spans: expect.arrayContaining([
Expand All @@ -215,7 +218,7 @@ describe('Google GenAI integration', () => {
'sentry.origin': 'auto.ai.google_genai',
'gen_ai.system': 'google_genai',
'gen_ai.request.model': 'gemini-2.0-flash-001',
'gen_ai.request.available_tools': expect.any(String), // Should include tools
'gen_ai.request.available_tools': EXPECTED_AVAILABLE_TOOLS_JSON,
'gen_ai.request.messages': expect.any(String), // Should include contents
'gen_ai.response.text': expect.any(String), // Should include response text
'gen_ai.response.tool_calls': expect.any(String), // Should include tool calls
Expand All @@ -236,7 +239,7 @@ describe('Google GenAI integration', () => {
'sentry.origin': 'auto.ai.google_genai',
'gen_ai.system': 'google_genai',
'gen_ai.request.model': 'gemini-2.0-flash-001',
'gen_ai.request.available_tools': expect.any(String), // Should include tools
'gen_ai.request.available_tools': EXPECTED_AVAILABLE_TOOLS_JSON,
'gen_ai.request.messages': expect.any(String), // Should include contents
'gen_ai.response.streaming': true,
'gen_ai.response.text': expect.any(String), // Should include response text
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/tracing/google-genai/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function extractRequestAttributes(

// Extract available tools from config
if ('tools' in config && Array.isArray(config.tools)) {
const functionDeclarations = config.tools.map(
const functionDeclarations = config.tools.flatMap(
(tool: { functionDeclarations: unknown[] }) => tool.functionDeclarations,
);
attributes[GEN_AI_REQUEST_AVAILABLE_TOOLS_ATTRIBUTE] = JSON.stringify(functionDeclarations);
Expand Down