Document direct functions as the preferred tool pattern#895
Document direct functions as the preferred tool pattern#895markbackman wants to merge 2 commits into
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
❌ Broken links detected! Please check the workflow logs for details on which links are broken and fix them before merging. |
80d31c9 to
568a01f
Compare
|
❌ Broken links detected! Please check the workflow logs for details on which links are broken and fix them before merging. |
Rework the function-calling docs so direct functions lead and the verbose FunctionSchema + register_function pattern is demoted to an "Advanced" section for when you need explicit schema control. - function-calling.mdx: direct-function-first implementation steps; new sections for @tool_options (cancel_on_interruption / timeout_secs), changing tools mid-conversation via LLMSetToolsFrame, and tools across LLMSwitcher service switches; deprecation note for register_direct_function / unregister_direct_function. - context-management.mdx, context-summarization.mdx: convert tool snippets to direct functions listed in LLMContext(tools=[...]). - data-frames.mdx: widen LLMSetToolsFrame.tools to accept direct functions / FunctionSchema; note auto-register/unregister. - llm-switcher.mdx: deprecate register_direct_function(). - novita.mdx, inception.mdx: convert function-calling examples to direct functions. Documents pipecat-ai/pipecat#4671.
568a01f to
ff9901c
Compare
|
Changed to this PR incoming, based on the work in pipecat-ai/pipecat#4709 |
|
There's a lot of words spent in these changes on talking about "hey, look, you don't have to register these functions with the LLM service anymore!", but that won't make sense to a new reader—they don't know/care/need to know about how things used to work, how manual registration used to be the main pattern. I'm working on changes to this PR now, so I'll include fixes for this. |
A FunctionSchema can carry the handler that runs when the LLM calls the tool. Document attaching it by passing it as the schema's handler and listing the schema like a direct function, with @tool_options setting its call options — across the function-calling guide, the LLMSetToolsFrame reference, and the LLMSwitcher.register_function note. Also strip the framing that explained tools by contrast with a manual-registration past new readers never knew. The tools the LLM can use are whatever you list in LLMContext(tools=[...]) or push via LLMSetToolsFrame; drop the 'no register_function needed' / 'that's all the wiring required' lines, quarantine explicit register_function/unregister_function to a brief, uncommon Advanced subsection, and remove the register_direct_function deprecation note the guide never needs. Lead 'Define a tool' with the handler/schema split and point to FunctionSchema as the alternative. Carry the same cleanup into the per-provider examples (inception, novita) and the context-management and context-summarization pages.
Documents pipecat-ai/pipecat#4671.