Embeddings
OpenAI’s text embeddings measure the relatedness of text strings.
We use this technology to create a semantic search engine, KnowledgeBase and a chat bot.
To use this feature, you must first create a Pinecone account.
You can think of Pinecone as a long-term external memory for your bot.
OpenAI charges a cost of $0.0004 per 1,000 tokens for embeddings.
Assuming that 750 words are approximately equal to 1,000 tokens, let's consider a scenario where you have a website with 1,000 pages, and each page has 750 words.
In this case, the website would have a total of 750,000 words, which translates to 1,000,000 tokens. Therefore, the cost of embeddings for the entire website would be $0.40.
Please note that this is only an approximation. For the precise cost, please refer to OpenAI usage.
You can use embeddings for:
- Chat Bot - You can use the embeddings feature to create a chat widget that will respond to your visitors’ questions related to your website.
- Semantic Search - We have a feature called SearchGPT where you can create your own search engine. You can use the embeddings feature to create a semantic search engine. For example, if you search for “dog”, you will get results for “puppy”, “pooch”, “canine”, “hound”, etc. This is because the embeddings feature will find the most similar text strings to “dog”.
OpenAI's text-embedding-ada-002 model can manage up to 8192 tokens, roughly equal to 8000 characters. So, if your WordPress post or page content has more than 8000 characters, you'll need to divide it into sections.
Now let's take a look at all the features in detail.
Pinecone Setup
To use the Embeddings feature in AI Power, you need to first create an account with Pinecone and obtain your API key.
Here's how:
- Visit Pinecone to sign up for a new account.
Pinecone is currently experiencing high demand. As a result, new users who wish to sign up for the Starter (free) plan may find themselves placed on a waitlist.
By providing your credit card information for a trial, you can start using Pinecone immediately. Don't worry, if you only wish to use the free plan, you can cancel the subscription after the trial period ends. This way, you can start using the free plan without having to wait.
- Once your account is created, go to the Pinecone dashboard.

- To create an index, click on the Create Index button.
- Provide a unique name for your index, set the dimension to 1536, and choose cosine for the metric.

- Click Create Index. Your index is now created!
- Your new index will be associated with a specific environment, something like us-east1-gcp. Please take note of this environment as it will be needed in the AI Power settings.

- Click on the API Keys option in the left side menu to generate your API key. Make sure to copy this key as you will need it later.

- Paste your Pinecone API Key in the corresponding field and select your Pinecone environment from the dropdown list under the Embeddings - Settings tab in AI Power. Be sure to save the changes after you've input the necessary information.

With these steps, you have successfully created an account with Pinecone, created an index, and configured AI Power to use this index.
Now you're ready to use the Embeddings feature!
If you have more than one index on Pinecone, you can specify your default index in AI Power. Navigate to the Embeddings - Settings tab and use the "Select Index" dropdown menu to choose your default index. Remember to save your changes!
Instant Embeddings
AI Power plugin features a robust tool called Instant Embeddings.
This feature allows you to generate embeddings for individual posts, pages, or products without the necessity of setting up a Cron Job or waiting for the Index Builder to run.
This makes for a quicker and more flexible approach to generating embeddings.
To use Instant Embeddings, follow the steps below:
- Navigate to the post, page, or product for which you wish to create an embedding.
- Locate and select the checkbox next to the Instant Embedding option.

- The plugin will then generate an embedding for the selected content.
Custom Post Types
Pro plan users have the additional advantage of being able to create instant embeddings for custom post types.
Once you've upgraded to the Pro plan, you can easily generate embeddings for your custom post types.
- Navigate to any of your custom post type pages.
- Select your content.
- Click the Instant Embedding button.

This action will create an instant embedding for your selected custom post type content.
This enhanced feature of the Pro plan empowers you to create embeddings for a wider range of content types, further enhancing the capabilities of your AI-powered chatbot.
Content Builder
The Content Builder tool is designed to empower your chat bot with custom, high-quality embeddings for your various content.
Whether it's free text strings, FAQs, knowledge base topics, product details, URLs, or company profiles, this tool is equipped to handle them all.
By adding these embeddings into your bot, you're creating a more personalized and effective interactions for your users, which can even serve as a useful resource for chatbot responses.
To use the Content Builder, follow these steps:
- Navigate to Embeddings - Content Builder.
- Select the content type that you want to use.
- Enter all the required information.
- Click on the Save button.

You can view your entries under the Embeddings - Entries tab.
Knowledge Base Topics
When your website features a rich array of knowledge base topics, you're providing your users with a comprehensive learning resource. These topics can cover anything from detailed product guides to software troubleshooting.
Consider the case of a tech company: they can embed topics like 'Setting up your device,' or 'Troubleshooting software issues.' When users interact with their chatbot, it can pull from these topics to provide detailed assistance, minimizing the need for human intervention.
To create Knowledge Base Topic embeddings, follow these steps:
- First, navigate to the Embeddings - Content Builder on your dashboard.
- Choose KnowledgeBase from the dropdown menu of content types.
- You will be presented with input fields for the Topic and Description. In the Topic field, input the title or subject of your knowledge base entry.
- In the Description field, provide detailed information about the topic. This could be a guide, an explanation, or any other form of information that would be useful to your users.

- Once you've completed these fields, click the Save button to finalize your new knowledge base embedding.
- Now that you have created your knowledgebase embedding, your chatbot can access this information and share it with users as needed. For example, if a user asks, "How can I troubleshoot Embeddings and Pinecone issues?", your chatbot can directly provide the saved knowledgebase for that questions. This leads to a more efficient and user-friendly navigation experience.

Product Details
Product details are crucial for any eCommerce site, providing users with all the information they need to make an informed purchasing decision.
By embedding these details, your chatbot can access and relay them to potential customers.
Imagine a clothing store: they can embed details for a particular dress, such as its available sizes, colors, fabric type, and price.
When a user inquires about this dress, the chatbot can quickly provide all these details, facilitating a smooth shopping experience.
To create Product Detail embeddings in the Content Builder, follow these steps:
- Navigate to the Embeddings - Content Builder on your dashboard.
- From the dropdown menu of content types, select Product Details.
- Now, you will be presented with several input fields including Product ID, Product Name, Product Description, Product Price, and Product URL. Fill out each of these fields with the relevant details of the product you wish to embed.
- In the Product ID field, input a unique identifier for your product. This could be a SKU, a barcode number, or any other unique identifier used in your inventory system.
- In the Product Name field, input the name of the product as it is listed on your site.
- In the Product Description field, provide a detailed description of the product. This should include information such as its features, uses, and any other details a customer might need to know.
- In the Product Price field, input the current price of the product.
- Finally, in the Product URL field, input the URL of the product page on your website.
- After filling in all the necessary fields, click on the Save button to store your new Product Detail embedding.

Now, your chatbot has access to this embedded product information and can provide it to customers when needed. For example, if a user asks your chatbot, "What is the price of product X?", your chatbot can provide the saved price from the product details you've embedded.

URLs
Embedding URLs can greatly enhance your website's navigation and overall user experience.
For instance, you can embed the URL of a new blog post, a product page, or a registration form.
Your chatbot can then provide these direct links when a user needs them.
For instance, a user might ask your chatbot, "Where can I register for the upcoming webinar?" Your chatbot can then provide the direct URL to the registration page, guiding the user efficiently.
Creating URL embeddings is a straightforward process.
Here's a step-by-step guide:
- First, navigate to the Embeddings - Content Builder on your dashboard.
- From the dropdown menu of content types, select URL.
- You'll be presented with input fields for the URL and its associated description. Start by typing the URL you want to embed in the first field.
- In the description field, provide some context about the URL. This could be a brief summary of the page it leads to or its relevance to your website or business.

- Once you've filled in both fields, click on the Save button to store your new URL embedding.

- Now that you have created your URL embedding, your chatbot can access this information and share it with users as needed. For example, if a user asks, "Where can I register for the upcoming webinar?", your chatbot can directly provide the saved URL for the registration page. This leads to a more efficient and user-friendly navigation experience.
Company Profile
A well-crafted company profile gives your website a professional feel, offering visitors insight into your business's history, goals, and achievements.
By embedding this profile, your chatbot can share it with interested users or direct them to the page where it's hosted.
Here's how to create Company Profile embeddings:
- First, go to the Embeddings - Content Builder section on your dashboard.
- From the dropdown menu of content types, select Company Profile.
- You'll now see input fields where you can enter relevant information about your company:
- Company Name: Enter the official name of your company.
- Founder: Input the name of the person or people who founded the company.
- CEO: Enter the name of your current CEO.
- Founded: Input the year your company was founded.
- Location: Type in the city and country where your company is based.
- Number of Employees: Input the current number of employees in your company.
- Industry: Indicate the industry in which your company operates.
- Products: Provide a brief list or description of your main products or services.
- Company Website: Input the URL of your company's official website.
- Company Email: Input the general contact email for your company.
- Company Phone: Input the general contact phone number for your company.
- Company Address: Type in your company's physical address.
- Company Description: Provide a detailed overview of your company, including its mission, achievements, and any other notable information.
- After you've filled out all the fields, click the Save button to create your new Company Profile embedding.

With this information embedded, your chatbot can provide users with comprehensive and accurate information about your company. As always, remember that the accuracy of your chatbot in providing these responses depends on its programming and configuration.
For instance, if a user asks, "What does your company do?", the chatbot can pull from the 'Description' field to provide a comprehensive answer.

PDF Upload
The PDF Upload feature of AI Power allows you to upload and embed PDF documents, enabling your chat bot to read and understand the content within those documents.
This feature processes your PDF files by each page, making the information available on the same page.
Here's how to use this feature:
- Navigate to the Embeddings - PDF Tab in AI Power.
- Click on the Browse button to select a PDF document from your device.
- After you have selected a PDF document, click on the Start button to begin the upload and embedding process.

- Wait for the process to complete. You can monitor the progress from the progress bar on the screen. Please note that the duration of this process will depend on the size and complexity of the PDF document.
- Once the process is completed, your PDF document will be embedded and you will be able to see the content on the same page. Each page of the document is embedded separately, making it easy to understand the structure of the document.
This feature is an excellent way of making complex or large volumes of information readily available and understandable to your AI, thereby improving its ability to generate accurate and relevant responses.
For optimal results, it is recommended to upload PDF documents that are primarily text-based. Documents with numerous images or complex formatting may not be processed as accurately.
By using this feature, you can enhance the functionality and effectiveness of your AI-powered chatbot, making it an even more powerful tool for delivering high-quality, contextually relevant responses to user inquiries.
Index Builder
To be able to use Index Builder you need to setup a cron job.
Configuring Cron Jobs
- Follow the steps outlined in this guide to set up a Cron Job.
- Ensure that you include the specific PHP command for the Embeddings job in your Cron Job configuration to make it functional.
- You can find your php command under Embeddings - Settings tab.

Your PHP command may vary depending on your server setup.
For the Embeddings module, you need to set up only one cron job.
Embeddings:
* * * * * php /var/www/html/index.php -- wpaicg_builder=yes
Learn how to setup a cron job here.
This is how my Cron setup looks like.

Once the Cron Job setup is complete, you should see a message stating, “Great! It looks like your Cron Job is running properly. You should now be able to use the Index Builder."
Configuring the Index Builder
Once you have set up the Cron Job, you can start using the Index Builder. Here's how:
- Navigate to the Embeddings - Index Builder tab in AI Power.
- Toggle the Cron Indexing option to Yes. Please note that enabling this option will start indexing your website content. Moreover, every time you create a new post, page, or product, it will be indexed automatically.
- Check the box for Posts, Pages, and Products.

- Click on the Save button.
- Wait for the indexing process to finish.
- You can track the progress of the indexing in the Index Builder tab.
Indexing Custom Post Types
The Pro plan of AI Power offers the ability to index custom post types.
Once you have upgraded to the Pro plan, you can navigate to the Embeddings - Settings tab.
Here, you will find the option Build Index for:. If you have any custom post types, they will be listed here.

For each custom post type, you will find a button labeled Select Fields next to it.
Clicking on this button will open a modal window where you can select fields and assign them labels.

These metadata will be added into the embeddings to deliver better search results.
Using the Index Builder
The Index Builder is a powerful tool that allows you to manage and monitor the indexing of your website's content. Once your Cron job is set up and running, all your content will be indexed and appear under the Embeddings - Index Builder tab in the AI Power.
The Index Builder is divided into three tabs:
- Indexed: This tab displays a list of pages that have been successfully indexed.
- Failed: This tab lists the pages that failed to index. There can be several reasons why a page may not index, but the most common issue is related to encoding. If your pages have encoding problems, they may fail to index. To resolve this, you need to clean them up.
- Skipped: This tab shows a list of pages that have been skipped. The Index Builder does not index pages if their content is less than 50 characters. Therefore, if you have shortcodes or other content that is less than 50 characters, they will likely not be indexed.

Understanding the Index List
The index list displays several columns:
- Title: This is the title of the page, post, product, or custom post type. It is clickable, and once clicked, it will show the embedded content.
- Token: Estimated token usage.
- Estimated: Estimated cost. OpenAI charges for embeddings based on the number of tokens, with the rate being $0.0004 per 1K tokens.
- Source: This shows the type of content that has been indexed (page, post, product, or custom post type).
- Status: This shows the status of the indexing process.
- Start: This shows the time when the indexing process started.
- Completed: This shows the time when the indexing process completed.
Managing Your Indexes
Under the Action column, there are two buttons:
- Reindex: This button allows you to reindex the content. This is particularly useful when you have updated a post, page, or product and you want the index to reflect the latest changes.
- Delete: This button allows you to delete an index.
Through the Index Builder, you have full control over the indexing process, ensuring your website's content is properly embedded for optimal use by the AI Power plugin.
FAQ
Maximum Context Length
What does the error message "This model’s maximum context length is 4097 tokens. However, you requested 4893 tokens" mean?
This error message indicates that the total number of tokens (which include individual words and punctuation) in the content you're trying to generate is exceeding the maximum limit of 4097 tokens allowed by the model. Tokens are the smallest units of meaning that the model can process, and the limit exists to ensure optimal model performance. There are two primary ways to address this:
- Lower the maximum token value: You can adjust the maximum token value to a lower number in your plugin settings. We recommend setting it to 500-700 tokens for optimal performance without losing the quality of output.
- Split your content into chunks: If you are dealing with large content, consider dividing it into smaller pieces. Each piece should ideally not be more than 1000 words. This will ensure that each chunk of content remains within the model's token limit, and thus can be processed efficiently.