当前位置: 首页 > news >正文

浅谈OpenAIClaude LLM Tools的额外配置

前言

  • https://platform.openai.com/docs/guides/function-calling?api-mode=chat&strict-mode=disabled#additional-configurations
  • https://docs.anthropic.com/en/docs/build-with-claude/tool-use/overview#forcing-tool-use

tool_choice

  1. “none” 就是不用tools, tools传入也为味空
  2. auto,就是可能调用tool,或者不调用,agent loop,很多写的范式都是,调用tool,就执行拿到结果进入下一个loop,如果不调用tool就直接
  3. required:必须使用其中一个到多个工具,这样的agentloop可能就是tools里有对应的类似于stopTool,调用到就agent ending
  4. forced function: 只调用一个特定tool。

claude也是一样的,就是传入参数 required 为any了

parallel_tool_calls

parallel_tool_calls = True的时候返回的ChatCompletionMessage中的choice.message.tool_calls有多个 toolcall

为False的时候, 只能每次调用一个tool

Strict mode

“strict”= true的时候更能保证json output的输出,这个参数感觉大家用的很少,实际上为true和false,对于tool的parameters写法很多都可以等价

比如:

{"type": "function","function": {"name": "get_weather","description": "Retrieves current weather for the given location.","parameters": {"type": "object","properties": {"location": {"type": "string","description": "City and country e.g. Bogotá, Colombia"},"units": {"type": "string","enum": ["celsius", "fahrenheit"],"description": "Units the temperature will be returned in."}},"required": ["location"],}}
}

这个是我们平时很爱写的写法,看到的基本上都是这种,只会把一定需要的参数写为required中,但openai的"strict"= true, 对type做一下修改是一样的效果

{"type": "function","function": {"name": "get_weather","description": "Retrieves current weather for the given location.","strict": true,"parameters": {"type": "object","properties": {"location": {"type": "string","description": "City and country e.g. Bogotá, Colombia"},"units": {"type": ["string", "null"],"enum": ["celsius", "fahrenheit"],"description": "Units the temperature will be returned in."}},"required": ["location", "units"],"additionalProperties": false}}
}

加入 "null"的type

http://www.dtcms.com/a/156467.html

相关文章:

  • 计算机网络中的DHCP是什么呀? 详情解答
  • 【速写】钩子与计算图
  • 抓包工具Wireshark的应用解析
  • Linux文件管理完全指南:从命名规则到压缩解压
  • 每日c/c++题 备战蓝桥杯(P1049 [NOIP 2001 普及组] 装箱问题)
  • 分层设计数据仓库的架构和设计高效数据库系统的方法
  • 自然语言处理+知识图谱:智能导诊的“大脑”是如何工作的?
  • 人工智能常见的数据处理方法
  • 感知古今:探秘古代传感器的奇妙世界
  • 架构师面试(三十六):广播消息
  • 重置 Git 项目并清除提交历史
  • QuickLookv3.7.3(官方版)文件快速预览工具软件下载及安装教程
  • websheet 之 table表格
  • 高精度电流检测革命:同轴分流器的创新应用与技术演进
  • 罗德FSP13 FSP40频谱分析仪频率13.6GHz
  • [感知机]:基于感知机模型的二分类问题训练与预测实现(C语言版)
  • QCustomPlot QCPItemText文字框可拖动
  • CMake ctest
  • 简单电池电量测量及局限
  • 数据库证书可以选OCP认证吗?
  • 大众点评 mtgsig1.2 分析 mtgsig
  • 每日c/c++题 备战蓝桥杯(P1252洛谷 马拉松接力赛)
  • 【CODEMATE】进制转换(transform) 粤港澳青少年信息学创新大赛 C/C++/Python 解题思路
  • Java—ThreadLocal底层实现原理
  • 谷歌AI眼镜:你的第二大脑,未来人机共生从这里开始
  • 【AI图像创作变现】04实操路径—插图/绘本/创意图集
  • ViTMAE:掩码自编码器是可扩展的视觉学习者
  • 《ATPL地面培训教材13:飞行原理》——第7章:失速
  • 8.ArkUI Stack的介绍和使用
  • 仿真每日一练 | Workbench多单元混合建模静力学分析