Metadata-Version: 2.1
Name: outerop
Version: 0.1.2
Summary: 
Author: Stephen Byrne
Author-email: 39441007+stephenbyrne99@users.noreply.github.com
Requires-Python: >=3.10,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: anthropic (>=0.21.0,<0.22.0)
Requires-Dist: mistralai (>=0.1.6,<0.2.0)
Requires-Dist: openai (>=1.14.2,<2.0.0)
Description-Content-Type: text/markdown

# Outerop Python SDK

The Outerop Python SDK provides a convenient way to interact with the Outerop API and integrate AI-powered chat functionality into your Python applications. It supports multiple AI providers, including OpenAI, Anthropic, and Mistral.

## Installation

To install the Outerop Python SDK, use pip:

```bash
pip install outerop
```

## Usage

To use the Outerop SDK, you need to create an instance of the `Outerop` class with your Outerop API key and optionally provide additional configuration options.

```python
from outerop import Outerop

outerop = Outerop(outerop_api_key="YOUR_OUTEROP_API_KEY", options={
    "openaiApiKey": "YOUR_OPENAI_API_KEY",
    "anthropicApiKey": "YOUR_ANTHROPIC_API_KEY",
    "mistralApiKey": "YOUR_MISTRAL_API_KEY"
})
```

### Retrieving a Prompt

To retrieve a prompt, use the `get_prompt` method:

```python
prompt = await outerop.get_prompt(prompt_uuid="PROMPT_UUID", environment="dev", version="latest")
```

### Chatting with AI

To chat with an AI, use the `chat` method:

```python
result = await outerop.chat(
    prompt_uuid="PROMPT_UUID",
    environment="dev",
    version="latest",
    variables={"name": "John", "age": "25"}
)
```

The `chat` method returns the AI's response based on the provided prompt and variables.

## Configuration

The `Outerop` class accepts an optional `options` parameter to configure additional settings:

- `baseURL`: The base URL of the Outerop API (default: "https://app.outerop.com").
- `loggingEnabled`: Enable or disable logging (default: True).
- `openaiApiKey`: The API key for OpenAI.
- `anthropicApiKey`: The API key for Anthropic.
- `mistralApiKey`: The API key for Mistral.
- `bypassHeader`: A bypass header for Vercel protection.

## Logging

The SDK includes a built-in logging mechanism to capture chat events and send them to the Outerop API for analytics and monitoring purposes. Logging is enabled by default, but you can disable it by setting `loggingEnabled` to `False` in the options.

## Error Handling

The SDK raises exceptions for various error scenarios, such as missing API keys, invalid responses, or network errors. Make sure to wrap your code in a try-except block to handle these exceptions gracefully.

## Contributing

Contributions to the Outerop Python SDK are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.

