Skip to content
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

.net core客户端openai-dotnet访问oneapi接口报错 #1998

Open
5 tasks
wdqzdd opened this issue Dec 26, 2024 · 1 comment
Open
5 tasks

.net core客户端openai-dotnet访问oneapi接口报错 #1998

wdqzdd opened this issue Dec 26, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@wdqzdd
Copy link

wdqzdd commented Dec 26, 2024

例行检查

  • 我已确认目前没有类似 issue
  • 我已确认我已升级到最新版本
  • 我已完整查看过项目 README,尤其是常见问题部分
  • 我理解并愿意跟进此 issue,协助测试和提供反馈
  • 我理解并认可上述内容,并理解项目维护者精力有限,不遵循规则的 issue 可能会被无视或直接关闭

问题描述
image

使用.net core客户端访问报错
'<' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.

https://github.com/openai/openai-dotnet
`ApiKeyCredential apiKeyCredential = new ApiKeyCredential(llmModel.Token);
OpenAIClientOptions openAIClientOptions = new OpenAIClientOptions();
openAIClientOptions.Endpoint = new Uri(llmModel.BaseUrl);

        ChatClient client = new(model: llmModel.Model, apiKeyCredential, openAIClientOptions);

        List<ChatMessage> chatMessages = new List<ChatMessage>();
        if (!string.IsNullOrWhiteSpace(model.System))
        {
            chatMessages.Add(ChatMessage.CreateSystemMessage(model.System));
        }
        if (!string.IsNullOrWhiteSpace(model.User))
        {
            chatMessages.Add(ChatMessage.CreateUserMessage(model.User));
        }
            


        ChatCompletion completion = await client.CompleteChatAsync(chatMessages);


        var llmResult = completion.Content[0].Text;`

复现步骤

预期结果

相关截图
如果没有的话,请删除此节。

@wdqzdd wdqzdd added the bug Something isn't working label Dec 26, 2024
@QAbot-zh
Copy link

你把整个 completion 打印出来看看接收到了什么内容

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants