- Language
- English
- Compatible XF 2.x versions
- 2.1
- 2.2
- 2.3
Integrate OpenAI's state-of-the-art language model into your XenForo 2 forum with the ChatGPT Framework add-on.
This add-on provides a comprehensive framework for integrating the ChatGPT API into your forum, allowing you to enhance your users' experience with cutting-edge language processing technology. With ChatGPT, you can generate human-like responses to user queries, automatically moderate content, and more.
The ChatGPT Framework add-on offers a range of features to help you customize and optimize your ChatGPT integration, including:
- Built-in message repository: Allows to load messages for ChatGPT from different places in the forum, such as threads or conversations. Also provides functions to prepare them.
- Error handling: Handle API errors and exceptions gracefully.
- Configurable response generation: Choose how responses are generated based on your preferences and use case.
Setup
Specify the API key from OpenAI in the options after installation.Developer usage guide
$apiKey = \XF::options()->bsChatGptApiKey;
Get Openair API:
/** \Orhanerday\OpenAi\OpenAi $api */
$api = \XF::app()->container('chatGPT');
Get a response 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,
])
);