swarmauri_llm_openai 0.1.1.dev2__tar.gz → 0.11.0.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- swarmauri_llm_openai-0.11.0.dev1/PKG-INFO +257 -0
- swarmauri_llm_openai-0.11.0.dev1/README.md +223 -0
- {swarmauri_llm_openai-0.1.1.dev2 → swarmauri_llm_openai-0.11.0.dev1}/pyproject.toml +23 -3
- swarmauri_llm_openai-0.1.1.dev2/PKG-INFO +0 -92
- swarmauri_llm_openai-0.1.1.dev2/README.md +0 -63
- {swarmauri_llm_openai-0.1.1.dev2 → swarmauri_llm_openai-0.11.0.dev1}/LICENSE +0 -0
- {swarmauri_llm_openai-0.1.1.dev2 → swarmauri_llm_openai-0.11.0.dev1}/swarmauri_llm_openai/OpenAIAudio.py +0 -0
- {swarmauri_llm_openai-0.1.1.dev2 → swarmauri_llm_openai-0.11.0.dev1}/swarmauri_llm_openai/OpenAIAudioTTS.py +0 -0
- {swarmauri_llm_openai-0.1.1.dev2 → swarmauri_llm_openai-0.11.0.dev1}/swarmauri_llm_openai/OpenAIModel.py +0 -0
- {swarmauri_llm_openai-0.1.1.dev2 → swarmauri_llm_openai-0.11.0.dev1}/swarmauri_llm_openai/OpenAIReasonModel.py +0 -0
- {swarmauri_llm_openai-0.1.1.dev2 → swarmauri_llm_openai-0.11.0.dev1}/swarmauri_llm_openai/OpenAIToolModel.py +0 -0
- {swarmauri_llm_openai-0.1.1.dev2 → swarmauri_llm_openai-0.11.0.dev1}/swarmauri_llm_openai/__init__.py +0 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: swarmauri_llm_openai
|
|
3
|
+
Version: 0.11.0.dev1
|
|
4
|
+
Summary: Provider-specific Swarmauri import package for OpenAI chat, reasoning, tool-calling, transcription, and text-to-speech workflows.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: swarmauri,llm,swarmauri llm,openai,openai api,chat completions,reasoning model,tool calling,function calling,speech to text,transcription,text to speech,tts,audio generation,gpt-5,gpt-4o,large language model,generative ai,model
|
|
8
|
+
Author: Jacob Stewart
|
|
9
|
+
Author-email: jacob@swarmauri.com
|
|
10
|
+
Requires-Python: >=3.10,<3.15
|
|
11
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
+
Classifier: Natural Language :: English
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
21
|
+
Classifier: Programming Language :: Python
|
|
22
|
+
Classifier: Programming Language :: Python :: 3
|
|
23
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
28
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
29
|
+
Requires-Dist: swarmauri_base
|
|
30
|
+
Requires-Dist: swarmauri_core
|
|
31
|
+
Requires-Dist: swarmauri_standard
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+

|
|
35
|
+
|
|
36
|
+
<p align="center">
|
|
37
|
+
<a href="https://pepy.tech/project/swarmauri_llm_openai/">
|
|
38
|
+
<img src="https://static.pepy.tech/badge/swarmauri_llm_openai/month" alt="PyPI - Downloads"/></a>
|
|
39
|
+
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_llm_openai/">
|
|
40
|
+
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_llm_openai.svg"/></a>
|
|
41
|
+
<a href="https://pypi.org/project/swarmauri_llm_openai/">
|
|
42
|
+
<img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
|
|
43
|
+
<a href="https://pypi.org/project/swarmauri_llm_openai/">
|
|
44
|
+
<img src="https://img.shields.io/pypi/l/swarmauri_llm_openai" alt="PyPI - License"/></a>
|
|
45
|
+
<a href="https://pypi.org/project/swarmauri_llm_openai/">
|
|
46
|
+
<img src="https://img.shields.io/pypi/v/swarmauri_llm_openai?label=swarmauri_llm_openai&color=green" alt="PyPI - swarmauri_llm_openai"/></a>
|
|
47
|
+
<a href="https://discord.gg/N4UpBuQv8T">
|
|
48
|
+
<img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
|
|
49
|
+
|
|
50
|
+
# Swarmauri OpenAI LLM
|
|
51
|
+
|
|
52
|
+
`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`.
|
|
53
|
+
|
|
54
|
+
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`.
|
|
55
|
+
|
|
56
|
+
## Why Use This Package?
|
|
57
|
+
|
|
58
|
+
- Keep OpenAI-specific imports explicit in Swarmauri applications.
|
|
59
|
+
- Use separate adapters for standard chat, reasoning, tool-calling, transcription, and TTS workflows.
|
|
60
|
+
- Reuse Swarmauri `Conversation`, toolkit, and component semantics across the OpenAI surface area.
|
|
61
|
+
- Track current OpenAI model families through one provider package boundary.
|
|
62
|
+
|
|
63
|
+
## FAQ
|
|
64
|
+
|
|
65
|
+
### What does `swarmauri_llm_openai` install?
|
|
66
|
+
|
|
67
|
+
It installs `OpenAIModel`, `OpenAIReasonModel`, `OpenAIToolModel`, `OpenAIAudio`, and `OpenAIAudioTTS`.
|
|
68
|
+
|
|
69
|
+
### Which OpenAI capabilities are wrapped today?
|
|
70
|
+
|
|
71
|
+
The package covers standard chat completions, reasoning-oriented chat models, tool-calling workflows, audio transcription, and text-to-speech generation.
|
|
72
|
+
|
|
73
|
+
### What is the difference between `OpenAIModel` and `OpenAIReasonModel`?
|
|
74
|
+
|
|
75
|
+
`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.
|
|
76
|
+
|
|
77
|
+
### When should I use `OpenAIToolModel`?
|
|
78
|
+
|
|
79
|
+
Use it when the application needs OpenAI tool calling through a Swarmauri toolkit. It is the provider-specific surface for tool-backed agent workflows.
|
|
80
|
+
|
|
81
|
+
### What do `OpenAIAudio` and `OpenAIAudioTTS` do?
|
|
82
|
+
|
|
83
|
+
`OpenAIAudio` wraps audio transcription workflows. `OpenAIAudioTTS` wraps text-to-speech generation workflows.
|
|
84
|
+
|
|
85
|
+
### Where should I verify current models and pricing?
|
|
86
|
+
|
|
87
|
+
Use the OpenAI section in [docs/LLM_PROVIDER_MODEL_PRICING_LINKS.md](../../../docs/LLM_PROVIDER_MODEL_PRICING_LINKS.md), which points to the current OpenAI models, function-calling, audio, TTS, and pricing documentation.
|
|
88
|
+
|
|
89
|
+
## Features
|
|
90
|
+
|
|
91
|
+
- `OpenAIModel` for sync, async, streaming, and batch chat completion workflows.
|
|
92
|
+
- `OpenAIReasonModel` for reasoning-model workflows across the repo-tracked `o*` families.
|
|
93
|
+
- `OpenAIToolModel` for toolkit-backed tool-calling and agent execution flows.
|
|
94
|
+
- `OpenAIAudio` for speech-to-text workflows against the tracked OpenAI transcription models.
|
|
95
|
+
- `OpenAIAudioTTS` for text-to-speech workflows against the tracked OpenAI TTS models.
|
|
96
|
+
- Compatibility with Python 3.10, 3.11, 3.12, 3.13, and 3.14.
|
|
97
|
+
|
|
98
|
+
## Installation
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
uv add swarmauri_llm_openai
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
pip install swarmauri_llm_openai
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Usage
|
|
109
|
+
|
|
110
|
+
Set `OPENAI_API_KEY` in your environment before creating any of the OpenAI adapters.
|
|
111
|
+
|
|
112
|
+
### Chat Completion
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
import os
|
|
116
|
+
|
|
117
|
+
from swarmauri_llm_openai import OpenAIModel
|
|
118
|
+
from swarmauri_standard.conversations.Conversation import Conversation
|
|
119
|
+
from swarmauri_standard.messages.HumanMessage import HumanMessage
|
|
120
|
+
|
|
121
|
+
conversation = Conversation()
|
|
122
|
+
conversation.add_message(HumanMessage(content="Summarize Swarmauri in two sentences."))
|
|
123
|
+
|
|
124
|
+
model = OpenAIModel(
|
|
125
|
+
api_key=os.environ["OPENAI_API_KEY"],
|
|
126
|
+
name="gpt-5.5",
|
|
127
|
+
)
|
|
128
|
+
result = model.predict(conversation=conversation)
|
|
129
|
+
|
|
130
|
+
print(result.get_last().content)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Reasoning Model
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
import os
|
|
137
|
+
|
|
138
|
+
from swarmauri_llm_openai import OpenAIReasonModel
|
|
139
|
+
from swarmauri_standard.conversations.Conversation import Conversation
|
|
140
|
+
from swarmauri_standard.messages.HumanMessage import HumanMessage
|
|
141
|
+
|
|
142
|
+
conversation = Conversation()
|
|
143
|
+
conversation.add_message(HumanMessage(content="Reason through a release rollback plan step by step."))
|
|
144
|
+
|
|
145
|
+
model = OpenAIReasonModel(
|
|
146
|
+
api_key=os.environ["OPENAI_API_KEY"],
|
|
147
|
+
name="o3",
|
|
148
|
+
)
|
|
149
|
+
result = model.predict(conversation=conversation)
|
|
150
|
+
|
|
151
|
+
print(result.get_last().content)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Tool Calling
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
import os
|
|
158
|
+
|
|
159
|
+
from swarmauri_llm_openai import OpenAIToolModel
|
|
160
|
+
from swarmauri_standard.conversations.Conversation import Conversation
|
|
161
|
+
from swarmauri_standard.messages.HumanMessage import HumanMessage
|
|
162
|
+
from swarmauri_standard.toolkits.Toolkit import Toolkit
|
|
163
|
+
from swarmauri_standard.tools.AdditionTool import AdditionTool
|
|
164
|
+
|
|
165
|
+
conversation = Conversation()
|
|
166
|
+
conversation.add_message(HumanMessage(content="What is 19 + 23? Use the tool."))
|
|
167
|
+
|
|
168
|
+
toolkit = Toolkit(tools={"add": AdditionTool()})
|
|
169
|
+
|
|
170
|
+
model = OpenAIToolModel(
|
|
171
|
+
api_key=os.environ["OPENAI_API_KEY"],
|
|
172
|
+
name="gpt-5.5",
|
|
173
|
+
)
|
|
174
|
+
result = model.predict(
|
|
175
|
+
conversation=conversation,
|
|
176
|
+
toolkit=toolkit,
|
|
177
|
+
tool_choice="auto",
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
print(result.get_last().content)
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Audio Transcription
|
|
184
|
+
|
|
185
|
+
```python
|
|
186
|
+
import os
|
|
187
|
+
|
|
188
|
+
from swarmauri_llm_openai import OpenAIAudio
|
|
189
|
+
|
|
190
|
+
audio_model = OpenAIAudio(
|
|
191
|
+
api_key=os.environ["OPENAI_API_KEY"],
|
|
192
|
+
name="whisper-1",
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
text = audio_model.predict("tests/static/test.mp3")
|
|
196
|
+
print(text)
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Text To Speech
|
|
200
|
+
|
|
201
|
+
```python
|
|
202
|
+
import os
|
|
203
|
+
|
|
204
|
+
from swarmauri_llm_openai import OpenAIAudioTTS
|
|
205
|
+
|
|
206
|
+
tts_model = OpenAIAudioTTS(
|
|
207
|
+
api_key=os.environ["OPENAI_API_KEY"],
|
|
208
|
+
name="tts-1",
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
audio_bytes = tts_model.predict("Swarmauri turns provider APIs into composable components.")
|
|
212
|
+
print(len(audio_bytes))
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Examples
|
|
216
|
+
|
|
217
|
+
- Use `OpenAIModel` for general-purpose chat completion workflows.
|
|
218
|
+
- Use `OpenAIReasonModel` when you want the reasoning-model family explicitly.
|
|
219
|
+
- Use `OpenAIToolModel` when an agent needs toolkit-backed tool invocation.
|
|
220
|
+
- Use `OpenAIAudio` and `OpenAIAudioTTS` when the workflow crosses text, speech, and audio generation boundaries.
|
|
221
|
+
|
|
222
|
+
## Related Packages
|
|
223
|
+
|
|
224
|
+
- [swarmauri_llm_mistral](https://pypi.org/project/swarmauri_llm_mistral/)
|
|
225
|
+
- [swarmauri_llm_groq](https://pypi.org/project/swarmauri_llm_groq/)
|
|
226
|
+
- [swarmauri_llm_hyperbolic](https://pypi.org/project/swarmauri_llm_hyperbolic/)
|
|
227
|
+
- [swarmauri_llm_deepinfra](https://pypi.org/project/swarmauri_llm_deepinfra/)
|
|
228
|
+
- [swarmauri_llm_perplexity](https://pypi.org/project/swarmauri_llm_perplexity/)
|
|
229
|
+
- [swarmauri_llm_playht](https://pypi.org/project/swarmauri_llm_playht/)
|
|
230
|
+
|
|
231
|
+
## Foundational Swarmauri Packages
|
|
232
|
+
|
|
233
|
+
- [swarmauri](https://pypi.org/project/swarmauri/)
|
|
234
|
+
- [swarmauri_core](https://pypi.org/project/swarmauri_core/)
|
|
235
|
+
- [swarmauri_base](https://pypi.org/project/swarmauri_base/)
|
|
236
|
+
- [swarmauri_standard](https://pypi.org/project/swarmauri_standard/)
|
|
237
|
+
|
|
238
|
+
## More Documentation
|
|
239
|
+
|
|
240
|
+
- [LLM provider model and pricing links](../../../docs/LLM_PROVIDER_MODEL_PRICING_LINKS.md)
|
|
241
|
+
- [OpenAI models](https://platform.openai.com/docs/models)
|
|
242
|
+
- [OpenAI function calling](https://platform.openai.com/docs/guides/function-calling)
|
|
243
|
+
- [OpenAI text to speech](https://platform.openai.com/docs/guides/text-to-speech)
|
|
244
|
+
|
|
245
|
+
## Best Practices
|
|
246
|
+
|
|
247
|
+
- Keep `OPENAI_API_KEY` in environment variables or a secret manager.
|
|
248
|
+
- Pick the adapter that matches the workflow: chat, reasoning, tool-calling, transcription, or TTS.
|
|
249
|
+
- Validate model availability against current OpenAI docs before hard-coding a dated model variant in production.
|
|
250
|
+
- Use reasoning models deliberately, since they should be chosen for workflows that actually benefit from deeper multi-step reasoning.
|
|
251
|
+
|
|
252
|
+
## License
|
|
253
|
+
|
|
254
|
+
Apache-2.0
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://pepy.tech/project/swarmauri_llm_openai/">
|
|
5
|
+
<img src="https://static.pepy.tech/badge/swarmauri_llm_openai/month" alt="PyPI - Downloads"/></a>
|
|
6
|
+
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_llm_openai/">
|
|
7
|
+
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_llm_openai.svg"/></a>
|
|
8
|
+
<a href="https://pypi.org/project/swarmauri_llm_openai/">
|
|
9
|
+
<img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
|
|
10
|
+
<a href="https://pypi.org/project/swarmauri_llm_openai/">
|
|
11
|
+
<img src="https://img.shields.io/pypi/l/swarmauri_llm_openai" alt="PyPI - License"/></a>
|
|
12
|
+
<a href="https://pypi.org/project/swarmauri_llm_openai/">
|
|
13
|
+
<img src="https://img.shields.io/pypi/v/swarmauri_llm_openai?label=swarmauri_llm_openai&color=green" alt="PyPI - swarmauri_llm_openai"/></a>
|
|
14
|
+
<a href="https://discord.gg/N4UpBuQv8T">
|
|
15
|
+
<img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
|
|
16
|
+
|
|
17
|
+
# Swarmauri OpenAI LLM
|
|
18
|
+
|
|
19
|
+
`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`.
|
|
20
|
+
|
|
21
|
+
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`.
|
|
22
|
+
|
|
23
|
+
## Why Use This Package?
|
|
24
|
+
|
|
25
|
+
- Keep OpenAI-specific imports explicit in Swarmauri applications.
|
|
26
|
+
- Use separate adapters for standard chat, reasoning, tool-calling, transcription, and TTS workflows.
|
|
27
|
+
- Reuse Swarmauri `Conversation`, toolkit, and component semantics across the OpenAI surface area.
|
|
28
|
+
- Track current OpenAI model families through one provider package boundary.
|
|
29
|
+
|
|
30
|
+
## FAQ
|
|
31
|
+
|
|
32
|
+
### What does `swarmauri_llm_openai` install?
|
|
33
|
+
|
|
34
|
+
It installs `OpenAIModel`, `OpenAIReasonModel`, `OpenAIToolModel`, `OpenAIAudio`, and `OpenAIAudioTTS`.
|
|
35
|
+
|
|
36
|
+
### Which OpenAI capabilities are wrapped today?
|
|
37
|
+
|
|
38
|
+
The package covers standard chat completions, reasoning-oriented chat models, tool-calling workflows, audio transcription, and text-to-speech generation.
|
|
39
|
+
|
|
40
|
+
### What is the difference between `OpenAIModel` and `OpenAIReasonModel`?
|
|
41
|
+
|
|
42
|
+
`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.
|
|
43
|
+
|
|
44
|
+
### When should I use `OpenAIToolModel`?
|
|
45
|
+
|
|
46
|
+
Use it when the application needs OpenAI tool calling through a Swarmauri toolkit. It is the provider-specific surface for tool-backed agent workflows.
|
|
47
|
+
|
|
48
|
+
### What do `OpenAIAudio` and `OpenAIAudioTTS` do?
|
|
49
|
+
|
|
50
|
+
`OpenAIAudio` wraps audio transcription workflows. `OpenAIAudioTTS` wraps text-to-speech generation workflows.
|
|
51
|
+
|
|
52
|
+
### Where should I verify current models and pricing?
|
|
53
|
+
|
|
54
|
+
Use the OpenAI section in [docs/LLM_PROVIDER_MODEL_PRICING_LINKS.md](../../../docs/LLM_PROVIDER_MODEL_PRICING_LINKS.md), which points to the current OpenAI models, function-calling, audio, TTS, and pricing documentation.
|
|
55
|
+
|
|
56
|
+
## Features
|
|
57
|
+
|
|
58
|
+
- `OpenAIModel` for sync, async, streaming, and batch chat completion workflows.
|
|
59
|
+
- `OpenAIReasonModel` for reasoning-model workflows across the repo-tracked `o*` families.
|
|
60
|
+
- `OpenAIToolModel` for toolkit-backed tool-calling and agent execution flows.
|
|
61
|
+
- `OpenAIAudio` for speech-to-text workflows against the tracked OpenAI transcription models.
|
|
62
|
+
- `OpenAIAudioTTS` for text-to-speech workflows against the tracked OpenAI TTS models.
|
|
63
|
+
- Compatibility with Python 3.10, 3.11, 3.12, 3.13, and 3.14.
|
|
64
|
+
|
|
65
|
+
## Installation
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
uv add swarmauri_llm_openai
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pip install swarmauri_llm_openai
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Usage
|
|
76
|
+
|
|
77
|
+
Set `OPENAI_API_KEY` in your environment before creating any of the OpenAI adapters.
|
|
78
|
+
|
|
79
|
+
### Chat Completion
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
import os
|
|
83
|
+
|
|
84
|
+
from swarmauri_llm_openai import OpenAIModel
|
|
85
|
+
from swarmauri_standard.conversations.Conversation import Conversation
|
|
86
|
+
from swarmauri_standard.messages.HumanMessage import HumanMessage
|
|
87
|
+
|
|
88
|
+
conversation = Conversation()
|
|
89
|
+
conversation.add_message(HumanMessage(content="Summarize Swarmauri in two sentences."))
|
|
90
|
+
|
|
91
|
+
model = OpenAIModel(
|
|
92
|
+
api_key=os.environ["OPENAI_API_KEY"],
|
|
93
|
+
name="gpt-5.5",
|
|
94
|
+
)
|
|
95
|
+
result = model.predict(conversation=conversation)
|
|
96
|
+
|
|
97
|
+
print(result.get_last().content)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Reasoning Model
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
import os
|
|
104
|
+
|
|
105
|
+
from swarmauri_llm_openai import OpenAIReasonModel
|
|
106
|
+
from swarmauri_standard.conversations.Conversation import Conversation
|
|
107
|
+
from swarmauri_standard.messages.HumanMessage import HumanMessage
|
|
108
|
+
|
|
109
|
+
conversation = Conversation()
|
|
110
|
+
conversation.add_message(HumanMessage(content="Reason through a release rollback plan step by step."))
|
|
111
|
+
|
|
112
|
+
model = OpenAIReasonModel(
|
|
113
|
+
api_key=os.environ["OPENAI_API_KEY"],
|
|
114
|
+
name="o3",
|
|
115
|
+
)
|
|
116
|
+
result = model.predict(conversation=conversation)
|
|
117
|
+
|
|
118
|
+
print(result.get_last().content)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Tool Calling
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
import os
|
|
125
|
+
|
|
126
|
+
from swarmauri_llm_openai import OpenAIToolModel
|
|
127
|
+
from swarmauri_standard.conversations.Conversation import Conversation
|
|
128
|
+
from swarmauri_standard.messages.HumanMessage import HumanMessage
|
|
129
|
+
from swarmauri_standard.toolkits.Toolkit import Toolkit
|
|
130
|
+
from swarmauri_standard.tools.AdditionTool import AdditionTool
|
|
131
|
+
|
|
132
|
+
conversation = Conversation()
|
|
133
|
+
conversation.add_message(HumanMessage(content="What is 19 + 23? Use the tool."))
|
|
134
|
+
|
|
135
|
+
toolkit = Toolkit(tools={"add": AdditionTool()})
|
|
136
|
+
|
|
137
|
+
model = OpenAIToolModel(
|
|
138
|
+
api_key=os.environ["OPENAI_API_KEY"],
|
|
139
|
+
name="gpt-5.5",
|
|
140
|
+
)
|
|
141
|
+
result = model.predict(
|
|
142
|
+
conversation=conversation,
|
|
143
|
+
toolkit=toolkit,
|
|
144
|
+
tool_choice="auto",
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
print(result.get_last().content)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Audio Transcription
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
import os
|
|
154
|
+
|
|
155
|
+
from swarmauri_llm_openai import OpenAIAudio
|
|
156
|
+
|
|
157
|
+
audio_model = OpenAIAudio(
|
|
158
|
+
api_key=os.environ["OPENAI_API_KEY"],
|
|
159
|
+
name="whisper-1",
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
text = audio_model.predict("tests/static/test.mp3")
|
|
163
|
+
print(text)
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Text To Speech
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
import os
|
|
170
|
+
|
|
171
|
+
from swarmauri_llm_openai import OpenAIAudioTTS
|
|
172
|
+
|
|
173
|
+
tts_model = OpenAIAudioTTS(
|
|
174
|
+
api_key=os.environ["OPENAI_API_KEY"],
|
|
175
|
+
name="tts-1",
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
audio_bytes = tts_model.predict("Swarmauri turns provider APIs into composable components.")
|
|
179
|
+
print(len(audio_bytes))
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Examples
|
|
183
|
+
|
|
184
|
+
- Use `OpenAIModel` for general-purpose chat completion workflows.
|
|
185
|
+
- Use `OpenAIReasonModel` when you want the reasoning-model family explicitly.
|
|
186
|
+
- Use `OpenAIToolModel` when an agent needs toolkit-backed tool invocation.
|
|
187
|
+
- Use `OpenAIAudio` and `OpenAIAudioTTS` when the workflow crosses text, speech, and audio generation boundaries.
|
|
188
|
+
|
|
189
|
+
## Related Packages
|
|
190
|
+
|
|
191
|
+
- [swarmauri_llm_mistral](https://pypi.org/project/swarmauri_llm_mistral/)
|
|
192
|
+
- [swarmauri_llm_groq](https://pypi.org/project/swarmauri_llm_groq/)
|
|
193
|
+
- [swarmauri_llm_hyperbolic](https://pypi.org/project/swarmauri_llm_hyperbolic/)
|
|
194
|
+
- [swarmauri_llm_deepinfra](https://pypi.org/project/swarmauri_llm_deepinfra/)
|
|
195
|
+
- [swarmauri_llm_perplexity](https://pypi.org/project/swarmauri_llm_perplexity/)
|
|
196
|
+
- [swarmauri_llm_playht](https://pypi.org/project/swarmauri_llm_playht/)
|
|
197
|
+
|
|
198
|
+
## Foundational Swarmauri Packages
|
|
199
|
+
|
|
200
|
+
- [swarmauri](https://pypi.org/project/swarmauri/)
|
|
201
|
+
- [swarmauri_core](https://pypi.org/project/swarmauri_core/)
|
|
202
|
+
- [swarmauri_base](https://pypi.org/project/swarmauri_base/)
|
|
203
|
+
- [swarmauri_standard](https://pypi.org/project/swarmauri_standard/)
|
|
204
|
+
|
|
205
|
+
## More Documentation
|
|
206
|
+
|
|
207
|
+
- [LLM provider model and pricing links](../../../docs/LLM_PROVIDER_MODEL_PRICING_LINKS.md)
|
|
208
|
+
- [OpenAI models](https://platform.openai.com/docs/models)
|
|
209
|
+
- [OpenAI function calling](https://platform.openai.com/docs/guides/function-calling)
|
|
210
|
+
- [OpenAI text to speech](https://platform.openai.com/docs/guides/text-to-speech)
|
|
211
|
+
|
|
212
|
+
## Best Practices
|
|
213
|
+
|
|
214
|
+
- Keep `OPENAI_API_KEY` in environment variables or a secret manager.
|
|
215
|
+
- Pick the adapter that matches the workflow: chat, reasoning, tool-calling, transcription, or TTS.
|
|
216
|
+
- Validate model availability against current OpenAI docs before hard-coding a dated model variant in production.
|
|
217
|
+
- Use reasoning models deliberately, since they should be chosen for workflows that actually benefit from deeper multi-step reasoning.
|
|
218
|
+
|
|
219
|
+
## License
|
|
220
|
+
|
|
221
|
+
Apache-2.0
|
|
222
|
+
|
|
223
|
+
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "swarmauri_llm_openai"
|
|
3
|
-
version = "0.
|
|
4
|
-
description = "Swarmauri
|
|
3
|
+
version = "0.11.0.dev1"
|
|
4
|
+
description = "Provider-specific Swarmauri import package for OpenAI chat, reasoning, tool-calling, transcription, and text-to-speech workflows."
|
|
5
5
|
license = "Apache-2.0"
|
|
6
6
|
readme = "README.md"
|
|
7
7
|
repository = "http://github.com/swarmauri/swarmauri-sdk"
|
|
@@ -11,6 +11,11 @@ classifiers = [
|
|
|
11
11
|
"Natural Language :: English",
|
|
12
12
|
"Development Status :: 3 - Alpha",
|
|
13
13
|
"Intended Audience :: Developers",
|
|
14
|
+
"Intended Audience :: Science/Research",
|
|
15
|
+
"Operating System :: OS Independent",
|
|
16
|
+
"Topic :: Multimedia :: Sound/Audio :: Speech",
|
|
17
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
18
|
+
"Topic :: Software Development :: Libraries",
|
|
14
19
|
"Topic :: Software Development :: Libraries :: Application Frameworks",
|
|
15
20
|
"Programming Language :: Python",
|
|
16
21
|
"Programming Language :: Python :: 3",
|
|
@@ -30,7 +35,22 @@ dependencies = [
|
|
|
30
35
|
keywords = [
|
|
31
36
|
"swarmauri",
|
|
32
37
|
"llm",
|
|
38
|
+
"swarmauri llm",
|
|
33
39
|
"openai",
|
|
40
|
+
"openai api",
|
|
41
|
+
"chat completions",
|
|
42
|
+
"reasoning model",
|
|
43
|
+
"tool calling",
|
|
44
|
+
"function calling",
|
|
45
|
+
"speech to text",
|
|
46
|
+
"transcription",
|
|
47
|
+
"text to speech",
|
|
48
|
+
"tts",
|
|
49
|
+
"audio generation",
|
|
50
|
+
"gpt-5",
|
|
51
|
+
"gpt-4o",
|
|
52
|
+
"large language model",
|
|
53
|
+
"generative ai",
|
|
34
54
|
"model",
|
|
35
55
|
]
|
|
36
56
|
|
|
@@ -79,7 +99,7 @@ dev = [
|
|
|
79
99
|
"pytest-xdist>=3.6.1",
|
|
80
100
|
"pytest-json-report>=1.5.0",
|
|
81
101
|
"python-dotenv",
|
|
82
|
-
"
|
|
102
|
+
"httpx>=0.27",
|
|
83
103
|
"flake8>=7.0",
|
|
84
104
|
"pytest-timeout>=2.3.1",
|
|
85
105
|
"ruff>=0.9.9",
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: swarmauri_llm_openai
|
|
3
|
-
Version: 0.1.1.dev2
|
|
4
|
-
Summary: Swarmauri Openai LLM adapters from swarmauri_standard.
|
|
5
|
-
License-Expression: Apache-2.0
|
|
6
|
-
License-File: LICENSE
|
|
7
|
-
Keywords: swarmauri,llm,openai,model
|
|
8
|
-
Author: Jacob Stewart
|
|
9
|
-
Author-email: jacob@swarmauri.com
|
|
10
|
-
Requires-Python: >=3.10,<3.15
|
|
11
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
-
Classifier: Natural Language :: English
|
|
13
|
-
Classifier: Development Status :: 3 - Alpha
|
|
14
|
-
Classifier: Intended Audience :: Developers
|
|
15
|
-
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
16
|
-
Classifier: Programming Language :: Python
|
|
17
|
-
Classifier: Programming Language :: Python :: 3
|
|
18
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
24
|
-
Requires-Dist: swarmauri_base
|
|
25
|
-
Requires-Dist: swarmauri_core
|
|
26
|
-
Requires-Dist: swarmauri_standard
|
|
27
|
-
Description-Content-Type: text/markdown
|
|
28
|
-
|
|
29
|
-

|
|
30
|
-
|
|
31
|
-
<p align="center">
|
|
32
|
-
<a href="https://pepy.tech/project/swarmauri_llm_openai/">
|
|
33
|
-
<img src="https://static.pepy.tech/badge/swarmauri_llm_openai/month" alt="PyPI - Downloads"/></a>
|
|
34
|
-
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_llm_openai/">
|
|
35
|
-
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_llm_openai.svg"/></a>
|
|
36
|
-
<a href="https://pypi.org/project/swarmauri_llm_openai/">
|
|
37
|
-
<img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
|
|
38
|
-
<a href="https://pypi.org/project/swarmauri_llm_openai/">
|
|
39
|
-
<img src="https://img.shields.io/pypi/l/swarmauri_llm_openai" alt="PyPI - License"/></a>
|
|
40
|
-
<a href="https://pypi.org/project/swarmauri_llm_openai/">
|
|
41
|
-
<img src="https://img.shields.io/pypi/v/swarmauri_llm_openai?label=swarmauri_llm_openai&color=green" alt="PyPI - swarmauri_llm_openai"/></a>
|
|
42
|
-
</p>
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
# swarmauri_llm_openai
|
|
46
|
-
|
|
47
|
-
Provider-specific Openai LLM package for Swarmauri. This package offers direct imports for OpenAIAudio, OpenAIAudioTTS, OpenAIModel, OpenAIReasonModel, OpenAIToolModel while keeping implementation parity with `swarmauri_standard`.
|
|
48
|
-
|
|
49
|
-
## Features
|
|
50
|
-
|
|
51
|
-
- `OpenAIAudio` adapter exported from `swarmauri_standard.llms.OpenAIAudio`.
|
|
52
|
-
- `OpenAIAudioTTS` adapter exported from `swarmauri_standard.llms.OpenAIAudioTTS`.
|
|
53
|
-
- `OpenAIModel` adapter exported from `swarmauri_standard.llms.OpenAIModel`.
|
|
54
|
-
- `OpenAIReasonModel` adapter exported from `swarmauri_standard.llms.OpenAIReasonModel`.
|
|
55
|
-
- `OpenAIToolModel` adapter exported from `swarmauri_standard.llms.OpenAIToolModel`.
|
|
56
|
-
- Compatible with Python 3.10 through 3.12.
|
|
57
|
-
|
|
58
|
-
## Installation
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
# uv
|
|
62
|
-
uv add swarmauri_llm_openai
|
|
63
|
-
|
|
64
|
-
# pip
|
|
65
|
-
pip install swarmauri_llm_openai
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## Usage
|
|
69
|
-
|
|
70
|
-
```python
|
|
71
|
-
from swarmauri_llm_openai import OpenAIAudio
|
|
72
|
-
from swarmauri_llm_openai import OpenAIAudioTTS
|
|
73
|
-
from swarmauri_llm_openai import OpenAIModel
|
|
74
|
-
from swarmauri_llm_openai import OpenAIReasonModel
|
|
75
|
-
from swarmauri_llm_openai import OpenAIToolModel
|
|
76
|
-
from swarmauri_standard.conversations.Conversation import Conversation
|
|
77
|
-
from swarmauri_standard.messages.HumanMessage import HumanMessage
|
|
78
|
-
|
|
79
|
-
conversation = Conversation()
|
|
80
|
-
conversation.add_message(HumanMessage(content="Hello from Swarmauri"))
|
|
81
|
-
|
|
82
|
-
model = OpenAIAudio()
|
|
83
|
-
# Configure provider credentials before making requests.
|
|
84
|
-
# result = model.predict(conversation=conversation)
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## Workflow Notes
|
|
88
|
-
|
|
89
|
-
- These adapters intentionally mirror the corresponding classes in `swarmauri_standard`.
|
|
90
|
-
- Use the provider package that matches your deployment and credential setup.
|
|
91
|
-
- Install only the provider packages you need to keep dependencies minimal.
|
|
92
|
-
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-

|
|
2
|
-
|
|
3
|
-
<p align="center">
|
|
4
|
-
<a href="https://pepy.tech/project/swarmauri_llm_openai/">
|
|
5
|
-
<img src="https://static.pepy.tech/badge/swarmauri_llm_openai/month" alt="PyPI - Downloads"/></a>
|
|
6
|
-
<a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_llm_openai/">
|
|
7
|
-
<img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_llm_openai.svg"/></a>
|
|
8
|
-
<a href="https://pypi.org/project/swarmauri_llm_openai/">
|
|
9
|
-
<img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
|
|
10
|
-
<a href="https://pypi.org/project/swarmauri_llm_openai/">
|
|
11
|
-
<img src="https://img.shields.io/pypi/l/swarmauri_llm_openai" alt="PyPI - License"/></a>
|
|
12
|
-
<a href="https://pypi.org/project/swarmauri_llm_openai/">
|
|
13
|
-
<img src="https://img.shields.io/pypi/v/swarmauri_llm_openai?label=swarmauri_llm_openai&color=green" alt="PyPI - swarmauri_llm_openai"/></a>
|
|
14
|
-
</p>
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
# swarmauri_llm_openai
|
|
18
|
-
|
|
19
|
-
Provider-specific Openai LLM package for Swarmauri. This package offers direct imports for OpenAIAudio, OpenAIAudioTTS, OpenAIModel, OpenAIReasonModel, OpenAIToolModel while keeping implementation parity with `swarmauri_standard`.
|
|
20
|
-
|
|
21
|
-
## Features
|
|
22
|
-
|
|
23
|
-
- `OpenAIAudio` adapter exported from `swarmauri_standard.llms.OpenAIAudio`.
|
|
24
|
-
- `OpenAIAudioTTS` adapter exported from `swarmauri_standard.llms.OpenAIAudioTTS`.
|
|
25
|
-
- `OpenAIModel` adapter exported from `swarmauri_standard.llms.OpenAIModel`.
|
|
26
|
-
- `OpenAIReasonModel` adapter exported from `swarmauri_standard.llms.OpenAIReasonModel`.
|
|
27
|
-
- `OpenAIToolModel` adapter exported from `swarmauri_standard.llms.OpenAIToolModel`.
|
|
28
|
-
- Compatible with Python 3.10 through 3.12.
|
|
29
|
-
|
|
30
|
-
## Installation
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
# uv
|
|
34
|
-
uv add swarmauri_llm_openai
|
|
35
|
-
|
|
36
|
-
# pip
|
|
37
|
-
pip install swarmauri_llm_openai
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Usage
|
|
41
|
-
|
|
42
|
-
```python
|
|
43
|
-
from swarmauri_llm_openai import OpenAIAudio
|
|
44
|
-
from swarmauri_llm_openai import OpenAIAudioTTS
|
|
45
|
-
from swarmauri_llm_openai import OpenAIModel
|
|
46
|
-
from swarmauri_llm_openai import OpenAIReasonModel
|
|
47
|
-
from swarmauri_llm_openai import OpenAIToolModel
|
|
48
|
-
from swarmauri_standard.conversations.Conversation import Conversation
|
|
49
|
-
from swarmauri_standard.messages.HumanMessage import HumanMessage
|
|
50
|
-
|
|
51
|
-
conversation = Conversation()
|
|
52
|
-
conversation.add_message(HumanMessage(content="Hello from Swarmauri"))
|
|
53
|
-
|
|
54
|
-
model = OpenAIAudio()
|
|
55
|
-
# Configure provider credentials before making requests.
|
|
56
|
-
# result = model.predict(conversation=conversation)
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Workflow Notes
|
|
60
|
-
|
|
61
|
-
- These adapters intentionally mirror the corresponding classes in `swarmauri_standard`.
|
|
62
|
-
- Use the provider package that matches your deployment and credential setup.
|
|
63
|
-
- Install only the provider packages you need to keep dependencies minimal.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|