Skip to main content

A wrapper around the Azure AI Inference SDK

Project description

Pangea + Azure AI Inference SDK

A wrapper around the Azure AI Inference SDK that wraps the chat completion API with Pangea AI Guard. Supports Python v3.10 and greater.

Installation

pip install -U pangea-azure-ai

Usage

import os

from azure.ai.inference.models import SystemMessage, UserMessage
from azure.core.credentials import AzureKeyCredential

from pangea_azure_ai.inference import PangeaChatCompletionsClient

endpoint = "https://[...].cognitiveservices.azure.com/openai/deployments/gpt-4o-mini"
model_name = "gpt-4o-mini"

client = PangeaChatCompletionsClient(
    endpoint=endpoint,
    credential=AzureKeyCredential(os.getenv("AZURE_API_KEY", "")),
    pangea_api_key=os.getenv("PANGEA_API_KEY", ""),
)

response = client.complete(
    messages=[
        SystemMessage(content="You are a helpful assistant."),
        UserMessage(content="I am going to Paris, what should I see?"),
    ],
    max_tokens=4096,
    temperature=1.0,
    top_p=1.0,
    model=model_name,
    stream=False,
)

print(response.choices[0].message.content)

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

pangea_azure_ai-0.1.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

pangea_azure_ai-0.1.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file pangea_azure_ai-0.1.0.tar.gz.

File metadata

  • Download URL: pangea_azure_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pangea_azure_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ea9ba9b0d4301642615143c7ae72123bb78be43aee9568bc1d157780dccb204e
MD5 8e0a8ae840a6a7ed407cc24c21bd7fc5
BLAKE2b-256 3f74411175d3bbed498ae7fc97746ed4f821e6c6425f5b47727228f5edd98af4

See more details on using hashes here.

File details

Details for the file pangea_azure_ai-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pangea_azure_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f122e59c242bfbbe2e46b7b3178d9166271524c42c3e89fbb4e9b4d885141c4a
MD5 437425e0d284b7e577b30438db140b33
BLAKE2b-256 2cee546b605c17dc003754eae0f8c4e146f8b8934d96f571cdaf8c1b8abc652f

See more details on using hashes here.

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