Find answers from the community

J
Jjonus
Offline, last seen 3 months ago
Joined September 25, 2024
J
Jjonus
·

Graph

Hello team, I am having trouble per Logan M last advice to find how to mimic the old composable graph structure. Per his comment:

Plain Text
 tbh the idea of this kind of graph has been slightly abdonded in favor of other tools (sub question query engine, routers, recursive retrievers)

But actually, we recently released this syntax for constructing an arbitrary graph using any components. Let me find the link


My structure before is:

  1. Thee composable graphs, each graph having 42 documents which can was accessed via langchain toolkit ( each graph was a tool)
  2. Response_mode = llm to retrieve the document summary index
  3. After querying with response_mode = llm ( to only query summary) retrieve the relevant document
Any advice would be greatly appreciated
10 comments
J
L
Hello Team, I had a question about the use of async on ComposableGraphs, at what point do I have to define use_async = True when instantiating a ComposableGraph. I see within graph_query_engine there are async methods, any help would be appreciated, thanks!

https://github.com/run-llama/llama_index/blob/8f659705dd7f032e8d204ca860ab654bdf7ab0c3/llama_index/query_engine/graph_query_engine.py
6 comments
J
L
Question, I have composable graphs that contain data on a certain entities , over time. So rather than having one index for 5 entities for 4 time frames (20 tools) , I can have 5 composable graphs with 4 documents (for each time frame). However, when running the composable graph, I notice it doesnt actually route the query - it just queries ALL of the documents, then chooses the most relevant selection. This causes costs to balloon. Having the tools grow over time is not scalable.

Interested to hear your thoughts on who I could make this work better? in theory I was expecting the composable graph to ROUTE the query rather than querying everything.
7 comments
J
a
Hello , is there a way to not pass node.text when synthesizing a response from TextNode(BaseNode) ? I had built a custom node for this use case before but trying to avoid that if possible. I want to pass the metadata only as default but the text is being passed as well with node.get_content() . Queried kapaai earlier and was looking at the index github but couldnt get a clear direction. Any guidance would be greatly appreciated, thanks!
5 comments
W
J
Hey there, been working with the subquestion query engine example comparing uber and lyft financial docs and running into some issues (and spammed kapa bot on it):

the index_1 and index_2 are base TreeIndex that I am able to query against individually. However when I run the code below I get the error at the bottom. Any clue?

I am attempting to build sub questions on two root tree indices and then refine the response in the end, similar to the uber and lyft example but just using tree index.

Plain Text
 from llama_index.tools import QueryEngineTool, ToolMetadata
from llama_index.query_engine import SubQuestionQueryEngine

index_1 = indices_list[0].as_query_engine(retriever_mode = "root",use_async=True)
index_2 = indices_list[1].as_query_engine(retriever_mode = "root",use_async=True)

query_engine_tools = [
    QueryEngineTool(
        query_engine=index_1,
        metadata=ToolMetadata(
            name=list(loaded_indices.keys())[1].strip(".json"),
            description=f'This is the earning transcripts for {list(loaded_indices.keys())[1].strip(".json")}',
        ),
    ),
    QueryEngineTool(
        query_engine=index_2,
        metadata=ToolMetadata(
            name=list(loaded_indices.keys())[2].strip(".json"),
            description=f'This is the earning transcripts for {list(loaded_indices.keys())[2].strip(".json")}',
        ),
    ),
]
s_engine = SubQuestionQueryEngine.from_defaults(
    query_engine_tools=query_engine_tools,
    service_context=service_context
)

response = s_engine.query("Please compare the performance of these two companies")


Error:

/opt/conda/lib/python3.8/site-packages/llama_index/question_gen/output_parser.py in format(failed resolving arguments)
15 def format(self, prompt_template: str) -> str:
16 del prompt_template
---> 17 raise NotImplementedError()

NotImplementedError:

P.S I am on llama_index version 0.8.30
14 comments
J
L
With chat agents as the llm (e.gChatOpenAI ), if using refine method , would it keep an ongoing chat history on node 1 - N? I have seen turbo 3.5 do pretty bad as it refines each node but I had a creeping suspicion the chat history was just adding accumulating too much context as the refine process went on. At least for some of the azure models I am limited to using the ChatOpenAI model . And response mode was set to “refine” fyi
1 comment
L
Hey All, I am trying to use the example to persist StorageContext through storage_context.persist(), however when I build a TreeIndex and set index_store = tree_index it says :

Plain Text
 Attribute Error: 'TreeIndex' object has no attribute 'persist.'


Question: Should I be able to persist TreeIndex this way? I am trying to take the route of documents --> node_parsing --> index building (with TreeIndex) --> persisting
14 comments
J
L
Hey Team, I have 20 nodes and I built a tree_index with num_children = 4, assuming I would 5 summary root nodes . However when I run tree_index.index_struct.root_nodes I only get 2 nodes? Was one extra level added to the tree? Almost seems like its ignoring my num_children argument
6 comments
J
L