Find answers from the community

Updated 2 months ago

Pining for a solution: metadata error in Pinecone VectorMemory

Hey everyone!

I’m trying to use Pinecone as a vector database with VectorMemory, but I keep getting a metadata error:

"Metadata value must be a string, number, boolean or list of strings, got '[{"additional_kw...' for field 'sub_dicts'"

I’ve tried different approaches, but no luck so far. I’m sharing a portion of my code here:

vector_store = PineconeVectorStore(
pinecone_index=pinecone_index,
namespace=namespace
)

vector_memory = VectorMemory.from_defaults(
vector_store=vector_store,
embed_model=embed_model,
retriever_kwargs={
"similarity_top_k": 5,
},
)

msgs = [
ChatMessage(
role="system",
content="You are a SOMEWHAT helpful assistant.",
),
ChatMessage(
role="user",
content="Bob likes burgers.",
),
ChatMessage(
role="assistant",
content="Indeed, Bob likes apples.",
),
]

vector_memory.set(msgs)

chat_memory_buffer = ChatMemoryBuffer.from_defaults()

composable_memory = SimpleComposableMemory.from_defaults(
primary_memory=chat_memory_buffer,
secondary_memory_sources=[vector_memory],
)

I’m stuck on this metadata issue and am unsure how to format it correctly. Any suggestions on fixing this? Thanks in advance!
L
1 comment
If pinecone doesn't allow dicts as metadata, I don't think there is an easy way to use it for vector memory
Add a reply
Sign up and join the conversation on Discord