Xenforo 2 [021] ChatGPT Framework

Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Sonia

Administrator
Administrator
Joined
Jan 27, 2019
Messages
1,533
Credits
1,338
This add-on provides helper functions for working with ChatGPT.
It allows you to set an API key for add-ons that work with ChatGPT and avoid loading duplicate dependencies.

Developer usage guide

Get the OpenAI API key
PHP:
Expand Collapse Copy
$apiKey = \XF::options()->bsChatGptApiKey;

Get a response from ChatGPT




PHP:
Expand Collapse Copy
use BS\ChatGPTBots\Response;

/** \Orhanerday\OpenAi\OpenAi $api */
$api = \XF::app()->container('chatGPT');

$messages = [
    ['role' => 'user', 'content' => 'Hello!']
];
$reply = Response::getReply(
    $api->chat([
        'model'             => 'gpt-3.5-turbo',
        'messages'          => $messages,
        'temperature'       => 1.0,
        'max_tokens'        => 420,
        'frequency_penalty' => 0,
        'presence_penalty'  => 0,
    ])
);



 
Back
Top