server: add thinking and tool calls to CompletionResponse

This commit is contained in:
ParthSareen
2025-08-21 14:50:34 -07:00
parent 4a5bdd5f12
commit eb7660d724

View File

@@ -1375,6 +1375,8 @@ func (d DoneReason) String() string {
type CompletionResponse struct { type CompletionResponse struct {
Content string `json:"content"` Content string `json:"content"`
Thinking string `json:"thinking"`
ToolCalls []api.ToolCall `json:"tool_calls"`
DoneReason DoneReason `json:"done_reason"` DoneReason DoneReason `json:"done_reason"`
Done bool `json:"done"` Done bool `json:"done"`
PromptEvalCount int `json:"prompt_eval_count"` PromptEvalCount int `json:"prompt_eval_count"`
@@ -1511,10 +1513,8 @@ func (s *llmServer) Completion(ctx context.Context, req CompletionRequest, fn fu
return ctx.Err() return ctx.Err()
} }
if c.Content != "" { if c.Content != "" || c.Thinking != "" || len(c.ToolCalls) > 0 {
fn(CompletionResponse{ fn(c)
Content: c.Content,
})
} }
if c.Done { if c.Done {