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.1.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.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pangea_azure_ai-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 98e19a0fcb5dc61d7d2fa5e5208f68b5b92b93ab80c6e1e1619ce1b8c6463f06
MD5 f280256e6ffd1f8f0632eba4ddd46499
BLAKE2b-256 aac96fa11658e47fbc6d1974247c4648f23307bd36f5f3c8f061e35047efd18c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pangea_azure_ai-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8252239851cb2fae3147fdf0ce8ad39c0ff49bf35666fe90591f67cbddeabccb
MD5 5dc3446a83c4c6782a59b5722e8d1448
BLAKE2b-256 fca4cdfb1bc475530d57a28270cab09a50d038832fbbfa99d925e8b0fd594619

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