katanaml / sparrow

Data processing with ML, LLM and Vision LLM
https://katanaml.io
GNU General Public License v3.0
3.71k stars 378 forks source link

api/chat not available #40

Closed svenbjornkvilt closed 8 months ago

svenbjornkvilt commented 8 months ago

HTTPStatusError: Client error '404 Not Found' for url 'http://127.0.0.1:11434/api/chat' image

abaranovskis-redsamurai commented 8 months ago

This means either Ollama is not installed or problem with Ollama install.

DrewThomasson commented 6 months ago

i have that issue but I can verify that ollama is fully installed and working on my system

the ollama run llama3 command works as expectedgiving me a terminal chat,

and also using curl shows that it exists on my machine

(.env_llamaindex) (base) drew@drew-System-Product-Name:~/sparrow/sparrow-ml/llm$ curl http://127.0.0.1:11434/api/chat -d '{ "model": "llama3", "prompt": "Why is the sky blue?" }' {"model":"llama3","created_at":"2024-05-08T01:51:47.34946244Z","message":{"role":"assistant","content":""},"done":true}(.env_llamaindex) (base) drew@drew-System-Product-Name:~/sparrow/sparrow-ml/llm$

This works giving me some response as you can see, and not just the 404 error

is it because i need to pull a diffrent ollama model other than llama3?

DrewThomasson commented 6 months ago

HTTPStatusError: Client error '404 Not Found' for url 'http://127.0.0.1:11434/api/chat' image

did you manage to ever fix this issue on your end?

abaranovskis-redsamurai commented 6 months ago

In LlamaIndex agent, call to Ollama is made in script: https://github.com/katanaml/sparrow/blob/main/sparrow-ml/llm/rag/agents/llamaindex/llamaindex.py

Check this line:

llm = self.invoke_pipeline_step(lambda: Ollama(model=cfg.LLM, base_url=cfg.OLLAMA_BASE_URL, temperature=0,
                                                       request_timeout=900),
                                        "Loading Ollama...",
                                        local)

You can create new basic Python script and try to call Ollama from there, to troubleshoot the issue:

Ollama(model=cfg.LLM, base_url=cfg.OLLAMA_BASE_URL, temperature=0,
                                                       request_timeout=900)

See if it works or no.

Make sure you are passing "http://127.0.0.1:11434" to Ollama client from LlamaIndex. LlamaIndex agent is using these libs:

llama-index==0.10.23
llama-index-embeddings-langchain==0.1.2
llama-index-llms-ollama==0.1.2
llama-index-vector-stores-weaviate==0.1.4
llama-index-multi-modal-llms-ollama==0.1.3
llama-index-readers-file==0.1.12
llama-index-embeddings-huggingface==0.1.4
llama-index-vector-stores-qdrant==0.1.4
llama-index-embeddings-clip==0.1.4
sentence-transformers
weaviate-client==3.26.2
pypdf
python-box
typer[all]
fastapi==0.110.0
uvicorn[standard]
ollama==0.1.7
python-multipart
DrewThomasson commented 6 months ago

edit: ALSO THANK YOU FOR YOUR RESPONSE

Never mind I fixed it you were right i just didn't have it set up correctly

I just hand't downloaded the specific model that the config.yml had set

running

ollama run adrienbrault/nous-hermes2pro:Q5_K_M-json

or

ollama run llama3:8b-instruct-q5_K_M

fixed the issue I was having

Asif-droid commented 3 months ago

when running on docker hitting api: /api/v1/sparrow-llm/ingest having internal server error for this: weaviate.exceptions.WeaviateStartUpError: Weaviate did not start up in 5 seconds. Either the Weaviate URL http://localhost:8080/ is wrong or Weaviate did not start up in the interval given in 'startup_period'

I have started the weaviate-db container: curl localhost:8080 {"links":{"href":"/v1","name":"api v1","documentationHref":"https://weaviate.io/developers/weaviate/current/"}}

help me to resolve this.