Provider-specific Swarmauri import package for OpenAI chat, reasoning, tool-calling, transcription, and text-to-speech workflows.
Project description
Swarmauri OpenAI LLM
swarmauri_llm_openai provides provider-specific Swarmauri imports for OpenAI chat, reasoning, tool-calling, audio transcription, and text-to-speech workflows. The package exposes OpenAIModel, OpenAIReasonModel, OpenAIToolModel, OpenAIAudio, and OpenAIAudioTTS as direct provider-package imports while preserving the shared runtime implementations in swarmauri_standard.
The repo currently tracks OpenAI chat model families including gpt-5.x, gpt-4.1, gpt-4o, gpt-4-turbo, gpt-oss, reasoning families including o1, o3, and o4-mini, audio transcription models including whisper-1 and gpt-4o-*transcribe, and text-to-speech models including tts-1, tts-1-hd, and gpt-4o-mini-tts.
Why Use This Package?
- Keep OpenAI-specific imports explicit in Swarmauri applications.
- Use separate adapters for standard chat, reasoning, tool-calling, transcription, and TTS workflows.
- Reuse Swarmauri
Conversation, toolkit, and component semantics across the OpenAI surface area. - Track current OpenAI model families through one provider package boundary.
FAQ
What does swarmauri_llm_openai install?
It installs OpenAIModel, OpenAIReasonModel, OpenAIToolModel, OpenAIAudio, and OpenAIAudioTTS.
Which OpenAI capabilities are wrapped today?
The package covers standard chat completions, reasoning-oriented chat models, tool-calling workflows, audio transcription, and text-to-speech generation.
What is the difference between OpenAIModel and OpenAIReasonModel?
OpenAIModel targets general chat model families such as gpt-5.x, gpt-4.1, and gpt-4o. OpenAIReasonModel targets the reasoning families tracked in the repo, including o1, o3, and o4-mini variants.
When should I use OpenAIToolModel?
Use it when the application needs OpenAI tool calling through a Swarmauri toolkit. It is the provider-specific surface for tool-backed agent workflows.
What do OpenAIAudio and OpenAIAudioTTS do?
OpenAIAudio wraps audio transcription workflows. OpenAIAudioTTS wraps text-to-speech generation workflows.
Where should I verify current models and pricing?
Use the OpenAI section in docs/LLM_PROVIDER_MODEL_PRICING_LINKS.md, which points to the current OpenAI models, function-calling, audio, TTS, and pricing documentation.
Features
OpenAIModelfor sync, async, streaming, and batch chat completion workflows.OpenAIReasonModelfor reasoning-model workflows across the repo-trackedo*families.OpenAIToolModelfor toolkit-backed tool-calling and agent execution flows.OpenAIAudiofor speech-to-text workflows against the tracked OpenAI transcription models.OpenAIAudioTTSfor text-to-speech workflows against the tracked OpenAI TTS models.- Compatibility with Python 3.10, 3.11, 3.12, 3.13, and 3.14.
Installation
uv add swarmauri_llm_openai
pip install swarmauri_llm_openai
Usage
Set OPENAI_API_KEY in your environment before creating any of the OpenAI adapters.
Chat Completion
import os
from swarmauri_llm_openai import OpenAIModel
from swarmauri_standard.conversations.Conversation import Conversation
from swarmauri_standard.messages.HumanMessage import HumanMessage
conversation = Conversation()
conversation.add_message(HumanMessage(content="Summarize Swarmauri in two sentences."))
model = OpenAIModel(
api_key=os.environ["OPENAI_API_KEY"],
name="gpt-5.5",
)
result = model.predict(conversation=conversation)
print(result.get_last().content)
Reasoning Model
import os
from swarmauri_llm_openai import OpenAIReasonModel
from swarmauri_standard.conversations.Conversation import Conversation
from swarmauri_standard.messages.HumanMessage import HumanMessage
conversation = Conversation()
conversation.add_message(HumanMessage(content="Reason through a release rollback plan step by step."))
model = OpenAIReasonModel(
api_key=os.environ["OPENAI_API_KEY"],
name="o3",
)
result = model.predict(conversation=conversation)
print(result.get_last().content)
Tool Calling
import os
from swarmauri_llm_openai import OpenAIToolModel
from swarmauri_standard.conversations.Conversation import Conversation
from swarmauri_standard.messages.HumanMessage import HumanMessage
from swarmauri_standard.toolkits.Toolkit import Toolkit
from swarmauri_standard.tools.AdditionTool import AdditionTool
conversation = Conversation()
conversation.add_message(HumanMessage(content="What is 19 + 23? Use the tool."))
toolkit = Toolkit(tools={"add": AdditionTool()})
model = OpenAIToolModel(
api_key=os.environ["OPENAI_API_KEY"],
name="gpt-5.5",
)
result = model.predict(
conversation=conversation,
toolkit=toolkit,
tool_choice="auto",
)
print(result.get_last().content)
Audio Transcription
import os
from swarmauri_llm_openai import OpenAIAudio
audio_model = OpenAIAudio(
api_key=os.environ["OPENAI_API_KEY"],
name="whisper-1",
)
text = audio_model.predict("tests/static/test.mp3")
print(text)
Text To Speech
import os
from swarmauri_llm_openai import OpenAIAudioTTS
tts_model = OpenAIAudioTTS(
api_key=os.environ["OPENAI_API_KEY"],
name="tts-1",
)
audio_bytes = tts_model.predict("Swarmauri turns provider APIs into composable components.")
print(len(audio_bytes))
Examples
- Use
OpenAIModelfor general-purpose chat completion workflows. - Use
OpenAIReasonModelwhen you want the reasoning-model family explicitly. - Use
OpenAIToolModelwhen an agent needs toolkit-backed tool invocation. - Use
OpenAIAudioandOpenAIAudioTTSwhen the workflow crosses text, speech, and audio generation boundaries.
Related Packages
- swarmauri_llm_mistral
- swarmauri_llm_groq
- swarmauri_llm_hyperbolic
- swarmauri_llm_deepinfra
- swarmauri_llm_perplexity
- swarmauri_llm_playht
Foundational Swarmauri Packages
More Documentation
Best Practices
- Keep
OPENAI_API_KEYin environment variables or a secret manager. - Pick the adapter that matches the workflow: chat, reasoning, tool-calling, transcription, or TTS.
- Validate model availability against current OpenAI docs before hard-coding a dated model variant in production.
- Use reasoning models deliberately, since they should be chosen for workflows that actually benefit from deeper multi-step reasoning.
License
Apache-2.0
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 swarmauri_llm_openai-0.11.0.dev1.tar.gz.
File metadata
- Download URL: swarmauri_llm_openai-0.11.0.dev1.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3daf47caa45402476f128fbed602d9fc9fc33854beab3077b8c2f689f8904a1a
|
|
| MD5 |
7966ec9d08779c8ad7844f7c20b8ec8b
|
|
| BLAKE2b-256 |
8a40711380ee467e06e99ade2ec9507013d44fe2647038d7a1d46616359da29a
|
File details
Details for the file swarmauri_llm_openai-0.11.0.dev1-py3-none-any.whl.
File metadata
- Download URL: swarmauri_llm_openai-0.11.0.dev1-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4aa632e44d154fbed572c6e3317dfc3caaeee11ea06a9ecc70cf230bce98e9bc
|
|
| MD5 |
6b49fa9750a0129175f96909fa072d44
|
|
| BLAKE2b-256 |
6113c95d2793371a35367903fc7e012c4c80ebb860dbb048bde2d59113b5a138
|