From d5d6f7be57753acac3da6b2d9fb133af25ec3fd2 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 22 Jun 2023 19:04:19 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20refactor(schemas.py):=20rename?= =?UTF-8?q?=20PredictRequest=20to=20InputRequest=20and=20remove=20message?= =?UTF-8?q?=20field,=20add=20TweaksRequest=20and=20UpdateTemplateRequest?= =?UTF-8?q?=20=E2=9C=A8=20feat(schemas.py):=20add=20ProcessResponse=20sche?= =?UTF-8?q?ma=20to=20represent=20the=20response=20of=20the=20process=20end?= =?UTF-8?q?point=20The=20PredictRequest=20schema=20has=20been=20renamed=20?= =?UTF-8?q?to=20InputRequest=20to=20better=20reflect=20its=20purpose.=20Th?= =?UTF-8?q?e=20message=20field=20has=20been=20removed=20as=20it=20is=20not?= =?UTF-8?q?=20needed.=20TweaksRequest=20has=20been=20added=20to=20represen?= =?UTF-8?q?t=20the=20request=20body=20for=20the=20tweaks=20endpoint.=20Upd?= =?UTF-8?q?ateTemplateRequest=20has=20been=20added=20to=20represent=20the?= =?UTF-8?q?=20request=20body=20for=20updating=20a=20template.=20ProcessRes?= =?UTF-8?q?ponse=20has=20been=20added=20to=20represent=20the=20response=20?= =?UTF-8?q?of=20the=20process=20endpoint,=20which=20returns=20a=20dictiona?= =?UTF-8?q?ry=20as=20the=20result.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/api/v1/schemas.py | 58 ++++++++++++++++---------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/src/backend/langflow/api/v1/schemas.py b/src/backend/langflow/api/v1/schemas.py index 747057a27..8e817204e 100644 --- a/src/backend/langflow/api/v1/schemas.py +++ b/src/backend/langflow/api/v1/schemas.py @@ -20,34 +20,48 @@ class ExportedFlow(BaseModel): data: GraphData -class PredictRequest(BaseModel): - """Predict request schema.""" +class InputRequest(BaseModel): + input: dict - message: str + +class TweaksRequest(BaseModel): tweaks: Optional[Dict[str, Dict[str, str]]] = Field(default_factory=dict) - class Config: - schema_extra = { - "example": { - "message": "Hello, how are you?", - "tweaks": { - "dndnode_986363f0-4677-4035-9f38-74b94af5dd78": { - "name": "A tool name", - "description": "A tool description", - }, - "dndnode_986363f0-4677-4035-9f38-74b94af57378": { - "template": "A {template}", - }, - }, - } - } + +# class PredictRequest(BaseModel): +# """Predict request schema.""" + +# input: dict +# tweaks: Optional[Dict[str, Dict[str, str]]] = Field(default_factory=dict) + +# class Config: +# schema_extra = { +# "example": { +# "input": { +# "question": "A question to process", +# "chat_history": ["A chat history", "Another chat history"], +# }, +# "tweaks": { +# "Tool-Aclk2": { +# "name": "A tool name", +# "description": "A tool description", +# }, +# "NodeName-2kclS": { +# "template": "A {template}", +# }, +# }, +# } +# } -class PredictResponse(BaseModel): - """Predict response schema.""" +class UpdateTemplateRequest(BaseModel): + template: dict - result: str - intermediate_steps: str = "" + +class ProcessResponse(BaseModel): + """Process response schema.""" + + result: dict class ChatMessage(BaseModel):