From f2bf62e2844b2b417d712b1c196a46a526a542af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Boschi?= Date: Mon, 1 Jul 2024 23:42:14 +0200 Subject: [PATCH] ci: fix mypy checks (#2431) * ci: fix mypy * ci: fix mypy * ci: fix mypy * run fe checks * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Gabriel Luiz Freitas Almeida Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .github/workflows/typescript_test.yml | 1 + .../langchain_utilities/FirecrawlCrawlApi.py | 1 - .../langchain_utilities/FirecrawlScrapeApi.py | 2 +- .../components/langchain_utilities/__init__.py | 0 .../base/langflow/components/vectorstores/Cassandra.py | 10 ++++------ 5 files changed, 6 insertions(+), 8 deletions(-) create mode 100644 src/backend/base/langflow/components/langchain_utilities/__init__.py diff --git a/.github/workflows/typescript_test.yml b/.github/workflows/typescript_test.yml index 07f86602a..116212200 100644 --- a/.github/workflows/typescript_test.yml +++ b/.github/workflows/typescript_test.yml @@ -10,6 +10,7 @@ on: pull_request: merge_group: + env: POETRY_VERSION: "1.8.3" NODE_VERSION: "21" diff --git a/src/backend/base/langflow/components/langchain_utilities/FirecrawlCrawlApi.py b/src/backend/base/langflow/components/langchain_utilities/FirecrawlCrawlApi.py index ea5a3918e..7b48677b0 100644 --- a/src/backend/base/langflow/components/langchain_utilities/FirecrawlCrawlApi.py +++ b/src/backend/base/langflow/components/langchain_utilities/FirecrawlCrawlApi.py @@ -59,7 +59,6 @@ class FirecrawlCrawlApi(CustomComponent): raise ImportError( "Could not import firecrawl integration package. " "Please install it with `pip install firecrawl-py`." ) - if crawlerOptions: crawler_options_dict = crawlerOptions.__dict__["data"]["text"] else: diff --git a/src/backend/base/langflow/components/langchain_utilities/FirecrawlScrapeApi.py b/src/backend/base/langflow/components/langchain_utilities/FirecrawlScrapeApi.py index a2bc6829b..ae5fbe784 100644 --- a/src/backend/base/langflow/components/langchain_utilities/FirecrawlScrapeApi.py +++ b/src/backend/base/langflow/components/langchain_utilities/FirecrawlScrapeApi.py @@ -43,7 +43,7 @@ class FirecrawlScrapeApi(CustomComponent): self, api_key: str, url: str, - timeout: Optional[int] = 10000, + timeout: int = 10000, pageOptions: Optional[Data] = None, extractorOptions: Optional[Data] = None, ) -> Data: diff --git a/src/backend/base/langflow/components/langchain_utilities/__init__.py b/src/backend/base/langflow/components/langchain_utilities/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/backend/base/langflow/components/vectorstores/Cassandra.py b/src/backend/base/langflow/components/vectorstores/Cassandra.py index ee6b83972..053e06ec0 100644 --- a/src/backend/base/langflow/components/vectorstores/Cassandra.py +++ b/src/backend/base/langflow/components/vectorstores/Cassandra.py @@ -1,4 +1,4 @@ -from typing import List +from typing import List, Optional from langchain_community.vectorstores import Cassandra @@ -138,9 +138,7 @@ class CassandraVectorStoreComponent(LCVectorStoreComponent): password=self.token, cluster_kwargs=self.cluster_kwargs, ) - - if not self.ttl_seconds: # type: ignore - self.ttl_seconds = None + ttl_seconds: Optional[int] = self.ttl_seconds documents = [] @@ -156,7 +154,7 @@ class CassandraVectorStoreComponent(LCVectorStoreComponent): embedding=self.embedding, table_name=self.table_name, keyspace=self.keyspace, - ttl_seconds=self.ttl_seconds, + ttl_seconds=ttl_seconds, batch_size=self.batch_size, body_index_options=self.body_index_options, ) @@ -166,7 +164,7 @@ class CassandraVectorStoreComponent(LCVectorStoreComponent): embedding=self.embedding, table_name=self.table_name, keyspace=self.keyspace, - ttl_seconds=self.ttl_seconds, + ttl_seconds=ttl_seconds, body_index_options=self.body_index_options, setup_mode=self.setup_mode, )