Rerank - Go SDK
The Go SDK and docs are currently in beta. Report issues on GitHub.
Rerank endpoints
Submits a rerank request to the rerank router
1package main23import(4 "context"5 "os"6 openrouter "github.com/OpenRouterTeam/go-sdk"7 "github.com/OpenRouterTeam/go-sdk/models/operations"8 "log"9)1011func main() {12 ctx := context.Background()1314 s := openrouter.New(15 openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")),16 )1718 res, err := s.Rerank.Rerank(ctx, operations.CreateRerankRequest{19 Documents: []string{20 "Paris is the capital of France.",21 "Berlin is the capital of Germany.",22 },23 Model: "cohere/rerank-v3.5",24 Query: "What is the capital of France?",25 })26 if err != nil {27 log.Fatal(err)28 }29 if res != nil {30 // handle response31 }32}
ctx
request
opts
*operations.CreateRerankResponse, error