Skip to main content

llm-python

PyPI Changelog Tests License

Run a Python interpreter in the LLM virtual environment

Installation

Install this plugin in the same environment as LLM.

llm install llm-python

Usage

This plugin adds a new python command to LLM. This executes Python in the same virtual environment as LLM itself.

You can use this to check the Python version

llm python --version
# Should output 'Python 3.10.10' or similar

Or to start a Python shell. In that shell you can import llm and use it to interact with models:

llm python
Python 3.10.10 (main, Mar 21 2023, 13:41:05) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import llm
>>> m = llm.get_model("mistral-7b-instruct-v0")
>>> print(m.prompt("Three fun facts about pelicans"))
1. Pelicans have a unique method of hunting for food. They fly high above the water and then fold their wings into a disc shape, creating a large scoop that they use to catch fish. This technique is called “plunge diving” and it allows them to catch up to six pounds of fish in one dive!
2. Pelicans have an incredible memory when it comes to finding food. They can remember the location of every single fishing spot they’ve ever visited, even if it’s been years since they last went there. This is because they use a combination of visual cues and the earth’s magnetic field to navigate.
3. Pelicans are incredibly social birds that form large flocks called “rookeries.” These rookeries can contain thousands of pelicans, and they are often found in areas with abundant food sources such as coastlines or offshore islands. In these groups, pelicans will engage in a variety of behaviors, including preening, grooming, and even playing with one another.

Development

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

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

Now install the dependencies and test dependencies:

llm install -e '.[test]'

To run the tests:

pytest

Release files for llm-python 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llm-python 0.1
File Size Uploaded
llm-python-0.1.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llm-python 0.1
File Interpreter ABI Platform
llm_python-0.1-py3-none-any.whl Python 3 none any Details

Total release size: 14.3 kB

Release files / llm-python-0.1.tar.gz

Download URL llm-python-0.1.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d6658ce60b2920eed3aa4c772ef7b94fd40291bb17a27fa5573f10f803b9d2e9
BLAKE2b-256 checksum
How to use checksums
f21d458635c7ba0fd7ad5b26c356cd489791afd00b68dfdbc09159c13d8e3b7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / llm_python-0.1-py3-none-any.whl

Download URL llm_python-0.1-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
44c4dc50dbd0cb6c7f3c7b3b6551db9deb2dd044317ac816e385aff646ffbb0f
BLAKE2b-256 checksum
How to use checksums
5985ebd4a6374dca29619b3274e52a164359db99aa856b4b67e983de24ab4f1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page