Skip to main content

Toolkit for fast and flexible integration with Azure OpenAI

Project description

PyPI Version PyPI Downloads GitHub Tag License Repo Size Python Version

Last Commit Commits Per Month Build Status Security Scan

GitHub Stars Contributors Open Issues Open PRs

Author LinkedIn


rsazure-openai-toolkit

A lightweight, independent toolkit (with CLI support) to simplify and accelerate integration with Azure OpenAI.


📚 Contents


❓ Why This Project?

There are many tools for interacting with OpenAI — but most are either too simplistic for real-world use, or too complex and tightly coupled to specific platforms.

This project was born out of the need for something in between:

  • 🔍 Transparent and auditable — no magic, no vendor lock-in
  • ⚙️ Flexible — can be used in scripts, production systems, or CI/CD pipelines
  • 🧩 Modular — easy to extend or integrate with other workflows
  • 🧠 Smart — includes retry logic, environment handling, and a developer-friendly CLI
  • 🧪 Lightweight — zero dependencies beyond what’s needed, no bloat

Whether you're prototyping locally or running critical flows in production, this toolkit helps you do it faster, safer, and with full control.

Built by an engineer with real-world experience in AI, cloud, and software systems — to solve real developer problems.


🧠 Design Principles

These principles define how this toolkit is designed, maintained, and expected to be used — prioritizing security, clarity, and real-world applicability:

  • Security first: No telemetry, no hidden dependencies, and full code transparency — always auditable and verifiable.
  • Simplicity over complexity: A minimal, no-friction interface that works out-of-the-box without overwhelming configuration.
  • Production-readiness: Built with reliability in mind — includes retry logic, CLI validation, and clear error handling.
  • Explicit over implicit: All configurations are visible and controlled; no surprises behind the scenes.
  • Extendable by design: Modular and adaptable for integration into larger systems and workflows.
  • Developer & team friendly: Works great for individuals, but also for teams needing reproducibility and onboarding ease.

These principles are not just technical choices — they're part of a commitment to making this toolkit secure, stable, and genuinely useful in professional environments.


🚀 Features

This toolkit was designed with reliability and real-world use in mind:

  • ✅ Modular architecture — easy to integrate and extend
  • ✅ Intelligent retry mechanism with exponential backoff (via tenacity)
  • ✅ Fully compatible with OpenAI-style request formats
  • ✅ CLI-first design — includes rschat for terminal usage and rschat-tools for automation
  • ✅ Secure by design — no telemetry, no external data sent
  • ✅ Production-ready — suitable for professional, CI/CD-integrated environments

🔐 Security

Security is a core pillar of this project — not an afterthought.

  • ✅ All code is fully open, auditable, and free from telemetry or tracking
  • ✅ No data is ever sent externally — all logic executes locally and transparently
  • ✅ Direct pushes and unreviewed merges are blocked by default via GitHub branch protection
  • ✅ Releases are manually reviewed and published by the maintainer

If you discover any security vulnerabilities or have concerns:

This project follows responsible disclosure practices. Thank you for helping keep the ecosystem secure.


📋 Requirements

  • Python 3.9 or higher
  • An active Azure OpenAI resource and deployment

📄 License

This project is open source and licensed under the MIT License, ensuring maximum flexibility and adoption.

You are free to use it in both personal and commercial projects.


🧪 Quick Start

⚠️ Requires Python 3.9+ and internet access. 📂 View setup scripts

Don't want to deal with virtual environments or manual setup?

Set up your environment with one command:

▶️ Windows (PowerShell):

iwr -useb https://raw.githubusercontent.com/renan-siqueira/rsazure-openai-toolkit/main/scripts/setup.ps1 | iex

🐧 Linux/macOS (Bash):

curl -sSfL https://raw.githubusercontent.com/renan-siqueira/rsazure-openai-toolkit/main/scripts/setup.sh | bash

This will:

  • Create a virtual environment
  • Activate it
  • Install rsazure-openai-toolkit
  • Print usage instructions

Ideal for both beginners and experienced developers 🚀

💬 Want to try it out quickly? Run rschat-tools samples after setup to see ready-to-run examples.


💻 Manual Setup (Alternative)

From PyPI:

pip install rsazure-openai-toolkit

From GitHub:

pip install git+https://github.com/renan-siqueira/rsazure-openai-toolkit

Usage

from rsazure_openai_toolkit import call_azure_openai_handler

response = call_azure_openai_handler(
    api_key="your-api-key",
    azure_endpoint="https://your-resource.openai.azure.com/",
    api_version="2023-12-01-preview",
    deployment_name="gpt-35-turbo",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Summarize what artificial intelligence is."}
    ]
)

print(response)

Environment Configuration

To simplify local development and testing, this toolkit supports loading environment variables from a .env file.

Create a .env file in your project root (or copy the provided .env.example) and add your Azure OpenAI credentials:

AZURE_OPENAI_API_KEY=your-api-key
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/
AZURE_OPENAI_API_VERSION=2023-12-01-preview
AZURE_DEPLOYMENT_NAME=your-deployment-name

In your script, load the environment variables before calling the handler:

from dotenv import load_dotenv
import os

load_dotenv()  # defaults to loading from .env in the current directory

from rsazure_openai_toolkit import call_azure_openai_handler

response = call_azure_openai_handler(
    api_key=os.getenv("AZURE_OPENAI_API_KEY"),
    azure_endpoint=os.getenv("AZURE_OPENAI_ENDPOINT"),
    api_version=os.getenv("AZURE_OPENAI_API_VERSION"),
    deployment_name=os.getenv("AZURE_DEPLOYMENT_NAME"),
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Summarize what artificial intelligence is."}
    ]
)

💻 CLI Usage (rschat)

After installing the package, you can interact with Azure OpenAI directly from your terminal using:

rschat "What can you do for me?"

Make sure you have a valid .env file with your Azure credentials configured:

AZURE_OPENAI_API_KEY=your-api-key
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/
AZURE_OPENAI_API_VERSION=2023-12-01-preview
AZURE_DEPLOYMENT_NAME=your-deployment-name

You can also ask in Portuguese (or any supported language):

rschat "Resuma o que é inteligência artificial"

If any required variable is missing, the CLI will exit with a clear error message.


🧰 Developer Tools (rschat-tools)

The toolkit includes a companion CLI called rschat-tools to assist with setup and onboarding.

To generate sample projects in your current directory, run:

rschat-tools samples

You'll see an interactive menu like this:

[0] Exit
[1] Basic Usage
[2] Advanced Usage
[3] Env Usage
[4] Env + Advanced Usage
[all] Generate All

Choose an option, and a folder will be created inside ./samples/ containing ready-to-run scripts and configurations.

💡 Samples that include a chat loop will clearly display: Type 'exit' to quit
This ensures the CLI is friendly even for non-developers who might not be familiar with Ctrl+C.

You can generate all examples at once using:

rschat-tools samples
# then select: all

This is the fastest way to explore real usage examples and start integrating Azure OpenAI with minimal setup.


🚨 Possible Issues

  • Invalid API Key or Endpoint
    Ensure your AZURE_OPENAI_API_KEY and AZURE_OPENAI_ENDPOINT are correctly set in your .env file.

  • Deployment Not Found
    Check that your deployment_name matches exactly the name defined in your Azure OpenAI resource.

  • Timeouts or 5xx Errors
    The toolkit includes automatic retries with exponential backoff via tenacity. If errors persist, verify network access or Azure service status.

  • Missing Environment Variables
    Always ensure load_dotenv() is called before accessing os.getenv(...), especially when testing locally.


📦 Changelog

We follow semantic versioning to ensure predictable upgrades.


👨‍💻 About the Author

I'm a software engineer with real-world experience across backend, frontend, DevOps, cloud, and AI — building solutions that are designed to last.

Today, my passion is helping teams make AI development more accessible, maintainable, and truly production-ready — with full control, transparency, and respect for sound engineering principles.

I believe that great tools should be simple, powerful, and built to empower — not to lock people in. That’s the mindset behind everything I build and share.


📬 Contact

I'm always open to feedback, ideas, or professional collaboration.

Feel free to connect or open an issue.
Suggestions, contributions, and responsible disclosures are always welcome.

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

rsazure_openai_toolkit-0.3.3.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

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

rsazure_openai_toolkit-0.3.3-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file rsazure_openai_toolkit-0.3.3.tar.gz.

File metadata

  • Download URL: rsazure_openai_toolkit-0.3.3.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for rsazure_openai_toolkit-0.3.3.tar.gz
Algorithm Hash digest
SHA256 1001f6a721fe525272c3ae2a666ec6f313912cb1f0807e95d49947a53687f257
MD5 42828d4612f4c8c597164fd69aee6394
BLAKE2b-256 0387b8f99f1d2cce436dfbf039338470bbe70b239fb6baa828b90457bed0a3ee

See more details on using hashes here.

File details

Details for the file rsazure_openai_toolkit-0.3.3-py3-none-any.whl.

File metadata

File hashes

Hashes for rsazure_openai_toolkit-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 57c08ace60b30de5ef6f9ea76eb6101edabd4a14ccd3986188463b2f3c45797c
MD5 9e94dfb4ce00fef15f2e7cb3988c3afb
BLAKE2b-256 186fd8d3ac445c5c0b47b411df6790e9f97e8958ffc3b220fd52e8fb094673af

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