From 45552803d128239f889c0372b34dd8db389158e9 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 26 Apr 2024 10:47:30 -0300 Subject: [PATCH] Update type annotations in TweaksRequest and Tweaks classes (#1779) * Update type annotations in TweaksRequest and Tweaks classes * Merge remote-tracking branch 'origin/dev' into 1776_fix_tweaks --- src/backend/base/langflow/api/v1/schemas.py | 2 +- src/backend/base/langflow/schema/graph.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/backend/base/langflow/api/v1/schemas.py b/src/backend/base/langflow/api/v1/schemas.py index f5d0b97d1..0cc6274c2 100644 --- a/src/backend/base/langflow/api/v1/schemas.py +++ b/src/backend/base/langflow/api/v1/schemas.py @@ -26,7 +26,7 @@ class BuildStatus(Enum): class TweaksRequest(BaseModel): - tweaks: Optional[Dict[str, Dict[str, str]]] = Field(default_factory=dict) + tweaks: Optional[Dict[str, Dict[str, Any]]] = Field(default_factory=dict) class UpdateTemplateRequest(BaseModel): diff --git a/src/backend/base/langflow/schema/graph.py b/src/backend/base/langflow/schema/graph.py index a515b3dd2..6b6cca66a 100644 --- a/src/backend/base/langflow/schema/graph.py +++ b/src/backend/base/langflow/schema/graph.py @@ -1,7 +1,8 @@ -from typing import List, Optional, Union +from typing import Any, List, Optional, Union + +from pydantic import BaseModel, Field, RootModel from langflow.schema.schema import InputType -from pydantic import BaseModel, Field, RootModel class InputValue(BaseModel): @@ -14,7 +15,7 @@ class InputValue(BaseModel): class Tweaks(RootModel): - root: dict[str, Union[str, dict[str, str]]] = Field( + root: dict[str, Union[str, dict[str, Any]]] = Field( description="A dictionary of tweaks to adjust the flow's execution. Allows customizing flow behavior dynamically. All tweaks are overridden by the input values.", ) model_config = {