refactor: Add StreamURL and Log types to schema.py and update ChatOutputResponse in utils/schemas.py

This commit is contained in:
ogabrielluiz 2024-06-05 11:18:36 -03:00
commit f85dfa31e8
2 changed files with 12 additions and 0 deletions

View file

@ -5,6 +5,7 @@ from typing import Literal, Optional, cast
from langchain_core.documents import Document
from langchain_core.messages import AIMessage, BaseMessage, HumanMessage
from pydantic import BaseModel, model_validator
from typing_extensions import TypedDict
class Record(BaseModel):
@ -177,3 +178,13 @@ INPUT_FIELD_NAME = "input_value"
InputType = Literal["chat", "text", "any"]
OutputType = Literal["chat", "text", "any", "debug"]
class StreamURL(TypedDict):
location: str
class Log(TypedDict):
message: str | dict | StreamURL
type: str
type: str

View file

@ -26,6 +26,7 @@ class ChatOutputResponse(BaseModel):
stream_url: Optional[str] = None
component_id: Optional[str] = None
files: List[File] = []
type: str
@field_validator("files", mode="before")
def validate_files(cls, files):