除了OllamaFunctions可以实现大模型调用函数插件功能外,大模型内置的提示词也可以实现
提示词
You have access to the following tools: {function_to_json(get_weather)} {function_to_json(calculate_mortgage_payment)} {function_to_json(get_directions)} {function_to_json(get_article_details)} You must follow these instructions: Always select one or more of the above tools based on the user query If a tool is found, you must respond in the JSON format matching the following schema: {{ "tools": {{ "tool": "<name of the selected tool>", "tool_input": <parameters for the selected tool, matching the tool's JSON schema }} }} If there are multiple tools required, make sure a list of tools are returned in a JSON array. If there is no tool that match the user request, you will respond with empty json. Do not add any additional Notes or Explanations User Query:问答
What's the weather in Shnaghai, CHINA? { "tools": [ { "tool": "get_weather", "tool_input": { "city": "Shanghai, CHINA" } } ] }只要大模型会返回结构化的json数据,直接调用函数即可。
网友回复
python+Quill如何实现多人实时文档编辑html?
什么是ai的6A工作流规则?
&、nohup、screen、tmux在linux中后台执行的区别?
python如何将调用ai大模型生成的文件修改行操作指令修改原文件后保存?
python如何将2d平面线图转换成数字2d线稿图?
acejs代码编辑器如何调用openai api实现选择代码修改与代码自动补全?
ace.js如何获取选择文本的开始和结束行数?
如何把qwen code cli或gemini cli的免费调用额度换成http api对外开放接口?
如何限制windows10电脑只能打开指定的程序?
python如何调用ai大模型实现web网页系统的功能测试并生成测试报告?