Update setup_mode to "Sync" in AstraDBVectorStoreComponent (#1670)

* Update setup_mode to "Sync" in AstraDBVectorStoreComponent

* Fix search_kwargs default value in PineconeSearch and QdrantSearch components
This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-04-10 21:09:26 -03:00 committed by GitHub
commit 3478d4c05e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 21 additions and 10 deletions

View file

@ -71,6 +71,8 @@ class PineconeSearchComponent(PineconeComponent, LCVectorStoreComponent):
)
if not vector_store:
raise ValueError("Failed to load the Pinecone index.")
if search_kwargs is None:
search_kwargs = {}
return self.search_with_vector_store(
vector_store=vector_store,

View file

@ -86,12 +86,13 @@ class QdrantSearchComponent(QdrantComponent, LCVectorStoreComponent):
port=port,
prefer_grpc=prefer_grpc,
prefix=prefix,
search_kwargs=search_kwargs,
timeout=timeout,
url=url,
)
if not vector_store:
raise ValueError("Failed to load the Qdrant index.")
if search_kwargs is None:
search_kwargs = {}
return self.search_with_vector_store(
vector_store=vector_store,

View file

@ -105,7 +105,7 @@ class AstraDBVectorStoreComponent(CustomComponent):
bulk_insert_batch_concurrency: Optional[int] = None,
bulk_insert_overwrite_concurrency: Optional[int] = None,
bulk_delete_concurrency: Optional[int] = None,
setup_mode: str = "Async",
setup_mode: str = "Sync",
pre_delete_collection: bool = False,
metadata_indexing_include: Optional[List[str]] = None,
metadata_indexing_exclude: Optional[List[str]] = None,

View file

@ -1,7 +1,7 @@
from typing import List, Optional
from langchain_community.vectorstores.mongodb_atlas import MongoDBAtlasVectorSearch
from langflow.field_typing import Embeddings, NestedDict
from langflow.field_typing import Embeddings
from langflow.interface.custom.custom_component import CustomComponent
from langflow.schema.schema import Record

View file

@ -4,7 +4,7 @@ from langchain.schema import BaseRetriever
from langchain_community.vectorstores import VectorStore
from langchain_community.vectorstores.qdrant import Qdrant
from langflow.field_typing import Embeddings, NestedDict
from langflow.field_typing import Embeddings
from langflow.interface.custom.custom_component import CustomComponent
from langflow.schema.schema import Record

View file

@ -5,7 +5,7 @@ from langchain_community.vectorstores import VectorStore
from langchain_community.vectorstores.supabase import SupabaseVectorStore
from supabase.client import Client, create_client
from langflow.field_typing import Embeddings, NestedDict
from langflow.field_typing import Embeddings
from langflow.interface.custom.custom_component import CustomComponent
from langflow.schema.schema import Record

File diff suppressed because one or more lines are too long

View file

@ -211,7 +211,7 @@ def create_super_user(
return super_user
def create_user_longterm_token(db: Session = Depends(get_session)) -> dict:
def create_user_longterm_token(db: Session = Depends(get_session)) -> tuple[UUID, dict]:
settings_service = get_settings_service()
username = settings_service.auth_settings.SUPERUSER
password = settings_service.auth_settings.SUPERUSER_PASSWORD

View file

@ -7,12 +7,13 @@ from typing import Any, List, Optional, Tuple, Type
import orjson
import yaml
from langflow.services.settings.constants import VARIABLES_TO_GET_FROM_ENVIRONMENT
from loguru import logger
from pydantic import field_validator, validator
from pydantic.fields import FieldInfo
from pydantic_settings import BaseSettings, EnvSettingsSource, PydanticBaseSettingsSource, SettingsConfigDict
from langflow.services.settings.constants import VARIABLES_TO_GET_FROM_ENVIRONMENT
# BASE_COMPONENTS_PATH = str(Path(__file__).parent / "components")
BASE_COMPONENTS_PATH = str(Path(__file__).parent.parent.parent / "components")
@ -27,9 +28,16 @@ def is_list_of_any(field: FieldInfo) -> bool:
Returns:
bool: True if the field is a list or a list of any type, False otherwise.
"""
if field.annotation is None:
return False
try:
if hasattr(field.annotation, "__args__"):
union_args = field.annotation.__args__
else:
union_args = []
return field.annotation.__origin__ == list or any(
arg.__origin__ == list for arg in field.annotation.__args__ if hasattr(arg, "__origin__")
arg.__origin__ == list for arg in union_args if hasattr(arg, "__origin__")
)
except AttributeError:
return False