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.2.0.tar.gz (5.7 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.2.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pangea_azure_ai-0.2.0.tar.gz
  • Upload date:
  • Size: 5.7 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.2.0.tar.gz
Algorithm Hash digest
SHA256 d55060b5bc15debb17ee458334a77095f1dddb12f91107230903fe6e99d7d69c
MD5 d52db83b379b105c1a357733c487957f
BLAKE2b-256 0ba9cf66703903f14243393a2c949553b2ba507ebe3bcf7c5a337976ee050e34

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pangea_azure_ai-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b286c12be0db1914cb2ad88ca984026530df8fadd07721b57f24be2adbcd2863
MD5 223f7d45c2933af84d5ea62eee3118e2
BLAKE2b-256 da17473e3130491de76f0e552f41a9658a4d1d2e1f328d4615d0092cdb45b6ba

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