diff --git a/src/backend/langflow/api/v1/chat.py b/src/backend/langflow/api/v1/chat.py index 59fe7ac9e..b9b703ad2 100644 --- a/src/backend/langflow/api/v1/chat.py +++ b/src/backend/langflow/api/v1/chat.py @@ -3,7 +3,7 @@ import time from fastapi import APIRouter, Depends, HTTPException, Query, WebSocket, WebSocketException, status,Body from fastapi.responses import StreamingResponse from langflow.api.utils import build_input_keys_response, format_elapsed_time -from langflow.api.v1.schemas import BuildStatus, BuiltResponse, InitResponse, ResultDict, StreamData, VerticesOrderResponse +from langflow.api.v1.schemas import BuildStatus, BuiltResponse, InitResponse, ResultDict, StreamData, VertexBuildResponse, VerticesOrderResponse from langflow.graph.vertex.base import StatelessVertex from langflow.processing.process import process_tweaks_on_graph from langflow.services.database.models.flow.flow import Flow diff --git a/src/backend/langflow/api/v1/schemas.py b/src/backend/langflow/api/v1/schemas.py index 2ee673fae..3d7fa1076 100644 --- a/src/backend/langflow/api/v1/schemas.py +++ b/src/backend/langflow/api/v1/schemas.py @@ -1,3 +1,4 @@ +from datetime import datetime from enum import Enum from pathlib import Path from typing import Any, Dict, List, Optional, Union @@ -221,3 +222,17 @@ class ResultDict(BaseModel): results: Optional[Any] = Field(default_factory=dict) artifacts: Optional[Any] = Field(default_factory=dict) """Outputs of the vertex build process.""" + +class VertexBuildResponse(BaseModel): + id: str + valid: bool + params: Optional[str] + """JSON string of the params.""" + data: ResultDict + """Mapping of vertex ids to result dict containing the param name and result value.""" + timestamp: Optional[datetime] = Field(default_factory=datetime.utcnow) + """Timestamp of the build.""" + + +class VerticesBuiltResponse(BaseModel): + vertices: List[VertexBuildResponse] \ No newline at end of file