Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion internal/llm/fantasy_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -686,9 +686,15 @@ func fantasyProviderCost(metadata fantasy.ProviderMetadata) *float64 {
}

func normalizedFantasyResponse(content string, toolCalls []ToolCall, providerState json.RawMessage, usage Usage, finish fantasy.FinishReason) *CompletionResponse {
// Normalize the library's finish reasons to this package's stable spelling.
// Fantasy owns the provider values; the agent loop and StopReason consumers
// read the normalized form.
finishReason := string(finish)
if finish == fantasy.FinishReasonToolCalls {
switch finish {
case fantasy.FinishReasonToolCalls:
finishReason = "tool_calls"
case fantasy.FinishReasonContentFilter:
finishReason = "content_filter"
}
return &CompletionResponse{
Object: "chat.completion",
Expand Down
Loading