mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-06-27 15:36:26 +00:00
Responses API fix
This commit is contained in:
parent
2da420e549
commit
8fd7e18113
@ -313,6 +313,10 @@ public sealed class ProviderOpenAI() : BaseProvider(LLMProviders.OPEN_AI, new Ur
|
|||||||
var providerTools = runnableTools
|
var providerTools = runnableTools
|
||||||
.Select(x => (object)ProviderToolAdapters.ToResponsesTool(x.Definition))
|
.Select(x => (object)ProviderToolAdapters.ToResponsesTool(x.Definition))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
// Keep only the minimal safe continuation state across follow-up requests.
|
||||||
|
// The Responses API requires the original function_call item together with
|
||||||
|
// the later function_call_output, but replaying all response output would
|
||||||
|
// include server-side IDs that are unavailable when store=false.
|
||||||
var internalItems = new List<object>();
|
var internalItems = new List<object>();
|
||||||
var toolCallCount = 0;
|
var toolCallCount = 0;
|
||||||
|
|
||||||
@ -369,8 +373,8 @@ public sealed class ProviderOpenAI() : BaseProvider(LLMProviders.OPEN_AI, new Ur
|
|||||||
await currentAssistantContent.StreamingEvent();
|
await currentAssistantContent.StreamingEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var outputItem in response.Output)
|
foreach (var functionCallItem in response.GetRawFunctionCallItems())
|
||||||
internalItems.Add(outputItem);
|
internalItems.Add(functionCallItem);
|
||||||
|
|
||||||
foreach (var functionCall in functionCalls)
|
foreach (var functionCall in functionCalls)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -27,6 +27,10 @@ public sealed record ResponsesResponse
|
|||||||
.Where(x => !string.IsNullOrWhiteSpace(x.CallId) && !string.IsNullOrWhiteSpace(x.Name))
|
.Where(x => !string.IsNullOrWhiteSpace(x.CallId) && !string.IsNullOrWhiteSpace(x.Name))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
public IReadOnlyList<JsonElement> GetRawFunctionCallItems() => this.Output
|
||||||
|
.Where(x => ReadString(x, "type").Equals("function_call", StringComparison.Ordinal))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
public string GetTextOutput()
|
public string GetTextOutput()
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(this.OutputText))
|
if (!string.IsNullOrWhiteSpace(this.OutputText))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user