The Convoworks GPT WordPress Plugin is an extension package for the Convoworks WP. This package is a bridge to the OpenAI API, allowing WordPress site owners to harness the power of GPT-based models directly within their websites. The plugin can either be part of the Convoworks core or function as a separate plugin, with that decision pending.
Service Templates
GPT Example Chat
This template provides a simple and interactive chat experience. It includes a basic system prompt and, additionally, loads up to 10 pages into the chat context using retrieval-augmented generation (RAG). This approach makes it a ready-to-use chatbot for small business websites with a few pages, helping users find information that might otherwise be hard to locate.
The template also includes a simple GPT function example that can generate a random number.
This template is a solid base for building your next public-facing chat. For more details, check out A Dead Simple RAG Setup for WordPress: AI Chatbots for Small Websites
GPT Site Admin
The GPT Site Admin template is designed as a robust AI assistant to help manage your system. In addition to basic instructions, this bot has access to PHP’s call_user_func()
function, enabling it to fetch and manipulate posts, create files, and more.
For more details, check out The GPT Site Admin: A New Era of AI Integration with WordPress.
Functions
The Convoworks GPT WordPress Plugin registers several expression language functions to enhance interactions:
tokenize_string( $text, $stopWords=null)
: Processes a given string by removing HTML, converting it to lowercase, stripping punctuation, and tokenizing it by spaces. It removes common stop words, making the string suitable for use with the embeddings API.serialize_gpt_messages( $messages )
: Serializes an array of GPT API messages into a human-readable string format.unserialize_gpt_messages( $strMessages )
: This function deserializes a human-readable conversation string back into an array of messages in GPT API format.split_text_into_chunks( $text, $maxChar=30000, $margin=1000 )
: Splits a large text document into smaller chunks at natural language boundaries, making it suitable for vector database indexing. If the last chunk is smaller than the margin, it is appended to the previous chunk to avoid small, incomplete segments.
Key Features
The package introduces several new and enhanced components:
- GPT Chat Completion API Element & GPT Chat Completion API v2: OpenAI API wrapper elements tailored for chat completions with advanced dynamic capabilities and added contexts.
- System Message & Conversation Messages: Components essential for managing and maintaining the context of conversations with GPT Chat Completion API v2.
- Chat Function: Function definitions enhancing GPT Chat Completion API v2 component.
- GPT Embeddings Element: A tool for fetching vector representations of given input through the OpenAI Embeddings API.
- GPT Moderation API: Ensures generated content aligns with guidelines by validating input through the OpenAI Moderation API.
In addition to the new components, the plugin offers a service template named GPT Example Chat that includes pre-configured setups, demonstrating the practical application of these elements.
Installation and Configuration
For a smooth installation and setup:
- Ensure the Convoworks WP plugin is installed and activated.
- Upload and activate the convoworks-gpt plugin.
- In your WP admin panel, navigate to Convoworks WP, choose Create new, enter a name, select the GPT Example Chat template, and click Submit.
- Under the Variables view, provide your OpenAI key into the `GPT_API_KEY` variable.
- Test the setup through the Test view.
For in-depth guidance, visit the plugin’s GitHub repository or refer to our blog post.
Further Read
Discover how we’ve utilized GPT, WordPress, and Convoworks in different applications:
- Dive into our HackerNoon article to learn about our experiment to develop an efficient spam filtering system using these technologies.
- Read our recent article, Leveraging Semantic Search in WordPress: Creating Embeddings with Convoworks, Pinecone, and OpenAI GPT, to explore how we’ve applied semantic search techniques in WordPress with the aid of Convoworks, Pinecone, and OpenAI GPT.
- Discover how to enable true system interaction with GPT through the GPT Site Assistant, a chatbot example that allows GPT to call any PHP function using `call_user_func`, making it capable of interacting directly with the WordPress system.
In Conclusion
The Convoworks GPT plugin opens up a realm of AI-powered opportunities for WordPress users. From building intelligent chat assistants to crafting bots for specific website tasks, this tool simplifies AI integration within WordPress. Though currently in the development phase, we’re excited about the potential enhancements, like leveraging user data more effectively and introducing long-term memory features. Stay tuned for more!