object

open_ai_client

OpenAI-compatible client facade using the http_client library.

Availability:
logtalk_load(open_ai(loader))
Author: Paulo Moura
Version: 1:0:0
Date: 2026-07-09
Compilation flags:
static, context_switching_calls
Remarks:
(none)
Inherited public predicates:
(none)

Public predicates

request/5

Calls an OpenAI operation by operation identifier. Path parameters are supplied as Name-Value pairs. The body is ignored for methods without a request body. Options include base_url/1, api_key/1, organization/1, project/1, and ordinary http_client request options.

Compilation flags:
static
Template:
request(OperationId,PathParameters,Body,Response,Options)
Mode and number of proofs:
request(+atom,+list(pair),+compound,--compound,+list(compound)) - one_or_error
Exceptions:
The catalog operation method Method is unsupported by the client facade:
domain_error(open_ai_operation_method,Method)
An element Parameter of the list PathParameters is not a Name-Value pair of atoms:
domain_error(open_ai_path_parameter,Parameter)
Options contains an invalid OpenAI client option:
domain_error(open_ai_client_option,Option)
The delegated HTTP client rejects the response stream:
domain_error(http_response_stream,Error)

operation_url/4

Builds the absolute request URL for an operation and path parameters.

Compilation flags:
static
Template:
operation_url(OperationId,PathParameters,URL,Options)
Mode and number of proofs:
operation_url(+atom,+list(pair),-atom,+list(compound)) - one_or_error
Exceptions:
An element Parameter of the list PathParameters is not a Name-Value pair of atoms:
domain_error(open_ai_path_parameter,Parameter)

Protected predicates

(no local declarations; see entity ancestors if any)

Private predicates

(no local declarations; see entity ancestors if any)

Operators

(none)