[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: 154
Author
Admin
Size
121.3 KB
Extension
zip
Downloads
20
Views
2,764
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] Fools Day with ChatGPT Admin
Tools to prank users on April 1 based on ChatGPT.
[021] Payment provider tax Admin
Adds the ability to set up an additional commission for each payment profile.
[021] Post as user Admin
Allows you to post answers on behalf of other users.
[021] Real time alerts Admin
Provides real-time display of alerts to users.
731Threads
2,286Messages
63,731Members
anythingyouwishLatest member
Back