chore: Updating AstraDB parameters format
This commit is contained in:
parent
9b4cca5a8b
commit
9cc6b2f243
1 changed files with 14 additions and 21 deletions
|
|
@ -38,15 +38,14 @@ class AstraVectorStoreComponent(LCVectorStoreComponent):
|
||||||
info="API endpoint URL for the Astra DB service.",
|
info="API endpoint URL for the Astra DB service.",
|
||||||
value="ASTRA_DB_API_ENDPOINT",
|
value="ASTRA_DB_API_ENDPOINT",
|
||||||
),
|
),
|
||||||
DataInput(
|
MultilineInput(
|
||||||
name="vector_store_inputs",
|
name="search_input",
|
||||||
display_name="Vector Store Inputs",
|
display_name="Search Input",
|
||||||
is_list=True,
|
|
||||||
),
|
),
|
||||||
HandleInput(
|
DataInput(
|
||||||
name="embedding",
|
name="ingest_data",
|
||||||
display_name="Embedding",
|
display_name="Ingest Data",
|
||||||
input_types=["Embeddings"],
|
is_list=True,
|
||||||
),
|
),
|
||||||
StrInput(
|
StrInput(
|
||||||
name="namespace",
|
name="namespace",
|
||||||
|
|
@ -105,6 +104,11 @@ class AstraVectorStoreComponent(LCVectorStoreComponent):
|
||||||
info="Optional list of metadata fields to include in the indexing.",
|
info="Optional list of metadata fields to include in the indexing.",
|
||||||
advanced=True,
|
advanced=True,
|
||||||
),
|
),
|
||||||
|
HandleInput(
|
||||||
|
name="embedding",
|
||||||
|
display_name="Embedding",
|
||||||
|
input_types=["Embeddings"],
|
||||||
|
),
|
||||||
StrInput(
|
StrInput(
|
||||||
name="metadata_indexing_exclude",
|
name="metadata_indexing_exclude",
|
||||||
display_name="Metadata Indexing Exclude",
|
display_name="Metadata Indexing Exclude",
|
||||||
|
|
@ -117,20 +121,12 @@ class AstraVectorStoreComponent(LCVectorStoreComponent):
|
||||||
info="Optional dictionary defining the indexing policy for the collection.",
|
info="Optional dictionary defining the indexing policy for the collection.",
|
||||||
advanced=True,
|
advanced=True,
|
||||||
),
|
),
|
||||||
BoolInput(
|
|
||||||
name="add_to_vector_store",
|
|
||||||
display_name="Add to Vector Store",
|
|
||||||
info="If true, the Vector Store Inputs will be added to the Vector Store.",
|
|
||||||
),
|
|
||||||
MultilineInput(
|
|
||||||
name="search_input",
|
|
||||||
display_name="Search Input",
|
|
||||||
),
|
|
||||||
DropdownInput(
|
DropdownInput(
|
||||||
name="search_type",
|
name="search_type",
|
||||||
display_name="Search Type",
|
display_name="Search Type",
|
||||||
options=["Similarity", "MMR"],
|
options=["Similarity", "MMR"],
|
||||||
value="Similarity",
|
value="Similarity",
|
||||||
|
advanced=True,
|
||||||
),
|
),
|
||||||
IntInput(
|
IntInput(
|
||||||
name="number_of_results",
|
name="number_of_results",
|
||||||
|
|
@ -186,15 +182,12 @@ class AstraVectorStoreComponent(LCVectorStoreComponent):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise ValueError(f"Error initializing AstraDBVectorStore: {str(e)}") from e
|
raise ValueError(f"Error initializing AstraDBVectorStore: {str(e)}") from e
|
||||||
|
|
||||||
if self.add_to_vector_store:
|
|
||||||
self._add_documents_to_vector_store(vector_store)
|
|
||||||
|
|
||||||
self.status = self._astradb_collection_to_data(vector_store.collection)
|
self.status = self._astradb_collection_to_data(vector_store.collection)
|
||||||
return vector_store
|
return vector_store
|
||||||
|
|
||||||
def _add_documents_to_vector_store(self, vector_store):
|
def _add_documents_to_vector_store(self, vector_store):
|
||||||
documents = []
|
documents = []
|
||||||
for _input in self.vector_store_inputs or []:
|
for _input in self.ingest_data or []:
|
||||||
if isinstance(_input, Data):
|
if isinstance(_input, Data):
|
||||||
documents.append(_input.to_lc_document())
|
documents.append(_input.to_lc_document())
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue