Richard Broussard
Richard Broussard

Reputation: 11

creating a RAG app with llama index using mistral - getting connection error when trying to run query test on vector index

Setting up an embed model tool with llama index using local Mistral model to parse a pdf file to be able to query from vector index but getting a connection error when trying to run a query_engine.query test.

main.py listed below - my API is labeled correctly in a .env file.

from llama_index.llms.ollama import Ollama
from llama_parse import LlamaParse
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, PromptTemplate
from llama_index.core.embeddings import resolve_embed_model
from dotenv import load_dotenv

load_dotenv()

llm = Ollama(model="mistral", request_timeout=30.0)

parser = LlamaParse(result_type="markdown")

file_extractor = {".pdf": parser}
documents = SimpleDirectoryReader("./data", file_extractor=file_extractor).load_data()

embed_model= resolve_embed_model("local:BAAI/bge-m3")
vector_index = VectorStoreIndex.from_documents(documents, embed_model=embed_model)
query_engine = vector_index.as_query_engine(llm=llm)

result = query_engine.query("what are some of the routes in the api?")
print(result)

I expected it to go into my data directory, parse the pdf file there, send it to the vector index, the use it to query a question about the pdf to get a response but instead i'm getting a connection error -

httpx.ConnectError: [Errno 61] Connection refused

Upvotes: 1

Views: 911

Answers (1)

jingchang hong
jingchang hong

Reputation: 51

Looks like the Ollama server is not on. Try installing Ollama and running it by:

curl -fsSL https://ollama.com/install.sh | sh

ollama serve

Upvotes: 0

Related Questions