Create a connector

Creates a standalone connector. For more information, see Connectors.

Path and HTTP methods

  1. POST /_plugins/_ml/connectors/_create

Request body fields

For a list of request fields, see Blueprint configuration parameters.

Example request

To create a standalone connector, send a request to the connectors/_create endpoint and provide all of the parameters described in Connector blueprints:

  1. POST /_plugins/_ml/connectors/_create
  2. {
  3. "name": "OpenAI Chat Connector",
  4. "description": "The connector to public OpenAI model service for GPT 3.5",
  5. "version": 1,
  6. "protocol": "http",
  7. "parameters": {
  8. "endpoint": "api.openai.com",
  9. "model": "gpt-3.5-turbo"
  10. },
  11. "credential": {
  12. "openAI_key": "..."
  13. },
  14. "actions": [
  15. {
  16. "action_type": "predict",
  17. "method": "POST",
  18. "url": "https://${parameters.endpoint}/v1/chat/completions",
  19. "headers": {
  20. "Authorization": "Bearer ${credential.openAI_key}"
  21. },
  22. "request_body": "{ \"model\": \"${parameters.model}\", \"messages\": ${parameters.messages} }"
  23. }
  24. ]
  25. }

copy

Example response

  1. {
  2. "connector_id": "a1eMb4kBJ1eYAeTMAljY"
  3. }