rerank.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package model
  2. type RerankRequest struct {
  3. TopN *int `json:"top_n,omitempty"`
  4. MaxChunksPerDoc *int `json:"max_chunks_per_doc,omitempty"`
  5. ReturnDocuments *bool `json:"return_documents,omitempty"`
  6. OverlapTokens *int `json:"overlap_tokens,omitempty"`
  7. Model string `json:"model"`
  8. Query string `json:"query"`
  9. Documents []string `json:"documents"`
  10. }
  11. type Document struct {
  12. Text string `json:"text"`
  13. }
  14. type RerankResult struct {
  15. Document *Document `json:"document,omitempty"`
  16. Index int `json:"index"`
  17. RelevanceScore float64 `json:"relevance_score"`
  18. }
  19. type RerankMetaTokens struct {
  20. InputTokens int64 `json:"input_tokens"`
  21. OutputTokens int64 `json:"output_tokens"`
  22. }
  23. type RerankMeta struct {
  24. Tokens *RerankMetaTokens `json:"tokens,omitempty"`
  25. Model string `json:"model,omitempty"`
  26. }
  27. type RerankResponse struct {
  28. Meta RerankMeta `json:"meta"`
  29. ID string `json:"id"`
  30. Results []*RerankResult `json:"results"`
  31. }
  32. type SlimRerankResponse struct {
  33. Meta RerankMeta `json:"meta"`
  34. }