1
0
mirror of https://github.com/coalaura/whiskr.git synced 2025-12-02 20:22:52 +00:00

add provider sorting

This commit is contained in:
Laura
2025-11-09 22:12:32 +01:00
parent adb8e82165
commit 1e7a711e36
6 changed files with 50 additions and 7 deletions

16
chat.go
View File

@@ -54,6 +54,7 @@ type Metadata struct {
type Request struct {
Prompt string `json:"prompt"`
Model string `json:"model"`
Provider string `json:"provider"`
Temperature float64 `json:"temperature"`
Iterations int64 `json:"iterations"`
Tools Tools `json:"tools"`
@@ -168,6 +169,21 @@ func (r *Request) Parse() (*openrouter.ChatCompletionRequest, error) {
}
}
switch r.Provider {
case "throughput":
request.Provider = &openrouter.ChatProvider{
Sort: openrouter.ProviderSortingThroughput,
}
case "latency":
request.Provider = &openrouter.ChatProvider{
Sort: openrouter.ProviderSortingLatency,
}
case "price":
request.Provider = &openrouter.ChatProvider{
Sort: openrouter.ProviderSortingPrice,
}
}
if model.JSON && r.Tools.JSON {
request.ResponseFormat = &openrouter.ChatCompletionResponseFormat{
Type: openrouter.ChatCompletionResponseFormatTypeJSONObject,