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:
parent
1df53a87f4
commit
220727a1f9
2 changed files with 1195 additions and 1128 deletions
|
|
@ -127,7 +127,7 @@ class AstraDBVectorStoreComponent(LCVectorStoreComponent):
|
||||||
name="api_endpoint",
|
name="api_endpoint",
|
||||||
display_name="API Endpoint",
|
display_name="API Endpoint",
|
||||||
info="The API endpoint for the Astra DB instance.",
|
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(
|
DropdownInput(
|
||||||
name="database_name",
|
name="database_name",
|
||||||
|
|
@ -145,6 +145,7 @@ class AstraDBVectorStoreComponent(LCVectorStoreComponent):
|
||||||
],
|
],
|
||||||
value="",
|
value="",
|
||||||
combobox=True,
|
combobox=True,
|
||||||
|
show=os.getenv("LANGFLOW_HOST") is None,
|
||||||
),
|
),
|
||||||
DropdownInput(
|
DropdownInput(
|
||||||
name="collection_name",
|
name="collection_name",
|
||||||
|
|
@ -165,6 +166,15 @@ class AstraDBVectorStoreComponent(LCVectorStoreComponent):
|
||||||
],
|
],
|
||||||
value="",
|
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(
|
StrInput(
|
||||||
name="keyspace",
|
name="keyspace",
|
||||||
display_name="Keyspace",
|
display_name="Keyspace",
|
||||||
|
|
@ -490,6 +500,16 @@ class AstraDBVectorStoreComponent(LCVectorStoreComponent):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None):
|
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:"):
|
if not self.token or not self.token.startswith("AstraCS:"):
|
||||||
build_config["database_name"]["info"] = "Add a Valid Token to Select a Database"
|
build_config["database_name"]["info"] = "Add a Valid Token to Select a Database"
|
||||||
else:
|
else:
|
||||||
|
|
@ -594,7 +614,11 @@ class AstraDBVectorStoreComponent(LCVectorStoreComponent):
|
||||||
raise ImportError(msg) from e
|
raise ImportError(msg) from e
|
||||||
|
|
||||||
# Get the embedding model and additional params
|
# 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 {}
|
additional_params = self.astradb_vectorstore_kwargs or {}
|
||||||
|
|
||||||
# Get Langflow version and platform information
|
# Get Langflow version and platform information
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue