Create a model response

POST /api/security_ai_assistant/chat/complete

Create a model response for the given chat conversation.

Query parameters

application/json

Body Required

  • connectorId string Required

    Required connector identifier to route the request.

  • conversationId string(nonempty)

    The ID of the anonymization field.

    Minimum length is 1.

  • isStream boolean

    If true, the response will be streamed in chunks.

  • API key for LangSmith integration.

  • LangSmith project name for tracing.

  • messages array[object] Required

    List of chat messages exchanged so far.

    A message exchanged within the AI chat conversation.

    Hide messages attributes Show messages attributes object
    • content string

      The textual content of the message.

    • data object

      Metadata to attach to the context of the message.

      Additional properties are allowed.

    • fields_to_anonymize array[string]

      List of field names within the data object that should be anonymized.

    • role string Required

      The sender role of the message.

      Values are system, user, or assistant.

  • model string

    Model ID or name to use for the response.

  • persist boolean Required

    Whether to persist the chat and response to storage.

  • promptId string

    Prompt template identifier.

  • ISO language code for the assistant's response.

Responses

  • 200 application/octet-stream

    Indicates a successful model response call.

  • 400 application/json

    Generic Error

    Hide response attributes Show response attributes object
POST /api/security_ai_assistant/chat/complete
curl \
 --request POST 'https://localhost:5601/api/security_ai_assistant/chat/complete' \
 --header "Authorization: $API_KEY" \
 --header "Content-Type: application/json" \
 --data '{"model":"gpt-4","persist":true,"isStream":true,"messages":[{"data":{"user_id":"user_789"},"role":"user","content":"What are some common phishing techniques?","fields_to_anonymize":["user.name","source.ip"]}],"promptId":"prompt_456","connectorId":"conn-001","conversationId":"abc123","langSmithApiKey":"sk-abc123","langSmithProject":"security_ai_project","responseLanguage":"en"}'
Request example
{
  "model": "gpt-4",
  "persist": true,
  "isStream": true,
  "messages": [
    {
      "data": {
        "user_id": "user_789"
      },
      "role": "user",
      "content": "What are some common phishing techniques?",
      "fields_to_anonymize": [
        "user.name",
        "source.ip"
      ]
    }
  ],
  "promptId": "prompt_456",
  "connectorId": "conn-001",
  "conversationId": "abc123",
  "langSmithApiKey": "sk-abc123",
  "langSmithProject": "security_ai_project",
  "responseLanguage": "en"
}