Error Chatbot using llama_index

Please guide me regarding this error?

ImportError: cannot import name 'VectorStoreIndex' from 'llama_index' (unknown 
location)
2024-04-16 08:25:18.902 503 GET /script-health-check (10.12.216.22) 5.31ms
────────────────────── Traceback (most recent call last) ───────────────────────
  /home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptru  
  nner/script_runner.py:584 in _run_script                                      
                                                                                
  /mount/src/hellow/bawa.py:2 in <module>                                       
                                                                                
     1 import streamlit as st                                                   
  ❱  2 from llama_index import VectorStoreIndex, ServiceContext, Document       
     3 from llama_index.llms import OpenAI                                      
     4 import openai                                                            
     5 from llama_index import SimpleDirectoryReader  

Hi @Arslan_Zahid,

Thanks for sharing your question with the community! :balloon: Please update your debugging post to include a code snippet and a link to your app’s public GitHub repo – this will allow the community to help you find an answer as quickly as possible. In the meantime, this post will be tagged as needs-more-info.

Hi @Arslan_Zahid,

This is the right import call:

from llama_index.core import VectorStoreIndex, ServiceContext, Document

Hi @tonykip
Thanks for your reply
The problem was resolved with following changes:

from llama_index.core import VectorStoreIndex, ServiceContext, Document
from llama_index.llms.openai import OpenAI
from llama_index.core import SimpleDirectoryReader

Hi @tonykip

Please find below the link to Github repo

Arzal007/hellow (github.com)

Glad it worked! Happy Streamlit-ing!:balloon:

Are you still experiencing any errors?

No. It is working. Thanks for your support.

1 Like

Awesome!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.