classifier
Classifier backed by Jev, TypeSafe’s hosted classification model.
JevClassifier turns each question into a request and each reply
into a result, through a JevClient.
- pipecat.classifiers.jev.classifier.JEV_MAX_CHOICE_OPTIONS = 255
The most options Jev takes in one choice question.
- class pipecat.classifiers.jev.classifier.JevClassifier(*, api_key: str | None = None, client: JevClient | None = None, model: str = 'jev-1.13.0', base_url: str = 'https://api.typesafe.ai', timeout: float = 10.0, **kwargs)[source]
Bases:
BaseClassifierAnswers questions by asking Jev.
Jev’s probabilities are calibrated. Build one with an API key to get a client of its own, or pass a
JevClientto share one between several classifiers. A client the classifier created is closed incleanup(); a shared one is left to whoever made it.Example:
client = JevClient(api_key=os.getenv("TYPESAFE_API_KEY")) turn_classifier = JevClassifier(client=client) voicemail_classifier = JevClassifier(client=client)
- __init__(*, api_key: str | None = None, client: JevClient | None = None, model: str = 'jev-1.13.0', base_url: str = 'https://api.typesafe.ai', timeout: float = 10.0, **kwargs)[source]
Initialize the classifier.
- Parameters:
api_key – Jev API key, when the classifier should have a client of its own.
client – A client to share. One of
api_keyandclientis required.model – The Jev model a client of its own asks.
base_url – Where a client of its own sends its questions.
timeout – Seconds a client of its own waits for an answer.
**kwargs – Additional arguments passed to the parent class.
- async setup(task_manager: BaseTaskManager)[source]
Open the connection to Jev ahead of the first question.
A connection that cannot be opened now is only a warning: the first question opens it itself.
- Parameters:
task_manager – The task manager of the owner.