Find answers from the community

Updated 2 years ago

Hey Loving GPT Index it s got so much

Hey! Loving GPT Index, it's got so much potential as LLM become more ubiquitous!!

I've got a question on structured indexes - I'd like to query across multiple tables, but it looks like on the existing functions, you need to specify a specific table to query against. Is there a way to build the indexes so the LLM can infer or understand relationships between tables?

As an example, if I have table 1:
action_name user_id
Thing 1 99
Thing2 105

table 2
user_id user_type
99 admin
105 normal

I'd like to be able to ask "What actions have admins taken?" and receive the response " admins have done thing 1"
3
c
h
d
11 comments
Is this question generic or specific? I feel like it could be hard to do that in a generic way, but if there are specific pieces of context you want to inject into queries you could always do that outside of the GPT index and include it in your query
You could always put documents from various different sources into the same index and encode the relationship between tables in the document metadata perhaps. This package is growing quickly and I'm sure someone will build in more advanced sql functionality at some point
There are lots of tools for mapping tabular data into RDF graphs, which represent everything as a network of entities with named interrelationships. Not sure yet how to use them in a gptindex setting though. Eg http://d2rq.org/ https://fairplus.github.io/the-fair-cookbook/content/recipes/interoperability/rdf-conversion.html
@Chris with the latest update I believe you should be able to query across multiple tables! The catch is that if you want to infer structured data from text, you can only do that for one table atm.

Take a look at this tweet here: https://twitter.com/gpt_index/status/1614669301071634438?s=20&t=bUuhEhErF-dl_pQ7Tlsqbw. I can also send you an example notebook
we are basically reusing langchain's SQL wrapper, which given a set of tables, will put all the tables into the prompt, allowing a text-to-SQL query prompt to make use of all the tables (so that the LLM can try to use relationships between tables)
if you have any feedback on this would love to hear your thoughts! i'm very open to improving/expanding this
Ah awesome, thanks @jerryjliu0 will take a look and let you know.

And thanks for the suggestions everyone else!
@jerryjliu0 Hi Jerry - any pointer for someone interested in text-to-graphQL query prompt? I have a bunch of endpoints that I'd like to query against. Thanks!
Ooooh. I actually don't have support for that atm. Can definitely add as a TODO though!
Great. Happy to contribute.
I've put together a proof-of-concept for text-to-graphql - currently using the api. https://github.com/cx0/chatGPT-for-genetics
Add a reply
Sign up and join the conversation on Discord