[021] ChatGPT Framework

[021] ChatGPT Framework 1.5.0

021

Developer
Jun 11, 2020
504
255
63
021 submitted a new resource:

[021] ChatGPT Bots - Bot framework for ChatGPT API.

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...

Read more about this resource...
 

021

Developer
Jun 11, 2020
504
255
63
021 updated [021] ChatGPT Bots with a new update entry:

1.1.0

Message repository

fetchMessagesFromThread – Loads the context for the bot from the topic. Bot quotes are transformed into his messages for the correct context.
PHP:
public function fetchMessagesFromThread(
    Thread $thread,
    int $stopPosition = null, // Thread post position to which to load the context
    ?User $assistant = null, // Bot user to mark his messages in context
    bool $transformAssistantQuotesToMessages = true, // If false, bot...

Read the rest of this update entry...
 

021

Developer
Jun 11, 2020
504
255
63
021 updated [021] ChatGPT Bots with a new update entry:

1.2.0

\BS\ChatGPTBots\Response class features

getReplyWithLogErrors(OpenAi $api, array $params): string – Receives a response and parse it to reply from the OpenAI API, logging the failure and adding the necessary information to the log.

Usage example
PHP:
$reply = Response::getReplyWithLogErrors($api, [
    'model'             => 'gpt-3.5-turbo',
    'messages'          => [],
    'temperature'       => 1.0...

Read the rest of this update entry...
 
  • Like
Reactions: ProWeb

021

Developer
Jun 11, 2020
504
255
63
021 updated [021] ChatGPT Framework with a new update entry:

1.3.0

The group of settings has been renamed in accordance with the name of the add-on
New method removeMessageDuplicates in message repo
New method fetchMessagesFromConversation in message repo
Now \BS\ChatGPTBots\Response::getReplyWithLogErrors accept $throwExceptions argument to throw exceptions on error instead of returning default reply
Now the prepareContent method in message also converts mentions into hits

Read the rest of this update entry...
 
Last edited:
  • Like
Reactions: Rhody401
Apr 5, 2023
1
0
1

Initialize the OpenAI API​

The ChatGPT API Framework provides a convenient way to initialize the OpenAI API. To get started, you can use the following code:



PHP:

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


I have the API key. Where exactly would I run that PHP code from, or where does the code get inserted? I'm already lost.
 

021

Developer
Jun 11, 2020
504
255
63
I have the API key. Where exactly would I run that PHP code from, or where does the code get inserted? I'm already lost.
Hello,

This is a guide for developers.
You just need to follow the steps from the "Setup" section in the description :)

Regards,
021
 
Activity
So far there's no one here