Missing focus mode or query
Closed this issue · 3 comments
400: If the request is malformed or missing required fields (e.g., no focus mode or query).
I am using the Request Body Structure test case provided in the SEARCH.md file to call search API, but I keep getting this error message {"message":"Missing focus mode or query"}
. I double check the structure, and focusMode
and query
are not missing.
I also have this problem. Could you tell me how you solved it?
Okay, I found the reason.I use the following code to call the API, but get an error.
import requests
url = "http://localhost:3001/api/search"
data = {
"chatModel": {"provider": "openai", "model": "gpt-4o-mini"},
"embeddingModel": {"provider": "openai", "model": "text-embedding-3-large"},
"optimizationMode": "speed",
"focusMode": "webSearch",
"query": "你好"
}
response = requests.post(url, data=data)
Finally, I found that changing response = requests.post(url, data=data)
to response = requests.post(url, json=data)
would work.
Okay, I found the reason.I use the following code to call the API, but get an error.
import requests url = "http://localhost:3001/api/search" data = { "chatModel": {"provider": "openai", "model": "gpt-4o-mini"}, "embeddingModel": {"provider": "openai", "model": "text-embedding-3-large"}, "optimizationMode": "speed", "focusMode": "webSearch", "query": "你好" } response = requests.post(url, data=data)Finally, I found that changing
response = requests.post(url, data=data)
toresponse = requests.post(url, json=data)
would work.
Hi, glad to hear that! And FYI, my solution is that I found in /src/config.ts, line 34, the getPort
does not specify the environment port number provided by GCP cloud run. Thus, I changed it to export const getPort = () => process.env.PORT || loadConfig().GENERAL.PORT || 8080;
, and it works.