I have just updated the DelphiGenAI wrapper to support the OpenAI APIs. Below is the list of changes made compared to version 1.1.0.
These enhancements are designed to fully leverage the capabilities of the GPT-5 model while ensuring optimal compatibility with previous models.
You can find the complete repository here: https://github.com/MaxiDonkey/DelphiGenAI
Version 1.2.0
JSON Normalization Before Deserialization
New GenAI.API.Normalizer module (TJSONNormalizer, TWrapKind, TNormalizationRule) to unify polymorphic fields (e.g., string vs. object).
Direct integration into the HTTP layer: new Get(..., Path) | Post(..., Path) overloads enabling targeted normalization of a JSON subtree before object mapping.
Canceling Background Requests
New Responses.AsyncAwaitCancel(response_id) method to cancel an asynchronous response (background = true), with full callback support (OnStart, OnSuccess, OnError).
Streaming Enhancements
Extended typed coverage for streaming events and outputs (MCP, Code Interpreter, Image Generation, etc.) via new Responses.OutputParams classes (TResponseOutput*, TResponseImageGenerationTool, TResponseCodeInterpreter, etc.).
New Types and Parameters
InputParams: full coverage for computer interactions, local shell, MCP, web search, code, image generation, reasoning, text/JSON formats, tool choice/hosted tool, and file search filters.
OutputParams: states (Created, InProgress, etc.), events (Added, Delta), usage metrics, and statistics.
New enums: TOutputIncluding, TReasoningGenerateSummary, TFidelityType, etc.
API v1/chat/completions
New parameters:
prompt_cache_key (prompt caching)
safety_identifier (stable ID for safety monitoring)
verbosity (low / medium / high)
API v1/responses
New parameters:
max_tool_calls
prompt (template reference via TPromptParams)
prompt_cache_key, safety_identifier
stream_options, top_logprobs, verbosity
Structured System and Developer Messages
New overloads:
TMessagePayload.Developer(const Content: TArray; const Name: string = '')
TMessagePayload.System(const Content: TArray; const Name: string = '')
Improves parity between plain text and structured content flows.