8000 获取当前时间function报错function.name:不能为空 · Issue #65 · AIDotNet/Thor · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

获取当前时间function报错function.name:不能为空 #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nygula opened this issue May 8, 2025 · 4 comments
Closed

获取当前时间function报错function.name:不能为空 #65

nygula opened this issue May 8, 2025 · 4 comments

Comments

@nygula
Copy link
nygula commented May 8, 2025
  • 描述: *
    当执行一个调用function的对话时.提示
    code:1214,message:tools[0].function.name:不能为空

  • 代码 *

using System.ComponentModel;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.Connectors.OpenAI;

var kernelBuilder = Kernel.CreateBuilder()
    .AddOpenAIChatCompletion("gpt-4.1-mini", new Uri("https://api.token-ai.cn/v1"),
        "您的密钥");

kernelBuilder.Plugins.AddFromType<TimeInformation>();

var kernel = kernelBuilder.Build();

// 用提示符调用SK,要求AI提供它无法提供的信息,并可能产生幻觉
Console.WriteLine(await kernel.InvokePromptAsync("离圣诞节还有几天?"));

OpenAIPromptExecutionSettings settings = new() { FunctionChoiceBehavior = FunctionChoiceBehavior.Auto() };

// 用提示符调用内核,并允许AI自动调用函数
Console.WriteLine(await kernel.InvokePromptAsync("离圣诞节还有几天?解释你的想法", new(settings)));

class TimeInformation
{
    [KernelFunction]
    [Description("获取当前时间帮助用户解决时区不准确。")]
    public string GetCurrentUtcTime() => DateTime.UtcNow.ToString("R");
}




  • 版本 *
    aidotnet/thor:latest 367c0e422144

  • 部署脚本 *


services:
  thor:
    image: aidotnet/thor:latest
    ports:
      - 18080:8080
    container_name: thor
    volumes:
      - ./data:/data
    environment:
      - TZ=Asia/Shanghai
      - DBType=sqlite # sqlite | [postgresql,pgsql] | [sqlserver,mssql] | mysql
      - ConnectionStrings:DefaultConnection=data source=/data/token.db
      - ConnectionStrings:LoggerConnection=data source=/data/logger.db
      - RunMigrationsAtStartup=true

Copy link
github-actions bot commented May 8, 2025

Message that will be displayed on users' first issue

@239573049
Copy link
Member

是最新版吗?
我在线部署的是否也会出现?

@nygula
Copy link
Author
nygula commented May 12, 2025

是最新版吗? 我在线部署的是否也会出现?

尝试docker pull到最新版.

 docker compose images
thor                aidotnet/thor       latest              be159f525a7b        419MB

配置thor地址 模型 key

	var kernelBuilder = Kernel.CreateBuilder()
		.AddOpenAIChatCompletion("glm-4-air", new Uri("http://192.168.0.75:18080/v1/"),
			"sk-i08S6ZcRDbeZQwJjoJwQvfdzu46sbPqyunaGJb");

问题依旧.

HTTP 400 (: 500)

code:1214,message:tools[0].function.name:不能为空

渠道:智谱AI
会不会是bigmodel.cn调用的问题?

@239573049
Copy link
Member

我平台并没有出现这种问题可能是智谱AI的api兼容存在了问题
建议使用前提平台或者看看智谱AI是否提供了兼容OpenAI的格式你可以直接使用OpenAI渠道

@nygula nygula closed this as completed May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0