Find answers from the community

Updated 3 months ago

when i do this:

when i do this:
from llama_index.core.llms.ollama import Ollama
i get a error:
Traceback (most recent call last):
File "/Users/ahmednadiir/Desktop/agency/main.py", line 6, in <module>
from llama_index.core.llms.ollama import Ollama
ModuleNotFoundError: No module named 'llama_index.core.llms.ollama'

altho i run : pip install llama-index-llms-ollama
L
C
5 comments
from llama_index.llms.ollama import Ollama
just a small error in the import you had
ya i see it but now am getting 404 error altho i test the api on differnt file like this:
import openai from openai import OpenAI client = OpenAI(api_key="ollama", base_url="http://localhost:11434/v1") completion = client.chat.completions.create(model="tinyllama", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "how old does cat get at max?"} ]) print(completion.choices[0].message.content)

and it works fine but in the llamaindex file i got this error:
raise HTTPStatusError(message, request=request, response=self) httpx.HTTPStatusError: Client error '404 Not Found' for url 'http://localhost:11434/v1/api/chat' For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404

here is my code:
import os import pandas as pd from llama_index.core.query_engine import PandasQueryEngine from prompts import new_prompt, instruction_str from llama_index.llms.ollama import Ollama llm = Ollama(model="tinyllama", request_timeout=60.0, base_url="http://localhost:11434/v1") #my quran.json file quran_path = os.path.join('data', 'quran.csv'); #load quran_df = pd.read_csv(quran_path) quran_query_engine = PandasQueryEngine(df=quran_df, verbose=True, instruction_str=instruction_str, llm=llm); quran_query_engine.update_prompts({"pandas_prompt": new_prompt}) quran_query_engine.query("how many total hasanat in the the whole quran")
is there any problem you see in my code it would help alot btw thanks you so much @Logan M
nvm i fixed the problem was the url
Add a reply
Sign up and join the conversation on Discord