Advertising sustains the DA. Ads are hidden for members. Join today

Getting started

Last updated on
23 July 2024

Pre-requisites:

  • A Drupal site with content that you wish to search using Search API AI, admin access and access to Composer.
  • An Open AI account and API key.
  • A Pinecone account and API Key.

Instructions

Please also view Exploring SearchAPI AI: A First Look at AI-Powered Search in Drupal (YouTube).

  1. Use Composer to install the search_API_AI module. The module is currently in development so make sure you have your composer minimum_stability set to ‘dev’. e.g.
    composer require drupal/search_api_ai
  2. Enable the following modules either in the UI or command line:
    • Search API AI,
    • Search API AI Explorer
    • Search API AI Pinecone

    These modules depend on Search API, Open AI and Open AI Embeddings, so these will also be installed.

  3. Add your Open AI API key to Configuration/Open AI/Settings (/admin/config/openai/settings).
  4. Add your Pinecone API key and hostname to Configuration/Open AI/Embeddings settings (/admin/config/openai/openai-embeddings/settings)
  5. Add your Pinecone server to Configuration/Search and metadata/Search API (/admin/config/search/search-api).
  6. Then Add an index including your chosen data sources and ensure Pinecone is selected as the server the index should use. (Also, it is worth reducing the CRON batch size)
  7. Then add a field from your chosen datasource to the index, eg body. Ensure it is of type Embeddings.
  8. Now go to the View page of your index and index your data.
  9. Check that you have the correct number of items indexed in your index created in step 6.
  10. You can now ask chatGPT a question in Configuration/OpenAI/Search API AI Search. (/admin/config/openai/search-api-ai-explorer)
  11. You can then go to your block layout (/admin/structure/block) to add and configure the ‘Search API AI: Chat form’ block. Here you select the index you have created, restrict the results to s specific view, and select entity types and messages.

Help improve this page

Page status: No known problems

You can: