Find answers from the community

Updated 3 months ago

Can't Go Past These Bugs, Anyone Facing Any Problems with Dependencies?

At a glance
Can't go past these bugs, anyone facing any problems with dependencies?
Attachment
Screenshot_2024-11-25_at_12.18.13_AM.png
W
s
27 comments
Do you have a folder name data in the place where your python file is present?
No I tried to connect directly to API and removed all internal files for data.
There were none
This particular line in your code:
documents = SimpleDirectoryReader("data").load_data()

looks for a folder data in the same place where your .py file is present.

Can you tell me more on connect directly to API part?
i have a diff error now ill show you the code cause i tried cursor to fix it and i ended up with a error loop
Here's a summary of what this Telegram bot does:
Setup & Configuration
Uses environment variables for API keys (Google, OpenAI, Telegram)
Sets up a Google search tool and an OpenAI-powered agent

Main Features
Movie Information Bot: Helps users find movies, theaters, and showtimes
Conversation Flow: Maintains a state-based conversation with users
Natural Language Processing: Uses spaCy to understand user queries

Key Components:
User Context Management
USER_CONTEXTS = {
"location": None,
"movie": None,
"showtime": None,
"conversation_state": "initial"
}

Conversation States:
need_location: Asks user for their location
need_movie: Asks which movie they want to watch
need_showtime: Asks when they want to watch

Query Processing:
Uses NLP to extract:
Movie titles
Locations
Time/date information
Performs Google searches based on extracted information

Workflow:
graph TD
A[User sends message] --> B{Check conversation state}
B -->|Initial| C[Process general query]
B -->|Need location| D[Get theaters nearby]
B -->|Need movie| E[Get movie details]
B -->|Need showtime| F[Get available showtimes]

RAG (Retrieval-Augmented Generation):
Creates context from search results
Uses LlamaIndex for better response generation
Combines search results with conversation context

Commands:
/start: Initiates the conversation
Regular messages: Processed based on conversation state
The bot essentially acts as a movie booking assistant, helping users find movie showtimes and theater information through a natural conversation flow.
error:
Attachment
Screenshot_2024-11-25_at_12.14.56_PM.png
The import is not correct:

from llama_index.core import VectorStoreIndex
rom llama_index.core import (
VectorStoreIndex,
Document,
OpenAI,
FunctionTool,
ReActAgent
)???
if there was a version coordination error, or right imports with some tools like web reader from llama index I experimented before.
For OpenAI you need to install lib for OpenAI separately if you didnt do pip install llama-index

Plain Text
# Do this first 
pip install llama-index
# Now import them like this
from llama_index.core import VectorStoreIndex, Document

from llama_index.llms.openai import OpenAI

from llama_index.core.tools import FunctionTool

from llama_index.core.agent import ReActAgent
You need to remove your import line at line number 12
do you want me to delete
from llama_index import VectorStoreIndex?
then how whould i index the query?
No replace the imports with what I have shared
Use these imports
i am using those sir
And this is removed?
Plain Text
from llama_index import (
    VectorStoreIndex,
    Document,
    OpenAI,
    FunctionTool,
    ReActAgent
)
?
any idea for this

from llama_index.readers.web import SimpleWebPageReader

its throwing an error
Have you installed the reader package?
pip install llama-index-readers-web

For more insight request you to share the error
the best way is would for me to learn to handle this on my own. i have very little knowlede about agentic Ai and more towads ML theory, can you refer me any resources to learn so i can have some context?
Ah since you are starting out, I would request you to checkout llamaindex doc site: docs.llamaindex.ai,
It contains docs related to llama-index and also has lots of examples related to almost everything related to Gen AI usecases and more.

Has lots of examples and hands on forAgentic stuff
Add a reply
Sign up and join the conversation on Discord