Hello,
I'm trying to understand how 'retrieval_query
' parameter in Langchain, from_existing_graph
works.
So, when I create vector index with syntax like:
CREATE VECTOR INDEX `abstract-embeddings`
FOR (n: Abstract) ON (n.embedding)
OPTIONS {indexConfig: {
`vector.dimensions`: 1536,
`vector.similarity_function`: 'cosine'
}}
I create index for ALL 'Abstract' node properties, right? This happens also when I execute 'from_existing_graph' for the first time, right?
Example:
existing_graph = Neo4jVector.from_existing_graph(
embedding=OpenAIEmbeddings(),
url=url,
username=username,
password=password,
index_name="person_index",
node_label="Person",
text_node_properties=["name", "location"],
embedding_node_property="embedding",
)
Parameter 'retrieval_query
' should sent some extra chunks of info to the model as I understand - some context. And this looks logical:
read_query = (
"CALL db.index.vector.queryNodes($index, $k, $embedding) "
"YIELD node, score "
) + retrieval_query
But when I look at some query example I see:
retrieval_query = """
OPTIONAL MATCH (node)<-[:EDITED_BY]-(p)
WITH node, score, collect(p) AS editors
RETURN node.info AS text,
score,
node {.*, vector: Null, info: Null, editors: editors} AS metadata
"""
So model text is taken from index node not this 'attached' relations or nodes; node.info. I'd expect some info from 'p' nodes. I see nothing is return from 'p' nodes in this query. Am I wrong?
What is 'metadata'? How can I use it in result data?
Thank you for your help