Python SDK for Obiguard
Project description
Obiguard Python SDK
Security Control Panel for AI Apps
pip install obiguard
Features
The Obiguard SDK is built on top of the OpenAI SDK, allowing you to seamlessly integrate Obiguard's advanced features while retaining full compatibility with OpenAI methods. With Obiguard, you can enhance your interactions with OpenAI or any other OpenAI-like provider by leveraging robust monitoring, reliability, prompt management, and more features - without modifying much of your existing code.
Obiguard AI Gateway
| Unified API Signature If you've used OpenAI, you already know how to use Obiguard with any other provider. |
Interoperability Write once, run with any provider. Switch between any model from_any provider seamlessly. |
| Automated Fallbacks & Retries Ensure your application remains functional even if a primary service fails. |
Load Balancing Efficiently distribute incoming requests among multiple models. |
| Semantic Caching Reduce costs and latency by intelligently caching results. |
Virtual Keys Secure your LLM API keys by storing them in Obiguard vault and using disposable virtual keys. |
Observability
| Logging Keep track of all requests for monitoring and debugging. |
Requests Tracing Understand the journey of each request for optimization. |
| Custom Metadata Segment and categorize requests for better insights. | Feedbacks Coming soon - Collect and analyse weighted feedback on requests from users. |
| Analytics Track your app & LLM's performance with 40+ production-critical metrics in a single place. |
Usage
Prerequisites
- Sign up on Obiguard and grab your Obiguard API Key
- Add your OpenAI key to Obiguard's Virtual Keys page and keep it handy
# Installing the SDK
$ pip install obiguard
$ export OBIGUARD_API_KEY=<OBIGUARD API OR VIRTUAL KEY>
Making a Request to OpenAI
- Obiguard fully adheres to the OpenAI SDK signature. You can instantly switch to Obiguard and start using our production features right out of the box.
- Just replace
from openai import OpenAIwithfrom obiguard_ai import Obiguard:
from obiguard import Obiguard
obiguard = Obiguard(
obiguard_api_key="OBIGUARD API OR VIRTUAL KEY"
)
chat_completion = obiguard.chat.completions.create(
messages=[{"role": 'user', "content": 'Say this is a test'}],
model='gpt-4'
)
print(chat_completion)
Async Usage
- Use
AsyncObiguardinstead ofObiguardwithawait:
import asyncio
from obiguard import AsyncObiguard
obiguard = AsyncObiguard(
obiguard_api_key="OBIGUARD API OR VIRTUAL KEY",
)
async def main():
chat_completion = await obiguard.chat.completions.create(
messages=[{'role': 'user', 'content': 'Say this is a test'}],
model='gpt-4'
)
print(chat_completion)
asyncio.run(main())
Compatibility with OpenAI SDK
Obiguard currently supports all the OpenAI methods, including the legacy ones.
| Methods | OpenAI V1.26.0 |
Obiguard V1.0.0 |
|---|---|---|
| Audio | ✅ | ✅ |
| Chat | ✅ | ✅ |
| Embeddings | ✅ | ✅ |
| Images | ✅ | ✅ |
| Fine-tuning | ✅ | ✅ |
| Batch | ✅ | ✅ |
| Files | ✅ | ✅ |
| Models | ✅ | ✅ |
| Moderations | ✅ | ✅ |
| Assistants | ✅ | ✅ |
| Threads | ✅ | ✅ |
| Thread - Messages | ✅ | ✅ |
| Thread - Runs | ✅ | ✅ |
| Thread - Run - Steps | ✅ | ✅ |
| Vector Store | ✅ | ✅ |
| Vector Store - Files | ✅ | ✅ |
| Vector Store - Files Batches | ✅ | ✅ |
| Generations | ❌ (Deprecated) | ✅ |
| Completions | ❌ (Deprecated) | ✅ |
Obiguard-Specific Methods (Coming Soon)
| Methods | Obiguard 1.0.X |
|---|---|
| Feedback | Obiguard |
| Prompts | Obiguard |
Check out Obiguard docs for the full list of supported providers
Contributing
Get started by checking out Github issues. Email us at support@obiguard.com.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file obiguard-1.0.2.tar.gz.
File metadata
- Download URL: obiguard-1.0.2.tar.gz
- Upload date:
- Size: 365.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7be53ac62d389026d240555fdcc0f57d7f17ce69b0f44c30fe52f75d9a586f8f
|
|
| MD5 |
d148dcd3eaf6231a9a86e646b36926c2
|
|
| BLAKE2b-256 |
bbc561a5636c3b25f2faa252f36f59539696f8f4031f9e40a0f3f65068cea8e5
|
Provenance
The following attestation bundles were made for obiguard-1.0.2.tar.gz:
Publisher:
deploy-pypi.yml on obiguard/obiguard-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
obiguard-1.0.2.tar.gz -
Subject digest:
7be53ac62d389026d240555fdcc0f57d7f17ce69b0f44c30fe52f75d9a586f8f - Sigstore transparency entry: 232200961
- Sigstore integration time:
-
Permalink:
obiguard/obiguard-python-sdk@f19edde24d5cb301aa2df43a15b289ade58b4e9c -
Branch / Tag:
refs/heads/release - Owner: https://github.com/obiguard
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy-pypi.yml@f19edde24d5cb301aa2df43a15b289ade58b4e9c -
Trigger Event:
push
-
Statement type:
File details
Details for the file obiguard-1.0.2-py3-none-any.whl.
File metadata
- Download URL: obiguard-1.0.2-py3-none-any.whl
- Upload date:
- Size: 708.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74c354a0dc9ccca1d49c1d7a669b26cdec51b4a0f08a4e11676f3f82c93c66ca
|
|
| MD5 |
1cefc09f37a609d179b87e618d60440d
|
|
| BLAKE2b-256 |
f38cc03ed63ac80e0607404695bed134e2c74cc725b650bca40f4fe298dcde7c
|
Provenance
The following attestation bundles were made for obiguard-1.0.2-py3-none-any.whl:
Publisher:
deploy-pypi.yml on obiguard/obiguard-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
obiguard-1.0.2-py3-none-any.whl -
Subject digest:
74c354a0dc9ccca1d49c1d7a669b26cdec51b4a0f08a4e11676f3f82c93c66ca - Sigstore transparency entry: 232200962
- Sigstore integration time:
-
Permalink:
obiguard/obiguard-python-sdk@f19edde24d5cb301aa2df43a15b289ade58b4e9c -
Branch / Tag:
refs/heads/release - Owner: https://github.com/obiguard
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy-pypi.yml@f19edde24d5cb301aa2df43a15b289ade58b4e9c -
Trigger Event:
push
-
Statement type: