Skip to main content

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

  1. Sign up on Obiguard and grab your Obiguard API Key
  2. 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 OpenAI with from 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 AsyncObiguard instead of Obiguard with await:
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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

obiguard-1.0.15.tar.gz (365.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

obiguard-1.0.15-py3-none-any.whl (708.4 kB view details)

Uploaded Python 3

File details

Details for the file obiguard-1.0.15.tar.gz.

File metadata

  • Download URL: obiguard-1.0.15.tar.gz
  • Upload date:
  • Size: 365.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for obiguard-1.0.15.tar.gz
Algorithm Hash digest
SHA256 56a3da57a6e6904888fc14ffb79ad7f803285a90e379700e76cfca7ab643cfb5
MD5 871472f43805b5659c6c212c9b9654cf
BLAKE2b-256 ca397e2834c3bd4db7628d785327c13cac721e3ec824b48e5bda0e672e04b1f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for obiguard-1.0.15.tar.gz:

Publisher: deploy-pypi.yml on obiguard/obiguard-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file obiguard-1.0.15-py3-none-any.whl.

File metadata

  • Download URL: obiguard-1.0.15-py3-none-any.whl
  • Upload date:
  • Size: 708.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for obiguard-1.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 d1ef9236ec8f5be065a7e1d75f4a35fc3331eda8ad66bef6c75535884a7c7cb2
MD5 34a277f3de4949c07ff6270e29afe82e
BLAKE2b-256 bd5fa479141fbe82ec47322f31d346e5555b7b55fa2ac7d5eb2ef2a7b98da4c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for obiguard-1.0.15-py3-none-any.whl:

Publisher: deploy-pypi.yml on obiguard/obiguard-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page