Skip to content

[Usage]: How to use LLM.classify(...) through OpenAI endpoint? #17415

@ccdv-ai

Description

@ccdv-ai

Your current environment

vLLM 0.8.5

How would you like to use vllm

I need to run a classification model, extract probs and serve it through OpenAI API.
I know that it is possible to do offline:

from vllm import LLM

llm = LLM(model="jason9693/Qwen2.5-1.5B-apeach", task="classify")
(output,) = llm.classify("Hello, my name is")

probs = output.outputs.probs
print(f"Class Probabilities: {probs!r} (size={len(probs)})")

My task is very similar to a reranker (score) task but with multiple classes (query + document).
How do you do you this using OpenAI?

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    usageHow to use vllm

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions