llm-python


Namellm-python JSON
Version 0.1 PyPI version JSON
download
home_page
SummaryRun a Python interpreter in the LLM virtual environment
upload_time2023-10-27 05:38:43
maintainer
docs_urlNone
authorSimon Willison
requires_python
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # llm-python

[![PyPI](https://img.shields.io/pypi/v/llm-python.svg)](https://pypi.org/project/llm-python/)
[![Changelog](https://img.shields.io/github/v/release/simonw/llm-python?include_prereleases&label=changelog)](https://github.com/simonw/llm-python/releases)
[![Tests](https://github.com/simonw/llm-python/workflows/Test/badge.svg)](https://github.com/simonw/llm-python/actions?query=workflow%3ATest)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/llm-python/blob/main/LICENSE)

Run a Python interpreter in the LLM virtual environment

## Installation

Install this plugin in the same environment as [LLM](https://llm.datasette.io/).
```bash
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

```bash
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:
```bash
llm python
```
```pycon
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:
```bash
cd llm-python
python3 -m venv venv
source venv/bin/activate
```
Now install the dependencies and test dependencies:
```bash
llm install -e '.[test]'
```
To run the tests:
```bash
pytest
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "llm-python",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Simon Willison",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/f2/1d/458635c7ba0fd7ad5b26c356cd489791afd00b68dfdbc09159c13d8e3b7d/llm-python-0.1.tar.gz",
    "platform": null,
    "description": "# llm-python\n\n[![PyPI](https://img.shields.io/pypi/v/llm-python.svg)](https://pypi.org/project/llm-python/)\n[![Changelog](https://img.shields.io/github/v/release/simonw/llm-python?include_prereleases&label=changelog)](https://github.com/simonw/llm-python/releases)\n[![Tests](https://github.com/simonw/llm-python/workflows/Test/badge.svg)](https://github.com/simonw/llm-python/actions?query=workflow%3ATest)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/llm-python/blob/main/LICENSE)\n\nRun a Python interpreter in the LLM virtual environment\n\n## Installation\n\nInstall this plugin in the same environment as [LLM](https://llm.datasette.io/).\n```bash\nllm install llm-python\n```\n## Usage\n\nThis plugin adds a new `python` command to LLM. This executes Python in the same virtual environment as LLM itself.\n\nYou can use this to check the Python version\n\n```bash\nllm python --version\n# Should output 'Python 3.10.10' or similar\n```\nOr to start a Python shell. In that shell you can import `llm` and use it to interact with models:\n```bash\nllm python\n```\n```pycon\nPython 3.10.10 (main, Mar 21 2023, 13:41:05) [Clang 14.0.6 ] on darwin\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import llm\n>>> m = llm.get_model(\"mistral-7b-instruct-v0\")\n>>> print(m.prompt(\"Three fun facts about pelicans\"))\n1. 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 \u201cplunge diving\u201d and it allows them to catch up to six pounds of fish in one dive!\n2. Pelicans have an incredible memory when it comes to finding food. They can remember the location of every single fishing spot they\u2019ve ever visited, even if it\u2019s been years since they last went there. This is because they use a combination of visual cues and the earth\u2019s magnetic field to navigate.\n3. Pelicans are incredibly social birds that form large flocks called \u201crookeries.\u201d 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.\n```\n\n## Development\n\nTo set up this plugin locally, first checkout the code. Then create a new virtual environment:\n```bash\ncd llm-python\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",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Run a Python interpreter in the LLM virtual environment",
    "version": "0.1",
    "project_urls": {
        "CI": "https://github.com/simonw/llm-python/actions",
        "Changelog": "https://github.com/simonw/llm-python/releases",
        "Homepage": "https://github.com/simonw/llm-python",
        "Issues": "https://github.com/simonw/llm-python/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5985ebd4a6374dca29619b3274e52a164359db99aa856b4b67e983de24ab4f1b",
                "md5": "8d11b7e7e488d72775ef773e258f3a93",
                "sha256": "44c4dc50dbd0cb6c7f3c7b3b6551db9deb2dd044317ac816e385aff646ffbb0f"
            },
            "downloads": -1,
            "filename": "llm_python-0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8d11b7e7e488d72775ef773e258f3a93",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 7207,
            "upload_time": "2023-10-27T05:38:42",
            "upload_time_iso_8601": "2023-10-27T05:38:42.063512Z",
            "url": "https://files.pythonhosted.org/packages/59/85/ebd4a6374dca29619b3274e52a164359db99aa856b4b67e983de24ab4f1b/llm_python-0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f21d458635c7ba0fd7ad5b26c356cd489791afd00b68dfdbc09159c13d8e3b7d",
                "md5": "1e2f792dd18bd9b75189e563b5912bba",
                "sha256": "d6658ce60b2920eed3aa4c772ef7b94fd40291bb17a27fa5573f10f803b9d2e9"
            },
            "downloads": -1,
            "filename": "llm-python-0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "1e2f792dd18bd9b75189e563b5912bba",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7102,
            "upload_time": "2023-10-27T05:38:43",
            "upload_time_iso_8601": "2023-10-27T05:38:43.749799Z",
            "url": "https://files.pythonhosted.org/packages/f2/1d/458635c7ba0fd7ad5b26c356cd489791afd00b68dfdbc09159c13d8e3b7d/llm-python-0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-27 05:38:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "simonw",
    "github_project": "llm-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "llm-python"
}
        
Elapsed time: 0.12409s