Find answers from the community

Home
Members
cmosguy
c
cmosguy
Offline, last seen 3 days ago
Joined September 25, 2024
@kapa.ai I want to take some text and reformat the text using an LLM, what is the best way to do this, should I use acomplete method?
7 comments
k
c
@kapa.ai lets say i am using the AgentWorkflow and I want a planning agent to use OpenAI o1 models that do not allow for system prompts and cannot do function calling, how would you recommend building this as an agent system to tie in the AgentWorkflow?
3 comments
k
@Logan M what I am asking is how does one think through scenario where you have multiple query sources. In this example you may have search_web search_internal_db search_custom_db , lets say you want to the tool to search all three, so does it search all 3 of them in parallel or should a special retriever be created instead to manage the different retriever endpoints, does that make sense?
5 comments
L
c
@Logan M @kapa.ai something strange is happenig when I run my documents through the pipeline I get this error:
Plain Text
    nodes = await pipeline.arun(documents=processed_documents)
    pipeline.persist(persist_dir=pipeline_cache)


Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/slowfs/amsgcn4/home/kleinada/ds_work/snps-edag-cc-dataset-gen/venv/lib/python3.11/site-packages/llama_index/core/ingestion/pipeline.py", line 319, in persist
self.docstore.persist(docstore_path, fs=fs)
File "/slowfs/amsgcn4/home/kleinada/ds_work/snps-edag-cc-dataset-gen/venv/lib/python3.11/site-packages/llama_index/core/storage/docstore/simple_docstore.py", line 84, in persist
self._kvstore.persist(persist_path, fs=fs)
File "/slowfs/amsgcn4/home/kleinada/ds_work/snps-edag-cc-dataset-gen/venv/lib/python3.11/site-packages/llama_index/core/storage/kvstore/simple_kvstore.py", line 88, in persist
f.write(json.dumps(self._data))
^^^^^^^^^^^^^^^^^^^^^^
File "/u/kleinada/.pyenv/versions/3.11.9/lib/python3.11/json/init.py", line 231, in dumps
return _default_encoder.encode(obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/u/kleinada/.pyenv/versions/3.11.9/lib/python3.11/json/encoder.py", line 200, in encode
chunks = self.iterencode(o, _one_shot=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/u/kleinada/.pyenv/versions/3.11.9/lib/python3.11/json/encoder.py", line 258, in iterencode
return _iterencode(o, 0)
^^^^^^^^^^^^^^^^^
File "/u/kleinada/.pyenv/versions/3.11.9/lib/python3.11/json/encoder.py", line 180, in default
raise TypeError(f'Object of type {o.class.name} '
TypeError: Object of type PosixPath is not JSON serializable
12 comments
k
c
L
@kapa.ai I do not understand when to use the RetrieverQueryEngine explain to me why I would use this
3 comments
k
@kapa.ai I have a markdown file with an image embedded in it. Is there a reader that creates both the document and image document with the images being described with a multi modal model?
6 comments
k
c
@kapa.ai I was trying to store a list in a value called "assciated_images" key in the metadata, but i got this error: ValueError: Value for metadata associated_images must be one of (str, int, float, None)
12 comments
k
c
@kapa.ai I am trying to embed my directory using open clip, but how do I tell what is the text associated with the document that it is embedded with?
41 comments
k
c
@kapa.ai I want to create custom response syntehsizer because i have metadata that I want to inject into the context window to help with answering the prompt how do I do this? I want to add the metadata to what is synthesized
11 comments
k
c
@kapa.ai what is the difference between TokenSplitter and SentenceSplitter, which items are the best to use?
28 comments
k
c
@kapa.ai when I load nodes into a vector store how do I avoid duplication? how do I just refresh the nodes?
23 comments
L
k
c
@kapa.ai how do I get all the nodes from the vector store I store all the nodes via a pipeline?
2 comments
k
Has anyone started to build an MCP service to llama index yet?

https://modelcontextprotocol.io/docs/first-server/python
11 comments
L
0
c
cmosguy
·

Storage

I’m seeing a significant slow down when I retrieve a storage connect from disk - is this there simmering I can do to figure out what is doing in here?
5 comments
L
c
@kapa.ai I have microsoft word documents, how do I extract the document content into a markdown and include the images as well?
14 comments
W
k
c
Hey @Logan M how are you? I am trying to use the workflow example to generate an example sub questions, then go through and use react to answer the subquestions form here: https://docs.llamaindex.ai/en/stable/examples/workflow/sub_question_query_engine/

The issue is when I get to the point in the subquestion routine:

agent = ReActAgent.from_tools(
await ctx.get("tools"), llm=llm_4o_2, verbose=False, max_iterations=5
)
response = agent.chat(ev.question)

There are some subquestion quries where it fails with :

Error code: 400 - {'error': {'message': "This model's maximum context length is 128000 tokens. However, your messages resulted in 129643 tokens. Please reduce the length of the messages.", 'type': 'invalid_request_error', 'param': 'messages', 'code': 'context_length_exceeded'}}

I really do not understand how to control this. BTW, the tools is a lit of retriever tools, that was supposed to have node_postprocessor reranker to titrate down the nodes. but i do keep hitting this error regardless.
6 comments
c
L
@kapa.ai I am trying to use an LLM azure open ai model, the chat works but the .complete Keeps asking for api key
19 comments
k
c
@kapa.ai I want to build a custom retriever that accesses the rerankes nodes for multiple vector stores and then compiles a large list do all the nodes and yhe. Use the query bundle object to query as a query tool
37 comments
c
k
@kapa.ai I was doing a :

Plain Text
nodes = md_node_parser.get_nodes_from_documents(oa_md_docs)


but all the sudden I got this error when processing an item

90 if kwds["dtype_backend"] == "pyarrow":
91 # Fail here loudly instead of in cython after reading
92 import_optional_dependency("pyarrow")
---> 93 self._reader = parsers.TextReader(src, **kwds)
95 self.unnamed_cols = self._reader.unnamed_cols
97 # error: Cannot determine type of 'names'

File parsers.pyx:574, in pandas._libs.parsers.TextReader.cinit()

File parsers.pyx:663, in pandas._libs.parsers.TextReader._get_header()

File parsers.pyx:874, in pandas._libs.parsers.TextReader._tokenize_rows()

File parsers.pyx:891, in pandas._libs.parsers.TextReader._check_tokenize_status()

File parsers.pyx:2061, in pandas._libs.parsers.raise_parser_error()

ParserError: Error tokenizing data. C error: EOF inside string starting at row 0
3 comments
k
c
@kapa.ai I am using a router query engine. is there a way to to use the .query method and just retrieve the nodes instead of going into the llm for synthesized response? i just want the results of the retriever after the reranker
25 comments
k
c
W
@kapa.ai I am confused I am working through this python code:

Plain Text
from llama_index.agent.openai import OpenAIAgent
from llama_index.core import load_index_from_storage, StorageContext
from llama_index.core.node_parser import SentenceSplitter
import os

node_parser = SentenceSplitter()

# Build agents dictionary
agents = {}
query_engines = {}

# this is for the baseline
all_nodes = []

for idx, wiki_title in enumerate(wiki_titles):
    nodes = node_parser.get_nodes_from_documents(city_docs[wiki_title])
    all_nodes.extend(nodes)

    if not os.path.exists(f"./data/{wiki_title}"):
        # build vector index
        vector_index = VectorStoreIndex(nodes)
        vector_index.storage_context.persist(
            persist_dir=f"./data/{wiki_title}"
        )
    else:
        vector_index = load_index_from_storage(
            StorageContext.from_defaults(persist_dir=f"./data/{wiki_title}"),
        )

    # build summary index
    summary_index = SummaryIndex(nodes)
    # define query engines
    vector_query_engine = vector_index.as_query_engine(llm=Settings.llm)
    summary_query_engine = summary_index.as_query_engine(llm=Settings.llm)

   


What I am trying to understand is the VectorStoreIndex(nodes) is storing to files, but what if I want to swap this out for Chroma db vector index? Also, the Symmary Index, does that rely on a chroma db vector store as well? how would that work?
121 comments
c
k
@kapa.ai I have raw_nodes_2021 = node_parser.get_nodes_from_documents(docs_2021) but it keeps calling the default openAI llm, I have an azure LLM that needs t be used here. How do I tell this method in the node_parser class that has:
Plain Text
from llama_index.core.node_parser import UnstructuredElementNodeParser

node_parser = UnstructuredElementNodeParser()

if not os.path.exists("2021_nodes.pkl"):
    raw_nodes_2021 = node_parser.get_nodes_from_documents(docs_2021)
    pickle.dump(raw_nodes_2021, open("2021_nodes.pkl", "wb"))
else:
    raw_nodes_2021 = pickle.load(open("2021_nodes.pkl", "rb"))

to use my llm_4o_mini azure open ai model class?
14 comments
k
c
hey @Logan M so I am doing this tutorial:

https://github.com/run-llama/llamacloud-demo/blob/main/examples/report_generation/report_generation.ipynb

when I get to the cell to do this:

Plain Text
ret = await agent.run(
    input="Tell me about the top-level assets and liabilities for Tesla in 2021, and compare it against those of Apple in 2021. Which company is doing better?"
)


I kept getting too many tokens for gpt-4o. Then when I attempt to repeat the steps I get:

Plain Text
Running step prepare_chat_history
Step prepare_chat_history produced event InputEvent
Running step handle_llm_input
Step handle_llm_input produced event ReportGenerationEvent
Running step generate_report
Step generate_report produced event StopEvent
6 comments
c
L
c
cmosguy
·

Video

@Logan M nice video man here: https://youtu.be/wuuO04j4jPc?si=t0d4cjARP5sab7B7 You should put the links in the comment to the video btw. Also, what was that screen capturing system you are using to record video and zoom in?
2 comments
L
c
cmosguy
·

Outputs

So is llama index capable of handling open ai update with structured output? https://openai.com/index/introducing-structured-outputs-in-the-api/
2 comments
c
L