Find answers from the community

Updated 2 months ago

Is it possible to give column level

Is it possible to give column level context to help refine querying on databases with many columns?
a
1 comment
Answering my own question in case someone else ends up here.

You can update the description on the table schema as that is passed in by default in the RefineTableContext prompt.

Alternatively you can customize the prompt if you need to.

https://github.com/jerryjliu/gpt_index/blob/main/gpt_index/prompts/default_prompts.py

NOTE: by partially filling schema, we can reduce to a RefinePrompt

that we can feed to ur table

DEFAULT_REFINE_TABLE_CONTEXT_TMPL = (
"We have provided a table schema below. "
"---------------------\n"
"{schema}\n"
"---------------------\n"
"We have also provided some context information below. "
"{context_msg}\n"
"---------------------\n"
"Given the context information and the table schema, "
"give a response to the following task: {query_str}\n"
"We have provided an existing answer: {existing_answer}\n"
"Given the new context, refine the original answer to better "
"answer the question. "
"If the context isn't useful, return the original answer."
)
Add a reply
Sign up and join the conversation on Discord