Playground | Elastic Docs (original) (raw)

Elastic Stack Serverless

This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.

Use Playground to combine your Elasticsearch data with the power of large language models (LLMs) for retrieval augmented generation (RAG). The chat interface translates your natural language questions into Elasticsearch queries, retrieves the most relevant results from your Elasticsearch documents, and passes those documents to the LLM to generate tailored responses.

Once you start chatting, use the UI to view and modify the Elasticsearch queries that search your data. You can also view the underlying Python code that powers the chat interface, and download this code to integrate into your own application.

Learn how to get started on this page. Refer to the following for more advanced topics:

How Playground works

Here’s a simpified overview of how Playground works:

Availability and prerequisites

For Elastic Cloud and self-managed deployments Playground is available in the Search space in Kibana, under Content > Playground.

For Elastic Serverless, Playground is available in your Elasticsearch project UI.

To use Playground, you’ll need the following:

  1. An Elastic v8.14.0+ deployment or Elasticsearch Serverless project. (Start a free trial).
  2. At least one Elasticsearch index with documents to search.
    • See ingest data if you’d like to ingest sample data.
  3. An account with a supported LLM provider. Playground supports the following:
    • Amazon Bedrock
      * Anthropic: Claude 3.5 Sonnet
      * Anthropic: Claude 3 Haiku
    • OpenAI
      * GPT-3 turbo
      * GPT-4 turbo
      * GPT-4 omni
    • Azure OpenAI (note: Buffers responses in large chunks)
      * GPT-3 turbo
      * GPT-4 turbo
    • Google
      * Google Gemini 1.5 Pro
      * Google Gemini 1.5 Flash

You can also use locally hosted LLMs that are compatible with the OpenAI SDK. Once you’ve set up your LLM, you can connect to it using the OpenAI connector. Refer to the following for examples:

Getting started

get started

Connect to LLM provider

To get started with Playground, you need to create a connector for your LLM provider. You can also connect to locally hosted LLMs which are compatible with the OpenAI API, by using the OpenAI connector.

To connect to an LLM provider, follow these steps on the Playground landing page:

  1. Under Connect to an LLM, click Create connector.
  2. Select your LLM provider.
  3. Name your connector.
  4. Select a URL endpoint (or use the default).
  5. Enter access credentials for your LLM provider. (If you’re running a locally hosted LLM using the OpenAI connector, you must input a value in the API key form, but the specific value doesn’t matter.)

If you need to update a connector, or add a new one, click the 🔧 Manage button beside Model settings.

Ingest data (optional)

You can skip this step if you already have data in one or more Elasticsearch indices.

There are many options for ingesting data into Elasticsearch, including:

We’ve also provided some Jupyter notebooks to easily ingest sample data into Elasticsearch. Find these in the elasticsearch-labs repository. These notebooks use the official Elasticsearch Python client.

Select Elasticsearch indices

Once you’ve connected to your LLM provider, it’s time to choose the data you want to search.

  1. Click Add data sources.
  2. Select one or more Elasticsearch indices.
  3. Click Save and continue to launch the chat interface.

You can always add or remove indices later by selecting the Data button from the main Playground UI.

data button

Chat and query modes

Since 8.15.0 (and earlier for Elasticsearch Serverless), the main Playground UI has two modes:

The chat mode is selected when you first set up your Playground instance.

chat interface

To switch to query mode, select Query from the main UI.

query interface

Set up the chat interface

You can start chatting with your data immediately, but you might want to tweak some defaults first.

You can adjust the following under Model settings:

Playground also uses another LLM under the hood, to encode all previous questions and responses, and make them available to the main model. This ensures the model has "conversational memory".

Under Indices, you can edit which Elasticsearch indices will be searched. This will affect the underlying Elasticsearch query.

Click ✨ Regenerate to resend the last query to the model for a fresh response.

Click ⟳ Clear chat to clear chat history and start a new conversation.

View and download Python code

Use the View code button to see the Python code that powers the chat interface. You can integrate it into your own application, modifying as needed. We currently support two implementation options:

Next steps

Once you’ve got Playground up and running, and you’ve tested out the chat interface, you might want to explore some more advanced topics: