MarcP
(MarcP)
December 17, 2024, 5:42am
1
How can we access semantic search through the API?
search.json does not seem to have semantic (even though, I remember they did at some point?)
discourse-ai/embeddings/semantic-search?q=
is called after search.json, good results are correct when I open the URL including query I just did.
But if I discourse-ai/embeddings/semantic-search?q=differentQuery
directly the results do not make sense at all.
What do I miss here?
1 Like
sam
(Sam Saffron)
December 17, 2024, 6:31am
2
You can do a pure embeddings search using:
https://DOMAIN/discourse-ai/embeddings/semantic-search.json?hyde=false&q=....
That disables the hyde portion so it is rate limited a lot less aggressively.
Additionally ideally use an api key for the call which relaxes a lot of the limits.
3 Likes
MarcP
(MarcP)
December 17, 2024, 6:41am
3
Thanks, this works!
I whitelisted my IP’s from ratelimiting in app.yml, I think I read somewhere that this was also a solution to bypass ratelimits if I’m correct.
sam
(Sam Saffron)
December 17, 2024, 6:43am
4
Not really, search limits are generally implemented in the app, skipping hyde is critical here:
You only get 4 hyde queries a minute (where we expand the search term for you), you get up to 100 non hyde ones (provided other rate limits are relaxed)
MarcP
(MarcP)
December 17, 2024, 6:46am
5
I will pass this param for sure.
My question was actually: passing API key is effectively the same as excluding an IP from ratelimits? Or did you mean hyde=false only works IF an API key is passed?
sam
(Sam Saffron)
December 17, 2024, 6:49am
6
both are unrelated. api has different knobs for rate limits, you can relax it more than other parts of the app in global settings
1 Like
MarcP
(MarcP)
December 17, 2024, 6:59am
7
Got it, the app.yml flag I was talking about seems to lift nginx ratelimits (DISCOURSE_MAX_REQS_PER_IP_EXCEPTIONS
)
The topic below made it a bit more clear to me:
Discourse ships with 3 different global rate limits that can be configured by site admins.
Global per-ip rate limits
These limits apply to every unique IP address that hits the Discourse application. (files that are served directly from the filesystem or the CDN are excluded)
By default this rate limit is enabled, you may disable it or set it to a reporting mode.
DISCOURSE_MAX_REQS_PER_IP_MODE : default block, this rate limit applies out of the box. (other options are warn, warn+block, and n…
1 Like