OpenAI plugin
This is a very thin wrapper between Qore and openai-php/client
.
Setting up
Enable this plugin and fill in:
- API Key
- Model name (default
gpt-4o-mini
) - Organization ID (optional)
When that's done, you can test if it works:
dd(openai_chat('Hi, why is vue better than react in max 10 words?'));
Usage
You can retrieve the OpenAI client by calling openai_client()
. For example
openai_client()->chat()->create([
'model' => tenant()->getSetting('qore/openai', 'openai_model', 'gpt-4o-mini'),
'messages' => [
[
'role' => 'user',
'content' => $question
]
],
]);
Documentation for the client openai_client()
is available here: https://github.com/openai-php/client