Skip to content

Allow to pass SentenceTransformers task and prompt #607

Description

@dantetemplar

Feature request

I want to use https://huggingface.co/jinaai/jina-embeddings-v3 with via infinity server and client, but I cant find an example to run it with task as in SentenceTransformers:

from sentence_transformers import SentenceTransformer

model = SentenceTransformer("jinaai/jina-embeddings-v3", trust_remote_code=True)

task = "retrieval.query"
embeddings = model.encode(
    ["What is the weather like in Berlin today?"],
    task=task,
    prompt_name=task,
)

Motivation

It will not be practical to use infinity for jinaai embeddings (and some others) without this functionality. Actually, we can prefix our input text with relevant prompt, but we should not.

Your contribution

I may be the first who will test and give feedback. If you hint me a contribution start point, I can try to cook a PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions