Skip to content

Commit b62e569

Browse files
committed
chore(gemini): remove dead executeToolCall function
1 parent 0bc776e commit b62e569

File tree

1 file changed

+1
-99
lines changed

1 file changed

+1
-99
lines changed

apps/sim/providers/gemini/core.ts

Lines changed: 1 addition & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import {
3232
prepareToolsWithUsageControl,
3333
} from '@/providers/utils'
3434
import { executeTool } from '@/tools'
35-
import type { ExecutionState, GeminiProviderType, GeminiUsage, ParsedFunctionCall } from './types'
35+
import type { ExecutionState, GeminiProviderType, GeminiUsage } from './types'
3636

3737
/**
3838
* Creates initial execution state
@@ -78,104 +78,6 @@ function createInitialState(
7878
}
7979
}
8080

81-
/**
82-
* Executes a tool call and updates state
83-
*/
84-
async function executeToolCall(
85-
functionCallPart: Part,
86-
functionCall: ParsedFunctionCall,
87-
request: ProviderRequest,
88-
state: ExecutionState,
89-
forcedTools: string[],
90-
logger: ReturnType<typeof createLogger>
91-
): Promise<{ success: boolean; state: ExecutionState }> {
92-
const toolCallStartTime = Date.now()
93-
const toolName = functionCall.name
94-
95-
const tool = request.tools?.find((t) => t.id === toolName)
96-
if (!tool) {
97-
logger.warn(`Tool ${toolName} not found in registry, skipping`)
98-
return { success: false, state }
99-
}
100-
101-
try {
102-
const { toolParams, executionParams } = prepareToolExecution(tool, functionCall.args, request)
103-
const result = await executeTool(toolName, executionParams)
104-
const toolCallEndTime = Date.now()
105-
const duration = toolCallEndTime - toolCallStartTime
106-
107-
const resultContent: Record<string, unknown> = result.success
108-
? ensureStructResponse(result.output)
109-
: { error: true, message: result.error || 'Tool execution failed', tool: toolName }
110-
111-
const toolCall: FunctionCallResponse = {
112-
name: toolName,
113-
arguments: toolParams,
114-
startTime: new Date(toolCallStartTime).toISOString(),
115-
endTime: new Date(toolCallEndTime).toISOString(),
116-
duration,
117-
result: resultContent,
118-
}
119-
120-
const updatedContents: Content[] = [
121-
...state.contents,
122-
{
123-
role: 'model',
124-
parts: [functionCallPart],
125-
},
126-
{
127-
role: 'user',
128-
parts: [
129-
{
130-
functionResponse: {
131-
name: functionCall.name,
132-
response: resultContent,
133-
},
134-
},
135-
],
136-
},
137-
]
138-
139-
const forcedToolCheck = checkForForcedToolUsage(
140-
[{ name: functionCall.name, args: functionCall.args }],
141-
state.currentToolConfig,
142-
forcedTools,
143-
state.usedForcedTools
144-
)
145-
146-
return {
147-
success: true,
148-
state: {
149-
...state,
150-
contents: updatedContents,
151-
toolCalls: [...state.toolCalls, toolCall],
152-
toolResults: result.success
153-
? [...state.toolResults, result.output as Record<string, unknown>]
154-
: state.toolResults,
155-
toolsTime: state.toolsTime + duration,
156-
timeSegments: [
157-
...state.timeSegments,
158-
{
159-
type: 'tool',
160-
name: toolName,
161-
startTime: toolCallStartTime,
162-
endTime: toolCallEndTime,
163-
duration,
164-
},
165-
],
166-
usedForcedTools: forcedToolCheck?.usedForcedTools ?? state.usedForcedTools,
167-
currentToolConfig: forcedToolCheck?.nextToolConfig ?? state.currentToolConfig,
168-
},
169-
}
170-
} catch (error) {
171-
logger.error('Error processing function call:', {
172-
error: error instanceof Error ? error.message : String(error),
173-
functionName: toolName,
174-
})
175-
return { success: false, state }
176-
}
177-
}
178-
17981
/**
18082
* Executes multiple tool calls in parallel and updates state.
18183
* Per Gemini docs, all function calls from a single response should be executed

0 commit comments

Comments
 (0)