Skip to main content

LLM plugin providing access to the free Samba models using the samba API

Project description

llm-samba

PyPI Tests License

Plugin for LLM providing access to multiple free models using the samba API.

Installation

Install this plugin in the same environment as LLM:

llm install llm-samba # or if not published
llm install -e ./path/to/llm-samba

Usage

First, obtain an API key signing up for the samba API

Configure the key using the llm keys set samba command:

llm keys set samba
# Paste your API key here, should be like the following:
# 8n1610xc-996c-4f1e-b63b-857d73b7eba3

You can also set it via environment variable:

export SAMBA_API_KEY="your-api-key-here"

You can now access the following free models:

  • Meta-Llama-3.1-405B-Instruct
  • Meta-Llama-3.1-70B-Instruct
  • Meta-Llama-3.1-8B-Instruct
  • Meta-Llama-3.2-1B-Instruct
  • Meta-Llama-3.2-3B-Instruct
  • Meta-Llama-3.3-70B-Instruct
  • Meta-Llama-Guard-3-8B
  • Qwen2.5-72B-Instruct
  • Qwen2.5-Coder-32B-Instruct
  • QwQ-32B-Preview

Run llm samba models to see the list of available models.

To run a prompt through a specific model:

llm -m Meta-Llama-3.1-405B-Instruct 'What is the meaning of life, the universe, and everything?'

To start an interactive chat session:

llm chat -m Meta-Llama-3.1-405B-Instruct

Example chat session:

Chatting with Meta-Llama-3.1-405B-Instruct
Type 'exit' or 'quit' to exit
Type '!multi' to enter multiple lines, then '!end' to finish
> Tell me a joke about programming

To use a system prompt to give the model specific instructions:

cat example.py | llm -m Meta-Llama-3.1-405B-Instruct -s 'explain this code in a humorous way'

adding aliases:

In $HOME/.config/io.datasette.llm/aliases.json add an alias for your preferred model. The key is the alias, the value is the model name here is some example:

{
    "llama3.1-405": "Meta-Llama-3.1-405B-Instruct",
    "llama3.3-70": "Meta-Llama-3.3-70B-Instruct",
    "llama3.1-8": "Meta-Llama-3.1-8B-Instruct",
    "llama3.2-1": "Meta-Llama-3.2-1B-Instruct",
    "llama3.2-3": "Meta-Llama-3.2-3B-Instruct",
    "llama3.3-70": "Meta-Llama-3.3-70B-Instruct",
    "llama-guard": "Meta-Llama-Guard-3-8B",
    "qwen": "Qwen2.5-72B-Instruct",
    "qwen-coder": "Qwen2.5-Coder-32B-Instruct",
    "qwq": "QwQ-32B-Preview"
}

Model Options

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

  • -o temperature 0.7: The sampling temperature, between 0 and 1. Higher values like 0.8 increase randomness, while lower values like 0.2 make the output more focused and deterministic.
  • -o max_tokens 100: Maximum number of tokens to generate in the completion.

Example with options:

llm -m Meta-Llama-3.1-405B-Instruct -o temperature 0.2 -o max_tokens 50 'Write a haiku about AI'

Development

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

git clone https://github.com/Tatarotus/llm-samba.git
cd samba
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest

Available Commands

List available models:

llm samba models

Check your current configuration:

llm samba config

API Documentation

This plugin uses the openai API. For more information about the API, see:

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

Apache License 2.0

Models

The following models are available:

  • Meta-Llama-3.1-405B-Instruct
  • Meta-Llama-3.1-70B-Instruct
  • Meta-Llama-3.1-8B-Instruct
  • Meta-Llama-3.2-1B-Instruct
  • Meta-Llama-3.2-3B-Instruct
  • Meta-Llama-3.3-70B-Instruct
  • Meta-Llama-Guard-3-8B
  • Qwen2.5-72B-Instruct
  • Qwen2.5-Coder-32B-Instruct
  • QwQ-32B-Preview

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_samba-0.1.0.tar.gz (10.5 kB view details)

Uploaded Source

Built Distributions

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

llm_samba-0.1.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

llm_samba-0.1-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file llm_samba-0.1.0.tar.gz.

File metadata

  • Download URL: llm_samba-0.1.0.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for llm_samba-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a7a9517badc83dd451683bb3807a9b356beab4540fec35817b7a64bc364011cf
MD5 43950e3540bde9649a28ec34635b3030
BLAKE2b-256 29f5cf60b3c1d0f9d9ad0966ab690519d3e15ec2ee80face887a995d02d71b01

See more details on using hashes here.

File details

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

File metadata

  • Download URL: llm_samba-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for llm_samba-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 28ab401a0f7ad96f5089814f7606ce8a5194a8d2fa41ffa2b84dd8257cbf2a54
MD5 5664ee44e5d3d45110341f341eb07c3f
BLAKE2b-256 d50b69a1106eb3ff0fa4554883ecec008239de07ab26912e5a58aae2f2b3cf76

See more details on using hashes here.

File details

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

File metadata

  • Download URL: llm_samba-0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for llm_samba-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 48123df8c306013bb1c5f99cdee603fdcf128b898eb0e2853ec685c7d73ffaaa
MD5 ea64da55f062dcf5242d5e4031d55291
BLAKE2b-256 4828eeb9de5e08017ee881cca8770165d604c3e691408f15dbbbd626deeb6862

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