Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
12977d9a
authored
Jul 03, 2025
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat: make TopN field in RerankRequest optional in JSON serialization
parent
13eb2ec1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
2 deletions
+6
-2
dto/rerank.go
+1
-1
relay/channel/jina/constant.go
+1
-0
relay/rerank_handler.go
+4
-1
No files found.
dto/rerank.go
View file @
12977d9a
...
@@ -4,7 +4,7 @@ type RerankRequest struct {
...
@@ -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"`
...
...
relay/channel/jina/constant.go
View file @
12977d9a
...
@@ -3,6 +3,7 @@ package jina
...
@@ -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"
relay/rerank_handler.go
View file @
12977d9a
...
@@ -78,12 +78,15 @@ func RerankHelper(c *gin.Context, relayMode int) (openaiErr *dto.OpenAIErrorWith
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment