Skip to main content

The Oshepherd guiding the Ollama(s) inference orchestration.

Project description

oshepherd

The Oshepherd guiding the Ollama(s) inference orchestration.

A centralized Flask API service, using Celery (RabbitMQ + Redis) to orchestrate multiple Ollama servers as workers.

Install

pip install oshepherd

Usage

  1. Setup RabbitMQ and Redis:

    Celery uses RabbitMQ as message broker, and Redis as backend, you'll need to create one instance for each. You can create small instances for free in cloudamqp.com and redislabs.com respectively.

  2. Setup Flask API Server:

    # define configuration env file
    #   use credentials for redis and rabbitmq
    cp .api.env.template .api.env
    
    # start api
    oshepherd start-api --env-file .api.env
    
  3. Setup Celery/Ollama Worker(s):

    # install ollama https://ollama.com/download
    ollama run mistral
    
    # define configuration env file
    #   use credentials for redis and rabbitmq
    cp .worker.env.template .worker.env
    
    # start worker
    oshepherd start-worker --env-file .worker.env
    
  4. Done, now you're ready to execute Ollama completions remotely. You can point your Ollama client to your oshepherd api server by setting the host, and it will return your requested completions from any of the workers:

    import ollama
    client = ollama.Client(host="http://127.0.0.1:5001")
    ollama_response = client.generate({"model": "mistral", "prompt": "Why is the sky blue?"})
    
    import { Ollama } from "ollama/browser";
    const ollama = new Ollama({ host: "http://127.0.0.1:5001" });
    const ollamaResponse = await ollama.generate({
        model: "mistral",
        prompt: "Why is the sky blue?",
    });
    
    • Raw http request:
    curl -X POST -H "Content-Type: application/json" -L http://127.0.0.1:5001/api/generate/ -d '{
        "model": "mistral",
        "prompt":"Why is the sky blue?"
    }'
    

Words of advice 🚨

This package is in alpha, its architecture and api might change in the near future. Currently this is getting tested in a controlled environment by real users, but haven't been audited, nor tested thorugly. Use it at your own risk.

Disclaimer on Support

As this is an alpha version, support and responses might be limited. We'll do our best to address questions and issues as quickly as possible.

Contribution Guidelines

We welcome contributions! If you find a bug or have suggestions for improvements, please open an issue or submit a pull request. Before creating a new issue/pull request, take a moment to search through the existing issues/pull requests to avoid duplicates.

Conda Support

To run and build locally you can use conda:

conda create -n oshepherd python=3.8
conda activate oshepherd
pip install -r requirements.txt

# install oshepherd
pip install -e .
Tests

Follow usage instructions to start api server and celery worker using a local ollama, and then run the tests:

pytest -s tests/

Author

This is a project developed and maintained by mnemonica.ai.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oshepherd-0.0.6.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

oshepherd-0.0.6-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file oshepherd-0.0.6.tar.gz.

File metadata

  • Download URL: oshepherd-0.0.6.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.19

File hashes

Hashes for oshepherd-0.0.6.tar.gz
Algorithm Hash digest
SHA256 cabae9dd661f442d4b7d5871e8bc2be6c10196b012bddc1bb637628e3d6319e8
MD5 9e9d8bfbebca475c3cb739b38f8bd346
BLAKE2b-256 7f856a3d23c036b089bcd688b636c2208dfc2b79cd1a3b16fe931775874d4c58

See more details on using hashes here.

File details

Details for the file oshepherd-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: oshepherd-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.19

File hashes

Hashes for oshepherd-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c63eb78b1413424caf6c5fa26f229bd2bba7561236803ef209f55ec097617073
MD5 69f32c2dcc63fad7ef8ab9807788239c
BLAKE2b-256 3b9ecc88243d13c069b7b7019dc9ad611617bfcc340f19d9f7fb607431400181

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page