| [ Web Proxy ] |
| Viewing: https://developers.cloudflare.com/workers-ai/features/function-calling/embedded/api-reference/ | [Back] [Original] |
Learn more about the API reference for embedded function calling.
This wrapper method enables you to do embedded function calling. You pass it the AI binding, model, inputs (messages array and tools array), and optional configurations.
AI BindingAi
env.AI.modelBaseAiTextGenerationModels
@hf/nousresearch/hermes-2-pro-mistral-7b.inputObject
messagesRoleScopedChatInput[]toolsAiTextGenerationToolInputWithFunction[]configObject
streamFinalResponseboolean optionalmaxRecursiveToolRunsnumber optionalstrictValidationboolean optionalverboseboolean optionaltrimFunctionboolean optional - For the trimFunction, you can pass it autoTrimTools, which is another helper method we've devised to automatically choose the correct tools (using an LLM) before sending it off for inference. This means that your final inference call will have fewer input tokens.This method lets you automatically create tool schemas based on OpenAPI specs, so you don't have to manually write or hardcode the tool schemas. You can pass the OpenAPI spec for any API in JSON or YAML format.
createToolsFromOpenAPISpec has a config input that allows you to perform overrides if you need to provide headers like Authentication or User-Agent.
specstring
configConfig optional - Configuration options for the createToolsFromOpenAPISpec function
overridesConfigRule[] optionalmatchPatternsRegExp[] optionaloptions Object optional {
verbose boolean optional
}| Web Proxy Viewer | New URL | Original Page |