Nice pack. Does it still work? Testing an example yields:
12 ?- gpt_completions('text-davinci-003','My favourite animal is ',Result,_,[]).
ERROR: url `'https://api.openai.com/v1/chat/completions'' does not exist (status(404,Not Found))
ERROR: In:
ERROR: [16] throw(error(existence_error(url,'https://api.openai.com/v1/chat/completions'),context(_934,...)))
ERROR: [14] http_open:try_http_proxy(direct,'<garbage_collected>','<garbage_collected>','<garbage_collected>') at c:/program files/swi-prolog 8.5.8/library/http/http_open.pl:490
ERROR: [12] http_client:http_get('https://api.openai.com/v1/chat/completions',_1004,[post(...),...|...]) at c:/program files/swi-prolog 8.5.8/library/http/http_client.pl:139
ERROR: [10] prolog2gpt:gpt_completions('text-davinci-003','My favourite animal is ',_1056,_1058,[]) at c:/users/fernan/desktop/gpt prolog/prolog2gpt.pl:296
ERROR: [9] toplevel_call('<garbage_collected>') at c:/program files/swi-prolog 8.5.8/boot/toplevel.pl:1162
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
13 ?-
However, another test does work:
13 ?- gpt_models(Models).
Models = ['dall-e-2', 'text-embedding-ada-002', 'text-embedding-3-large', 'babbage-002', 'o1-mini', 'davinci-002', 'o1-mini-2024-09-12', 'whisper-1', 'dall-e-3'|...].
Tests run in Windows 11 and SWI-Prolog 8.5.8.