Metadata-Version: 2.4
Name: explaidllm
Version: 0.1.3
Summary: CLI tool for debugging clingo using a combination of MUS and LLMs
Author-email: Hannes Weichelt <hweichelt@uni-potsdam.de>
Maintainer-email: Hannes Weichelt <hweichelt@uni-potsdam.de>
License: MIT License
        
        Copyright (c) 2024 Hannes Weichelt
        
        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.
        
Project-URL: Homepage, https://github.com/hweichelt/explaidllm
Project-URL: Source, https://github.com/hweichelt/explaidllm
Project-URL: Issues, https://github.com/hweichelt/explaidllm/issues
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: clingo>=5.8
Requires-Dist: clingexplaid>=1.3.5
Requires-Dist: openai>=1.107
Requires-Dist: python-dotenv>=1.1.1
Requires-Dist: cursor==1.3.5
Requires-Dist: autoflake
Dynamic: license-file

# ExplaidLLM

ExplaidLLM is a command line tool aimed for debugging clingo programs. This is achieved by combining the Minimal
Unsatisfiable Subset (MUS) functionalities of `clingexplaid` together with the natural language capabilities of an LLM.

![](static/explaid_llm.png)

## Installation

### From Source

`pip install .`

### From PyPi

`coming soon`

## Configuration

> [!NOTE]
> Currently ExplaidLLM only supports the OpenAI LLM API. The implementation of other API's can be requested through Issues.

### LLM API

Before using ExplaidLLM you need to store your API Key to prompt your LLM of choice.
You can do this in two different ways:

#### Using a `.env` file

+ Recommended for installation from source

```.dotenv
OPENAI_API_KEY=<YOUR-KEY-GOES-HERE>
```

#### Using the `-k` API-KEY option

+ Recommended for installation from PYPI

```bash
explaidllm examples/test.lp -k=$YOUR_OPENAI_KEY_ENV_VAR
```

## Usage

ExplaidLLM allows you to quickly debug your unsatisfiable ASP Programs. For the default behaviour just use this command:

```bash
explaidllm example/test.lp
```

The default behaviour converts all you program atoms to assumptions, computes an MUS (Minimal Unsatisfiable Subset) from
them, finds a matching unsatisfiable constraint and then prompts the configured LLM for an explanation.

### Assumption Signatures

If you want to filter only certain assumption signatures use the option `-a` to specify the signatures to be converted.

```bash
explaidllm example/test.lp -a x/1
```

### LLM Models

You can also specify which LLM Model should be used for the explanation using the `-m` model option.
A list of available models can be found on the `--help` page.

```bash
explaidllm example/test.lp -m='gpt-4o'
```
