Generative AI connector and actionedit

The Generative AI connector uses axios to send a POST request to an OpenAI provider, either OpenAI or Azure OpenAI. The connector uses the run connector API to send the request.

Create connectors in Kibanaedit

You can create connectors in Stack Management > Connectors. For example:

Generative AI connector
Connector configurationedit

Generative AI connectors have the following configuration properties:

Name
The name of the connector.
API Provider
The OpenAI API provider, either OpenAI or Azure OpenAI.
API URL
The OpenAI request URL.
API Key
The OpenAI or Azure OpenAI API key for authentication.

Create preconfigured connectorsedit

If you are running Kibana on-prem, you can define connectors by adding xpack.actions.preconfigured settings to your kibana.yml file. For example:

xpack.actions.preconfigured:
  my-gen-ai:
    name: preconfigured-gen-ai-connector-type
    actionTypeId: .gen-ai
    config:
      apiUrl: https://api.openai.com/v1/chat/completions
      apiProvider: 'Azure OpenAI'
    secrets:
      apiKey: superlongapikey

Config defines information for the connector type.

apiProvider
A string that corresponds to OpenAI API Provider.
apiUrl
A URL string that corresponds to the OpenAI API URL.

Secrets defines sensitive information for the connector type.

apiKey
A string that corresponds to OpenAI API Key.

Test connectorsedit

You can test connectors with the run connector API or as you’re creating or editing the connector in Kibana. For example:

Generative AI params test

The Generative AI actions have the following configuration properties.

Body

A JSON payload sent to the OpenAI API URL. For example:

{
  "model": "gpt-3.5-turbo",
  "messages": [
    {
      "role": "user",
      "content": "Hello world"
    }
  ]
}

Connector networking configurationedit

Use the Action configuration settings to customize connector networking configurations, such as proxies, certificates, or TLS settings. You can set configurations that apply to all your connectors or use xpack.actions.customHostSettings to set per-host configurations.

Token usage dashboardedit

Once you’ve created a Generative AI connector, you can monitor its token usage using the Generative AI Token Usage dashboard. Select the connector in Stack Management > Connectors to view its details, then click the View OpenAI Usage Dashboard for "<Name>" Connector link to open the dashboard.

To view the dashboard, you need at least read and view_index_metadata privileges for the .kibana-event-log-* index and the Read feature privilege for Kibana. You can set up a role with these minimum privileges and assign it to non-admin users who need to view this dashboard.