Find answers from the community

Updated last year

I m trying to insert a Document into an

At a glance

The community member is trying to insert a document into an index, but is encountering an error related to the metadata in the document. The document contains a "BoundingBox" field that is not a string, which is causing an issue with the Weaviate vector store. The community members suggest that the community member may need to cast the bounding box to a string or use json.dumps to resolve the issue, but there is no explicitly marked answer.

I'm trying to insert a Document into an index but having some issues. My document contains metadata that I want to use after retrieval but that is not a string and should not be used to retreiver or query any LLMS. Here is what one document looks like:
Plain Text
Document(
                text=block["Text"],
                metadata=dict(
                    metadata,
                    **{
                        "page_num": str(block["Page"]),
                        "BoundingBox": block["BoundingBox"],
                    },
                    excluded_embed_metadata_keys=["BoundingBox"],
                    excluded_llm_metadata_keys=["BoundingBox"],
                ),
            ) 

This is the error message I get though:
Plain Text
{'error': [{'message': "invalid text property 'boundingBox' on class 'InvalidityGPTI': not a string, but map[string]interface {}"}]}


I cant seem to figure out where this is coming from

This is how I insert into my index:
Plain Text
self.index = VectorStoreIndex.from_vector_store(
                service_context=self.serviceContext,
                vector_store=WeaviateVectorStore(
                    weaviate_client=self.client, index_name="InvalidityGPTI"
                )
            )

self.index.insert(doc)
self.index.storage_context.persist()
L
I
3 comments
I thiiink this is coming from weaviate?

You may need to cast the bounding box to be a string? Or a json.dumps ?
Not sure what the current type of boundingBox is, normally I think weaviate handles lists of basic types
Add a reply
Sign up and join the conversation on Discord