{"id":13861726,"url":"https://github.com/simonw/llm-mistral","last_synced_at":"2025-05-16T07:07:05.289Z","repository":{"id":212585155,"uuid":"731857813","full_name":"simonw/llm-mistral","owner":"simonw","description":"LLM plugin providing access to Mistral models using the Mistral API","archived":false,"fork":false,"pushed_at":"2025-05-07T21:27:20.000Z","size":47,"stargazers_count":177,"open_issues_count":2,"forks_count":16,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-07T21:47:11.298Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simonw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"simonw"}},"created_at":"2023-12-15T03:30:59.000Z","updated_at":"2025-05-07T21:24:28.000Z","dependencies_parsed_at":"2023-12-15T04:16:52.220Z","dependency_job_id":"e18110fc-fefb-431a-b3ed-3f808491e811","html_url":"https://github.com/simonw/llm-mistral","commit_stats":{"total_commits":30,"total_committers":3,"mean_commits":10.0,"dds":0.06666666666666665,"last_synced_commit":"aed678f7e82f53086be9973f40377ba57c1a344a"},"previous_names":["simonw/llm-mistral"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fllm-mistral","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fllm-mistral/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fllm-mistral/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fllm-mistral/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonw","download_url":"https://codeload.github.com/simonw/llm-mistral/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254485065,"owners_count":22078767,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-05T06:01:28.886Z","updated_at":"2025-05-16T07:07:00.277Z","avatar_url":"https://github.com/simonw.png","language":"Python","funding_links":["https://github.com/sponsors/simonw"],"categories":["Python"],"sub_categories":[],"readme":"# llm-mistral\n\n[![PyPI](https://img.shields.io/pypi/v/llm-mistral.svg)](https://pypi.org/project/llm-mistral/)\n[![Changelog](https://img.shields.io/github/v/release/simonw/llm-mistral?include_prereleases\u0026label=changelog)](https://github.com/simonw/llm-mistral/releases)\n[![Tests](https://github.com/simonw/llm-mistral/workflows/Test/badge.svg)](https://github.com/simonw/llm-mistral/actions?query=workflow%3ATest)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/llm-mistral/blob/main/LICENSE)\n\n[LLM](https://llm.datasette.io/) plugin providing access to [Mistral](https://mistral.ai) models using the Mistral API\n\n## Installation\n\nInstall this plugin in the same environment as LLM:\n```bash\nllm install llm-mistral\n```\n## Usage\n\nFirst, obtain an API key for [the Mistral API](https://console.mistral.ai/).\n\nConfigure the key using the `llm keys set mistral` command:\n```bash\nllm keys set mistral\n```\n```\n\u003cpaste key here\u003e\n```\nYou can now access the Mistral hosted models. Run `llm models` for a list.\n\nTo run a prompt through `mistral-tiny`:\n\n```bash\nllm -m mistral-tiny 'A sassy name for a pet sasquatch'\n```\nTo start an interactive chat session with `mistral-small`:\n```bash\nllm chat -m mistral-small\n```\n```\nChatting with mistral-small\nType 'exit' or 'quit' to exit\nType '!multi' to enter multiple lines, then '!end' to finish\n\u003e three proud names for a pet walrus\n1. \"Nanuq,\" the Inuit word for walrus, which symbolizes strength and resilience.\n2. \"Sir Tuskalot,\" a playful and regal name that highlights the walrus' distinctive tusks.\n3. \"Glacier,\" a name that reflects the walrus' icy Arctic habitat and majestic presence.\n```\nTo use a system prompt with `mistral-medium` to explain some code:\n```bash\ncat example.py | llm -m mistral-medium -s 'explain this code'\n```\n## Vision\n\nThe Pixtral models are capable of interpreting images. You can use those like this:\n\n```bash\nllm -m pixtral-large 'describe this image' \\\n  -a https://static.simonwillison.net/static/2025/two-pelicans.jpg\n```\nOutput:\n\n\u003e This image features two pelicans in flight against a clear blue sky. Pelicans are large water birds known for their long beaks and distinctive throat pouches, which they use for catching fish. In this photo, the birds are flying close to each other, showcasing their expansive wings and characteristic beaks. The clear sky provides a stark contrast, highlighting the details of their feathers and the graceful curves of their wings. The image captures a moment of synchronicity and elegance in nature.\n\nYou can pass filenames instead of URLs.\n\n## Schemas\n\nMistral models (with the exception of `codestral-mamba`) also support [schemas](https://llm.datasette.io/en/stable/schemas.html):\n```bash\nllm -m mistral-small --schema 'name,bio:one sentence' 'invent a cool dog'\n```\nOutput:\n```json\n{\n  \"name\": \"CyberHound\",\n  \"bio\": \"A futuristic dog with glowing cybernetic enhancements and the ability to hack into any system.\"\n}\n```\n\n## Model options\n\nAll three models accept the following options, using `-o name value` syntax:\n\n- `-o temperature 0.7`: The sampling temperature, between 0 and 1. Higher increases randomness, lower values are more focused and deterministic.\n- `-o top_p 0.1`: 0.1 means consider only tokens in the top 10% probability mass. Use this or temperature but not both.\n- `-o max_tokens 20`: Maximum number of tokens to generate in the completion.\n- `-o safe_mode 1`: Turns on [safe mode](https://docs.mistral.ai/platform/guardrailing/), which adds a system prompt to add guardrails to the model output.\n- `-o random_seed 123`: Set an integer random seed to generate deterministic results.\n- `-o prefix 'Prefix here`: Set a prefix that will be used for the start of the response. Try `{` to encourage JSON or `GlaDOS: ` to encourage a roleplay from a specific character.\n\n## Available models\n\nRun `llm models` for a full list of Mistral models. This plugin configures the following alias shortcuts:\n\n\u003c!-- [[[cog\nimport cog, json\nfrom llm_mistral import DEFAULT_ALIASES\nfor model_id, alias in DEFAULT_ALIASES.items():\n    cog.out(f\"- `{alias}` for `{model_id}`\\n\")\n]]] --\u003e\n- `mistral-tiny` for `mistral/mistral-tiny`\n- `mistral-nemo` for `mistral/open-mistral-nemo`\n- `mistral-small-2312` for `mistral/mistral-small-2312`\n- `mistral-small-2402` for `mistral/mistral-small-2402`\n- `mistral-small-2409` for `mistral/mistral-small-2409`\n- `mistral-small-2501` for `mistral/mistral-small-2501`\n- `mistral-small` for `mistral/mistral-small-latest`\n- `mistral-medium` for `mistral/mistral-medium`\n- `mistral-large` for `mistral/mistral-large-latest`\n- `codestral-mamba` for `mistral/codestral-mamba-latest`\n- `codestral` for `mistral/codestral-latest`\n- `ministral-3b` for `mistral/ministral-3b-latest`\n- `ministral-8b` for `mistral/ministral-8b-latest`\n- `pixtral-12b` for `mistral/pixtral-12b-latest`\n- `pixtral-large` for `mistral/pixtral-large-latest`\n\u003c!-- [[[end]]] --\u003e\n\n\n## Refreshing the model list\n\nMistral sometimes release new models.\n\nTo make those models available to an existing installation of `llm-mistral` run this command:\n```bash\nllm mistral refresh\n```\nThis will fetch and cache the latest list of available models. They should then become available in the output of the `llm models` command.\n\n## Embeddings\n\nThe Mistral [Embeddings API](https://docs.mistral.ai/platform/client#embeddings) can be used to generate 1,024 dimensional embeddings for any text.\n\nTo embed a single string:\n\n```bash\nllm embed -m mistral-embed -c 'this is text'\n```\nThis will return a JSON array of 1,024 floating point numbers.\n\nThe [LLM documentation](https://llm.datasette.io/en/stable/embeddings/index.html) has more, including how to embed in bulk and store the results in a SQLite database.\n\nSee [LLM now provides tools for working with embeddings](https://simonwillison.net/2023/Sep/4/llm-embeddings/) and [Embeddings: What they are and why they matter](https://simonwillison.net/2023/Oct/23/embeddings/) for more about embeddings.\n\n## Development\n\nTo set up this plugin locally, first checkout the code. Then create a new virtual environment:\n```bash\ncd llm-mistral\npython3 -m venv venv\nsource venv/bin/activate\n```\nNow install the dependencies and test dependencies:\n```bash\nllm install -e '.[test]'\n```\nTo run the tests:\n```bash\npytest\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonw%2Fllm-mistral","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonw%2Fllm-mistral","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonw%2Fllm-mistral/lists"}