Skip to main content

Tasks related to ollama

Project description

Zrb Ollama

zrb-ollama is a pypi package that acts as Ollama's wrapper, allowing you to incorporate LLM into your workflow.

Installation

You can install zrb-ollama by invoking the following command:

# From pypi
pip install zrb-ollama
# From github
pip install git+https://github.com/goFrendiAsgard/zrb-ollama.git@main
# From directory
pip install --use-feature=in-tree-build path/to/this/directory

Run Zrb Ollama

Once you install zrb-ollama, you can then run it by invoking the following command:

zrb-ollama "Why is the sky blue?"

When you talk to zrb-ollama, it will save your context history in ~/.zrb-ollama-context.json. Thus, you can continue the conversation and retain the context. For example, you can ask zrb-ollama "Explain in more detail".

Creating a PromptTask

You can also import zrb-ollama into your Zrb project and perform some fun things:

from zrb import runner
from zrb_ollama import PromptTask

chat = PromptTask(
    name='chat',
    model='mistral',
    prompt='echo {{ " ".join(input._args) if input._args | length > 0 else "tell me some fun fact" }}',  # noqa
    options={
        'temperature': 0.8,
        'num_gpu': 0
    },
    system_prompt='You are a code tutor. You eager to explain code in a very detail manner',  # noqa
    context_file='.ctx.json'
)
runner.register(chat)
zrb chat "Please explain the following Python script: $(cat fibo.py)"
zrb chat "Can you make it better?"

Configuration

You can configure Zrb Ollama using a few environment variables:

  • ZRB_OLLAMA_BASE_URL: Default Ollama base URL. if not specified, Zrb Ollama will use http://localhost:11434.
  • ZRB_OLLAMA_DEFAULT_MODEL: Default Ollama model. If not specified, Zrb Ollama will use mistral.

For maintainers

Publish to pypi

To publish zrb-ollama, you need to have a Pypi account:

You can also create a TestPypi account:

Once you have your API token, you need to create a ~/.pypirc file:

[distutils]
index-servers =
   pypi
   testpypi

[pypi]
  repository = https://upload.pypi.org/legacy/
  username = __token__
  password = pypi-xxx-xxx
[testpypi]
  repository = https://test.pypi.org/legacy/
  username = __token__
  password = pypi-xxx-xxx

To publish zrb-ollama, you can do the following command:

zrb plugin publish

Updating version

You can update zrb-ollama version by modifying the following section in pyproject.toml:

[project]
version = "0.0.2"

Adding dependencies

To add zrb-ollama dependencies, you can edit the following section in pyproject.toml:

[project]
dependencies = [
    "Jinja2==3.1.2",
    "jsons==1.6.3"
]

Adding script

To make zrb-package-name executable, you can edit the following section in pyproject.toml:

[project-scripts]
zrb-ollama = "zrb-ollama.__main__:hello"

This will look for hello callable inside of your __main__.py file

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

zrb_ollama-0.0.5.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

zrb_ollama-0.0.5-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file zrb_ollama-0.0.5.tar.gz.

File metadata

  • Download URL: zrb_ollama-0.0.5.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for zrb_ollama-0.0.5.tar.gz
Algorithm Hash digest
SHA256 f3ed5b26fb5f084d38511e98c78ed7710fae69be3049141aef8013b9fdba6b1b
MD5 c9c79319b2bb6d165fe1ae6d01220557
BLAKE2b-256 5c39304892718ac630a384aba179e178485464dd06385639882a678ef77a5514

See more details on using hashes here.

File details

Details for the file zrb_ollama-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: zrb_ollama-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for zrb_ollama-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ea7e54b3117e24947142a19cf1d12e81cc250273507039d11e91eaa2d74650be
MD5 66c7533ec389da186cbc09858f38eb18
BLAKE2b-256 3db3d50dc155c46e69f717e968b7f319586a182c4982073dfdadba0a7a209ddf

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