ollama / ollama/ollama-python

Alerting and stopping API request on failure

Open
#673 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.5k
Forks
1.2k
Avg merge
4m
Merged PRs (30d)
1

Description

Context: I've been developing a local RAG system with FastAPI using Ollama as the brains for embeddings and response creation. I've implemented asyncio within to avoid overloading the API but still have found an edge case where the process keeps running even after an error occurs blocking the API, so to test again after reviving the FastAPI server I need to open Windows Task Manager and kill the Ollama process to be able to make new requests.

Desire: Having a endpoint within the API that cancels any ongoing excecution and clears any queue pending so it can be called when handling errors.

Previous issues: I started by checking open issues realted to this and found two (287 and 492) that asked for something similar, however they are at least 1y old and had no good responses.

Other suggestions: People suggest using the generate and chat endpoints with parameter keep_alive set to 0, however I believe this may not be the solution since it requires the request to be taken and addressed.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the generate and chat endpoints and the keep_alive parameter, then review prior issues #287 and #492 for related cancellation behavior. Define how an API cancellation endpoint should stop ongoing execution and clear pending queue work, and verify that subsequent requests can run without manually terminating Ollama.

Written by the indexing model from the issue text.

Assessment

Tech stack
fastapi, ollama, python
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.