Find answers from the community

Updated 2 years ago

i think you have to set the response_mode to default when using the «query» function 😊 tha

i think you have to set the response_mode to default when using the «query» function 😊 thats whats @kapa.ai told me, and it works really good for me
k
2 comments
Please stand by @lars as I search the knowledge base. I normally take about 10-15 seconds or so. :wave:
----------------------
Hmm, I don't know enough to give you a confident answer yet. However, you can find more information about setting the response_mode in the Query Reference (https://gpt-index.readthedocs.io/en/latest/reference/query.html).

For a list index, you can set the response_mode to default or compact when using the query function. For example:

Plain Text
index = GPTListIndex(documents)
# mode="default"
response = index.query("What did the author do growing up?", response_mode="default")
# mode="compact"
response = index.query("What did the author do growing up?", response_mode="compact")


For a keyword table index, you can set the mode to default, simple, or rake when using the query function. For example:

Plain Text
# build table with default GPTKeywordTableIndex
from gpt_index import GPTKeywordTableIndex, SimpleDirectoryReader
from IPython.display import Markdown, display

documents = SimpleDirectoryReader('data').load_data()
index = GPTKeywordTableIndex(documents)

# default
response = index.query("What did the author do after his time at Y Combinator?", mode="default")
display(Markdown(f"<b>{response}</b>"))

# simple
response = index.query("What did the author do after his time at Y Combinator?", mode="simple")
display(Markdown(f"<b>{response}</b>"))

# rake
response = index.query("What did the author do after his time at Y Combinator?", mode="rake")
display(Markdown(f"<b>{response}</b>"))

----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Add a reply
Sign up and join the conversation on Discord