Skip to content

Allow to pass SentenceTransformers task and prompt #607

@dantetemplar

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.

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