OpenAI and Azure compatibility helpers with response format contracts.
Project description
openazharmony
A small compatibility wrapper around the OpenAI Python client, with pydantic contracts for response formatting and Azure/OpenAI configuration. It provides chat and responses helpers with unified response_format handling.
- Unified chat/responses helpers
- Pydantic contracts for response_format
- Azure endpoint inference from base_url
Install
pip install openazharmony
Quickstart
from openazharmony import HarmonyClient, ResponseFormat
client = HarmonyClient(
api_key="...",
model="gpt-4o-mini",
)
response = client.chat(
question="Say hello",
response_format=ResponseFormat(type="json_object"),
)
print(response)
Azure quickstart
from openazharmony import HarmonyClient
client = HarmonyClient(
api_key="...",
model="gpt-4o-mini",
azure_endpoint="https://your-resource.openai.azure.com",
api_version="2024-02-15-preview",
use_azure_v1_base_url=False,
)
response = client.responses(question="Say hello")
print(response)
Documentation (bundled)
The package ships with offline documentation that is accessible after install:
python -m openazharmony.docs --list
python -m openazharmony.docs --show PYTHON
python -m openazharmony.docs --show RESPONSE_FORMATS
python -m openazharmony.docs --show AZURE
python -m openazharmony.docs --show EXAMPLES
python -m openazharmony.docs --show LIMITATIONS
python -m openazharmony.docs --show SECURITY
python -m openazharmony.docs --show TROUBLESHOOTING
python -m openazharmony.docs --show FAQ
python -m openazharmony.docs --show CHANGELOG
python -m openazharmony.docs --write-dir .\openazharmony-docs
Python API (core objects)
HarmonyClient
HarmonyClient(
config: ClientConfig | None = None,
api_key: str | None = None,
model: str | None = None,
base_url: str | None = None,
azure_endpoint: str | None = None,
api_version: str | None = None,
use_azure_v1_base_url: bool = True,
client: object | None = None,
)
Response format models
ResponseFormat(type="json_object")
ResponseFormat(
type="json_schema",
json_schema=JsonSchemaSpec(
name="summary",
schema={"type": "object", "properties": {"summary": {"type": "string"}}},
strict=True,
),
)
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 openazharmony-0.0.0.tar.gz.
File metadata
- Download URL: openazharmony-0.0.0.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cbbe40d1d04284581493da594c87e52966c0b6fcad2cc93e211f59dc17b9454
|
|
| MD5 |
f81fdb0a942cc9c51d78e26529d61872
|
|
| BLAKE2b-256 |
3fdc655ad5dff2a3a5c1ff37b6377eb457b6d3cea4d2001cee180fc16466f4a7
|
File details
Details for the file openazharmony-0.0.0-py3-none-any.whl.
File metadata
- Download URL: openazharmony-0.0.0-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
875ba91cc0693718f938fe7984938153e6c61b97b78ba8263646c43c4120c071
|
|
| MD5 |
967d7a48e738a69c77d50ea88d3fd926
|
|
| BLAKE2b-256 |
316536c326eab9ced26e955d7cbca86c17008c9373b35366b86087773112a785
|