Prompt usage

#1
by tomaarsen - opened

Hello!

I believe the query and document prompts from the config_sentence_transformers.json aren't applied automatically with model.encode, only with model.encode_query (uses prompt "query") and model.encode_document (uses prompt "document").

So then

from sentence_transformers import SentenceTransformer

model = SentenceTransformer("jjp97/laal-embedding-v1")

q_emb = model.encode("ν™”μž¬ μ‹œ λŒ€ν”Ό 방법")
p_emb = model.encode("ν™”μž¬κ°€ λ°œμƒν•˜λ©΄ μ¦‰μ‹œ 119에 μ‹ κ³ ν•˜κ³  μ•ˆμ „ν•œ 경둜둜 λŒ€ν”Όν•΄μ•Ό ν•œλ‹€.")

would not use any instructions.

API Documentation: https://sbert.net/docs/package_reference/sentence_transformer/SentenceTransformer.html#sentence_transformers.SentenceTransformer.encode_query

  • Tom Aarsen

Hi Tom, thanks for the helpful feedback!

I've made the following updates:

  • Changed the prompt key from "passage" to "document" in config_sentence_transformers.json
  • Updated the README examples to use encode_query() and encode_document() instead of encode()

Appreciate you catching this!

Very nice! That's exactly how I would have tackled it as well.
Congratulations on the release!

  • Tom Aarsen
tomaarsen changed discussion status to closed

Sign up or log in to comment