refactor: Add StreamURL and Log types to schema.py and update ChatOutputResponse in utils/schemas.py
This commit is contained in:
parent
971f0cff89
commit
f85dfa31e8
2 changed files with 12 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue