object

# `open_ai_server(Backend)`

- `Backend` - Application object implementing `open_ai_backend_protocol`.

OpenAI-compatible REST server facade backed by an application object.

Availability:
`logtalk_load(open_ai(loader))`
Author: Paulo Moura
Version: 1:0:0
Date: 2026-07-13
Compilation flags:
`static, context_switching_calls`
Implements:
`public` http_handler_protocol
`public` open_api_provider_protocol
Imports:
`public` rest
Uses:
http_core
list
open_ai_api
open_ai_catalog
Remarks:
(none)
Inherited public predicates:
api_info/1 binary_body/2 created_response/4 form_body/2 handle/2 json_array_body/2 json_body/2 json_object_body/2 json_response/4 json_response/5 no_content_response/2 operations/1 path_parameter/3 problem_response/6 query_parameter/3 request_body/2 request_header/3 schema/2 security/1 security_scheme/2 servers/1 text_body/2

## Public predicates

(no local declarations; see entity ancestors if any)

## Protected predicates

### `open_api_info/1`

Hook returning the OpenAPI information object for the server facade.

Compilation flags:
`static`
Template:
`open_api_info(Info)`
Mode and number of proofs:
`open_api_info(-compound)` - `one`

### `open_api_servers/1`

Hook returning the OpenAPI server list for the local server facade.

Compilation flags:
`static`
Template:
`open_api_servers(Servers)`
Mode and number of proofs:
`open_api_servers(-list(compound))` - `one`

### `open_api_security/1`

Hook returning the OpenAPI security requirements for the server facade.

Compilation flags:
`static`
Template:
`open_api_security(Security)`
Mode and number of proofs:
`open_api_security(-list(compound))` - `zero_or_one`

### `open_api_security_scheme/2`

Hook enumerating OpenAPI security schemes for the server facade.

Compilation flags:
`static`
Template:
`open_api_security_scheme(Name,Scheme)`
Mode and number of proofs:
`open_api_security_scheme(?atom,?compound)` - `zero_or_more`

### `open_api_schema/2`

Hook enumerating named OpenAPI schemas for the server facade.

Compilation flags:
`static`
Template:
`open_api_schema(Name,Schema)`
Mode and number of proofs:
`open_api_schema(?atom,?compound)` - `zero_or_more`

### `endpoint/5`

Hook enumerating REST endpoint descriptors derived from the generated OpenAI catalog.

Compilation flags:
`static`
Template:
`endpoint(Id,Method,Path,Action,Options)`
Mode and number of proofs:
`endpoint(?atom,?atom,?atom,?atom,?list(compound))` - `zero_or_more`

### `open_api_validate_request/1`

Hook selecting operations whose requests should be validated against the OpenAPI contract.

Compilation flags:
`static`
Template:
`open_api_validate_request(Id)`
Mode and number of proofs:
`open_api_validate_request(?atom)` - `zero_or_more`

### `open_api_validate_response/1`

Hook selecting operations whose responses should be validated against the OpenAPI contract.

Compilation flags:
`static`
Template:
`open_api_validate_response(Id)`
Mode and number of proofs:
`open_api_validate_response(?atom)` - `zero_or_more`

### `dispatch_open_ai/2`

Dispatches a routed OpenAI request to the backend object and returns a REST result. Backend application errors should be returned as REST result terms; unexpected backend failure or error is left to the `rest` action failure handling.

Compilation flags:
`static`
Template:
`dispatch_open_ai(Request,Result)`
Mode and number of proofs:
`dispatch_open_ai(+compound,--term)` - `one`

## Private predicates

(no local declarations; see entity ancestors if any)

## Operators

(none)