Add a default "query" prompt for `model.encode_query`
Hello!
Pull Request overview
- Add a default "query" prompt for
model.encode_query
Details
Since the Sentence Transformers v5.0.0 release, I've added encode_document and encode_query helper methods alongside encode, which are essentially shorthands for model.encode(..., prompt_name="query") (or "document") with a bit of checking if these prompts exist, so that third party libraries like LangChain or PydanticAI can rely on these methods directly for their retrieval-related inference. Because of that, I think it might be useful to additionally add a "query" prompt that just mirrors the "web_search_query". We don't have to update the README, but with this PR, model.encode_query(...) immediately uses a generic retrieval query instead of no query. It's still always recommended to use a custom prompt if you're not working with simple web search queries, at which point users can use e.g. model.encode_query(..., prompt="...") or model.encode(..., prompt="...") (they'll be equivalent).
Overall, this is a very minor change as you've done great with the integration already, nicely done!
See also https://huggingface.co/microsoft/harrier-oss-v1-270m/discussions/1 as this PR mirrors it.
- Tom Aarsen