MCPcopy Index your code
hub / github.com/simstudioai/sim / buildNextConfig

Function buildNextConfig

apps/sim/providers/gemini/core.ts:304–333  ·  view source on GitHub ↗

* Builds config for next iteration

(
  baseConfig: GenerateContentConfig,
  state: ExecutionState,
  forcedTools: string[],
  request: ProviderRequest,
  logger: ReturnType<typeof createLogger>,
  model: string
)

Source from the content-addressed store, hash-verified

302 * Builds config for next iteration
303 */
304function buildNextConfig(
305 baseConfig: GenerateContentConfig,
306 state: ExecutionState,
307 forcedTools: string[],
308 request: ProviderRequest,
309 logger: ReturnType<typeof createLogger>,
310 model: string
311): GenerateContentConfig {
312 const nextConfig = { ...baseConfig }
313 const allForcedToolsUsed =
314 forcedTools.length > 0 && state.usedForcedTools.length === forcedTools.length
315
316 if (allForcedToolsUsed && request.responseFormat) {
317 nextConfig.tools = undefined
318 nextConfig.toolConfig = undefined
319 if (isGemini3Model(model)) {
320 logger.info('Gemini 3: Stripping tools after forced tool execution, schema already set')
321 } else {
322 nextConfig.responseMimeType = 'application/json'
323 nextConfig.responseSchema = cleanSchemaForGemini(request.responseFormat.schema) as Schema
324 logger.info('Using structured output for final response after tool execution')
325 }
326 } else if (state.currentToolConfig) {
327 nextConfig.toolConfig = state.currentToolConfig
328 } else {
329 nextConfig.toolConfig = { functionCallingConfig: { mode: FunctionCallingConfigMode.AUTO } }
330 }
331
332 return nextConfig
333}
334
335/**
336 * Creates streaming execution result template

Callers 1

executeGeminiRequestFunction · 0.85

Calls 3

isGemini3ModelFunction · 0.90
cleanSchemaForGeminiFunction · 0.90
infoMethod · 0.80

Tested by

no test coverage detected