mirror of
https://github.com/coalaura/whiskr.git
synced 2025-09-09 09:19:54 +00:00
json & web search
This commit is contained in:
14
chat.go
14
chat.go
@@ -25,6 +25,8 @@ type Request struct {
|
||||
Prompt string `json:"prompt"`
|
||||
Model string `json:"model"`
|
||||
Temperature float64 `json:"temperature"`
|
||||
JSON bool `json:"json"`
|
||||
Search bool `json:"search"`
|
||||
Reasoning Reasoning `json:"reasoning"`
|
||||
Messages []Message `json:"messages"`
|
||||
}
|
||||
@@ -60,6 +62,18 @@ func (r *Request) Parse() (*openrouter.ChatCompletionRequest, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if model.JSON && r.JSON {
|
||||
request.ResponseFormat = &openrouter.ChatCompletionResponseFormat{
|
||||
Type: openrouter.ChatCompletionResponseFormatTypeJSONObject,
|
||||
}
|
||||
}
|
||||
|
||||
if r.Search {
|
||||
request.Plugins = append(request.Plugins, openrouter.ChatCompletionPlugin{
|
||||
ID: openrouter.PluginIDWeb,
|
||||
})
|
||||
}
|
||||
|
||||
prompt, err := BuildPrompt(r.Prompt, model)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Reference in New Issue
Block a user