How Function Calling and Dynamic Model Lists work
mainAI Studio Bridge provides an end-to-end automation loop for advanced AI features:
Function Calling / Tool Calling
- Definition: You define tools (functions) within your API request.
- AI Decision: AI Studio determines when to call a tool and returns a
tool_callsresponse in OpenAI format. - Parallel Execution: The system supports scenarios where the AI calls multiple functions in a single request.
- Automation Loop: You execute the function on the client side and send the result back using a message with
role: "tool". The system automatically submits this to AI Studio and streams the final text response.
Dynamic Model Discovery
When a client calls the /v1/models endpoint, the system triggers the modelfetcher.js script. This script refreshes the page, intercepts the model requests, and returns a real-time, OpenAI-compatible list of available models.