From e5bc9aca3fab0dad52aefda09e12fedbb98bd086 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 19 Feb 2024 13:27:21 -0300 Subject: [PATCH 1/5] Update version to 0.6.7a3 in pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 90bcf3af9..37a9e82a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langflow" -version = "0.6.7a2" +version = "0.6.7a3" description = "A Python package with a built-in web application" authors = ["Logspace "] maintainers = [ From abd9b8e3a9fca2cf74a323b19ebd6337a315da94 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 19 Feb 2024 13:28:16 -0300 Subject: [PATCH 2/5] Fix formatting and import issues --- src/backend/langflow/api/v1/login.py | 4 +--- src/backend/langflow/components/llms/ChatLiteLLM.py | 11 +++++------ .../interface/custom/custom_component/component.py | 4 +--- src/backend/langflow/services/settings/auth.py | 4 +--- src/frontend/src/stores/typesStore.ts | 2 +- 5 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/backend/langflow/api/v1/login.py b/src/backend/langflow/api/v1/login.py index 1bd3dd55b..e793fe3f7 100644 --- a/src/backend/langflow/api/v1/login.py +++ b/src/backend/langflow/api/v1/login.py @@ -85,9 +85,7 @@ async def auto_login( @router.post("/refresh") -async def refresh_token( - request: Request, response: Response, settings_service=Depends(get_settings_service) -): +async def refresh_token(request: Request, response: Response, settings_service=Depends(get_settings_service)): auth_settings = settings_service.auth_settings token = request.cookies.get("refresh_token_lf") diff --git a/src/backend/langflow/components/llms/ChatLiteLLM.py b/src/backend/langflow/components/llms/ChatLiteLLM.py index 59507733f..2d2113163 100644 --- a/src/backend/langflow/components/llms/ChatLiteLLM.py +++ b/src/backend/langflow/components/llms/ChatLiteLLM.py @@ -1,4 +1,3 @@ -from dataclasses import Field from langflow import CustomComponent from typing import Optional, Union, Callable, Any, Dict from langflow.field_typing import BaseLanguageModel @@ -109,19 +108,19 @@ class ChatLiteLLMComponent(CustomComponent): ) -> Union[BaseLanguageModel, Callable]: try: import litellm - litellm.drop_params=True - litellm.set_verbose=verbose + + litellm.drop_params = True + litellm.set_verbose = verbose except ImportError: raise ChatLiteLLMException( - "Could not import litellm python package. " - "Please install it with `pip install litellm`" + "Could not import litellm python package. " "Please install it with `pip install litellm`" ) if api_key: if "perplexity" in model: os.environ["PERPLEXITYAI_API_KEY"] = api_key elif "replicate" in model: os.environ["REPLICATE_API_KEY"] = api_key - + LLM = ChatLiteLLM( model=model, client=None, diff --git a/src/backend/langflow/interface/custom/custom_component/component.py b/src/backend/langflow/interface/custom/custom_component/component.py index 4fe5573ca..9053dcb0f 100644 --- a/src/backend/langflow/interface/custom/custom_component/component.py +++ b/src/backend/langflow/interface/custom/custom_component/component.py @@ -21,9 +21,7 @@ class ComponentFunctionEntrypointNameNullError(HTTPException): class Component: ERROR_CODE_NULL: ClassVar[str] = "Python code must be provided." - ERROR_FUNCTION_ENTRYPOINT_NAME_NULL: ClassVar[str] = ( - "The name of the entrypoint function must be provided." - ) + ERROR_FUNCTION_ENTRYPOINT_NAME_NULL: ClassVar[str] = "The name of the entrypoint function must be provided." code: Optional[str] = None _function_entrypoint_name: str = "build" diff --git a/src/backend/langflow/services/settings/auth.py b/src/backend/langflow/services/settings/auth.py index 258ff5f63..8463d0781 100644 --- a/src/backend/langflow/services/settings/auth.py +++ b/src/backend/langflow/services/settings/auth.py @@ -26,9 +26,7 @@ class AuthSettings(BaseSettings): REFRESH_TOKEN_EXPIRE_MINUTES: int = 60 * 12 * 7 # API Key to execute /process endpoint - API_KEY_SECRET_KEY: Optional[str] = ( - "b82818e0ad4ff76615c5721ee21004b07d84cd9b87ba4d9cb42374da134b841a" - ) + API_KEY_SECRET_KEY: Optional[str] = "b82818e0ad4ff76615c5721ee21004b07d84cd9b87ba4d9cb42374da134b841a" API_KEY_ALGORITHM: str = "HS256" API_V1_STR: str = "/api/v1" diff --git a/src/frontend/src/stores/typesStore.ts b/src/frontend/src/stores/typesStore.ts index a04b4c11f..1a0ae3634 100644 --- a/src/frontend/src/stores/typesStore.ts +++ b/src/frontend/src/stores/typesStore.ts @@ -23,7 +23,7 @@ export const useTypesStore = create((set, get) => ({ data: { ...old.data, ...data }, templates: templatesGenerator(data), })); - setLoading(false) + setLoading(false); resolve(); }) .catch((error) => { From 451f176fb4ffe7a0a475d64703bdcf0010406b12 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 19 Feb 2024 13:29:32 -0300 Subject: [PATCH 3/5] Import litellm package and update ChatLiteLLMComponent class --- src/backend/langflow/components/llms/ChatLiteLLM.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/backend/langflow/components/llms/ChatLiteLLM.py b/src/backend/langflow/components/llms/ChatLiteLLM.py index 2d2113163..f2b7f7dc3 100644 --- a/src/backend/langflow/components/llms/ChatLiteLLM.py +++ b/src/backend/langflow/components/llms/ChatLiteLLM.py @@ -1,8 +1,9 @@ -from langflow import CustomComponent -from typing import Optional, Union, Callable, Any, Dict -from langflow.field_typing import BaseLanguageModel -from langchain_community.chat_models.litellm import ChatLiteLLM, ChatLiteLLMException import os +from typing import Any, Callable, Dict, Optional, Union + +from langchain_community.chat_models.litellm import ChatLiteLLM, ChatLiteLLMException +from langflow import CustomComponent +from langflow.field_typing import BaseLanguageModel class ChatLiteLLMComponent(CustomComponent): @@ -107,7 +108,7 @@ class ChatLiteLLMComponent(CustomComponent): verbose: bool = False, ) -> Union[BaseLanguageModel, Callable]: try: - import litellm + import litellm # type: ignore litellm.drop_params = True litellm.set_verbose = verbose From d2c1d86f678eef687d7f78b816b64f43ddd4efc7 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 19 Feb 2024 13:36:38 -0300 Subject: [PATCH 4/5] Update login.py with new auth settings --- src/backend/langflow/api/v1/login.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/langflow/api/v1/login.py b/src/backend/langflow/api/v1/login.py index e793fe3f7..2055c18c2 100644 --- a/src/backend/langflow/api/v1/login.py +++ b/src/backend/langflow/api/v1/login.py @@ -37,7 +37,7 @@ async def login_to_get_access_token( response.set_cookie( "refresh_token_lf", tokens["refresh_token"], - httponly=auth_settings.REFRESH_TOKEN_HTTPONLY, + httponly=auth_settings.REFRESH_HTTPONLY, samesite=auth_settings.REFRESH_SAME_SITE, secure=auth_settings.REFRESH_SECURE, ) From b95169c1e908f9059dce4d348aea3b5507d05063 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 19 Feb 2024 13:37:06 -0300 Subject: [PATCH 5/5] Update version to 0.6.7a4 in pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 37a9e82a8..af8ec268f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langflow" -version = "0.6.7a3" +version = "0.6.7a4" description = "A Python package with a built-in web application" authors = ["Logspace "] maintainers = [