Skip to content

Commit

Permalink
optimize ai-search references (alibaba#1859)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlanni authored Mar 7, 2025
1 parent ab419ef commit 9e6bd6d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions plugins/wasm-go/extensions/ai-search/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func onHttpRequestBody(ctx wrapper.HttpContext, config Config, body []byte, log
startTime := time.Now()
rewritePrompt := strings.Replace(searchRewrite.prompt, "{question}", query, 1)
rewriteBody, _ := sjson.SetBytes([]byte(fmt.Sprintf(
`{"stream":false,"max_tokens":100,"model":"%s","messages":[{"role":"user","content":""}]}`,
`{"stream":false,"max_tokens":4096,"model":"%s","messages":[{"role":"user","content":""}]}`,
searchRewrite.modelName)), "messages.0.content", rewritePrompt)
err := searchRewrite.client.Post(searchRewrite.url,
[][2]string{
Expand Down Expand Up @@ -443,7 +443,7 @@ func executeSearch(ctx wrapper.HttpContext, config Config, queryIndex int, body
log.Debugf("modifeid body:%s", modifiedBody)
proxywasm.ReplaceHttpRequestBody(modifiedBody)
if config.needReference {
ctx.SetContext("References", strings.Join(formattedReferences, "\n"))
ctx.SetContext("References", strings.Join(formattedReferences, "\n\n"))
}
}
proxywasm.ResumeHttpRequest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def main():
}
data = {
"model": "deepseek-v3",
"max_tokens": 100,
"max_tokens": 4096,
"messages": [
{
"role": "user",
Expand Down

0 comments on commit 9e6bd6d

Please sign in to comment.