Skip to content

Commit 6d75976

Browse files
MaxiDonkey@hotmail.comMaxiDonkey@hotmail.com
authored andcommitted
version 1.3.0
1 parent 3dd8b9e commit 6d75976

31 files changed

Lines changed: 13463 additions & 1890 deletions

Changelog.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,64 @@
1+
#### 2025, October 19 version 1.3.0
2+
3+
**Deprecation of Assistants API units**
4+
5+
OpenAI announced the deprecation of the Assistants API on August 26, 2025, with permanent removal scheduled for August 26, 2026.
6+
The following units are now marked as deprecated within the wrapper:
7+
8+
- `GenAI.Messages.pas`
9+
- `GenAI.Threads.pas`
10+
- `GenAI.Run.pas`
11+
- `GenAI.RunSteps.pas`
12+
13+
These remain functional for backward compatibility but should no longer be used for new developments. Migration to the `v1/conversations` and `v1/responses` endpoints is strongly recommended.
14+
A dedicated Assistants-to-Conversations migration guide has been added to the documentation.
15+
16+
<br>
17+
18+
**New API endpoint: `v1/conversations`**
19+
20+
- Implements the new Conversations API introduced by OpenAI in March 2025.
21+
- Enables persistent conversation management and structured context building for use with `v1/responses`.
22+
- New Delphi types (`TConversation`, `TConversationMessage`, etc.) for creating, updating and listing conversation threads.
23+
- Supports streamed responses, tool execution, system/developer messages, caching (`prompt_cache_key`) and safety identifiers.
24+
25+
<br>
26+
27+
**New API endpoint: `v1/containers` (Code Interpreter execution environment)**
28+
29+
- Full support for creating and managing remote execution containers used by the Code Interpreter tool.
30+
- File upload, Python code execution, artifact retrieval and container lifecycle are now available through the `GenAI.Containers.*` namespace.
31+
- Provides low-level control over execution state and outputs.
32+
33+
<br>
34+
35+
**New API endpoint: `v1/video` (Sora video generation)**
36+
37+
- Adds access to OpenAI’s Sora API for text-to-video and image-to-video generation with audio.
38+
- Task status tracking supported (`queued`, `in_progress`, `completed`, `failed`).
39+
- New `GenAI.Video.*` units cover request/response typing, metadata (resolution, duration, fps, audio inclusion, seed, safety information, etc.).
40+
41+
<br>
42+
43+
**Realtime API (separate module)**
44+
45+
Although outside the core HTTP-based GenAI wrapper, a separate implementation has been introduced to support OpenAI’s Realtime API (WebRTC):
46+
47+
- Real-time audio/text/vision streaming interactions with models.
48+
- Supports live reasoning, tool usage and code execution.
49+
- Documented in the project's *Realtime* section. This module is optional and not required for standard REST usage.
50+
51+
<br>
52+
53+
**Additional updates**
54+
55+
- Documentation (README, TutorialHub) updated to reflect the Conversations + Responses workflow.
56+
- Compiler warnings added for deprecated Assistants API units.
57+
- `InputParams` and `OutputParams` updated to maintain compatibility with new endpoints.
58+
- Foundation prepared for the complete removal of Assistants API in a future release.
59+
60+
<br>
61+
162
#### 2025, August 14 version 1.2.1
263
- Fix the destructor `TResponseOutputComputer.Destroy;` method in `GenAI.Responses.OutputParams module`.
364

README.md

Lines changed: 148 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,28 @@ ___
55
![GitHub](https://img.shields.io/badge/IDE%20Version-Delphi%2010.4/11/12-ffffba)
66
[![GetIt – Available](https://img.shields.io/badge/GetIt-Available-baffc9?logo=delphi&logoColor=white)](https://getitnow.embarcadero.com/genai-optimized-openai-integration-wrapper/)
77
![GitHub](https://img.shields.io/badge/platform-all%20platforms-baffc9)
8-
![GitHub](https://img.shields.io/badge/Updated%20on%20August%2012,%202025-blue)
8+
![GitHub](https://img.shields.io/badge/Updated%20on%20October%2019,%202025-blue)
99

1010
<br>
1111

12-
NEW:
12+
#### NEW:
1313
- Getit current version: 1.2.0
14-
- [Changelog v1.2.0](Changelog.md)
15-
14+
- [Changelog v1.3.0](Changelog.md)
15+
- [Videos using SORA](guides/Videos.md#videos)
16+
- [Conversations API](guides/Conversations.md#conversations)
17+
- [Containers for code interpreter](guides/Containers.md#containers-managment)
18+
- [Realtime](guides/Realtime.md#realtime)
1619
___
1720

1821
<br>
1922

2023
- [Introduction](#introduction)
2124
- [Documentation Overview](#documentation-overview)
22-
- [TIPS for using the tutorial effectively](#tips-for-using-the-tutorial-effectively)
25+
- [Tips for using the tutorial effectively](#tips-for-using-the-tutorial-effectively)
26+
- [Obtain an API Key](#obtain-an-api-key)
27+
- [Code examples](#code-examples)
2328
- [Strategies for quickly using the code examples](#strategies-for-quickly-using-the-code-examples)
2429
- [Use file2knowledge](#use-file2knowledge)
25-
- [Obtain an api key](#obtain-an-api-key)
2630
- [GenAI functional coverage](#genai-functional-coverage)
2731
- [Quick Start Guide](#quick-start-guide)
2832
- [Responses vs. Chat Completions](#responses-vs-chat-completions)
@@ -34,6 +38,7 @@ ___
3438
- [How to execute multiple background requests to process a batch of responses?](#how-to-execute-multiple-background-requests-to-process-a-batch-of-responses)
3539
- [How to structure a chain of thought and develop advanced processing with GenAI?](#how-to-structure-a-chain-of-thought-and-develop-advanced-processing-with-genai)
3640
- [How do you structure advanced reasoning using Promises and pipelines?](#how-do-you-structure-advanced-reasoning-using-promises-and-pipelines)
41+
- [Deprecated](#deprecated)
3742
- [Contributing](#contributing)
3843
- [License](#license)
3944

@@ -45,7 +50,7 @@ ___
4550

4651
> **Built with Delphi 12 Community Edition** (v12.1 Patch 1)
4752
>The wrapper itself is MIT-licensed.
48-
>You can compile and test it free of charge with Delphi CE; any recent commercial Delphi edition works as well.
53+
>You can compile and test it **free of charge with Delphi CE**; any recent commercial Delphi edition works as well.
4954
5055
**DelphiGenAI** is a full OpenAI wrapper for Delphi, covering the entire platform: text, vision, audio, image generation, video (Sora-2), embeddings, conversations, containers, and the latest `v1/responses` agentic workflows. It offers a unified interface with sync/async/await support across major Delphi platforms, making it easy to leverage modern multimodal and tool-based AI capabilities in Delphi applications.
5156

@@ -72,7 +77,117 @@ Comprehensive Project Documentation Reference
7277

7378
___
7479

75-
# TIPS for using the tutorial effectively
80+
# Tips for using the tutorial effectively
81+
82+
## Obtain an API Key
83+
84+
To initialize the API instance, you need to obtain an [API key from OpenAI](https://platform.openai.com/settings/organization/api-keys)
85+
86+
Once you have a token, you can initialize IGenAI interface, which is an entry point to the API.
87+
88+
>[!NOTE]
89+
>```pascal
90+
>//uses GenAI, GenAI.Types;
91+
>
92+
>//Declare
93+
>// Client: IGenAI;
94+
>
95+
> Client := TGenAIFactory.CreateInstance(api_key);
96+
>```
97+
98+
To streamline the use of the API wrapper, the process for declaring units has been simplified. Regardless of which methods you use, you only need to reference the following two core units:
99+
`GenAI` and `GenAI.Types`.
100+
101+
<br>
102+
103+
>[!TIP]
104+
> To effectively use the examples in this tutorial, particularly when working with asynchronous methods, it is recommended to define the client interfaces with the broadest possible scope. For optimal implementation, these clients should be declared in the application's `OnCreate` method.
105+
>
106+
107+
<br>
108+
109+
## Code examples
110+
111+
The **OpenAI API** lets you plug advanced models into your applications and production workflows in just a few lines of code. Once billing is enabled on your account, your API keys become active and you can start making requests — including your first call to the chat endpoint within seconds.
112+
113+
- [Synchronous code example](#synchronous-code-example)
114+
- [Asynchronous code example](#asynchronous-code-example)
115+
116+
<br>
117+
118+
### Synchronous code example
119+
120+
```pascal
121+
//uses GenAI, GenAI.Types, GenAI.Tutorial.VCL;
122+
123+
var API_Key := 'OPENAI_API_KEY';
124+
var MyClient := TGenAIFactory.CreateInstance(API_KEY);
125+
126+
var Value := Client.Responses.Create(
127+
procedure (Params: TResponsesParams)
128+
begin
129+
Params
130+
.Model('gpt-4.1-mini')
131+
.Input('What is the difference between a mathematician and a physicist?')
132+
.Store(False); // Response not stored
133+
end);
134+
try
135+
for var Item in Value.Output do
136+
for var SubItem in Item.Content do
137+
Memo1.Text := SubItem.Text;
138+
finally
139+
Value.Free;
140+
end;
141+
```
142+
143+
<br>
144+
145+
### Asynchronous code example
146+
147+
```pascal
148+
//uses GenAI, GenAI.Types, GenAI.Tutorial.VCL;
149+
150+
var MyClient: IGenAI;
151+
152+
procedure TForm1.Test;
153+
begin
154+
var API_Key := 'OPENAI_API_KEY';
155+
MyClient := TGenAIFactory.CreateInstance(API_KEY);
156+
157+
MyClient.Responses.AsynCreate(
158+
procedure (Params: TResponsesParams)
159+
begin
160+
Params
161+
.Model('gpt-4.1-mini')
162+
.Input('What is the difference between a mathematician and a physicist?')
163+
.Store(False); // Response not stored
164+
end,
165+
function : TAsynResponse
166+
begin
167+
Result.OnStart :=
168+
procedure (Sender: TObject)
169+
begin
170+
Memo1.Lines.Text := 'Please wait...';
171+
end;
172+
173+
Result.OnSuccess :=
174+
procedure (Sender: TObject; Value: TResponse)
175+
begin
176+
for var Item in Value.Output do
177+
for var SubItem in Item.Content do
178+
Memo1.Text := SubItem.Text;
179+
end;
180+
181+
Result.OnError :=
182+
procedure (Sender: TObject; Error: string)
183+
begin
184+
Memo1.Lines.Text := Error;
185+
end;
186+
end);
187+
end;
188+
```
189+
190+
<br>
76191

77192
## Strategies for quickly using the code examples
78193

@@ -83,7 +198,7 @@ To streamline the implementation of the code examples provided in this tutorial,
83198
>Extract the `VCL` or `FMX` version depending on your target platform for testing.
84199
>Next, add the path to the DelphiGenAI library in your project’s options, then copy and paste the code examples for immediate execution.
85200
>
86-
>These two archives have been designed to fully leverage the TutorialHub middleware and enable rapid upskilling with DelphiGenAI.
201+
>These two archives are designed to fully leverage the TutorialHub middleware and enable rapid upskilling with DelphiGenAI.
87202
88203
- [**`VCL`**](https://github.com/MaxiDonkey/DelphiGenAI/tree/main/sample) support with TutorialHUB: ***TestGenAI_VCL.zip***
89204

@@ -101,48 +216,24 @@ This [project](https://github.com/MaxiDonkey/file2knowledge/blob/main/README.md)
101216

102217
<br>
103218

104-
## Obtain an api key
105-
106-
To initialize the API instance, you need to obtain an [API key from OpenAI](https://platform.openai.com/settings/organization/api-keys)
107-
108-
Once you have a token, you can initialize IGenAI interface, which is an entry point to the API.
109-
110-
>[!NOTE]
111-
>```Delphi
112-
>//uses GenAI, GenAI.Types;
113-
>
114-
>//Declare
115-
>// Client: IGenAI;
116-
>
117-
> Client := TGenAIFactory.CreateInstance(api_key);
118-
>```
119-
120-
To streamline the use of the API wrapper, the process for declaring units has been simplified. Regardless of the methods being utilized, you only need to reference the following two core units:
121-
`GenAI` and `GenAI.Types`.
122-
123-
<br>
124-
125-
>[!TIP]
126-
> To effectively use the examples in this tutorial, particularly when working with asynchronous methods, it is recommended to define the client interfaces with the broadest possible scope. For optimal implementation, these clients should be declared in the application's `OnCreate` method.
127-
>
128-
129-
<br>
130-
131219
___
132220

133221
# GenAI functional coverage
134222

135223
Below, the table succinctly summarizes all OpenAI endpoints supported by the GenAI.
136224

137-
|End point | supported | status |
225+
|End point | supported | status / notes|
138226
|--- |:---: |:---: |
139227
| [/assistants](guides/Deprecated.md#assistants) | <div align="center"><span style="color: green;">●</span></div> | ![deprecated](https://img.shields.io/badge/DEPRECATED-orange) |
140228
| [/audio/speech](guides/Audio.md#text-to-speech) | <div align="center"><span style="color: green;">●</span></div> | |
141229
| [/audio/transcriptions](guides/Audio.md#speech-to-text) | <div align="center"><span style="color: green;">●</span></div> | |
142230
| [/audio/translations](guides/Audio.md#speech-to-text) | <div align="center"><span style="color: green;">●</span></div> | |
143231
| [/batches](guides/Batch.md#batch) | <div align="center"><span style="color: green;">●</span></div> | |
144232
| [/chat/completions](guides/ChatCompletion.md#chat-completion) | <div align="center"><span style="color: green;">●</span></div> | |
233+
| /chatkit | | |
145234
| [/completions](guides/Legacy.md#legacy) | <div align="center"><span style="color: green;">●</span></div> | ![legacy](https://img.shields.io/badge/LEGACY-fuchsia) |
235+
| [/containers](guides/Containers.md#containers-managment) | <div align="center"><span style="color: green;">●</span></div> | ![new](https://img.shields.io/badge/NEW-006400?style=flat) |
236+
| [/conversations](guides/Conversations.md#conversations) | <div align="center"><span style="color: green;">●</span></div> | ![new](https://img.shields.io/badge/NEW-006400?style=flat) |
146237
| [/embeddings](guides/Embeddings.md#embeddings) | <div align="center"><span style="color: green;">●</span></div> | |
147238
| /evals | | |
148239
| [/files](guides/Files.md#files) | <div align="center"><span style="color: green;">●</span></div> | |
@@ -151,11 +242,12 @@ Below, the table succinctly summarizes all OpenAI endpoints supported by the Gen
151242
| [/models](guides/Models.md#models) | <div align="center"><span style="color: green;">●</span></div> | |
152243
| [/moderations](guides/Moderation.md#moderation) | <div align="center"><span style="color: green;">●</span></div> | |
153244
| /organization | | |
154-
| /realtime | | |
155-
| [/responses](guides/Responses.md#responses) | <div align="center"><span style="color: green;">●</span></div> | |
245+
| [/realtime](guides/Realtime.md#realtime) | <div align="center"><span style="color: green;">●</span></div> | ![new](https://img.shields.io/badge/NEW-006400?style=flat) |
246+
| [/responses](guides/Responses.md#responses) | <div align="center"><span style="color: green;">●</span></div> | ![updated](https://img.shields.io/badge/UPDATED-003399?style=flat) |
156247
| [/threads](guides/Deprecated.md#threads) | <div align="center"><span style="color: green;">●</span></div> | ![deprecated](https://img.shields.io/badge/DEPRECATED-orange) |
157248
| [/uploads](guides/Uploads.md#uploads) | <div align="center"><span style="color: green;">●</span></div> | |
158249
| [/vector_stores](guides/VectorStore.md#vector-store-managment) | <div align="center"><span style="color: green;">●</span></div> | |
250+
| [/videos](guides/Videos.md#videos) | <div align="center"><span style="color: green;">●</span></div> | ![new](https://img.shields.io/badge/NEW-006400?style=flat) |
159251

160252
<br>
161253

@@ -239,7 +331,7 @@ Alternatively, you can access it via the `HttpMonitoring` function, declared in
239331

240332
**Usage Example**
241333

242-
```Delphi
334+
```pascal
243335
//uses GenAI;
244336
245337
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
@@ -263,7 +355,7 @@ Among the method's parameters, you can specify the model to be used for the enti
263355

264356
**Usage Example**
265357

266-
```Delphi
358+
```pascal
267359
//uses GenAI, GenAI.Types, GenAI.Tutorial.VCL;
268360
269361
Client.Chat.CreateParallel(
@@ -323,7 +415,22 @@ Orchestrate AI thought chains elegantly and efficiently. By leveraging a dynamic
323415

324416
___
325417

418+
# Deprecated
419+
420+
## Deprecation of the OpenAI Assistants API
326421

422+
OpenAI announced the deprecation of the Assistants API on **August 26, 2025**, with permanent removal scheduled for **August 26, 2026**.
423+
This API is being replaced by the new ***Responses API*** and ***Conversations API***, launched in March 2025, which integrate and simplify all functionality previously provided by the Assistants API.
424+
425+
To ensure future compatibility, it is strongly recommended to migrate your integrations to the Responses and Conversations APIs as soon as possible.
426+
See the [Assistants-to-Conversations migration guide](https://platform.openai.com/docs/assistants/migration) for more details.
427+
428+
Affected units:
429+
`GenAI.Messages.pas`, `GenAI.Threads.pas`, `GenAI.Run.pas`, `GenAI.RunSteps.pas`
430+
431+
<br>
432+
433+
___
327434

328435
# Contributing
329436

0 commit comments

Comments
 (0)