Skip to content

Empty call IDs can't roundtrip #428

@stephentoub

Description

@stephentoub

Service

OpenAI

Describe the bug

Tool call IDs are surfaced as part of ChatToolCall objects returned from ChatCompletion.ToolCalls. While the OpenAI service always provides non-empty IDs, some other endpoints, such as Gemini's "OpenAI compatible" endpoint, does not. The ChatToolCall.Id properties coming back from these calls is empty. That's fine, except that when you then try to use ChatToolCall.CreateFunctionToolCall to roundtrip the data from such a ChatToolCall, it fails with an argument exception about the ID being empty.

Steps to reproduce

Call ChatToolCall.CreateFunctionToolCall with string.Empty for the ID parameter.

Code snippets

OS

Windows

.NET version

.NET 9

Library version

2.2.0-beta.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugCategory: Something isn't working and appears to be a defect in the client library.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions