fix: metadata serialization in AstraDB vector store (#8855)
* fix(astradb): serialize metadata in documents * chore: update starter projects * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Eric Hare <ericrhare@gmail.com>
This commit is contained in:
parent
c7962855d5
commit
2f3600a64e
3 changed files with 9 additions and 3 deletions
|
|
@ -7,6 +7,7 @@ from astrapy.data.info.reranking import RerankServiceOptions
|
||||||
from astrapy.info import CollectionDescriptor, CollectionLexicalOptions, CollectionRerankOptions
|
from astrapy.info import CollectionDescriptor, CollectionLexicalOptions, CollectionRerankOptions
|
||||||
from langchain_astradb import AstraDBVectorStore, VectorServiceOptions
|
from langchain_astradb import AstraDBVectorStore, VectorServiceOptions
|
||||||
from langchain_astradb.utils.astradb import HybridSearchMode, _AstraDBCollectionEnvironment
|
from langchain_astradb.utils.astradb import HybridSearchMode, _AstraDBCollectionEnvironment
|
||||||
|
from langchain_core.documents import Document
|
||||||
|
|
||||||
from langflow.base.vectorstores.model import LCVectorStoreComponent, check_cached_vector_store
|
from langflow.base.vectorstores.model import LCVectorStoreComponent, check_cached_vector_store
|
||||||
from langflow.base.vectorstores.vector_store_connection_decorator import vector_store_connection
|
from langflow.base.vectorstores.vector_store_connection_decorator import vector_store_connection
|
||||||
|
|
@ -22,6 +23,7 @@ from langflow.io import (
|
||||||
StrInput,
|
StrInput,
|
||||||
)
|
)
|
||||||
from langflow.schema.data import Data
|
from langflow.schema.data import Data
|
||||||
|
from langflow.serialization import serialize
|
||||||
from langflow.utils.version import get_version_info
|
from langflow.utils.version import get_version_info
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1164,6 +1166,10 @@ class AstraDBVectorStoreComponent(LCVectorStoreComponent):
|
||||||
msg = "Vector Store Inputs must be Data objects."
|
msg = "Vector Store Inputs must be Data objects."
|
||||||
raise TypeError(msg)
|
raise TypeError(msg)
|
||||||
|
|
||||||
|
documents = [
|
||||||
|
Document(page_content=doc.page_content, metadata=serialize(doc.metadata, to_str=True)) for doc in documents
|
||||||
|
]
|
||||||
|
|
||||||
if documents and self.deletion_field:
|
if documents and self.deletion_field:
|
||||||
self.log(f"Deleting documents where {self.deletion_field}")
|
self.log(f"Deleting documents where {self.deletion_field}")
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue