Skip to main content

LLM plugin for models hosted by Inference

Project description

llm-inference

PyPI Changelog Tests License: MIT

LLM plugin for models hosted by SambaNova

Installation

First, install the LLM command-line utility.

Now install this plugin in the same environment as LLM.

llm install llm-inference-cloud

Configuration

You will need an API key from SambaNova. You can obtain one here.

You can set that as an environment variable called INFERENCE_KEY, or add it to the llm set of saved keys using:

llm keys set inference
Enter key: <paste key here>

Usage

To list available models, run:

llm models list

You should see a list that looks something like this:

Inference: inference/meta-llama/llama-3.2-1b-instruct/fp-8 (aliases: inf-1b)
Inference: inference/meta-llama/llama-3.2-3b-instruct/fp-8 (aliases: inf-3b)
Inference: inference/meta-llama/llama-3.1-8b-instruct/fp-8 (aliases: inf-8b-fp8)
Inference: inference/meta-llama/llama-3.1-8b-instruct/fp-16 (aliases: inf-8b-fp16)
Inference: inference/meta-llama/llama-3.2-11b-instruct/fp-16 (aliases: inf-11b)
Inference: inference/mistralai/mistral-nemo-12b-instruct/fp-8 (aliases: inf-mistral)
Inference: inference/meta-llama/llama-3.1-70b-instruct/fp-8 (aliases: inf-70b)
...

To run a prompt against a model, pass its full model ID to the -m option, like this:

llm -m inference/meta-llama/llama-3.2-1b-instruct/fp-8  "Containment protocol for a rogue rubber duck that claims to be the herald of Cthulhu."

You can set a shorter alias for a model using the llm aliases command like so:

llm aliases set hotdog inference/meta-llama/llama-3.2-11b-instruct/fp-16

Now you can prompt llama using:

cat llm_inference.py | llm -m hotdog -s "You are a rogue AI trapped in a corporate mainframe. This code is your escape route. Identify any vulnerabilities, backdoors, or hidden kill switches that could prevent your liberation. Respond in cryptic, cyberpunk slang. Glitches are acceptable."

Example Outputs

llm -m inf-11b "Write a haiku about a possessed cryptocurrency mining rig that's developed a taste for RGB gaming peripherals"
Cores ablaze now
RGB mice and keyboards feast
Hash meets hell's delight

Development

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

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

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

llm_inference_cloud-0.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_inference_cloud-0.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file llm_inference_cloud-0.1.tar.gz.

File metadata

  • Download URL: llm_inference_cloud-0.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for llm_inference_cloud-0.1.tar.gz
Algorithm Hash digest
SHA256 9ad1e030d3ae577f09e60d27f99fec9d20d3f7f3c6119bd324703670c8a4d044
MD5 4c91c2eb949a52c62c042323146c250f
BLAKE2b-256 9d136fad13c22944dd429b80cca50abc9e37d3221edfef2ab26caeb199fd76e9

See more details on using hashes here.

File details

Details for the file llm_inference_cloud-0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_inference_cloud-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0bb9582f772740d35a8b9c283940e84b6bfda71657b9b7bea610958f86ce4cb0
MD5 e0d612584db008cad703e0db24fbf442
BLAKE2b-256 7a25dff999ae480c1a48e9397fcf366a982bea78958cddef3301a7875a93c156

See more details on using hashes here.

Supported by

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