You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consolidated the duplicated function-tool schema conversion in the OpenAI chat completions and responses request builders through the existing unexported schemaToMap helper. This keeps the Go provider internals closer to the .NET provider's central FunctionDefinition shape while preserving the generated request payloads.
.NET Reference
dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/ChatCompletions/Models/Tool.cs - central tool/function definition model used when constructing OpenAI tool payloads.
Public API and Behavior
No public Go API changed. No intentional behavior change was made.
dotnet/src/Microsoft.Agents.AI/Skills/Decorators/FilteringAgentSkillsSource.cs - Go already exposes skill filtering through ContextProviderOptions.SkillFilter; adding a .NET-style source decorator would add new public API, so it was rejected.
dotnet/src/Microsoft.Agents.AI.Workflows/Checkpointing/JsonConverterDictionarySupportBase.cs - Go checkpoint JSON uses explicit entry structs rather than dictionary-key converters, so there was no narrow structural cleanup that would improve parity without churn.
dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticConstants.cs - no corresponding Go Magentic internals exist in the current sampled surface, so adding constants would be placeholder feature shape rather than portability cleanup.
Open [dotnet-code] PR #484 already covers workflow edge construction, so adjacent workflow-edge work was avoided.
This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch dotnet-code-openai-tool-schema-helper-20260714224108-151da8cb1496cb3c.
To fix the permissions issue, go to Settings → Actions → General and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ
Show patch preview (77 of 77 lines)
From 238b07810a274cd81f3c90a739e14dd1c3379930 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Tue, 14 Jul 2026 22:41:08 +0000
Subject: [PATCH] Consolidate OpenAI tool schema conversion
Share the internal schema conversion helper between chat completions and responses tool request construction so the Go provider shape stays closer to the central .NET FunctionDefinition model without changing API or request behavior.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
provider/openaiprovider/chat.go | 19 ++++---------------
provider/openaiprovider/responses.go | 19 ++++---------------
2 files changed, 8 insertions(+), 30 deletions(-)
diff --git a/provider/openaiprovider/chat.go b/provider/openaiprovider/chat.go
index 5195109c2..259492730 100644
--- a/provider/openaiprovider/chat.go+++ b/provider/openaiprovider/chat.go@@ -308,21 +308,10 @@ func buildCompletionParams(model string, messages []*message.Message, opts []age
}
case tool.FuncTool:
name, description := tl.Name(), tl.Description()
- var funcParams map[string]any- switch schema := tl.Schema().(type) {- case map[string]any:- funcParams = schema- default:- if schema == nil {- break- }- data, err := json.Marshal(schema)- if err == nil {- err = json.Unmarshal(data, &funcParams)- }- if err != nil {- return openai.ChatCompletionNewParams{}, fmt.Errorf("failed to convert function tool schema to JSON format: %w", err)- }+ schema := tl.Schema()+ funcParams, err := schemaToMap(schema)+ if err != nil {+ return openai.ChatCompletionNewParams{}, fmt.Errorf("failed to convert function tool schema to JSON format: %w", err)
}
params.Tools = append(params.Tools, openai.ChatCompletionToolUnionParam{
OfFunction: &openai.ChatCompletionFunctionToolParam{
diff --git a/provider/openaiprovider/responses.go b/provider/openaiprovider/responses.go
index 3
... (truncated)
Summary
Consolidated the duplicated function-tool schema conversion in the OpenAI chat completions and responses request builders through the existing unexported
schemaToMaphelper. This keeps the Go provider internals closer to the .NET provider's centralFunctionDefinitionshape while preserving the generated request payloads..NET Reference
dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/ChatCompletions/Models/Tool.cs- central tool/function definition model used when constructing OpenAI tool payloads.Public API and Behavior
No public Go API changed. No intentional behavior change was made.
Tests
gofmt -w provider/openaiprovider/chat.go provider/openaiprovider/responses.gogo test ./provider/openaiproviderNotes
Rejected candidates:
dotnet/src/Microsoft.Agents.AI/Skills/Decorators/FilteringAgentSkillsSource.cs- Go already exposes skill filtering throughContextProviderOptions.SkillFilter; adding a .NET-style source decorator would add new public API, so it was rejected.dotnet/src/Microsoft.Agents.AI.Workflows/Checkpointing/JsonConverterDictionarySupportBase.cs- Go checkpoint JSON uses explicit entry structs rather than dictionary-key converters, so there was no narrow structural cleanup that would improve parity without churn.dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticConstants.cs- no corresponding Go Magentic internals exist in the current sampled surface, so adding constants would be placeholder feature shape rather than portability cleanup.Open
[dotnet-code]PR #484 already covers workflow edge construction, so adjacent workflow-edge work was avoided.Note
This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch
dotnet-code-openai-tool-schema-helper-20260714224108-151da8cb1496cb3c.Click here to create the pull request
To fix the permissions issue, go to Settings → Actions → General and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ
Show patch preview (77 of 77 lines)