mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-10-17 04:37:00 +00:00
* feat(classifier): add optional Jev component and CLI demo * fix(classifier): expose Jev demo through inherited default service
25 lines
741 B
Python
25 lines
741 B
Python
"""Lifecycle-managed wrappers for AgentScope classifier models."""
|
|
|
|
from abc import abstractmethod
|
|
from collections.abc import Mapping
|
|
from typing import TYPE_CHECKING, Any
|
|
|
|
from ..base_component import BaseComponent
|
|
from ...enumeration import ComponentEnum
|
|
|
|
if TYPE_CHECKING:
|
|
from agentscope.classifier import ClassifierResponse
|
|
|
|
|
|
class BaseAsClassifier(BaseComponent):
|
|
"""Classify shared text or JSON state with named probabilistic questions."""
|
|
|
|
component_type = ComponentEnum.AS_CLASSIFIER
|
|
|
|
@abstractmethod
|
|
async def __call__(
|
|
self,
|
|
state: str | dict,
|
|
questions: Mapping[str, Any],
|
|
) -> "ClassifierResponse":
|
|
"""Return typed answers; concrete components own provider resources."""
|