Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lucasrcezimbra/llm-jupyter
LLM plugin to run an IPython interpreter or notebook in the LLM virtual environment and use the LLM from within the interpreter or notebook as a magic function.
https://github.com/lucasrcezimbra/llm-jupyter
hacktoberfest ipython jupyter llm llm-ipython llm-jupyter llm-python python
Last synced: 3 days ago
JSON representation
LLM plugin to run an IPython interpreter or notebook in the LLM virtual environment and use the LLM from within the interpreter or notebook as a magic function.
- Host: GitHub
- URL: https://github.com/lucasrcezimbra/llm-jupyter
- Owner: lucasrcezimbra
- License: apache-2.0
- Created: 2024-05-12T15:31:33.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-10-08T11:46:47.000Z (4 months ago)
- Last Synced: 2024-10-13T11:21:53.057Z (4 months ago)
- Topics: hacktoberfest, ipython, jupyter, llm, llm-ipython, llm-jupyter, llm-python, python
- Language: Python
- Homepage:
- Size: 337 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# llm-jupyter
[](https://pypi.org/project/llm-jupyter/)
[](https://github.com/lucasrcezimbra/llm-jupyter/releases)
[](https://github.com/lucasrcezimbra/llm-jupyter/actions?query=workflow%3ATest)
[](https://github.com/lucasrcezimbra/llm-jupyter/blob/main/LICENSE)Run a IPython interpreter in the [LLM](https://github.com/simonw/llm) virtual environment
## Installation
Install this plugin in the same environment as [LLM](https://llm.datasette.io/).
```bash
pipx install llm
llm install llm-jupyter
```
## Usage### IPython
This plugin adds a new `ipython` command to LLM. This executes IPython in the same virtual environment as LLM itself.You can use this to check the Python version
```bash
llm ipython --version
# Should output '8.20.0' or similar
```Or to start a IPython shell. In that shell you can import `llm` and use it to interact with models:
```bash
llm ipython
``````python
In [1]: %llm 'Who are you?'# LLM output will be set as the next input
In [2]: print("I am a Python programmer using Jupyter Notebook.")
I am a Python programmer using Jupyter Notebook.In [3]: %llm --help
usage: __main__.py [-h] [--print] [--model MODEL] [--system SYSTEM] [prompt ...]positional arguments:
prompt Prompt to useoptional arguments:
-h, --help show this help message and exit
--print, -p Only print the output
--model MODEL, -m MODEL
Model to use
--system SYSTEM, -s SYSTEM
System prompt to use
```https://github.com/lucasrcezimbra/llm-jupyter/assets/7042915/b7f8a9ec-d269-4b24-bac3-a01ad6802032
### Notebook
This plugin also adds a new `notebook` command to LLM. This executes a Jupyter Notebook in the same virtual environment as LLM itself.```bash
llm notebook
``````python
%load_ext llm_jupyter.magic%llm 'Who are you?'
# LLM output will be set as the next input
print("I am a Python programmer using Jupyter Notebook.")
```https://github.com/lucasrcezimbra/llm-jupyter/assets/7042915/58c63b2e-3a7b-43f1-b0aa-ab3daf2e9810
## Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
```bash
git clone [email protected]:lucasrcezimbra/llm-jupyter.git
cd llm-jupyter
python -m venv .venv
source .venv/bin/activate
pip install -e .[test]
```
Now install the dependencies and test dependencies:
```bash
llm install -e '.[test]'
```
To run the tests:
```bash
pytest
```