Repository navigation
Releases
Releases · objecthub/GPTForFoundationModels
0.1.4
- Retries: a request is sent again after a temporary failure (rate limits, overloaded or failing servers, failed responses, lost or stalled connections) while nothing of its response has reached the session.
GPTRetryPolicy(default: two retries, at most 20 s of waiting each) sets how often; the server'sretry-after-ms,retry-after, orx-ratelimit-reset-*decides how long, or else an exponential backoff with jitter. A longer requested wait fails right away with the reset time. - Rejected settings are corrected once and remembered per executor: reasoning summaries (e.g. for unverified organizations),
temperature/top_p, unsupported reasoning efforts (replaced by the closest effort the error lists), and reasoning parameters on models without reasoning. - The reasoning effort
max, accepted by the GPT-6 and GPT-5.6 models. - Requests that carry the whole conversation leave out the reasoning of earlier turns: the API only uses the current turn's, so it only made requests larger (about 2 KB per reasoning item). Fingerprints of stored responses still cover everything.
- Responses that took more than one attempt record the number under
openai.attempts.
0.1.3
- All requests with the same timeout share one
URLSession. Before, every executor created its own session, and so did every model list and token count call; the sessions were never invalidated, and each kept its own idle connections alive, which expire with log messages likenw_read_request_report [C13] Receive failed with error "Operation timed out".
0.1.2
- Strict schemas state the count limits of arrays and the ranges of numbers in their descriptions, e.g.
(2 to 3 items). The API enforces these limits while generating the output, but the model doesn't learn about them: a model that wanted to write more array elements than allowed kept extending the last one instead, often with garbled text (4 of 12 runs of an itinerary schema withgpt-5.5; none with the descriptions).
0.1.1
- A prompt flagged by the safety check of reasoning models (
invalid_prompt, "your prompt was flagged as potentially violating our usage policy") now throwsLanguageModelError.guardrailViolationinstead ofGPTAPIError. The check doesn't always fire for the same prompt, so retrying can succeed.
0.1.0
Changelog
0.1.0 (2026-11-21)
First release.
GPTLanguageModel: OpenAI's GPT models as a Foundation Models language model, backed by the Responses API.- Generation: text, streaming, guided generation with strict JSON schemas, tool calling, reasoning with summaries.
- Input: images and PDF attachments.
- Usage reporting, with cached and reasoning tokens.
- Conversations are stateless by default: every request carries the whole transcript, with the model's reasoning as encrypted items.
state: .storedstores responses at OpenAI and continues them by ID, falling back to the whole transcript whenever it no longer matches the stored conversation. - Model output is recorded on its transcript entries and replayed exactly: reasoning with its encrypted content, function calls, built-in tool calls.
- Strict schemas: optional properties are sent as nullable and their
nulls removed again; schemas that aren't objects are wrapped; properties keep their declared order. GPTModel:- constants for the GPT-6, GPT-5, o3, and GPT-4 models, with the reasoning efforts each accepts and its default;
GPTModel.available(auth:)lists the API's models.
- Built-in tools: web search and code interpreter.
GPTToolActivityreads their calls back out of a transcript. - Token counting with the API's input token endpoint.
- Error mapping to
LanguageModelError,GPTError, andGPTAPIError. Unverifiable encrypted reasoning is dropped and the request retried. - Streams that send no events for three times the request timeout fail with a timeout instead of hanging.
- The package builds for macOS 14 / iOS 17; its API is available on the OS 27 releases.