包含Go API项目的所有源代码、配置文件、Docker配置、文档和前端资源 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
34 lines
885 B
Go
34 lines
885 B
Go
package dto
|
|
|
|
type RerankRequest struct {
|
|
Documents []any `json:"documents"`
|
|
Query string `json:"query"`
|
|
Model string `json:"model"`
|
|
TopN int `json:"top_n,omitempty"`
|
|
ReturnDocuments *bool `json:"return_documents,omitempty"`
|
|
MaxChunkPerDoc int `json:"max_chunk_per_doc,omitempty"`
|
|
OverLapTokens int `json:"overlap_tokens,omitempty"`
|
|
}
|
|
|
|
func (r *RerankRequest) GetReturnDocuments() bool {
|
|
if r.ReturnDocuments == nil {
|
|
return false
|
|
}
|
|
return *r.ReturnDocuments
|
|
}
|
|
|
|
type RerankResponseResult struct {
|
|
Document any `json:"document,omitempty"`
|
|
Index int `json:"index"`
|
|
RelevanceScore float64 `json:"relevance_score"`
|
|
}
|
|
|
|
type RerankDocument struct {
|
|
Text any `json:"text"`
|
|
}
|
|
|
|
type RerankResponse struct {
|
|
Results []RerankResponseResult `json:"results"`
|
|
Usage Usage `json:"usage"`
|
|
}
|