✨ feat: make TopN field in RerankRequest optional in JSON serialization
This commit is contained in:
@@ -4,7 +4,7 @@ type RerankRequest struct {
|
|||||||
Documents []any `json:"documents"`
|
Documents []any `json:"documents"`
|
||||||
Query string `json:"query"`
|
Query string `json:"query"`
|
||||||
Model string `json:"model"`
|
Model string `json:"model"`
|
||||||
TopN int `json:"top_n"`
|
TopN int `json:"top_n,omitempty"`
|
||||||
ReturnDocuments *bool `json:"return_documents,omitempty"`
|
ReturnDocuments *bool `json:"return_documents,omitempty"`
|
||||||
MaxChunkPerDoc int `json:"max_chunk_per_doc,omitempty"`
|
MaxChunkPerDoc int `json:"max_chunk_per_doc,omitempty"`
|
||||||
OverLapTokens int `json:"overlap_tokens,omitempty"`
|
OverLapTokens int `json:"overlap_tokens,omitempty"`
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package jina
|
|||||||
var ModelList = []string{
|
var ModelList = []string{
|
||||||
"jina-clip-v1",
|
"jina-clip-v1",
|
||||||
"jina-reranker-v2-base-multilingual",
|
"jina-reranker-v2-base-multilingual",
|
||||||
|
"jina-reranker-m0",
|
||||||
}
|
}
|
||||||
|
|
||||||
var ChannelName = "jina"
|
var ChannelName = "jina"
|
||||||
|
|||||||
@@ -78,12 +78,15 @@ func RerankHelper(c *gin.Context, relayMode int) (openaiErr *dto.OpenAIErrorWith
|
|||||||
return service.OpenAIErrorWrapperLocal(err, "json_marshal_failed", http.StatusInternalServerError)
|
return service.OpenAIErrorWrapperLocal(err, "json_marshal_failed", http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
requestBody := bytes.NewBuffer(jsonData)
|
requestBody := bytes.NewBuffer(jsonData)
|
||||||
statusCodeMappingStr := c.GetString("status_code_mapping")
|
if common.DebugEnabled {
|
||||||
|
println(fmt.Sprintf("Rerank request body: %s", requestBody.String()))
|
||||||
|
}
|
||||||
resp, err := adaptor.DoRequest(c, relayInfo, requestBody)
|
resp, err := adaptor.DoRequest(c, relayInfo, requestBody)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return service.OpenAIErrorWrapper(err, "do_request_failed", http.StatusInternalServerError)
|
return service.OpenAIErrorWrapper(err, "do_request_failed", http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
statusCodeMappingStr := c.GetString("status_code_mapping")
|
||||||
var httpResp *http.Response
|
var httpResp *http.Response
|
||||||
if resp != nil {
|
if resp != nil {
|
||||||
httpResp = resp.(*http.Response)
|
httpResp = resp.(*http.Response)
|
||||||
|
|||||||
Reference in New Issue
Block a user