mirror of
https://github.com/ollama/ollama.git
synced 2025-11-11 17:56:52 +01:00
server: add thinking and tool calls to CompletionResponse
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user