Metadata-Version: 2.4
Name: semanticguard
Version: 0.1.0
Summary: Drop-in wrapper for the OpenAI Python SDK that routes requests through the SemanticGuard gateway for intelligent caching, cost tracking, and analytics.
Project-URL: Homepage, https://semanticguard.dev
Project-URL: Repository, https://github.com/KB-AI-LLC/sg-ai
Author: KB-AI LLC
License-Expression: MIT
License-File: LICENSE
Keywords: ai,azure-openai,bedrock,cache,cost-tracking,llm,openai,semantic-cache
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
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
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.8
Requires-Dist: openai>=1.0.0
Provides-Extra: async
Requires-Dist: httpx>=0.24.0; extra == 'async'
Description-Content-Type: text/markdown

# semanticguard

Drop-in Python wrapper for the [OpenAI Python SDK](https://github.com/openai/openai-python) that routes requests through the [SemanticGuard](https://semanticguard.dev) gateway for intelligent caching, cost tracking, and analytics.

## Installation

```bash
pip install semanticguard
```

## Quick start

```python
from openai import OpenAI
from semanticguard import SemanticGuard

sg = SemanticGuard(api_key="sg-...", gateway_url="https://semanticguard.dev")
client = sg.wrap_openai(OpenAI(api_key="sk-..."))

# Use the client exactly as you normally would
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}],
)
```

## Azure OpenAI

```python
from openai import AzureOpenAI
from semanticguard import SemanticGuard

sg = SemanticGuard(api_key="sg-...", gateway_url="https://semanticguard.dev")
azure = AzureOpenAI(api_key="...", api_version="2024-02-01",
                     azure_endpoint="https://my-resource.openai.azure.com")
client = sg.wrap_azure(azure, resource="my-resource", deployment="gpt-4o")
```

## AWS Bedrock

```python
from openai import OpenAI
from semanticguard import SemanticGuard

sg = SemanticGuard(api_key="sg-...", gateway_url="https://semanticguard.dev")
client = sg.wrap_bedrock(
    OpenAI(api_key="not-used"),
    aws_access_key="AKIA...",
    aws_secret_key="...",
    region="us-east-1",
)
```

## Project tagging

Pass a `project` argument to any wrapper to tag requests:

```python
client = sg.wrap_openai(OpenAI(api_key="sk-..."), project="my-project")
```

## License

MIT
