Metadata-Version: 2.4
Name: docbuddy
Version: 0.6.0
Summary: Add an AI Assistant to your `/docs` page.
Project-URL: Homepage, https://github.com/pearsonkyle/docbuddy
Project-URL: Repository, https://github.com/pearsonkyle/docbuddy
Author: Kyle Pearson
License: MIT License
        
        Copyright (c) 2024 Kyle Pearson
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: docs,fastapi,llm,openai,swagger
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.9
Requires-Dist: fastapi>=0.95.0
Requires-Dist: jinja2>=3.0.0
Requires-Dist: starlette>=0.27.0
Provides-Extra: dev
Requires-Dist: bandit>=1.7.0; extra == 'dev'
Requires-Dist: httpx>=0.23.0; extra == 'dev'
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: pre-commit; extra == 'dev'
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Requires-Dist: uvicorn[standard]>=0.20.0; extra == 'dev'
Description-Content-Type: text/markdown

# Documentation Buddy

[![CI](https://github.com/pearsonkyle/swagger-llm-ui/actions/workflows/ci.yml/badge.svg)](https://github.com/pearsonkyle/swagger-llm-ui/actions/workflows/ci.yml)
[![PyPI version](https://badge.fury.io/py/docbuddy.svg)](https://badge.fury.io/py/docbuddy)
[![Python versions](https://img.shields.io/pypi/pyversions/docbuddy.svg)](https://pypi.org/project/docbuddy/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Downloads](https://static.pepy.tech/badge/docbuddy)](https://pepy.tech/project/docbuddy)
[![FastAPI](https://img.shields.io/badge/FastAPI-0.100+-green.svg)](https://fastapi.tiangolo.com/)

> Add an AI assistant to your `/docs` page.

### Try the [Standalone Demo](https://pearsonkyle.github.io/DocBuddy/)

## Installation

```bash
pip install docbuddy
```

Run the standalone page locally with the command:

```bash
docbuddy --port 9000
```

## Python Integration

```python
from fastapi import FastAPI
from docbuddy import setup_docs

app = FastAPI()
setup_docs(app)  # replaces default /docs
```

That's it! Visit `/docs`

| API Explorer | Chat Interface |
|--------------|----------------|
| ![API Explorer](examples/api.png) | ![Chat Interface with Tools](examples/tools.png) |

| Workflow Panel | LLM Settings |
|---------------|--------------|
| ![Workflow Panel](examples/workflow.png) | ![LLM Settings](examples/settings.png) |

## Features

- 💬 Chat interface with full OpenAPI context
- 🤖 LLM Settings panel with local providers (Ollama, LM Studio, vLLM, Custom)
- 🔗 Tool-calling for API Requests
- 🎨 Dark/light theme support

## Using the Chat

Ask questions like:
  - "What endpoints are available?"
  - "Create a curl cmd for adding a new user"
  - "Ping health"

Enable tool calling in the settings to allow the assistant to make API requests on your behalf.

## Standalone Mode

If you prefer manual control, run DocBuddy from the repo root:

1. Run `python3 -m http.server 8080` from the repo root
2. Visit in your browser [http://localhost:8080/docs/index.html](http://localhost:8080/docs/index.html)

> **Note:** Due to browser security restrictions (CORS), if you want to use local LLMs (Ollama, LM Studio, vLLM), you must run DocBuddy locally instead of from the GitHub Pages hosted version.

## LLM Settings

1. Choose your local LLM provider (Ollama, LM Studio, vLLM, or Custom)
2. Enter the API endpoint for your LLM (e.g. `http://localhost:1234/v1` for LMStudio)
3. Verify that the plugin can connect to your LLM provider and select a model from the drop down after.
4. Enable tool calling if you want the assistant to make API requests on your behalf.

Some local LLM providers will require users to enable CORS in their API settings to allow the plugin to connect.
![](examples/lmstudio_cors.png)

## Demo Server

```bash
uvicorn examples.demo_server:app --reload --host 0.0.0.0 --port 3333
```

## Development

```bash
pip install -e ".[dev]"

pytest tests/
pre-commit run --all-files
```
