Add reasoning effort
This commit is contained in:
@@ -450,6 +450,8 @@ type Request struct {
|
||||
SystemMessage string `json:"system_message,omitempty"`
|
||||
// MaxIterations caps the number of agent loop turns (0 = unlimited).
|
||||
MaxIterations int `json:"max_iterations,omitempty"`
|
||||
// ThinkingBudgetTokens is the llama.cpp reasoning budget (-1 = unlimited, 0 = off).
|
||||
ThinkingBudgetTokens *int `json:"thinking_budget_tokens,omitempty"`
|
||||
}
|
||||
|
||||
// Response is the response format for chat and voice endpoints.
|
||||
@@ -545,7 +547,13 @@ func (svc *Service) chat(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
res, err := llmc.Completions(
|
||||
ctx, model, req.SystemMessage, req.MaxIterations, req.Messages,
|
||||
ctx, llm.CompletionsParams{
|
||||
Model: model,
|
||||
SystemMessage: req.SystemMessage,
|
||||
MaxIterations: req.MaxIterations,
|
||||
Messages: req.Messages,
|
||||
ThinkingBudgetTokens: req.ThinkingBudgetTokens,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
log.ErrorContext(
|
||||
@@ -717,7 +725,13 @@ func (svc *Service) chatStream(w http.ResponseWriter, r *http.Request) {
|
||||
)
|
||||
go func() {
|
||||
errs <- llmc.CompletionsStream(
|
||||
ctx, model, req.SystemMessage, req.MaxIterations, req.Messages, events,
|
||||
ctx, llm.CompletionsParams{
|
||||
Model: model,
|
||||
SystemMessage: req.SystemMessage,
|
||||
MaxIterations: req.MaxIterations,
|
||||
Messages: req.Messages,
|
||||
ThinkingBudgetTokens: req.ThinkingBudgetTokens,
|
||||
}, events,
|
||||
)
|
||||
close(errs)
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user