genai-stack icon indicating copy to clipboard operation
genai-stack copied to clipboard

Is it possible to parameters to the vector retrieval query ?

Open BLaZeKiLL opened this issue 2 years ago • 4 comments

Hi,

I was wondering if it is possible to pass some parameters to the vector index retrieval query (similar to the one in chains.py:142). The value of these parameters depends on user input. I want to retrieve different sets of indexes depending on the user input.

In my query, I have the following match clause.

MATCH (question) -[:SITE]-> (s:Site {name: $site_name})

$site_name will depend on user input

BLaZeKiLL avatar Nov 02 '23 04:11 BLaZeKiLL

At the moment, there is no clean way to pass parameters to the query. What you could do is to instantiate a Neo4jVector object for each site, and then use the appropriate based on the input parameter

tomasonjo avatar Nov 02 '23 07:11 tomasonjo

Okay, For now, I implemented a chain factory and used string interpolation for the query, not ideal but it's working

BLaZeKiLL avatar Nov 03 '23 07:11 BLaZeKiLL

But good idea to make it configurable and allow external parameters to be used in the query @tomasonjo esp. if we integrate it into the LangChain parameter passing between chains. Can you make a note of that or GH issue in LC?

jexp avatar Nov 03 '23 15:11 jexp

Hi,

I created Neo4j Vector Store connector for Semantic Kernel; I make the retrieval query configurable by providing an overridable query factory and a Dynamic properties dictionary.

The user can update the values in the dictionary at runtime and override the query factory to consume the required keys from the dictionary

BLaZeKiLL avatar Jan 19 '24 20:01 BLaZeKiLL