Skip to main content

LLM plugin providing access to local Ollama models using HTTP API

Project description

llm-ollama

PyPI Changelog Tests License

LLM plugin providing access to models running on local Ollama server.

Installation

Install this plugin in the same environment as LLM.

llm install llm-ollama

Usage

First, ensure that your Ollama server is running and that you have pulled some models. You can use ollama list to check what is locally available.

The plugin will query the Ollama server for the list of models. You can use llm ollama list-models to see the list; it should be the same as output by ollama list. All these models will be automatically registered with LLM and made available for prompting and chatting.

Assuming you have llama2:latest available, you can run a prompt using:

llm -m llama2:latest 'How much is 2+2?'

To start an interactive chat session:

llm chat -m llama2:latest
Chatting with llama2:latest
Type 'exit' or 'quit' to exit
Type '!multi' to enter multiple lines, then '!end' to finish
>

Model options

All models accept the following options, using -o name value syntax:

  • -o temperature 0.8: The temperature of the model. Increasing the temperature will make the model answer more creatively.

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd llm-ollama
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

llm install -e '.[test]'

To run the tests:

pytest

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

llm-ollama-0.1.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

llm_ollama-0.1.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file llm-ollama-0.1.0.tar.gz.

File metadata

  • Download URL: llm-ollama-0.1.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for llm-ollama-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9e13c51a1e58b881d2500a5968273d4fa2c354d90ac5de18df3ccb95d987ae97
MD5 acc3f4047c6b611e0f0f987a9951a4dc
BLAKE2b-256 695ff9e71f047905eb26827cbfb173e789f68ffc5541f2b96f7592b7a6f21c61

See more details on using hashes here.

File details

Details for the file llm_ollama-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: llm_ollama-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for llm_ollama-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b5e3a0bd3b555fea115c4e49edad32fef30fa0e3cd579254a5ed1fc7ddbc0710
MD5 fec33f9b49287a18b64ccc86334beec7
BLAKE2b-256 c3fba195b488c2177f385b6603138b8b4a34f519b4e27121d568d6f2648beccd

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