Fix: Ensure compatibility with DSLF Overlays in Astra DB Component (#5876)

* fix: address DSLF issues with Astra DB component

* Update Vector Store RAG.json

* [autofix.ci] apply automated fixes

* Update astradb.py

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Eric Hare 2025-01-22 12:31:02 -08:00 committed by GitHub
commit 220727a1f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 1195 additions and 1128 deletions

View file

@ -127,7 +127,7 @@ class AstraDBVectorStoreComponent(LCVectorStoreComponent):
name="api_endpoint",
display_name="API Endpoint",
info="The API endpoint for the Astra DB instance.",
advanced=True,
show=os.getenv("LANGFLOW_HOST") is not None, # TODO: Clean up all examples of these
),
DropdownInput(
name="database_name",
@ -145,6 +145,7 @@ class AstraDBVectorStoreComponent(LCVectorStoreComponent):
],
value="",
combobox=True,
show=os.getenv("LANGFLOW_HOST") is None,
),
DropdownInput(
name="collection_name",
@ -165,6 +166,15 @@ class AstraDBVectorStoreComponent(LCVectorStoreComponent):
],
value="",
),
DropdownInput(
name="vectorize_choice",
display_name="Embedding Model or Astra Vectorize",
info="Choose an embedding model or use Astra Vectorize.",
options=["Embedding Model", "Astra Vectorize"],
value="Embedding Model",
show=os.getenv("LANGFLOW_HOST") is not None,
real_time_refresh=True,
),
StrInput(
name="keyspace",
display_name="Keyspace",
@ -490,6 +500,16 @@ class AstraDBVectorStoreComponent(LCVectorStoreComponent):
return []
def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):
if field_name == "vectorize_choice":
if field_value == "Astra Vectorize":
build_config["embedding_model"]["show"] = False
build_config["embedding_model"]["required"] = False
else:
build_config["embedding_model"]["show"] = True
build_config["embedding_model"]["required"] = True
return build_config
if not self.token or not self.token.startswith("AstraCS:"):
build_config["database_name"]["info"] = "Add a Valid Token to Select a Database"
else:
@ -594,7 +614,11 @@ class AstraDBVectorStoreComponent(LCVectorStoreComponent):
raise ImportError(msg) from e
# Get the embedding model and additional params
embedding_params = {"embedding": self.embedding_model} if self.embedding_model else {}
embedding_params = (
{"embedding": self.embedding_model}
if self.embedding_model and self.vectorize_choice == "Embedding Model"
else {}
)
additional_params = self.astradb_vectorstore_kwargs or {}
# Get Langflow version and platform information

File diff suppressed because one or more lines are too long