Find answers from the community

Updated last month

Troubleshooting API connection issues

running into an issue of not connecting, api is in my env, I checked with echo, not sure why its nto working
Attachment
Screenshot_2024-11-11_at_12.11.47_PM.png
L
P
25 comments
That prints your key?
yes it does
Is the key valid? You can test this directly too

Plain Text
from llama_index.embeddings.openai import OpenAIEmbedding

# test directly
embed_model = OpenAIEmbedding(api_key=api_key)
resp = embed_model.get_text_embedding("hello world")

# can also pass in directly 
index = VectorStoreIndex(nodes=nodes, embed_model=embed_model)
yeah that seemed to work
thank you so much
i am now in the final portion of this program and now it wont give me a response
Attachment
Screenshot_2024-11-11_at_2.28.54_PM.png
any idea why?
Seems a similar issue, it's not finding your key for whatever reason

Similar solution too

Plain Text
from llama_index.llms.openai import OpenAI

llm = OpenAI(model="gpt-4o-mini" api_key="...")

query_engine = index.as_query_engine(llm=llm)
heres my engine, do i just put the llm=llm into the selector?
Attachment
Screenshot_2024-11-11_at_2.58.44_PM.png
i really appreciate the help, thank you
lemme try that
you'll also want to make sure your tools/other query engines have an llm too
interesting so I shouldnt run from defaults then?
from defaults is fine. For the selector, the llm goes in there LLMSingleSelector.from_defaults(llm=llm)

Your query engine tools are also fine, nearly
but you are passing in an index instead of query engine for the vector tool
and when you create the vector index query engine/summary query engine, pass the llm in there
hope that makes sense
got a little bit closer, let me try to put the llm in both engines
Attachment
Screenshot_2024-11-11_at_3.02.12_PM.png
sickkk i got it to summarize
thanks so much
normally you don't have to do this πŸ˜… It should be picking it up from os.environ in your notebook, but I guess something is wonky
Yea happy to help!
a little bit late, but i was curious, if i wanted to hookup a csv instead of a document how easy could it be?
CSV's are pretty tricky. If its just a list of QA pairs for example, embedding every row makes sense (which is what simpledirectoryreader does by default)

If they are highly numerical/relational, you might want text2sql
Add a reply
Sign up and join the conversation on Discord