[021] ChatGPT Bots

xF2 Add-on [021] ChatGPT Bots 1.1.0

No permission to download
Compatible XF Versions
  1. 2.0
  2. 2.1
  3. 2.2
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:
$apiKey = \XF::options()->bsChatGptApiKey;

Get OpenAI API

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

Get reply from ChatGPT

PHP:
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,
    ])
);
  • Options.png
    Options.png
    28.3 KB · Views: 76
Author
Admin
Size
121.3 KB
Extension
zip
Downloads
20
Views
2,517
First release
Last update

More resources from Admin

Latest updates

  1. 1.1.0

    Message repository fetchMessagesFromThread – Loads the context for the bot from the topic. Bot...

Similar resources

[021] ChatGPT Framework Admin
0.00 star(s) 0 ratings
Downloads
15
Updated
[021] Fools Day with ChatGPT Admin
Tools to prank users on April 1 based on ChatGPT.
0.00 star(s) 0 ratings
Downloads
3
Updated
[021] Payment provider tax Admin
Adds the ability to set up an additional commission for each payment profile.
0.00 star(s) 0 ratings
Downloads
2
Updated
[021] Post as user Admin
Allows you to post answers on behalf of other users.
0.00 star(s) 0 ratings
Downloads
6
Updated
[021] Real time alerts Admin
Provides real-time display of alerts to users.
0.00 star(s) 0 ratings
Downloads
12
Updated