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

怎么做简单的视频网站网络推广官网首页

怎么做简单的视频网站,网络推广官网首页,商城网站建设网络公司,wordpress发布图片默认 Ollama 中的 Qwen2 模型不支持 Function Calling,使用默认 Qwen2,Ollama 会报错。本文将根据官方模板对 ChatTemplate 进行改进,使得Qwen2 支持 Tools,支持函数调用。 Ollama 会检查对话模板中是否存在 Tools,如…

默认 Ollama 中的 Qwen2 模型不支持 Function Calling,使用默认 Qwen2,Ollama 会报错。本文将根据官方模板对 ChatTemplate 进行改进,使得Qwen2 支持 Tools,支持函数调用。
在这里插入图片描述
Ollama 会检查对话模板中是否存在 Tools,如果不存在就会报错,下面的代码是 Ollama 解析模板的代码。
在这里插入图片描述
Ollama 3.1 是支持 Tools 的,可以看到模板中定义了 Tools。
在这里插入图片描述
修改 Qwen2 配置并创建新的模型,首先我们定义一个 Ollama 模型文件,创建文件 qwen_tools。

FROM qwen2:7b# set the temperature to 0.7 [higher is more creative, lower is more coherent]
PARAMETER temperature 0.7
PARAMETER top_p 0.8
PARAMETER repeat_penalty 1.05
TEMPLATE """{{ if .Messages }}
{{- if or .System .Tools }}<|im_start|>system
{{ .System }}
{{- if .Tools }}# ToolsYou are provided with function signatures within <tools></tools> XML tags. You may call one or more functions to assist with the user query. Don't make assumptions about what values to plug into functions. Here are the available tools:
<tools>{{- range .Tools }}{{ .Function }}{{- end }}</tools>For each function call, return a JSON object with function name and arguments within <tool_call></tool_call> XML tags as follows:
<tool_call>
{"name": <function-name>, "arguments": <args-json-object>}
</tool_call>{{- end }}<|im_end|>{{- end }}
{{- range .Messages }}
{{- if eq .Role "user" }}
<|im_start|>{{ .Role }}
{{ .Content }}<|im_end|>
{{- else if eq .Role "assistant" }}
<|im_start|>{{ .Role }}
{{- if .Content }}
{{ .Content }}
{{- end }}
{{- if .ToolCalls }}
<tool_call>
{{ range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}
{{ end }}</tool_call>
{{- end }}<|im_end|>
{{- else if eq .Role "tool" }}
<|im_start|>user
<tool_response>
{{ .Content }}
</tool_response><|im_end|>
{{- end }}
{{- end }}
<|im_start|>assistant
{{ else }}{{ if .System }}<|im_start|>system
{{ .System }}<|im_end|>
{{ end }}{{ if .Prompt }}<|im_start|>user
{{ .Prompt }}<|im_end|>
{{ end }}<|im_start|>assistant
{{ end }}
"""

构建模型

ollama create qwen2tools --file ./qwen_tools 

测试模型

在这里插入图片描述

总结

现在的模型都是支持 Tools,在 Ollama 中使用我们需要对 Template 配置,配置好 Tools 后,就可以通过 Ollama 直接进行函数调用了。

http://www.ds6.com.cn/news/41593.html

相关文章:

  • 5ucms怎样做网站自适应百度seo建议
  • 北京西路做网站的公司seo自动工具
  • 长安区网站建设如何制作网站赚钱
  • 网站建设有那些内容b站黄页推广
  • 珠海网站制作哪家便宜超级外链发布工具
  • 长长沙网站制作app推广策略
  • 网站架构图怎么做平台优化是什么意思
  • 代做毕业设计的网站好东莞专业网站推广工具
  • 网站优化建设公司杭州网站seo推广
  • 无锡网站建设.com千锋教育怎么样
  • 桂林日月双塔seo整站优化方案
  • 网站开发哪些公司吉林seo管理平台
  • 别人的网站是怎么找到的成都seo优化推广
  • 网站建设前台与后台最新技术厦门seo优化外包公司
  • 常州微信网站建设公司金华网站推广
  • 廊坊市固安县建设局网站steam交易链接怎么看
  • 一个企业可以做多个网站吗宁波seo网站推广软件
  • 新泰网站制作公司产品推广软文300字
  • 网站开发众筹pc端百度
  • 深圳网络做网站seo网站推广软件 快排
  • 在线做头像网站域名大全免费网站
  • 温州知名网站推广软文经典案例
  • wordpress获取文章id方法漯河seo公司
  • 百度微信官网网站模板重庆网站建设公司
  • 种子汤唯梁朝伟做视频网站百度自动驾驶技术
  • 东莞市疾控中心24小时咨询电话家庭优化大师免费下载
  • 网站建设好的公司搜索引擎大全网站
  • 工程建设流程seo数据优化教程
  • 网站开发专业就业前景分析seo还可以做哪些推广
  • 网站上传文件功能实现计算机培训