Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I want to use Llama-index for document classification. How can I use multiple indexes with it? #1986

Closed
AkshitChugh787 opened this issue May 3, 2023 · 2 comments

Comments

@AkshitChugh787
Copy link

Like I got two PDF files in different directories. I load them with the following:
doc1 = SimpleDirectoryReader('file1').load_data()
doc2 = SimpleDirectoryReader('file2.').load_data()

Then I created indexes for each:
index1 = GPTTreeIndex.from_documents(doc1)
index2 = GPTTreeIndex.from_documents(doc2)
index1_summary = "<summary1>"
index1_summary = str(summary1)

same done for index2

all_indices = [index1, index2]
index_summaries = [index1_summary, index2_summary]

graph = ComposableGraph.from_indices(GPTTreeIndex, all_indices, index_summaries=index_summaries)

index = ComposableGraph.load_from_disk("graph.json")
query_configs = [ { "index_struct_type": "simple_dict", "query_mode": "default", "query_kwargs": { "similarity_top_k": 3, "response_mode": "tree_summarize" } }, ]

response = index.query(text, query_configs=query_configs)

is this approach correct or do I have to make changes? Can this classify both the indexes and queries asked related to them?
Thanks!

@asadabbas09
Copy link

@AkshitChugh787 I have exactly the same question. Is this the right approach? Have you figured it out?

@dosubot
Copy link

dosubot bot commented Oct 5, 2023

Hi, @AkshitChugh787! I'm Dosu, and I'm here to help the LlamaIndex team manage their backlog. I wanted to let you know that we are marking this issue as stale.

From what I understand, you opened this issue to inquire about using Llama-index for document classification with multiple indexes. You provided some code snippets and were seeking confirmation if your approach is correct. Asadabbas09 also commented on the issue, asking if a solution has been found.

However, it seems that the issue is still unresolved. Before we close it, we wanted to check with you if it is still relevant to the latest version of the LlamaIndex repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days.

Thank you for your understanding, and please don't hesitate to reach out if you have any further questions or concerns.

@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Oct 5, 2023
@dosubot dosubot bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 12, 2023
@dosubot dosubot bot removed the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants