-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImportError: cannot import name 'ChatMessage' from 'llama_index.core.llms' (unknown location) #2
Comments
In main.py: in prompts.py: |
change: updated from [https://docs.llamaindex.ai/en/stable/examples/llm/openai/] |
error:
Traceback (most recent call last): File "/Users/ahmednadiir/Desktop/agency/main.py", line 4, in <module> from llama_index.core.query_engine import PandasQueryEngine File "/Users/ahmednadiir/Desktop/agency/ai/lib/python3.11/site-packages/llama_index/__init__.py", line 13, in <module> from llama_index.callbacks.global_handlers import set_global_handler File "/Users/ahmednadiir/Desktop/agency/ai/lib/python3.11/site-packages/llama_index/callbacks/__init__.py", line 7, in <module> from .token_counting import TokenCountingHandler File "/Users/ahmednadiir/Desktop/agency/ai/lib/python3.11/site-packages/llama_index/callbacks/token_counting.py", line 6, in <module> from llama_index.utilities.token_counting import TokenCounter File "/Users/ahmednadiir/Desktop/agency/ai/lib/python3.11/site-packages/llama_index/utilities/token_counting.py", line 6, in <module> from llama_index.llms import ChatMessage, MessageRole File "/Users/ahmednadiir/Desktop/agency/ai/lib/python3.11/site-packages/llama_index/llms/__init__.py", line 14, in <module> from llama_index.llms.anyscale import Anyscale File "/Users/ahmednadiir/Desktop/agency/ai/lib/python3.11/site-packages/llama_index/llms/anyscale.py", line 10, in <module> from llama_index.llms.openai import OpenAI File "/Users/ahmednadiir/Desktop/agency/ai/lib/python3.11/site-packages/llama_index/llms/openai/__init__.py", line 1, in <module> from llama_index.llms.openai.base import AsyncOpenAI, OpenAI, SyncOpenAI, Tokenizer File "/Users/ahmednadiir/Desktop/agency/ai/lib/python3.11/site-packages/llama_index/llms/openai/base.py", line 28, in <module> from llama_index.core.callbacks import CallbackManager File "/Users/ahmednadiir/Desktop/agency/ai/lib/python3.11/site-packages/llama_index/core/callbacks/__init__.py", line 4, in <module> from .token_counting import TokenCountingHandler File "/Users/ahmednadiir/Desktop/agency/ai/lib/python3.11/site-packages/llama_index/core/callbacks/token_counting.py", line 6, in <module> from llama_index.core.utilities.token_counting import TokenCounter File "/Users/ahmednadiir/Desktop/agency/ai/lib/python3.11/site-packages/llama_index/core/utilities/token_counting.py", line 6, in <module> from llama_index.core.llms import ChatMessage, MessageRole ImportError: cannot import name 'ChatMessage' from 'llama_index.core.llms' (/Users/ahmednadiir/Desktop/agency/ai/lib/python3.11/site-packages/llama_index/core/llms/__init__.py)
code:
`from dotenv import load_dotenv
import os
import pandas as pd
from llama_index.core.query_engine import PandasQueryEngine
from prompts import new_prompt, instruction_str
load_dotenv()
#my quran.json file
quran_path = os.path.join('data', 'data.json');
#load
quran_df = pd.read_json(quran_path);
quran_query_engine = PandasQueryEngine(df=quran_df, verbose=True, instruction_str=instruction_str);
quran_query_engine.update_prompts({"pandas_prompt": new_prompt})
quran_query_engine.query("how many total hasanat in the the whole quran")`
help me plz
The text was updated successfully, but these errors were encountered: