Skip to main content

LLM plugin for the Meta AI API

Project description

llm-meta-ai

PyPI Tests Changelog License

LLM plugin for models hosted by the Meta AI API

Installation

Install this plugin in the same environment as LLM:

llm install llm-meta-ai

Usage

First, obtain an API key for the Meta AI API and set it as a key called meta-ai:

llm keys set meta-ai
# Paste key here

You can also set the key using the META_AI_TOKEN environment variable.

Run llm models to get a full list of available models. Models are prefixed with meta-ai/, for example:

llm -m meta-ai/muse-spark-1.1 "What is the capital of France?"

You can also list just the Meta AI models like this:

llm meta-ai models

Add --json for the full JSON model definitions.

The list of models is fetched from the API and cached for an hour. Run this command to refresh it:

llm meta-ai refresh

Reasoning

These are reasoning models: they think before they answer, and the reasoning tokens count towards your output token budget - they are reported in the completion_tokens_details.reasoning_tokens key in llm logs --json. Control how much the model reasons with the reasoning_effort option, one of none, minimal, low, medium, high or xhigh (not every model supports every value):

llm -m meta-ai/muse-spark-1.1 'What is the capital of France?' -o reasoning_effort low

Rate limits and max_tokens

Requests count against an output token rate limit before they run. Setting a token limit on your prompts helps avoid exhausting your quota - leave generous room for reasoning tokens:

llm -m meta-ai/muse-spark-1.1 'A short poem about a pelican' -o max_tokens 2000

Rate limits are applied per model - a model that returns 429 errors even after a long wait may not be enabled for your team, even if it shows up in the models list.

Attachments

Models accept images (PNG, JPEG, WebP, GIF, ICO) and PDFs:

llm -m meta-ai/muse-spark-1.1 'Describe this image' \
  -a https://static.simonwillison.net/static/2024/pelicans.jpg

The API also supports MP4 video via its Files API, which this plugin does not yet use.

Tools

Meta AI models support tools:

llm -m meta-ai/muse-spark-1.1 -T llm_time 'What time is it?' --td

Schemas

They support schemas as well:

llm -m meta-ai/muse-spark-1.1 'Invent a dog' --schema 'name, age int, breed'

Development

To contribute to this library, first checkout the code. Then create a new virtual environment:

cd llm-meta-ai
python -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

python -m pip install -e . --group dev

To run the tests:

python -m 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_meta_ai-0.1.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

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

llm_meta_ai-0.1-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llm_meta_ai-0.1.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for llm_meta_ai-0.1.tar.gz
Algorithm Hash digest
SHA256 253beba954b712ac9fa10848228634a08f3a9d2ea1745453d20854cd6128e735
MD5 2fbead8faa21182f901f4653f89ec898
BLAKE2b-256 f52df29bd9236217592dc4eabffdd86401acb30b3c86c5e8894ba0ded8a4e9b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_meta_ai-0.1.tar.gz:

Publisher: publish.yml on simonw/llm-meta-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: llm_meta_ai-0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for llm_meta_ai-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b5dd561ee13f09938b43728a939b20ebe06e2a3501d99b0a45ed1b479d98726c
MD5 617c7cb6da2bf82e7f760331907d8625
BLAKE2b-256 8a1130e33e49ca05386ac9b95413d97420977224510b24e03fe675ffc18b9d14

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_meta_ai-0.1-py3-none-any.whl:

Publisher: publish.yml on simonw/llm-meta-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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