Prolog to GPT API

I’ve written most of the Prolog to GPT API. Have a look at https://github.com/RdR1024/prolog2gpt .

Background

Large Language Models like GPT (by Open AI) have advanced natural language processing enormously in recent years. However, such models can benefit from interactions with other approaches to reasoning, such as logic engines. This seems an opportunity for Prolog. This library enables SWI-Prolog users to use the GPT API from within Prolog programs. The results from calls to GPT are returned as simple Prolog terms, with optional access to more detail in the returned JSON structures.

For convenience, I’ve added most of the API documentation into the source code, so that the SWI-Prolog PlDoc documentation server can read it.

Current Status

There are some less critical issues to fix, and I want to add some more examples. But the API predicates exist, and are pretty easy to use within Prolog.

6 Likes