Find answers from the community

Home
Members
afewell
a
afewell
Offline, last seen 2 months ago
Joined September 25, 2024
hi, I am trying to preload an index of data from storage, and I also want the user to be able to specify their own openAI api key, but, it looks like the openAI key is needed before llama_index can successfully load a saved index, so I cant load the index until the user specifies their openAI key, and it takes like a minute to load the index. It would be a much better user experience if the index would load from storage without needing the openai key present. So If I want the user to be able to use their own key, I have to have them sit and wait for a full minute for the index to load. I understand why the API key is needed for doing the indexing, but I dont understand why it would be needed to load a saved index from storage. Is there anything that could be done about this? Thanks!
1 comment
L
Hey I wanted to share that my peer just shared a basic llama-index use case using gradio to provide the UI and ... I have never used gradio before and I was very impressed how easy it was. The whole ui for the chatbot is just a couple lines of code:
Plain Text
iface = gr.Interface(fn=chatbot,
                     inputs=gr.inputs.Textbox(lines=7, label="How may I help you?"),
                     outputs="text",
                     title="Tanzu-Trained-ChatBot")

So simple, I will make a thread and paste the full code, but its just the basic llamaindex pattern + these couple lines and you get a nice gui!
3 comments
A
L
a
I was using simple directory reader and had a couple of files out of about 100 I was ingesting that had some data that was not liked and it failed without a meaningful error message. Is there a way to get it to ignore or log errors, or other ways to better debug? Or alternatively I could just loop feed each document individually and can put in some error handling, any advice would be appreciated, thanks!
1 comment
a
I thought I would share some initial results from a couple tests if there are other noobs like me who may find it useful 🙂
I am attempting to create a chat/qa bot that can allow my users to interact with my documentation with natural language. As source data, I am ingesting the documentation for my product. ChatGPT already has knowledge of older versions of my product, so I am testing it with questions derived specific to the newer version.
I plan to do a lot more testing, but so far I have used gpt3.5turbo a couple times with different tunings for max chunk size and num tokens. By accident I queried the models that were indexed by gpt3.5 with the default davinci query, and then again with 3.5. I indexed and queried a test with the default davinci settings. And I created a knowledge graph index with no embeddings. All the questions I asked were derived directly from the documents I fed in and were based on the exact text I fed in. I only used 5 questions to do an initial sample of model effectiveness, and with such a small number of samples, keep in mind the metrics will be skewed accordingly. My best results thus far are with: (Thanks to @dagthomas!)
Plain Text
# set maximum input size
max_input_size = 4096
# set number of output tokens
num_outputs = 512
# set maximum chunk overlap
max_chunk_overlap = 40
# set chunk size limit
chunk_size_limit = 600

# define LLM
llm_predictor = LLMPredictor(llm=OpenAIChat(
    temperature=0, model_name="gpt-3.5-turbo", max_tokens=num_outputs))
prompt_helper = PromptHelper(max_input_size,
                             num_outputs,
                             max_chunk_overlap,
                             chunk_size_limit=chunk_size_limit)

And also with the same settings but a num_output=2048, the results were the same but slightly more verbose which could be positive or negative depending on your needs. I got 4/5 questions correct with these.
I have a few more notes I will post to this thread if your interested ...
23 comments
a
d
L
Hi Everyone, I built a knowledge graph index and the build process worked fine, but now I am running into errors when trying to run a query. I am doing basically the same thing as the example, but I am using the default davinci-003 llm rather than davinci-002 as shown in the example as I assumed it wouldnt matter. If anyone has any insight they could share on this error message, I would be grateful!
Error:
File "/root/myproject/myproject/d2v/t5/testq.py", line 4, in <module>
index = GPTSimpleVectorIndex.load_from_disk('testindex.json')
File "/usr/local/lib/python3.10/dist-packages/llama_index/indices/base.py", line 477, in load_from_disk
return cls.load_from_string(file_contents, kwargs) File "/usr/local/lib/python3.10/dist-packages/llama_index/indices/base.py", line 453, in load_from_string return cls.load_from_dict(result_dict, kwargs)
File "/usr/local/lib/python3.10/dist-packages/llama_index/indices/vector_store/base.py", line 242, in load_from_dict
return super().load_from_dict(result_dict, config_dict, kwargs)
File "/usr/local/lib/python3.10/dist-packages/llama_index/indices/base.py", line 424, in load_from_dict
docstore = DocumentStore.load_from_dict(
File "/usr/local/lib/python3.10/dist-packages/llama_index/docstore.py", line 59, in load_from_dict
raise ValueError(
ValueError: doc_type kg not found in type_to_struct. Make sure that it was registered in the index registry.
3 comments
L
a
Also if the info is useful to estimate cost of building a knowledge graph, I am feeding in a documentation manual for a software product. If I remember correctly, when I indexed it with GPTSimpleVectorIndex I think it said it was about 300k tokens but in that model I think cost less than a dollar. Building the knowledge graph index for the same dataset cost about 11 dollars.
2 comments
j
M
That can depend a lot on your use case, and often there is no clear answer as to what would work best other than testing different options. Playground may be helpful for you, another great thing is checking out the examples on github, and also chatGPT itself is super useful at helping with tuning recommendations. You can also feed documentation or even code from llamaindex into chatGPT to get its awesome assistance. Here is info on playground: https://github.com/jerryjliu/gpt_index/tree/6184d15456d0d387ba6336e79444bfdba721f6a5/examples/playground
3 comments
a
j
Hi everyone, I am new but have been scouring every document I can find, still have some things I am confused about and would appreciate any help! I am confused by the distinction between the llm predictor and the embed model. The docs state the llm predictor is used to create the index, which I assumed meant to generate embeddings, but that doesnt seem right. On one page it says the default llm predictor is davinci, but elsewhere I see ada-002 is default for embeddings. I understand how davinci would be used when querying, but I am confused about how it is used in index construction. If anyone can help clarify, I am grateful!
3 comments
a
K
L