File size: 973 Bytes
7def60a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package schema

// RerankRequest defines the structure of the request payload
type JINARerankRequest struct {
	Model     string   `json:"model"`
	Query     string   `json:"query"`
	Documents []string `json:"documents"`
	TopN      int      `json:"top_n"`
}

// DocumentResult represents a single document result
type JINADocumentResult struct {
	Index          int      `json:"index"`
	Document       JINAText `json:"document"`
	RelevanceScore float64  `json:"relevance_score"`
}

// Text holds the text of the document
type JINAText struct {
	Text string `json:"text"`
}

// RerankResponse defines the structure of the response payload
type JINARerankResponse struct {
	Model   string               `json:"model"`
	Usage   JINAUsageInfo        `json:"usage"`
	Results []JINADocumentResult `json:"results"`
}

// UsageInfo holds information about usage of tokens
type JINAUsageInfo struct {
	TotalTokens  int `json:"total_tokens"`
	PromptTokens int `json:"prompt_tokens"`
}