Find answers from the community

Updated 3 months ago

Good evening - I'm using propertygraph

Good evening - I'm using propertygraph index - I'm making the entities and relations manually and inserting them with upsert_nodes/upsert_relations - basically the same as the example in the docs.

I'm noticing these nodes/relations don't get any embedding and when making a query, they're all scored at 0. I've tried calculaing the embedding manually for the EntityNodes but am still getting 0 scores. Is there something fundamental I am missing?
L
Y
4 comments
You'll need to attach embeddings when inserting them

Plain Text
node = Entity(...)
node.embedding = embed_model.get_text_embedding("some text")


However, if you aren't using a graph store that supports vectors, this gets a lot more complicated πŸ˜…
Yes - I am both doing that part and not using a graph that supports vectors - so I suppose I'm on the complicated route
Yea so basically, you need to create a text node that references your entity node, and embed/insert that into the vector store

Reading the source code might help this make more sense.
https://github.com/run-llama/llama_index/blob/a18b94699ac4e49b17f3f49879adf29dfc7c3ed3/llama-index-core/llama_index/core/indices/property_graph/base.py#L308

Alternatively, I would use a graph store that supports vector search
Thanks - that worked. I ended up calling '_insert_nodes_to_vector_index' with the entity node list
Add a reply
Sign up and join the conversation on Discord