Metadata-Version: 2.1
Name: pai-repl
Version: 0.1.12
Summary: Python REPL with LLM integration
Author: Alex Wiles
Author-email: xwiles@gmail.com
Requires-Python: >=3.8,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: llama-cpp-python (>=0.1.78,<0.2.0)
Requires-Dist: openai (==0.27.8)
Requires-Dist: prompt_toolkit (==3.0.39)
Requires-Dist: pydantic (==2.1.1)
Requires-Dist: toml (>=0.10.2,<0.11.0)
Description-Content-Type: text/markdown

# pai: It's like having code interpreter in your Python REPL
A Python REPL with a built in AI agents and code generation. REPL history is used for LLM context. Supports OpenAI and llama.cpp

You and the AI have access to the same data, so you can guide the AI and move seamlessly between the two.

## Installation
```
pip install pai-repl
```

## Command line usage
When you invoke `pai`, it will start an interactive Python REPL with a built in AI agent.

```
$ pai
INP [0]>
```


Use with OpenAI. The default model is `gpt-4`
```
$ export OPENAI_API_KEY=<your key>
$ pai
```

Specify OpenAI model
```
$ pai --openai gpt-3.5-turbo
```

Use with llama.cpp compatible models
```
$ pai --llama <path to model>
```

Prompt pai from the command line
```
$ pai "find the largest file in the current directory"
```

## AI Agent
Prompt the AI agent to complete a task by typing `pai: <prompt>`. The AI agent will continuously generate and run code until it completes the task or fails. All generated code must be approved by the user.

The task: "pai: there is a csv in the current directory. find it and give me a full analysis"

<img src="./assets/agent.gif" />

## Generate code

Generate code in the REPL by type `gen: <prompt>`. The generated code will be displayed and you can accept, edit or cancel it.

<img src="./assets/gen.gif" />
