# ag-llm

A Python package that integrates LLM functionality directly into your Python shell experience.

## Installation

```bash
uv install ag-llm
```

Or alternatively:

```bash
pip install ag-llm
```

## Usage

Once installed, you can use `ag` directly in your Python shell with a simple syntax:

```python
import ag
ag/"how are you"
```

This sends your query to the default LLM and streams the response directly in your terminal with beautiful markdown rendering thanks to [Streamdown](https://github.com/day50-dev/Streamdown).

## Features

- **Direct Python Integration**: Use natural Python syntax with the `/` operator
- **Streaming Responses**: Get real-time output as the model generates responses
- **Markdown Rendering**: Beautifully formatted output with code highlighting
- **IPython Integration**: Automatically hooks into IPython for seamless usage
- **Simple Setup**: Just import and start querying

## Requirements

- Python >= 3.8
- [llm](https://github.com/simonw/llm) for LLM integration
- [streamdown](https://github.com/day50-dev/Streamdown) for markdown rendering

## Configuration

The package uses the default configuration from the `llm` package for model selection. You can configure your preferred model using:

```bash
llm models default your-model-name
```

See the [LLM documentation](https://github.com/simonw/llm) for more configuration options.

## Example

```python
import ag

# Simple query
ag/"What is the capital of France?"

# More complex query
ag/"Explain quantum computing in simple terms"
```

## How It Works

When you use `ag/"your query"`, the package:

1. Sends your query to the configured LLM model via the `llm` package
2. Streams the response token by token
3. Renders the output using Streamdown for beautiful formatting
4. Handles all the complexity behind the scenes

## Development

To develop on this package:

```bash
git clone [repository-url]
cd ag-llm
uv install
```

## License

MIT