.. index:: single: open_ai_backend_protocol
.. _open_ai_backend_protocol/0:

.. rst-class:: right

**protocol**

``open_ai_backend_protocol``
============================

Protocol implemented by OpenAI-compatible server backends.

| **Availability:** 
|    ``logtalk_load(open_ai(loader))``

| **Author:** Paulo Moura
| **Version:** 1:0:0
| **Date:** 2026-07-13

| **Compilation flags:**
|    ``static``


| **Dependencies:**
|   (none)


| **Remarks:**
|    (none)

| **Inherited public predicates:**
|    (none)

.. contents::
   :local:
   :backlinks: top

Public predicates
-----------------

.. index:: handle_open_ai/3
.. _open_ai_backend_protocol/0::handle_open_ai/3:

``handle_open_ai/3``
^^^^^^^^^^^^^^^^^^^^

Handles an OpenAI operation selected by operation identifier for the normalized HTTP request and returns a REST result term accepted by the ``rest`` library. The predicate is expected to succeed once for both successful and application error outcomes; plain failure or error is a backend contract violation handled by the server facade as an unexpected server error.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``handle_open_ai(OperationId,Request,Result)``
| **Mode and number of proofs:**
|    ``handle_open_ai(+atom,+compound,--term)`` - ``one``


------------

Protected predicates
--------------------

(none)

Private predicates
------------------

(none)

Operators
---------

(none)

