Title: ImportError: cannot import name 'ChatMessage' from 'llama_index.core.llms' (unknown location) · Issue #2 · techwithtim/PythonAgentAI · GitHub
Open Graph Title: ImportError: cannot import name 'ChatMessage' from 'llama_index.core.llms' (unknown location) · Issue #2 · techwithtim/PythonAgentAI
X Title: ImportError: cannot import name 'ChatMessage' from 'llama_index.core.llms' (unknown location) · Issue #2 · techwithtim/PythonAgentAI
Description: error: Traceback (most recent call last): File "/Users/ahmednadiir/Desktop/agency/main.py", line 4, in
Open Graph Description: error: Traceback (most recent call last): File "/Users/ahmednadiir/Desktop/agency/main.py", line 4, in
X Description: 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 &quo...
Opengraph URL: https://github.com/techwithtim/PythonAgentAI/issues/2
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ImportError: cannot import name 'ChatMessage' from 'llama_index.core.llms' (unknown location)","articleBody":"error:\r\n`Traceback (most recent call last):\r\n File \"/Users/ahmednadiir/Desktop/agency/main.py\", line 4, in \u003cmodule\u003e\r\n from llama_index.core.query_engine import PandasQueryEngine\r\n File \"/Users/ahmednadiir/Desktop/agency/ai/lib/python3.11/site-packages/llama_index/__init__.py\", line 13, in \u003cmodule\u003e\r\n from llama_index.callbacks.global_handlers import set_global_handler\r\n File \"/Users/ahmednadiir/Desktop/agency/ai/lib/python3.11/site-packages/llama_index/callbacks/__init__.py\", line 7, in \u003cmodule\u003e\r\n from .token_counting import TokenCountingHandler\r\n File \"/Users/ahmednadiir/Desktop/agency/ai/lib/python3.11/site-packages/llama_index/callbacks/token_counting.py\", line 6, in \u003cmodule\u003e\r\n from llama_index.utilities.token_counting import TokenCounter\r\n File \"/Users/ahmednadiir/Desktop/agency/ai/lib/python3.11/site-packages/llama_index/utilities/token_counting.py\", line 6, in \u003cmodule\u003e\r\n from llama_index.llms import ChatMessage, MessageRole\r\n File \"/Users/ahmednadiir/Desktop/agency/ai/lib/python3.11/site-packages/llama_index/llms/__init__.py\", line 14, in \u003cmodule\u003e\r\n from llama_index.llms.anyscale import Anyscale\r\n File \"/Users/ahmednadiir/Desktop/agency/ai/lib/python3.11/site-packages/llama_index/llms/anyscale.py\", line 10, in \u003cmodule\u003e\r\n from llama_index.llms.openai import OpenAI\r\n File \"/Users/ahmednadiir/Desktop/agency/ai/lib/python3.11/site-packages/llama_index/llms/openai/__init__.py\", line 1, in \u003cmodule\u003e\r\n from llama_index.llms.openai.base import AsyncOpenAI, OpenAI, SyncOpenAI, Tokenizer\r\n File \"/Users/ahmednadiir/Desktop/agency/ai/lib/python3.11/site-packages/llama_index/llms/openai/base.py\", line 28, in \u003cmodule\u003e\r\n from llama_index.core.callbacks import CallbackManager\r\n File \"/Users/ahmednadiir/Desktop/agency/ai/lib/python3.11/site-packages/llama_index/core/callbacks/__init__.py\", line 4, in \u003cmodule\u003e\r\n from .token_counting import TokenCountingHandler\r\n File \"/Users/ahmednadiir/Desktop/agency/ai/lib/python3.11/site-packages/llama_index/core/callbacks/token_counting.py\", line 6, in \u003cmodule\u003e\r\n from llama_index.core.utilities.token_counting import TokenCounter\r\n File \"/Users/ahmednadiir/Desktop/agency/ai/lib/python3.11/site-packages/llama_index/core/utilities/token_counting.py\", line 6, in \u003cmodule\u003e\r\n from llama_index.core.llms import ChatMessage, MessageRole\r\nImportError: 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)`\r\n\r\n\r\ncode:\r\n`from dotenv import load_dotenv\r\nimport os\r\nimport pandas as pd\r\nfrom llama_index.core.query_engine import PandasQueryEngine\r\nfrom prompts import new_prompt, instruction_str\r\n\r\n\r\nload_dotenv()\r\n\r\n\r\n#my quran.json file\r\nquran_path = os.path.join('data', 'data.json');\r\n#load\r\nquran_df = pd.read_json(quran_path);\r\n\r\nquran_query_engine = PandasQueryEngine(df=quran_df, verbose=True, instruction_str=instruction_str);\r\nquran_query_engine.update_prompts({\"pandas_prompt\": new_prompt})\r\nquran_query_engine.query(\"how many total hasanat in the the whole quran\")`\r\n\r\nhelp me plz","author":{"url":"https://github.com/C0deXG","@type":"Person","name":"C0deXG"},"datePublished":"2024-02-20T04:00:15.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/2/PythonAgentAI/issues/2"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b9838937-0bf8-1eca-e16c-ba3cbb399cc8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D358:162B2:28BD745:3842AB8:6A4EFE80 |
| html-safe-nonce | ee36bcfb64e7db39f3f75b3c47fe8b85c4c08c014d09d1db2deb713c5e2a5d43 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMzU4OjE2MkIyOjI4QkQ3NDU6Mzg0MkFCODo2QTRFRkU4MCIsInZpc2l0b3JfaWQiOiI1MzE3MjE4MjMyMDQ1NjAwMzg0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 581000ea8eae1c3404f5e450071ff1fb78239f22a04ae32fdf4773d9f76e4376 |
| hovercard-subject-tag | issue:2143496217 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/techwithtim/PythonAgentAI/2/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4b5fe99c64429d7d2a2599cbb99e72bd196001d5a2cd9f1df9b68f91cf9bb02b/techwithtim/PythonAgentAI/issues/2 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4b5fe99c64429d7d2a2599cbb99e72bd196001d5a2cd9f1df9b68f91cf9bb02b/techwithtim/PythonAgentAI/issues/2 |
| og:image:alt | error: Traceback (most recent call last): File "/Users/ahmednadiir/Desktop/agency/main.py", line 4, in |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | C0deXG |
| hostname | github.com |
| expected-hostname | github.com |
| None | b92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9 |
| turbo-cache-control | no-preview |
| go-import | github.com/techwithtim/PythonAgentAI git https://github.com/techwithtim/PythonAgentAI.git |
| octolytics-dimension-user_id | 35348871 |
| octolytics-dimension-user_login | techwithtim |
| octolytics-dimension-repository_id | 750367130 |
| octolytics-dimension-repository_nwo | techwithtim/PythonAgentAI |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 750367130 |
| octolytics-dimension-repository_network_root_nwo | techwithtim/PythonAgentAI |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2b8f23afb982271f1b22258a94aede67a6b77760 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width