Semantic Search API

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

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

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.

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)

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?

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

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:

1 Like