- Introduction of dynamic Processors - Introduction of caching system - Introduction of a better template manager - Adaptation of ModelVariables to support dynamic Processors / Retrievers / Specialists - Start adaptation of chat client
24 lines
785 B
Python
24 lines
785 B
Python
# Output Schema Management - common/langchain/outputs/base.py
|
|
from typing import Dict, Type, Any
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class BaseSpecialistOutput(BaseModel):
|
|
"""Base class for all specialist outputs"""
|
|
pass
|
|
|
|
|
|
class OutputRegistry:
|
|
"""Registry for specialist output schemas"""
|
|
_schemas: Dict[str, Type[BaseSpecialistOutput]] = {}
|
|
|
|
@classmethod
|
|
def register(cls, specialist_type: str, schema_class: Type[BaseSpecialistOutput]):
|
|
cls._schemas[specialist_type] = schema_class
|
|
|
|
@classmethod
|
|
def get_schema(cls, specialist_type: str) -> Type[BaseSpecialistOutput]:
|
|
if specialist_type not in cls._schemas:
|
|
raise ValueError(f"No output schema registered for {specialist_type}")
|
|
return cls._schemas[specialist_type]
|