25 lines
859 B
Python
25 lines
859 B
Python
from pydantic import BaseModel, Field, model_validator, PrivateAttr
|
|
from typing import Literal, TypeAlias, get_args, List, Generator, Iterator, AsyncGenerator, TYPE_CHECKING, Optional, ClassVar
|
|
from typing_extensions import Annotated
|
|
from abc import ABC, abstractmethod
|
|
from typing_extensions import Annotated
|
|
import logging
|
|
from .base import Agent, registry
|
|
from .. conversation import Conversation
|
|
from .. message import Message
|
|
|
|
class FactCheck(Agent):
|
|
agent_type: Literal["fact_check"] = "fact_check"
|
|
_agent_type: ClassVar[str] = agent_type # Add this for registration
|
|
|
|
facts: str = ""
|
|
|
|
@model_validator(mode="after")
|
|
def validate_facts(self):
|
|
if not self.facts.strip():
|
|
raise ValueError("Facts cannot be empty")
|
|
return self
|
|
|
|
# Register the base agent
|
|
registry.register(FactCheck._agent_type, FactCheck)
|