Thanks for surfacing. Where did you get the text variable ?
I figured out the answer the docs say something like this: index1.set_text(
index1.query(
"What is a summary of this document?",
mode="summarize"
)
)
but we should really we taking the response attribute of the query because otherwise we're setting the text to the response object instead of the response text
Oh you can get the response text through the response
attribute, e.g. response.response
Another issue, I'm struggling with is making the composable index good for multiple documents. Each document as a tree index works great, but when I summarize them and add it to a vector store index, it doesn't work well because the summaries are too condensed I think.
Any recommendations to improve this?
Oh interesting, and you'll querying the top-level vector store index? What types of queries are you running?
By default the query for SimpleVectorStoreIndex has similarity_top_k=1
, you can try setting that to something higher, e.g. index.query('<query_text>', similarity_top_k=5)
I was running a recursive query.
The structure was something like this: index1 = GPTTreeIndex(doc1)
index2 = GPTTreeIndex(doc2)
index3 = GPTTreeIndex(doc3)
vector_index = GPTSimpleVectorIndex([index1, index2, index3])
queried like this: response = vector_index.query(
"query", mode="recursive", query_configs=query_configs
)
and query_configs: query_configs = [
{
"index_struct_type": "tree",
"query_mode": "embedding",
"query_kwargs": {
"child_branch_factor": 1
}
},
{
"index_struct_type": "simple_dict",
"query_mode": "embedding",
"query_kwargs": {}
},
]
Right, then specify a query_config entry as this:
[
{
"index_struct_type": "simple_dict",
"query_mode": "default",
"query_kwargs": {
"similarity_top_k": 5
}
},
...
]
is there a way to see which tree index we chose from the first layer?
if you turn verbose=True, it should be able to show you
Also when a single document works really good in the TreeIndex, why does combining that document when a bunch of others into a big document and then making a TreeIndex of that not work that well?
is there a way to print the whole tree data structure
Haha so currently you're using the tree index for each document right? I would recommend GPTSimpleVectorIndex for larger documents or collections of documents. Empirically it's cheaper/gives better initial results. e.g. use GPTSimpleVectorIndex as a subindex
GPT-3 is not very good at reasoning over multiple choice tasks (especially repeated multiple choice tasks), which the tree index depends on. my hope is the tree index will get better with new LLM iterations
Hmm that makes sense, I'll try it
you can think of composability as manually defining a "tree" over your data instead of us doing it automatically
Hey there! I need help with an issue.
I'm trying to run a query on a composable graph and i'm getting this error:
TypeError: ComposableGraph.query() missing 1 required positional argument: 'query_configs'
Looking at the docs, it seems like query_configs should be optional. Has something changed?
i think query_configs may be required now
i can take a look at making it optional again, but in the meantime its required currently
Do you know which was the default query_config it used?
Hi, im trying to implement a KeywordTableIndex filter then SimpleVectorIndex, but on top nodes, is it possible?. ie: find every document that contains N keywords, then take K top with embeddings