diff --git a/x-pack/packages/kbn-elastic-assistant-common/docs/openapi/ess/elastic_assistant_api_1.bundled.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/docs/openapi/ess/elastic_assistant_api_1.bundled.schema.yaml new file mode 100644 index 0000000000000..be9cb47ef033d --- /dev/null +++ b/x-pack/packages/kbn-elastic-assistant-common/docs/openapi/ess/elastic_assistant_api_1.bundled.schema.yaml @@ -0,0 +1,1133 @@ +openapi: 3.0.3 +info: + description: Manage and interact with Security Assistant resources. + title: Security AI Assistant API (Elastic Cloud & self-hosted) + version: '1' +servers: + - url: 'http://{kibana_host}:{port}' + variables: + kibana_host: + default: localhost + port: + default: '5601' +paths: + /api/security_ai_assistant/anonymization_fields/_bulk_action: + post: + description: >- + The bulk action is applied to all anonymization fields that match the + filter or to the list of anonymization fields by their IDs. + operationId: PerformBulkAction + requestBody: + content: + application/json: + schema: + type: object + properties: + create: + items: + $ref: '#/components/schemas/AnonymizationFieldCreateProps' + type: array + delete: + type: object + properties: + ids: + description: Array of anonymization fields IDs + items: + type: string + minItems: 1 + type: array + query: + description: Query to filter anonymization fields + type: string + update: + items: + $ref: '#/components/schemas/AnonymizationFieldUpdateProps' + type: array + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AnonymizationFieldsBulkCrudActionResponse' + description: Indicates a successful call. + '400': + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: number + description: Generic Error + summary: Applies a bulk action to multiple anonymization fields + tags: + - Bulk API + /api/security_ai_assistant/anonymization_fields/_find: + get: + description: Finds anonymization fields that match the given query. + operationId: FindAnonymizationFields + parameters: + - in: query + name: fields + required: false + schema: + items: + type: string + type: array + - description: Search query + in: query + name: filter + required: false + schema: + type: string + - description: Field to sort by + in: query + name: sort_field + required: false + schema: + $ref: '#/components/schemas/FindAnonymizationFieldsSortField' + - description: Sort order + in: query + name: sort_order + required: false + schema: + $ref: '#/components/schemas/SortOrder' + - description: Page number + in: query + name: page + required: false + schema: + default: 1 + minimum: 1 + type: integer + - description: AnonymizationFields per page + in: query + name: per_page + required: false + schema: + default: 20 + minimum: 0 + type: integer + responses: + '200': + content: + application/json: + schema: + type: object + properties: + data: + items: + $ref: '#/components/schemas/AnonymizationFieldResponse' + type: array + page: + type: integer + perPage: + type: integer + total: + type: integer + required: + - page + - perPage + - total + - data + description: Successful response + '400': + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: number + description: Generic Error + summary: Finds anonymization fields that match the given query. + tags: + - AnonymizationFields API + /api/security_ai_assistant/current_user/conversations: + post: + description: Create a conversation + operationId: CreateConversation + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationCreateProps' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResponse' + description: Indicates a successful call. + '400': + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: number + description: Generic Error + summary: Create a conversation + tags: + - Conversation API + /api/security_ai_assistant/current_user/conversations/_find: + get: + description: Finds conversations that match the given query. + operationId: FindConversations + parameters: + - in: query + name: fields + required: false + schema: + items: + type: string + type: array + - description: Search query + in: query + name: filter + required: false + schema: + type: string + - description: Field to sort by + in: query + name: sort_field + required: false + schema: + $ref: '#/components/schemas/FindConversationsSortField' + - description: Sort order + in: query + name: sort_order + required: false + schema: + $ref: '#/components/schemas/SortOrder' + - description: Page number + in: query + name: page + required: false + schema: + default: 1 + minimum: 1 + type: integer + - description: Conversations per page + in: query + name: per_page + required: false + schema: + default: 20 + minimum: 0 + type: integer + responses: + '200': + content: + application/json: + schema: + type: object + properties: + data: + items: + $ref: '#/components/schemas/ConversationResponse' + type: array + page: + type: integer + perPage: + type: integer + total: + type: integer + required: + - page + - perPage + - total + - data + description: Successful response + '400': + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: number + description: Generic Error + summary: Finds conversations that match the given query. + tags: + - Conversations API + '/api/security_ai_assistant/current_user/conversations/{id}': + delete: + description: Deletes a single conversation using the `id` field. + operationId: DeleteConversation + parameters: + - description: The conversation's `id` value. + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/NonEmptyString' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResponse' + description: Indicates a successful call. + '400': + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: number + description: Generic Error + summary: Deletes a single conversation using the `id` field. + tags: + - Conversation API + get: + description: Read a single conversation + operationId: ReadConversation + parameters: + - description: The conversation's `id` value. + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/NonEmptyString' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResponse' + description: Indicates a successful call. + '400': + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: number + description: Generic Error + summary: Read a single conversation + tags: + - Conversations API + put: + description: Update a single conversation + operationId: UpdateConversation + parameters: + - description: The conversation's `id` value. + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/NonEmptyString' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationUpdateProps' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResponse' + description: Indicates a successful call. + '400': + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: number + description: Generic Error + summary: Update a conversation + tags: + - Conversation API + /api/security_ai_assistant/prompts/_bulk_action: + post: + description: >- + The bulk action is applied to all prompts that match the filter or to + the list of prompts by their IDs. + operationId: PerformBulkAction + requestBody: + content: + application/json: + schema: + type: object + properties: + create: + items: + $ref: '#/components/schemas/PromptCreateProps' + type: array + delete: + type: object + properties: + ids: + description: Array of prompts IDs + items: + type: string + minItems: 1 + type: array + query: + description: Query to filter promps + type: string + update: + items: + $ref: '#/components/schemas/PromptUpdateProps' + type: array + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PromptsBulkCrudActionResponse' + description: Indicates a successful call. + '400': + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: number + description: Generic Error + summary: Applies a bulk action to multiple prompts + tags: + - Bulk API + /api/security_ai_assistant/prompts/_find: + get: + description: Finds prompts that match the given query. + operationId: FindPrompts + parameters: + - in: query + name: fields + required: false + schema: + items: + type: string + type: array + - description: Search query + in: query + name: filter + required: false + schema: + type: string + - description: Field to sort by + in: query + name: sort_field + required: false + schema: + $ref: '#/components/schemas/FindPromptsSortField' + - description: Sort order + in: query + name: sort_order + required: false + schema: + $ref: '#/components/schemas/SortOrder' + - description: Page number + in: query + name: page + required: false + schema: + default: 1 + minimum: 1 + type: integer + - description: Prompts per page + in: query + name: per_page + required: false + schema: + default: 20 + minimum: 0 + type: integer + responses: + '200': + content: + application/json: + schema: + type: object + properties: + data: + items: + $ref: '#/components/schemas/PromptResponse' + type: array + page: + type: integer + perPage: + type: integer + total: + type: integer + required: + - page + - perPage + - total + - data + description: Successful response + '400': + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: number + description: Generic Error + summary: Finds prompts that match the given query. + tags: + - Prompts API +components: + schemas: + AnonymizationFieldCreateProps: + type: object + properties: + allowed: + type: boolean + anonymized: + type: boolean + field: + type: string + required: + - field + AnonymizationFieldDetailsInError: + type: object + properties: + id: + type: string + name: + type: string + required: + - id + AnonymizationFieldResponse: + type: object + properties: + allowed: + type: boolean + anonymized: + type: boolean + createdAt: + type: string + createdBy: + type: string + field: + type: string + id: + $ref: '#/components/schemas/NonEmptyString' + namespace: + description: Kibana space + type: string + timestamp: + $ref: '#/components/schemas/NonEmptyString' + updatedAt: + type: string + updatedBy: + type: string + required: + - id + - field + AnonymizationFieldsBulkActionSkipReason: + enum: + - ANONYMIZATION_FIELD_NOT_MODIFIED + type: string + AnonymizationFieldsBulkActionSkipResult: + type: object + properties: + id: + type: string + name: + type: string + skip_reason: + $ref: '#/components/schemas/AnonymizationFieldsBulkActionSkipReason' + required: + - id + - skip_reason + AnonymizationFieldsBulkCrudActionResponse: + type: object + properties: + anonymization_fields_count: + type: integer + attributes: + type: object + properties: + errors: + items: + $ref: '#/components/schemas/NormalizedAnonymizationFieldError' + type: array + results: + $ref: '#/components/schemas/AnonymizationFieldsBulkCrudActionResults' + summary: + $ref: '#/components/schemas/BulkCrudActionSummary' + required: + - results + - summary + message: + type: string + status_code: + type: integer + success: + type: boolean + required: + - attributes + AnonymizationFieldsBulkCrudActionResults: + type: object + properties: + created: + items: + $ref: '#/components/schemas/AnonymizationFieldResponse' + type: array + deleted: + items: + type: string + type: array + skipped: + items: + $ref: '#/components/schemas/AnonymizationFieldsBulkActionSkipResult' + type: array + updated: + items: + $ref: '#/components/schemas/AnonymizationFieldResponse' + type: array + required: + - updated + - created + - deleted + - skipped + AnonymizationFieldUpdateProps: + type: object + properties: + allowed: + type: boolean + anonymized: + type: boolean + id: + type: string + required: + - id + ApiConfig: + type: object + properties: + actionTypeId: + description: action type id + type: string + connectorId: + description: connector id + type: string + defaultSystemPromptId: + description: defaultSystemPromptId + type: string + model: + description: model + type: string + provider: + $ref: '#/components/schemas/Provider' + description: Provider + required: + - connectorId + - actionTypeId + BulkCrudActionSummary: + type: object + properties: + failed: + type: integer + skipped: + type: integer + succeeded: + type: integer + total: + type: integer + required: + - failed + - skipped + - succeeded + - total + ConversationCategory: + description: The conversation category. + enum: + - assistant + - insights + type: string + ConversationConfidence: + description: The conversation confidence. + enum: + - low + - medium + - high + type: string + ConversationCreateProps: + type: object + properties: + apiConfig: + $ref: '#/components/schemas/ApiConfig' + description: LLM API configuration. + category: + $ref: '#/components/schemas/ConversationCategory' + description: The conversation category. + excludeFromLastConversationStorage: + description: excludeFromLastConversationStorage. + type: boolean + id: + description: The conversation id. + type: string + isDefault: + description: Is default conversation. + type: boolean + messages: + description: The conversation messages. + items: + $ref: '#/components/schemas/Message' + type: array + replacements: + $ref: '#/components/schemas/Replacements' + title: + description: The conversation title. + type: string + required: + - title + ConversationResponse: + type: object + properties: + apiConfig: + $ref: '#/components/schemas/ApiConfig' + description: LLM API configuration. + category: + $ref: '#/components/schemas/ConversationCategory' + description: The conversation category. + createdAt: + description: The last time conversation was updated. + type: string + excludeFromLastConversationStorage: + description: excludeFromLastConversationStorage. + type: boolean + id: + $ref: '#/components/schemas/NonEmptyString' + isDefault: + description: Is default conversation. + type: boolean + messages: + description: The conversation messages. + items: + $ref: '#/components/schemas/Message' + type: array + namespace: + description: Kibana space + type: string + replacements: + $ref: '#/components/schemas/Replacements' + summary: + $ref: '#/components/schemas/ConversationSummary' + timestamp: + $ref: '#/components/schemas/NonEmptyString' + title: + description: The conversation title. + type: string + updatedAt: + description: The last time conversation was updated. + type: string + users: + items: + $ref: '#/components/schemas/User' + type: array + required: + - id + - title + - createdAt + - users + - namespace + - category + ConversationSummary: + type: object + properties: + confidence: + $ref: '#/components/schemas/ConversationConfidence' + description: >- + How confident you are about this being a correct and useful + learning. + content: + description: Summary text of the conversation over time. + type: string + public: + description: Define if summary is marked as publicly available. + type: boolean + timestamp: + $ref: '#/components/schemas/NonEmptyString' + description: The timestamp summary was updated. + ConversationUpdateProps: + type: object + properties: + apiConfig: + $ref: '#/components/schemas/ApiConfig' + description: LLM API configuration. + category: + $ref: '#/components/schemas/ConversationCategory' + description: The conversation category. + excludeFromLastConversationStorage: + description: excludeFromLastConversationStorage. + type: boolean + id: + $ref: '#/components/schemas/NonEmptyString' + messages: + description: The conversation messages. + items: + $ref: '#/components/schemas/Message' + type: array + replacements: + $ref: '#/components/schemas/Replacements' + summary: + $ref: '#/components/schemas/ConversationSummary' + title: + description: The conversation title. + type: string + required: + - id + FindAnonymizationFieldsSortField: + enum: + - created_at + - anonymized + - allowed + - field + - updated_at + type: string + FindConversationsSortField: + enum: + - created_at + - is_default + - title + - updated_at + type: string + FindPromptsSortField: + enum: + - created_at + - is_default + - name + - updated_at + type: string + Message: + description: AI assistant conversation message. + type: object + properties: + content: + description: Message content. + type: string + isError: + description: Is error message. + type: boolean + reader: + $ref: '#/components/schemas/Reader' + description: Message content. + role: + $ref: '#/components/schemas/MessageRole' + description: Message role. + timestamp: + $ref: '#/components/schemas/NonEmptyString' + description: The timestamp message was sent or received. + traceData: + $ref: '#/components/schemas/TraceData' + description: trace Data + required: + - timestamp + - content + - role + MessageRole: + description: Message role. + enum: + - system + - user + - assistant + type: string + NonEmptyString: + description: A string that is not empty and does not contain only whitespace + minLength: 1 + pattern: ^(?! *$).+$ + type: string + NormalizedAnonymizationFieldError: + type: object + properties: + anonymization_fields: + items: + $ref: '#/components/schemas/AnonymizationFieldDetailsInError' + type: array + err_code: + type: string + message: + type: string + status_code: + type: integer + required: + - message + - status_code + - anonymization_fields + NormalizedPromptError: + type: object + properties: + err_code: + type: string + message: + type: string + prompts: + items: + $ref: '#/components/schemas/PromptDetailsInError' + type: array + status_code: + type: integer + required: + - message + - status_code + - prompts + PromptCreateProps: + type: object + properties: + categories: + items: + type: string + type: array + color: + type: string + consumer: + type: string + content: + type: string + isDefault: + type: boolean + isNewConversationDefault: + type: boolean + name: + type: string + promptType: + $ref: '#/components/schemas/PromptType' + required: + - name + - content + - promptType + PromptDetailsInError: + type: object + properties: + id: + type: string + name: + type: string + required: + - id + PromptResponse: + type: object + properties: + categories: + items: + type: string + type: array + color: + type: string + consumer: + type: string + content: + type: string + createdAt: + type: string + createdBy: + type: string + id: + $ref: '#/components/schemas/NonEmptyString' + isDefault: + type: boolean + isNewConversationDefault: + type: boolean + name: + type: string + namespace: + description: Kibana space + type: string + promptType: + $ref: '#/components/schemas/PromptType' + timestamp: + $ref: '#/components/schemas/NonEmptyString' + updatedAt: + type: string + updatedBy: + type: string + users: + items: + $ref: '#/components/schemas/User' + type: array + required: + - id + - name + - promptType + - content + PromptsBulkActionSkipReason: + enum: + - PROMPT_FIELD_NOT_MODIFIED + type: string + PromptsBulkActionSkipResult: + type: object + properties: + id: + type: string + name: + type: string + skip_reason: + $ref: '#/components/schemas/PromptsBulkActionSkipReason' + required: + - id + - skip_reason + PromptsBulkCrudActionResponse: + type: object + properties: + attributes: + type: object + properties: + errors: + items: + $ref: '#/components/schemas/NormalizedPromptError' + type: array + results: + $ref: '#/components/schemas/PromptsBulkCrudActionResults' + summary: + $ref: '#/components/schemas/BulkCrudActionSummary' + required: + - results + - summary + message: + type: string + prompts_count: + type: integer + status_code: + type: integer + success: + type: boolean + required: + - attributes + PromptsBulkCrudActionResults: + type: object + properties: + created: + items: + $ref: '#/components/schemas/PromptResponse' + type: array + deleted: + items: + type: string + type: array + skipped: + items: + $ref: '#/components/schemas/PromptsBulkActionSkipResult' + type: array + updated: + items: + $ref: '#/components/schemas/PromptResponse' + type: array + required: + - updated + - created + - deleted + - skipped + PromptType: + description: Prompt type + enum: + - system + - quick + type: string + PromptUpdateProps: + type: object + properties: + categories: + items: + type: string + type: array + color: + type: string + consumer: + type: string + content: + type: string + id: + type: string + isDefault: + type: boolean + isNewConversationDefault: + type: boolean + required: + - id + Provider: + description: Provider + enum: + - OpenAI + - Azure OpenAI + type: string + Reader: + additionalProperties: true + type: object + Replacements: + additionalProperties: + type: string + description: Replacements object used to anonymize/deanomymize messsages + type: object + SortOrder: + enum: + - asc + - desc + type: string + TraceData: + description: trace Data + type: object + properties: + traceId: + description: 'Could be any string, not necessarily a UUID' + type: string + transactionId: + description: 'Could be any string, not necessarily a UUID' + type: string + User: + description: 'Could be any string, not necessarily a UUID' + type: object + properties: + id: + description: User id + type: string + name: + description: User name + type: string + securitySchemes: + BasicAuth: + scheme: basic + type: http +security: + - BasicAuth: [] +tags: ! '' diff --git a/x-pack/packages/kbn-elastic-assistant-common/docs/openapi/ess/elastic_assistant_api_2023_10_31.bundled.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/docs/openapi/ess/elastic_assistant_api_2023_10_31.bundled.schema.yaml new file mode 100644 index 0000000000000..701df70006d88 --- /dev/null +++ b/x-pack/packages/kbn-elastic-assistant-common/docs/openapi/ess/elastic_assistant_api_2023_10_31.bundled.schema.yaml @@ -0,0 +1,114 @@ +openapi: 3.0.3 +info: + description: Manage and interact with Security Assistant resources. + title: Security AI Assistant API (Elastic Cloud & self-hosted) + version: '2023-10-31' +servers: + - url: 'http://{kibana_host}:{port}' + variables: + kibana_host: + default: localhost + port: + default: '5601' +paths: + /api/security_ai_assistant/chat/complete: + post: + description: Creates a model response for the given chat conversation. + operationId: ChatComplete + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ChatCompleteProps' + required: true + responses: + '200': + content: + application/octet-stream: + schema: + format: binary + type: string + description: Indicates a successful call. + '400': + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: number + description: Generic Error + summary: Creates a model response for the given chat conversation. + tags: + - Chat Complete API +components: + schemas: + ChatCompleteProps: + type: object + properties: + connectorId: + type: string + conversationId: + type: string + isStream: + type: boolean + langSmithApiKey: + type: string + langSmithProject: + type: string + messages: + items: + $ref: '#/components/schemas/ChatMessage' + type: array + model: + type: string + persist: + type: boolean + promptId: + type: string + responseLanguage: + type: string + required: + - messages + - persist + - connectorId + ChatMessage: + description: AI assistant message. + type: object + properties: + content: + description: Message content. + type: string + data: + $ref: '#/components/schemas/MessageData' + description: ECS object to attach to the context of the message. + fields_to_anonymize: + items: + type: string + type: array + role: + $ref: '#/components/schemas/ChatMessageRole' + description: Message role. + required: + - role + ChatMessageRole: + description: Message role. + enum: + - system + - user + - assistant + type: string + MessageData: + additionalProperties: true + type: object + securitySchemes: + BasicAuth: + scheme: basic + type: http +security: + - BasicAuth: [] +tags: ! '' diff --git a/x-pack/packages/kbn-elastic-assistant-common/docs/openapi/serverless/elastic_assistant_api_1.bundled.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/docs/openapi/serverless/elastic_assistant_api_1.bundled.schema.yaml new file mode 100644 index 0000000000000..e0579f55dfbb9 --- /dev/null +++ b/x-pack/packages/kbn-elastic-assistant-common/docs/openapi/serverless/elastic_assistant_api_1.bundled.schema.yaml @@ -0,0 +1,1133 @@ +openapi: 3.0.3 +info: + description: Manage and interact with Security Assistant resources. + title: Security AI Assistant API (Elastic Cloud Serverless) + version: '1' +servers: + - url: 'http://{kibana_host}:{port}' + variables: + kibana_host: + default: localhost + port: + default: '5601' +paths: + /api/security_ai_assistant/anonymization_fields/_bulk_action: + post: + description: >- + The bulk action is applied to all anonymization fields that match the + filter or to the list of anonymization fields by their IDs. + operationId: PerformBulkAction + requestBody: + content: + application/json: + schema: + type: object + properties: + create: + items: + $ref: '#/components/schemas/AnonymizationFieldCreateProps' + type: array + delete: + type: object + properties: + ids: + description: Array of anonymization fields IDs + items: + type: string + minItems: 1 + type: array + query: + description: Query to filter anonymization fields + type: string + update: + items: + $ref: '#/components/schemas/AnonymizationFieldUpdateProps' + type: array + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AnonymizationFieldsBulkCrudActionResponse' + description: Indicates a successful call. + '400': + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: number + description: Generic Error + summary: Applies a bulk action to multiple anonymization fields + tags: + - Bulk API + /api/security_ai_assistant/anonymization_fields/_find: + get: + description: Finds anonymization fields that match the given query. + operationId: FindAnonymizationFields + parameters: + - in: query + name: fields + required: false + schema: + items: + type: string + type: array + - description: Search query + in: query + name: filter + required: false + schema: + type: string + - description: Field to sort by + in: query + name: sort_field + required: false + schema: + $ref: '#/components/schemas/FindAnonymizationFieldsSortField' + - description: Sort order + in: query + name: sort_order + required: false + schema: + $ref: '#/components/schemas/SortOrder' + - description: Page number + in: query + name: page + required: false + schema: + default: 1 + minimum: 1 + type: integer + - description: AnonymizationFields per page + in: query + name: per_page + required: false + schema: + default: 20 + minimum: 0 + type: integer + responses: + '200': + content: + application/json: + schema: + type: object + properties: + data: + items: + $ref: '#/components/schemas/AnonymizationFieldResponse' + type: array + page: + type: integer + perPage: + type: integer + total: + type: integer + required: + - page + - perPage + - total + - data + description: Successful response + '400': + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: number + description: Generic Error + summary: Finds anonymization fields that match the given query. + tags: + - AnonymizationFields API + /api/security_ai_assistant/current_user/conversations: + post: + description: Create a conversation + operationId: CreateConversation + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationCreateProps' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResponse' + description: Indicates a successful call. + '400': + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: number + description: Generic Error + summary: Create a conversation + tags: + - Conversation API + /api/security_ai_assistant/current_user/conversations/_find: + get: + description: Finds conversations that match the given query. + operationId: FindConversations + parameters: + - in: query + name: fields + required: false + schema: + items: + type: string + type: array + - description: Search query + in: query + name: filter + required: false + schema: + type: string + - description: Field to sort by + in: query + name: sort_field + required: false + schema: + $ref: '#/components/schemas/FindConversationsSortField' + - description: Sort order + in: query + name: sort_order + required: false + schema: + $ref: '#/components/schemas/SortOrder' + - description: Page number + in: query + name: page + required: false + schema: + default: 1 + minimum: 1 + type: integer + - description: Conversations per page + in: query + name: per_page + required: false + schema: + default: 20 + minimum: 0 + type: integer + responses: + '200': + content: + application/json: + schema: + type: object + properties: + data: + items: + $ref: '#/components/schemas/ConversationResponse' + type: array + page: + type: integer + perPage: + type: integer + total: + type: integer + required: + - page + - perPage + - total + - data + description: Successful response + '400': + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: number + description: Generic Error + summary: Finds conversations that match the given query. + tags: + - Conversations API + '/api/security_ai_assistant/current_user/conversations/{id}': + delete: + description: Deletes a single conversation using the `id` field. + operationId: DeleteConversation + parameters: + - description: The conversation's `id` value. + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/NonEmptyString' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResponse' + description: Indicates a successful call. + '400': + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: number + description: Generic Error + summary: Deletes a single conversation using the `id` field. + tags: + - Conversation API + get: + description: Read a single conversation + operationId: ReadConversation + parameters: + - description: The conversation's `id` value. + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/NonEmptyString' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResponse' + description: Indicates a successful call. + '400': + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: number + description: Generic Error + summary: Read a single conversation + tags: + - Conversations API + put: + description: Update a single conversation + operationId: UpdateConversation + parameters: + - description: The conversation's `id` value. + in: path + name: id + required: true + schema: + $ref: '#/components/schemas/NonEmptyString' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationUpdateProps' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ConversationResponse' + description: Indicates a successful call. + '400': + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: number + description: Generic Error + summary: Update a conversation + tags: + - Conversation API + /api/security_ai_assistant/prompts/_bulk_action: + post: + description: >- + The bulk action is applied to all prompts that match the filter or to + the list of prompts by their IDs. + operationId: PerformBulkAction + requestBody: + content: + application/json: + schema: + type: object + properties: + create: + items: + $ref: '#/components/schemas/PromptCreateProps' + type: array + delete: + type: object + properties: + ids: + description: Array of prompts IDs + items: + type: string + minItems: 1 + type: array + query: + description: Query to filter promps + type: string + update: + items: + $ref: '#/components/schemas/PromptUpdateProps' + type: array + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PromptsBulkCrudActionResponse' + description: Indicates a successful call. + '400': + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: number + description: Generic Error + summary: Applies a bulk action to multiple prompts + tags: + - Bulk API + /api/security_ai_assistant/prompts/_find: + get: + description: Finds prompts that match the given query. + operationId: FindPrompts + parameters: + - in: query + name: fields + required: false + schema: + items: + type: string + type: array + - description: Search query + in: query + name: filter + required: false + schema: + type: string + - description: Field to sort by + in: query + name: sort_field + required: false + schema: + $ref: '#/components/schemas/FindPromptsSortField' + - description: Sort order + in: query + name: sort_order + required: false + schema: + $ref: '#/components/schemas/SortOrder' + - description: Page number + in: query + name: page + required: false + schema: + default: 1 + minimum: 1 + type: integer + - description: Prompts per page + in: query + name: per_page + required: false + schema: + default: 20 + minimum: 0 + type: integer + responses: + '200': + content: + application/json: + schema: + type: object + properties: + data: + items: + $ref: '#/components/schemas/PromptResponse' + type: array + page: + type: integer + perPage: + type: integer + total: + type: integer + required: + - page + - perPage + - total + - data + description: Successful response + '400': + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: number + description: Generic Error + summary: Finds prompts that match the given query. + tags: + - Prompts API +components: + schemas: + AnonymizationFieldCreateProps: + type: object + properties: + allowed: + type: boolean + anonymized: + type: boolean + field: + type: string + required: + - field + AnonymizationFieldDetailsInError: + type: object + properties: + id: + type: string + name: + type: string + required: + - id + AnonymizationFieldResponse: + type: object + properties: + allowed: + type: boolean + anonymized: + type: boolean + createdAt: + type: string + createdBy: + type: string + field: + type: string + id: + $ref: '#/components/schemas/NonEmptyString' + namespace: + description: Kibana space + type: string + timestamp: + $ref: '#/components/schemas/NonEmptyString' + updatedAt: + type: string + updatedBy: + type: string + required: + - id + - field + AnonymizationFieldsBulkActionSkipReason: + enum: + - ANONYMIZATION_FIELD_NOT_MODIFIED + type: string + AnonymizationFieldsBulkActionSkipResult: + type: object + properties: + id: + type: string + name: + type: string + skip_reason: + $ref: '#/components/schemas/AnonymizationFieldsBulkActionSkipReason' + required: + - id + - skip_reason + AnonymizationFieldsBulkCrudActionResponse: + type: object + properties: + anonymization_fields_count: + type: integer + attributes: + type: object + properties: + errors: + items: + $ref: '#/components/schemas/NormalizedAnonymizationFieldError' + type: array + results: + $ref: '#/components/schemas/AnonymizationFieldsBulkCrudActionResults' + summary: + $ref: '#/components/schemas/BulkCrudActionSummary' + required: + - results + - summary + message: + type: string + status_code: + type: integer + success: + type: boolean + required: + - attributes + AnonymizationFieldsBulkCrudActionResults: + type: object + properties: + created: + items: + $ref: '#/components/schemas/AnonymizationFieldResponse' + type: array + deleted: + items: + type: string + type: array + skipped: + items: + $ref: '#/components/schemas/AnonymizationFieldsBulkActionSkipResult' + type: array + updated: + items: + $ref: '#/components/schemas/AnonymizationFieldResponse' + type: array + required: + - updated + - created + - deleted + - skipped + AnonymizationFieldUpdateProps: + type: object + properties: + allowed: + type: boolean + anonymized: + type: boolean + id: + type: string + required: + - id + ApiConfig: + type: object + properties: + actionTypeId: + description: action type id + type: string + connectorId: + description: connector id + type: string + defaultSystemPromptId: + description: defaultSystemPromptId + type: string + model: + description: model + type: string + provider: + $ref: '#/components/schemas/Provider' + description: Provider + required: + - connectorId + - actionTypeId + BulkCrudActionSummary: + type: object + properties: + failed: + type: integer + skipped: + type: integer + succeeded: + type: integer + total: + type: integer + required: + - failed + - skipped + - succeeded + - total + ConversationCategory: + description: The conversation category. + enum: + - assistant + - insights + type: string + ConversationConfidence: + description: The conversation confidence. + enum: + - low + - medium + - high + type: string + ConversationCreateProps: + type: object + properties: + apiConfig: + $ref: '#/components/schemas/ApiConfig' + description: LLM API configuration. + category: + $ref: '#/components/schemas/ConversationCategory' + description: The conversation category. + excludeFromLastConversationStorage: + description: excludeFromLastConversationStorage. + type: boolean + id: + description: The conversation id. + type: string + isDefault: + description: Is default conversation. + type: boolean + messages: + description: The conversation messages. + items: + $ref: '#/components/schemas/Message' + type: array + replacements: + $ref: '#/components/schemas/Replacements' + title: + description: The conversation title. + type: string + required: + - title + ConversationResponse: + type: object + properties: + apiConfig: + $ref: '#/components/schemas/ApiConfig' + description: LLM API configuration. + category: + $ref: '#/components/schemas/ConversationCategory' + description: The conversation category. + createdAt: + description: The last time conversation was updated. + type: string + excludeFromLastConversationStorage: + description: excludeFromLastConversationStorage. + type: boolean + id: + $ref: '#/components/schemas/NonEmptyString' + isDefault: + description: Is default conversation. + type: boolean + messages: + description: The conversation messages. + items: + $ref: '#/components/schemas/Message' + type: array + namespace: + description: Kibana space + type: string + replacements: + $ref: '#/components/schemas/Replacements' + summary: + $ref: '#/components/schemas/ConversationSummary' + timestamp: + $ref: '#/components/schemas/NonEmptyString' + title: + description: The conversation title. + type: string + updatedAt: + description: The last time conversation was updated. + type: string + users: + items: + $ref: '#/components/schemas/User' + type: array + required: + - id + - title + - createdAt + - users + - namespace + - category + ConversationSummary: + type: object + properties: + confidence: + $ref: '#/components/schemas/ConversationConfidence' + description: >- + How confident you are about this being a correct and useful + learning. + content: + description: Summary text of the conversation over time. + type: string + public: + description: Define if summary is marked as publicly available. + type: boolean + timestamp: + $ref: '#/components/schemas/NonEmptyString' + description: The timestamp summary was updated. + ConversationUpdateProps: + type: object + properties: + apiConfig: + $ref: '#/components/schemas/ApiConfig' + description: LLM API configuration. + category: + $ref: '#/components/schemas/ConversationCategory' + description: The conversation category. + excludeFromLastConversationStorage: + description: excludeFromLastConversationStorage. + type: boolean + id: + $ref: '#/components/schemas/NonEmptyString' + messages: + description: The conversation messages. + items: + $ref: '#/components/schemas/Message' + type: array + replacements: + $ref: '#/components/schemas/Replacements' + summary: + $ref: '#/components/schemas/ConversationSummary' + title: + description: The conversation title. + type: string + required: + - id + FindAnonymizationFieldsSortField: + enum: + - created_at + - anonymized + - allowed + - field + - updated_at + type: string + FindConversationsSortField: + enum: + - created_at + - is_default + - title + - updated_at + type: string + FindPromptsSortField: + enum: + - created_at + - is_default + - name + - updated_at + type: string + Message: + description: AI assistant conversation message. + type: object + properties: + content: + description: Message content. + type: string + isError: + description: Is error message. + type: boolean + reader: + $ref: '#/components/schemas/Reader' + description: Message content. + role: + $ref: '#/components/schemas/MessageRole' + description: Message role. + timestamp: + $ref: '#/components/schemas/NonEmptyString' + description: The timestamp message was sent or received. + traceData: + $ref: '#/components/schemas/TraceData' + description: trace Data + required: + - timestamp + - content + - role + MessageRole: + description: Message role. + enum: + - system + - user + - assistant + type: string + NonEmptyString: + description: A string that is not empty and does not contain only whitespace + minLength: 1 + pattern: ^(?! *$).+$ + type: string + NormalizedAnonymizationFieldError: + type: object + properties: + anonymization_fields: + items: + $ref: '#/components/schemas/AnonymizationFieldDetailsInError' + type: array + err_code: + type: string + message: + type: string + status_code: + type: integer + required: + - message + - status_code + - anonymization_fields + NormalizedPromptError: + type: object + properties: + err_code: + type: string + message: + type: string + prompts: + items: + $ref: '#/components/schemas/PromptDetailsInError' + type: array + status_code: + type: integer + required: + - message + - status_code + - prompts + PromptCreateProps: + type: object + properties: + categories: + items: + type: string + type: array + color: + type: string + consumer: + type: string + content: + type: string + isDefault: + type: boolean + isNewConversationDefault: + type: boolean + name: + type: string + promptType: + $ref: '#/components/schemas/PromptType' + required: + - name + - content + - promptType + PromptDetailsInError: + type: object + properties: + id: + type: string + name: + type: string + required: + - id + PromptResponse: + type: object + properties: + categories: + items: + type: string + type: array + color: + type: string + consumer: + type: string + content: + type: string + createdAt: + type: string + createdBy: + type: string + id: + $ref: '#/components/schemas/NonEmptyString' + isDefault: + type: boolean + isNewConversationDefault: + type: boolean + name: + type: string + namespace: + description: Kibana space + type: string + promptType: + $ref: '#/components/schemas/PromptType' + timestamp: + $ref: '#/components/schemas/NonEmptyString' + updatedAt: + type: string + updatedBy: + type: string + users: + items: + $ref: '#/components/schemas/User' + type: array + required: + - id + - name + - promptType + - content + PromptsBulkActionSkipReason: + enum: + - PROMPT_FIELD_NOT_MODIFIED + type: string + PromptsBulkActionSkipResult: + type: object + properties: + id: + type: string + name: + type: string + skip_reason: + $ref: '#/components/schemas/PromptsBulkActionSkipReason' + required: + - id + - skip_reason + PromptsBulkCrudActionResponse: + type: object + properties: + attributes: + type: object + properties: + errors: + items: + $ref: '#/components/schemas/NormalizedPromptError' + type: array + results: + $ref: '#/components/schemas/PromptsBulkCrudActionResults' + summary: + $ref: '#/components/schemas/BulkCrudActionSummary' + required: + - results + - summary + message: + type: string + prompts_count: + type: integer + status_code: + type: integer + success: + type: boolean + required: + - attributes + PromptsBulkCrudActionResults: + type: object + properties: + created: + items: + $ref: '#/components/schemas/PromptResponse' + type: array + deleted: + items: + type: string + type: array + skipped: + items: + $ref: '#/components/schemas/PromptsBulkActionSkipResult' + type: array + updated: + items: + $ref: '#/components/schemas/PromptResponse' + type: array + required: + - updated + - created + - deleted + - skipped + PromptType: + description: Prompt type + enum: + - system + - quick + type: string + PromptUpdateProps: + type: object + properties: + categories: + items: + type: string + type: array + color: + type: string + consumer: + type: string + content: + type: string + id: + type: string + isDefault: + type: boolean + isNewConversationDefault: + type: boolean + required: + - id + Provider: + description: Provider + enum: + - OpenAI + - Azure OpenAI + type: string + Reader: + additionalProperties: true + type: object + Replacements: + additionalProperties: + type: string + description: Replacements object used to anonymize/deanomymize messsages + type: object + SortOrder: + enum: + - asc + - desc + type: string + TraceData: + description: trace Data + type: object + properties: + traceId: + description: 'Could be any string, not necessarily a UUID' + type: string + transactionId: + description: 'Could be any string, not necessarily a UUID' + type: string + User: + description: 'Could be any string, not necessarily a UUID' + type: object + properties: + id: + description: User id + type: string + name: + description: User name + type: string + securitySchemes: + BasicAuth: + scheme: basic + type: http +security: + - BasicAuth: [] +tags: ! '' diff --git a/x-pack/packages/kbn-elastic-assistant-common/docs/openapi/serverless/elastic_assistant_api_2023_10_31.bundled.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/docs/openapi/serverless/elastic_assistant_api_2023_10_31.bundled.schema.yaml new file mode 100644 index 0000000000000..f04e55d6c5a55 --- /dev/null +++ b/x-pack/packages/kbn-elastic-assistant-common/docs/openapi/serverless/elastic_assistant_api_2023_10_31.bundled.schema.yaml @@ -0,0 +1,114 @@ +openapi: 3.0.3 +info: + description: Manage and interact with Security Assistant resources. + title: Security AI Assistant API (Elastic Cloud Serverless) + version: '2023-10-31' +servers: + - url: 'http://{kibana_host}:{port}' + variables: + kibana_host: + default: localhost + port: + default: '5601' +paths: + /api/security_ai_assistant/chat/complete: + post: + description: Creates a model response for the given chat conversation. + operationId: ChatComplete + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ChatCompleteProps' + required: true + responses: + '200': + content: + application/octet-stream: + schema: + format: binary + type: string + description: Indicates a successful call. + '400': + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: number + description: Generic Error + summary: Creates a model response for the given chat conversation. + tags: + - Chat Complete API +components: + schemas: + ChatCompleteProps: + type: object + properties: + connectorId: + type: string + conversationId: + type: string + isStream: + type: boolean + langSmithApiKey: + type: string + langSmithProject: + type: string + messages: + items: + $ref: '#/components/schemas/ChatMessage' + type: array + model: + type: string + persist: + type: boolean + promptId: + type: string + responseLanguage: + type: string + required: + - messages + - persist + - connectorId + ChatMessage: + description: AI assistant message. + type: object + properties: + content: + description: Message content. + type: string + data: + $ref: '#/components/schemas/MessageData' + description: ECS object to attach to the context of the message. + fields_to_anonymize: + items: + type: string + type: array + role: + $ref: '#/components/schemas/ChatMessageRole' + description: Message role. + required: + - role + ChatMessageRole: + description: Message role. + enum: + - system + - user + - assistant + type: string + MessageData: + additionalProperties: true + type: object + securitySchemes: + BasicAuth: + scheme: basic + type: http +security: + - BasicAuth: [] +tags: ! '' diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/actions_connector/post_actions_connector_execute_route.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/actions_connector/post_actions_connector_execute_route.schema.yaml index c21d3b080767f..e4a1e1ce0f7b9 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/actions_connector/post_actions_connector_execute_route.schema.yaml +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/actions_connector/post_actions_connector_execute_route.schema.yaml @@ -5,8 +5,9 @@ info: paths: /internal/elastic_assistant/actions/connector/{connectorId}/_execute: post: - operationId: ExecuteConnector x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: ExecuteConnector description: Execute Elastic Assistant connector by id summary: Execute Elastic Assistant connector tags: diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/anonymization_fields/bulk_crud_anonymization_fields_route.gen.ts b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/anonymization_fields/bulk_crud_anonymization_fields_route.gen.ts index 96b9b7fa643f7..7c94bf1748499 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/anonymization_fields/bulk_crud_anonymization_fields_route.gen.ts +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/anonymization_fields/bulk_crud_anonymization_fields_route.gen.ts @@ -10,7 +10,7 @@ * This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator. * * info: - * title: Bulk Actions API endpoint + * title: Bulk Anonymization Fields Actions API endpoint * version: 1 */ @@ -18,14 +18,20 @@ import { z } from 'zod'; import { NonEmptyString } from '../common_attributes.gen'; -export type BulkActionSkipReason = z.infer; -export const BulkActionSkipReason = z.literal('ANONYMIZATION_FIELD_NOT_MODIFIED'); - -export type BulkActionSkipResult = z.infer; -export const BulkActionSkipResult = z.object({ +export type AnonymizationFieldsBulkActionSkipReason = z.infer< + typeof AnonymizationFieldsBulkActionSkipReason +>; +export const AnonymizationFieldsBulkActionSkipReason = z.literal( + 'ANONYMIZATION_FIELD_NOT_MODIFIED' +); + +export type AnonymizationFieldsBulkActionSkipResult = z.infer< + typeof AnonymizationFieldsBulkActionSkipResult +>; +export const AnonymizationFieldsBulkActionSkipResult = z.object({ id: z.string(), name: z.string().optional(), - skip_reason: BulkActionSkipReason, + skip_reason: AnonymizationFieldsBulkActionSkipReason, }); export type AnonymizationFieldDetailsInError = z.infer; @@ -59,12 +65,14 @@ export const AnonymizationFieldResponse = z.object({ namespace: z.string().optional(), }); -export type BulkCrudActionResults = z.infer; -export const BulkCrudActionResults = z.object({ +export type AnonymizationFieldsBulkCrudActionResults = z.infer< + typeof AnonymizationFieldsBulkCrudActionResults +>; +export const AnonymizationFieldsBulkCrudActionResults = z.object({ updated: z.array(AnonymizationFieldResponse), created: z.array(AnonymizationFieldResponse), deleted: z.array(z.string()), - skipped: z.array(BulkActionSkipResult), + skipped: z.array(AnonymizationFieldsBulkActionSkipResult), }); export type BulkCrudActionSummary = z.infer; @@ -75,14 +83,16 @@ export const BulkCrudActionSummary = z.object({ total: z.number().int(), }); -export type BulkCrudActionResponse = z.infer; -export const BulkCrudActionResponse = z.object({ +export type AnonymizationFieldsBulkCrudActionResponse = z.infer< + typeof AnonymizationFieldsBulkCrudActionResponse +>; +export const AnonymizationFieldsBulkCrudActionResponse = z.object({ success: z.boolean().optional(), status_code: z.number().int().optional(), message: z.string().optional(), anonymization_fields_count: z.number().int().optional(), attributes: z.object({ - results: BulkCrudActionResults, + results: AnonymizationFieldsBulkCrudActionResults, summary: BulkCrudActionSummary, errors: z.array(NormalizedAnonymizationFieldError).optional(), }), @@ -123,4 +133,4 @@ export const PerformBulkActionRequestBody = z.object({ export type PerformBulkActionRequestBodyInput = z.input; export type PerformBulkActionResponse = z.infer; -export const PerformBulkActionResponse = BulkCrudActionResponse; +export const PerformBulkActionResponse = AnonymizationFieldsBulkCrudActionResponse; diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/anonymization_fields/bulk_crud_anonymization_fields_route.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/anonymization_fields/bulk_crud_anonymization_fields_route.schema.yaml index 9e2623966f129..f077f70396df5 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/anonymization_fields/bulk_crud_anonymization_fields_route.schema.yaml +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/anonymization_fields/bulk_crud_anonymization_fields_route.schema.yaml @@ -1,12 +1,13 @@ openapi: 3.0.0 info: - title: Bulk Actions API endpoint + title: Bulk Anonymization Fields Actions API endpoint version: '1' paths: - /internal/elastic_assistant/anonymization_fields/_bulk_action: + /api/security_ai_assistant/anonymization_fields/_bulk_action: post: - operationId: PerformBulkAction x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: PerformBulkAction summary: Applies a bulk action to multiple anonymization fields description: The bulk action is applied to all anonymization fields that match the filter or to the list of anonymization fields by their IDs. tags: @@ -33,7 +34,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/BulkCrudActionResponse' + $ref: '#/components/schemas/AnonymizationFieldsBulkCrudActionResponse' 400: description: Generic Error content: @@ -50,12 +51,12 @@ paths: components: schemas: - BulkActionSkipReason: + AnonymizationFieldsBulkActionSkipReason: type: string enum: - ANONYMIZATION_FIELD_NOT_MODIFIED - BulkActionSkipResult: + AnonymizationFieldsBulkActionSkipResult: type: object properties: id: @@ -63,7 +64,7 @@ components: name: type: string skip_reason: - $ref: '#/components/schemas/BulkActionSkipReason' + $ref: '#/components/schemas/AnonymizationFieldsBulkActionSkipReason' required: - id - skip_reason @@ -124,7 +125,7 @@ components: type: string description: Kibana space - BulkCrudActionResults: + AnonymizationFieldsBulkCrudActionResults: type: object properties: updated: @@ -142,7 +143,7 @@ components: skipped: type: array items: - $ref: '#/components/schemas/BulkActionSkipResult' + $ref: '#/components/schemas/AnonymizationFieldsBulkActionSkipResult' required: - updated - created @@ -166,7 +167,7 @@ components: - succeeded - total - BulkCrudActionResponse: + AnonymizationFieldsBulkCrudActionResponse: type: object properties: success: @@ -181,7 +182,7 @@ components: type: object properties: results: - $ref: '#/components/schemas/BulkCrudActionResults' + $ref: '#/components/schemas/AnonymizationFieldsBulkCrudActionResults' summary: $ref: '#/components/schemas/BulkCrudActionSummary' errors: diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/anonymization_fields/find_anonymization_fields_route.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/anonymization_fields/find_anonymization_fields_route.schema.yaml index 3541c3a1c649b..3ec1f398df65c 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/anonymization_fields/find_anonymization_fields_route.schema.yaml +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/anonymization_fields/find_anonymization_fields_route.schema.yaml @@ -3,10 +3,11 @@ info: title: Find AnonymizationFields API endpoint version: '1' paths: - /internal/elastic_assistant/anonymization_fields/_find: + /api/security_ai_assistant/anonymization_fields/_find: get: - operationId: FindAnonymizationFields x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: FindAnonymizationFields description: Finds anonymization fields that match the given query. summary: Finds anonymization fields that match the given query. tags: diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/attack_discovery/cancel_attack_discovery_route.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/attack_discovery/cancel_attack_discovery_route.schema.yaml index 553d741089cd0..fb9ae33f57cfb 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/attack_discovery/cancel_attack_discovery_route.schema.yaml +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/attack_discovery/cancel_attack_discovery_route.schema.yaml @@ -5,8 +5,9 @@ info: paths: /internal/elastic_assistant/attack_discovery/cancel/{connectorId}: put: - operationId: AttackDiscoveryCancel x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: AttackDiscoveryCancel description: Cancel relevant data for performing an attack discovery like pending requests summary: Cancel relevant data for performing an attack discovery tags: diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/attack_discovery/get_attack_discovery_route.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/attack_discovery/get_attack_discovery_route.schema.yaml index 33638a588679a..bd4bfb7c667b2 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/attack_discovery/get_attack_discovery_route.schema.yaml +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/attack_discovery/get_attack_discovery_route.schema.yaml @@ -5,8 +5,9 @@ info: paths: /internal/elastic_assistant/attack_discovery/{connectorId}: get: - operationId: AttackDiscoveryGet x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: AttackDiscoveryGet description: Get relevant data for performing an attack discovery like pending requests summary: Get relevant data for performing an attack discovery tags: diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/attack_discovery/post_attack_discovery_route.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/attack_discovery/post_attack_discovery_route.schema.yaml index 1c658174abd5c..e613fbf841a21 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/attack_discovery/post_attack_discovery_route.schema.yaml +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/attack_discovery/post_attack_discovery_route.schema.yaml @@ -8,8 +8,9 @@ components: paths: /internal/elastic_assistant/attack_discovery: post: - operationId: AttackDiscoveryPost x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: AttackDiscoveryPost description: Generate attack discoveries from alerts summary: Generate attack discoveries from alerts via the Elastic Assistant tags: diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/capabilities/get_capabilities_route.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/capabilities/get_capabilities_route.schema.yaml index 8e8325e1501c7..0f07d1f58afe5 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/capabilities/get_capabilities_route.schema.yaml +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/capabilities/get_capabilities_route.schema.yaml @@ -5,8 +5,9 @@ info: paths: /internal/elastic_assistant/capabilities: get: - operationId: GetCapabilities x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: GetCapabilities description: Get Elastic Assistant capabilities for the requesting plugin summary: Get Elastic Assistant capabilities tags: diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/chat/post_chat_complete_route.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/chat/post_chat_complete_route.schema.yaml index 21c348251b039..8758e34b13598 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/chat/post_chat_complete_route.schema.yaml +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/chat/post_chat_complete_route.schema.yaml @@ -3,10 +3,11 @@ info: title: Chat Complete API endpoint version: '2023-10-31' paths: - /api/elastic_assistant/chat/complete: + /api/security_ai_assistant/chat/complete: post: - operationId: ChatComplete x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: ChatComplete description: Creates a model response for the given chat conversation. summary: Creates a model response for the given chat conversation. tags: @@ -86,7 +87,7 @@ components: promptId: type: string isStream: - type: boolean + type: boolean responseLanguage: type: string langSmithProject: diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/bulk_crud_conversations_route.gen.ts b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/bulk_crud_conversations_route.gen.ts index 40ff05b496178..65ea85b3f0190 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/bulk_crud_conversations_route.gen.ts +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/bulk_crud_conversations_route.gen.ts @@ -10,7 +10,7 @@ * This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator. * * info: - * title: Bulk Actions API endpoint + * title: Bulk Conversations Actions API endpoint * version: 1 */ @@ -22,14 +22,14 @@ import { ConversationResponse, } from './common_attributes.gen'; -export type BulkActionSkipReason = z.infer; -export const BulkActionSkipReason = z.literal('CONVERSATION_NOT_MODIFIED'); +export type ConversationsBulkActionSkipReason = z.infer; +export const ConversationsBulkActionSkipReason = z.literal('CONVERSATION_NOT_MODIFIED'); -export type BulkActionSkipResult = z.infer; -export const BulkActionSkipResult = z.object({ +export type ConversationsBulkActionSkipResult = z.infer; +export const ConversationsBulkActionSkipResult = z.object({ id: z.string(), name: z.string().optional(), - skip_reason: BulkActionSkipReason, + skip_reason: ConversationsBulkActionSkipReason, }); export type ConversationDetailsInError = z.infer; @@ -46,12 +46,12 @@ export const NormalizedConversationError = z.object({ conversations: z.array(ConversationDetailsInError), }); -export type BulkCrudActionResults = z.infer; -export const BulkCrudActionResults = z.object({ +export type ConversationsBulkCrudActionResults = z.infer; +export const ConversationsBulkCrudActionResults = z.object({ updated: z.array(ConversationResponse), created: z.array(ConversationResponse), deleted: z.array(z.string()), - skipped: z.array(BulkActionSkipResult), + skipped: z.array(ConversationsBulkActionSkipResult), }); export type BulkCrudActionSummary = z.infer; @@ -62,14 +62,16 @@ export const BulkCrudActionSummary = z.object({ total: z.number().int(), }); -export type BulkCrudActionResponse = z.infer; -export const BulkCrudActionResponse = z.object({ +export type ConversationsBulkCrudActionResponse = z.infer< + typeof ConversationsBulkCrudActionResponse +>; +export const ConversationsBulkCrudActionResponse = z.object({ success: z.boolean().optional(), status_code: z.number().int().optional(), message: z.string().optional(), conversations_count: z.number().int().optional(), attributes: z.object({ - results: BulkCrudActionResults, + results: ConversationsBulkCrudActionResults, summary: BulkCrudActionSummary, errors: z.array(NormalizedConversationError).optional(), }), @@ -96,4 +98,4 @@ export const PerformBulkActionRequestBody = z.object({ export type PerformBulkActionRequestBodyInput = z.input; export type PerformBulkActionResponse = z.infer; -export const PerformBulkActionResponse = BulkCrudActionResponse; +export const PerformBulkActionResponse = ConversationsBulkCrudActionResponse; diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/bulk_crud_conversations_route.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/bulk_crud_conversations_route.schema.yaml index 0768508205708..7517c32b1075b 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/bulk_crud_conversations_route.schema.yaml +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/bulk_crud_conversations_route.schema.yaml @@ -1,12 +1,13 @@ openapi: 3.0.0 info: - title: Bulk Actions API endpoint + title: Bulk Conversations Actions API endpoint version: '1' paths: - /internal/elastic_assistant/conversations/_bulk_action: + /internal/elastic_assistant/current_user/conversations/_bulk_action: post: - operationId: PerformBulkAction x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: PerformBulkAction summary: Applies a bulk action to multiple conversations description: The bulk action is applied to all conversations that match the filter or to the list of conversations by their IDs. tags: @@ -33,7 +34,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/BulkCrudActionResponse' + $ref: '#/components/schemas/ConversationsBulkCrudActionResponse' 400: description: Generic Error content: @@ -50,12 +51,12 @@ paths: components: schemas: - BulkActionSkipReason: + ConversationsBulkActionSkipReason: type: string enum: - CONVERSATION_NOT_MODIFIED - BulkActionSkipResult: + ConversationsBulkActionSkipResult: type: object properties: id: @@ -63,7 +64,7 @@ components: name: type: string skip_reason: - $ref: '#/components/schemas/BulkActionSkipReason' + $ref: '#/components/schemas/ConversationsBulkActionSkipReason' required: - id - skip_reason @@ -96,7 +97,7 @@ components: - status_code - conversations - BulkCrudActionResults: + ConversationsBulkCrudActionResults: type: object properties: updated: @@ -114,7 +115,7 @@ components: skipped: type: array items: - $ref: '#/components/schemas/BulkActionSkipResult' + $ref: '#/components/schemas/ConversationsBulkActionSkipResult' required: - updated - created @@ -138,7 +139,7 @@ components: - succeeded - total - BulkCrudActionResponse: + ConversationsBulkCrudActionResponse: type: object properties: success: @@ -153,7 +154,7 @@ components: type: object properties: results: - $ref: '#/components/schemas/BulkCrudActionResults' + $ref: '#/components/schemas/ConversationsBulkCrudActionResults' summary: $ref: '#/components/schemas/BulkCrudActionSummary' errors: @@ -180,4 +181,3 @@ components: minItems: 1 items: type: string - \ No newline at end of file diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml index fc2f86e8a8654..ae5ca7d325a6a 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml @@ -3,10 +3,11 @@ info: title: Create Conversation API endpoint version: '1' paths: - /internal/elastic_assistant/conversations: + /api/security_ai_assistant/current_user/conversations: post: - operationId: CreateConversation x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: CreateConversation description: Create a conversation summary: Create a conversation tags: @@ -38,10 +39,11 @@ paths: message: type: string - /internal/elastic_assistant/conversations/{id}: + /api/security_ai_assistant/current_user/conversations/{id}: get: - operationId: ReadConversation x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: ReadConversation description: Read a single conversation summary: Read a single conversation tags: @@ -74,8 +76,9 @@ paths: message: type: string put: - operationId: UpdateConversation x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: UpdateConversation description: Update a single conversation summary: Update a conversation tags: @@ -114,8 +117,9 @@ paths: message: type: string delete: - operationId: DeleteConversation x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: DeleteConversation description: Deletes a single conversation using the `id` field. summary: Deletes a single conversation using the `id` field. tags: @@ -148,10 +152,11 @@ paths: message: type: string - /internal/elastic_assistant/conversations/{id}/messages: + /internal/elastic_assistant/current_user/conversations/{id}/messages: post: - operationId: AppendConversationMessage x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: AppendConversationMessage description: Append a message to the conversation summary: Append a message to the conversation tags: diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/find_conversations_route.gen.ts b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/find_conversations_route.gen.ts index 6f8607640e262..f5d0962d13a77 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/find_conversations_route.gen.ts +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/find_conversations_route.gen.ts @@ -63,42 +63,3 @@ export const FindConversationsResponse = z.object({ total: z.number().int(), data: z.array(ConversationResponse), }); -export type FindCurrentUserConversationsRequestQuery = z.infer< - typeof FindCurrentUserConversationsRequestQuery ->; -export const FindCurrentUserConversationsRequestQuery = z.object({ - fields: ArrayFromString(z.string()).optional(), - /** - * Search query - */ - filter: z.string().optional(), - /** - * Field to sort by - */ - sort_field: FindConversationsSortField.optional(), - /** - * Sort order - */ - sort_order: SortOrder.optional(), - /** - * Page number - */ - page: z.coerce.number().int().min(1).optional().default(1), - /** - * Conversations per page - */ - per_page: z.coerce.number().int().min(0).optional().default(20), -}); -export type FindCurrentUserConversationsRequestQueryInput = z.input< - typeof FindCurrentUserConversationsRequestQuery ->; - -export type FindCurrentUserConversationsResponse = z.infer< - typeof FindCurrentUserConversationsResponse ->; -export const FindCurrentUserConversationsResponse = z.object({ - page: z.number().int(), - perPage: z.number().int(), - total: z.number().int(), - data: z.array(ConversationResponse), -}); diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/find_conversations_route.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/find_conversations_route.schema.yaml index fcb4c0a013eaa..ea1f9b637186d 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/find_conversations_route.schema.yaml +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/find_conversations_route.schema.yaml @@ -3,10 +3,11 @@ info: title: Find Conversations API endpoint version: '1' paths: - /internal/elastic_assistant/conversations/_find: + /api/security_ai_assistant/current_user/conversations/_find: get: - operationId: FindConversations x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: FindConversations description: Finds conversations that match the given query. summary: Finds conversations that match the given query. tags: @@ -91,94 +92,6 @@ paths: message: type: string - /internal/elastic_assistant/conversations/current_user/_find: - get: - operationId: FindCurrentUserConversations - x-codegen-enabled: true - description: Finds current user conversations that match the given query. - summary: Finds current user conversations that match the given query. - tags: - - Conversations API - parameters: - - name: 'fields' - in: query - required: false - schema: - type: array - items: - type: string - - name: 'filter' - in: query - description: Search query - required: false - schema: - type: string - - name: 'sort_field' - in: query - description: Field to sort by - required: false - schema: - $ref: '#/components/schemas/FindConversationsSortField' - - name: 'sort_order' - in: query - description: Sort order - required: false - schema: - $ref: '../common_attributes.schema.yaml#/components/schemas/SortOrder' - - name: 'page' - in: query - description: Page number - required: false - schema: - type: integer - minimum: 1 - default: 1 - - name: 'per_page' - in: query - description: Conversations per page - required: false - schema: - type: integer - minimum: 0 - default: 20 - - responses: - 200: - description: Successful response - content: - application/json: - schema: - type: object - properties: - page: - type: integer - perPage: - type: integer - total: - type: integer - data: - type: array - items: - $ref: './common_attributes.schema.yaml#/components/schemas/ConversationResponse' - required: - - page - - perPage - - total - - data - 400: - description: Generic Error - content: - application/json: - schema: - type: object - properties: - statusCode: - type: number - error: - type: string - message: - type: string - components: schemas: FindConversationsSortField: diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/evaluation/get_evaluate_route.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/evaluation/get_evaluate_route.schema.yaml index b0c0c218eb9ac..deccfb9f2488c 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/evaluation/get_evaluate_route.schema.yaml +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/evaluation/get_evaluate_route.schema.yaml @@ -5,8 +5,9 @@ info: paths: /internal/elastic_assistant/evaluate: get: - operationId: GetEvaluate x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: GetEvaluate description: Get relevant data for performing an evaluation like available sample data, agents, and evaluators summary: Get relevant data for performing an evaluation tags: diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/evaluation/post_evaluate_route.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/evaluation/post_evaluate_route.schema.yaml index 41a7230e85ac5..4b567f9cd118a 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/evaluation/post_evaluate_route.schema.yaml +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/evaluation/post_evaluate_route.schema.yaml @@ -5,8 +5,9 @@ info: paths: /internal/elastic_assistant/evaluate: post: - operationId: PostEvaluate x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: PostEvaluate description: Perform an evaluation using sample data against a combination of Agents and Connectors summary: Performs an evaluation of the Elastic Assistant tags: diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/bulk_crud_knowledge_base_route.gen.ts b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/bulk_crud_knowledge_base_route.gen.ts index a7578d722d797..5c5f7e2faafb9 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/bulk_crud_knowledge_base_route.gen.ts +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/bulk_crud_knowledge_base_route.gen.ts @@ -11,7 +11,7 @@ * * info: * title: Bulk Knowledge Base Actions API endpoint - * version: 2023-10-31 + * version: 1 */ import { z } from 'zod'; diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/bulk_crud_knowledge_base_route.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/bulk_crud_knowledge_base_route.schema.yaml index f8a2ee49d399a..7670114c7164a 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/bulk_crud_knowledge_base_route.schema.yaml +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/bulk_crud_knowledge_base_route.schema.yaml @@ -1,12 +1,15 @@ openapi: 3.0.0 info: title: Bulk Knowledge Base Actions API endpoint - version: '2023-10-31' + version: '1' paths: - /api/elastic_assistant/knowledge_base/entries/_bulk_action: + /internal/elastic_assistant/knowledge_base/entries/_bulk_action: post: - operationId: PerformKnowledgeBaseEntryBulkAction x-codegen-enabled: true + # This API is still behind the `assistantKnowledgeBaseByDefault` feature flag + x-internal: true + x-labels: [ess, serverless] + operationId: PerformKnowledgeBaseEntryBulkAction summary: Applies a bulk action to multiple Knowledge Base Entries description: The bulk action is applied to all Knowledge Base Entries that match the filter or to the list of Knowledge Base Entries by their IDs tags: diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_kb_route.gen.ts b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_kb_route.gen.ts index bd60c296743ae..b6b1c86f959c3 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_kb_route.gen.ts +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_kb_route.gen.ts @@ -11,7 +11,7 @@ * * info: * title: KnowledgeBase API endpoints - * version: 2023-10-31 + * version: 1 */ import { z } from 'zod'; diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_kb_route.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_kb_route.schema.yaml index 16d13c24f23ea..6dccf1f1b2e09 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_kb_route.schema.yaml +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_kb_route.schema.yaml @@ -1,12 +1,13 @@ openapi: 3.0.0 info: title: KnowledgeBase API endpoints - version: '2023-10-31' + version: '1' paths: /internal/elastic_assistant/knowledge_base/{resource}: post: - operationId: CreateKnowledgeBase x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: CreateKnowledgeBase summary: Create a KnowledgeBase description: Create a KnowledgeBase tags: @@ -38,8 +39,9 @@ paths: message: type: string get: - operationId: ReadKnowledgeBase x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: ReadKnowledgeBase description: Read a single KB summary: Read a KnowledgeBase tags: @@ -82,8 +84,9 @@ paths: message: type: string delete: - operationId: DeleteKnowledgeBase x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: DeleteKnowledgeBase description: Deletes KnowledgeBase with the `resource` field. summary: Deletes a KnowledgeBase tags: diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_knowledge_base_route.gen.ts b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_knowledge_base_route.gen.ts index 01c3427f80c85..669292e955ec9 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_knowledge_base_route.gen.ts +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_knowledge_base_route.gen.ts @@ -11,7 +11,7 @@ * * info: * title: Manage Knowledge Base Entries API endpoint - * version: 2023-10-31 + * version: 1 */ import { z } from 'zod'; diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_knowledge_base_route.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_knowledge_base_route.schema.yaml index 6db7da89f55e5..32e66efffc13c 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_knowledge_base_route.schema.yaml +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_knowledge_base_route.schema.yaml @@ -1,12 +1,15 @@ openapi: 3.0.0 info: title: Manage Knowledge Base Entries API endpoint - version: '2023-10-31' + version: '1' paths: - /api/elastic_assistant/knowledge_base/entries: + /internnal/elastic_assistant/knowledge_base/entries: post: - operationId: CreateKnowledgeBaseEntry x-codegen-enabled: true + # This API is still behind the `assistantKnowledgeBaseByDefault` feature flag + x-internal: true + x-labels: [ess, serverless] + operationId: CreateKnowledgeBaseEntry description: Create a Knowledge Base Entry summary: Create a Knowledge Base Entry tags: @@ -31,10 +34,13 @@ paths: schema: $ref: './common_attributes.schema.yaml#/components/schemas/KnowledgeBaseEntryErrorSchema' - /api/elastic_assistant/knowledge_base/entries/{id}: + /internal/elastic_assistant/knowledge_base/entries/{id}: get: - operationId: ReadKnowledgeBaseEntry x-codegen-enabled: true + # This API is still behind the `assistantKnowledgeBaseByDefault` feature flag + x-internal: true + x-labels: [ess, serverless] + operationId: ReadKnowledgeBaseEntry description: Read a Knowledge Base Entry summary: Read a Knowledge Base Entry tags: @@ -60,8 +66,11 @@ paths: schema: $ref: './common_attributes.schema.yaml#/components/schemas/KnowledgeBaseEntryErrorSchema' put: - operationId: UpdateKnowledgeBaseEntry x-codegen-enabled: true + # This API is still behind the `assistantKnowledgeBaseByDefault` feature flag + x-internal: true + x-labels: [ess, serverless] + operationId: UpdateKnowledgeBaseEntry description: Update a Knowledge Base Entry summary: Update a Knowledge Base Entry tags: @@ -93,8 +102,11 @@ paths: schema: $ref: './common_attributes.schema.yaml#/components/schemas/KnowledgeBaseEntryErrorSchema' delete: - operationId: DeleteKnowledgeBaseEntry x-codegen-enabled: true + # This API is still behind the `assistantKnowledgeBaseByDefault` feature flag + x-internal: true + x-labels: [ess, serverless] + operationId: DeleteKnowledgeBaseEntry description: Deletes a single Knowledge Base Entry using the `id` field summary: Deletes a single Knowledge Base Entry using the `id` field tags: diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/find_knowledge_base_entries_route.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/find_knowledge_base_entries_route.schema.yaml index d5298ff2ccbdc..cf88de73df1db 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/find_knowledge_base_entries_route.schema.yaml +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/knowledge_base/find_knowledge_base_entries_route.schema.yaml @@ -5,8 +5,11 @@ info: paths: /internal/elastic_assistant/knowledge_base/entries/_find: get: - operationId: FindKnowledgeBaseEntries x-codegen-enabled: true + # This API is still behind the `assistantKnowledgeBaseByDefault` feature flag + x-internal: true + x-labels: [ess, serverless] + operationId: FindKnowledgeBaseEntries description: Finds Knowledge Base Entries that match the given query. summary: Finds Knowledge Base Entries that match the given query. tags: diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/prompts/bulk_crud_prompts_route.gen.ts b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/prompts/bulk_crud_prompts_route.gen.ts index 2d7a4d762eecc..09e7fc85f9363 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/prompts/bulk_crud_prompts_route.gen.ts +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/prompts/bulk_crud_prompts_route.gen.ts @@ -10,7 +10,7 @@ * This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator. * * info: - * title: Bulk Actions API endpoint + * title: Bulk Prompts Actions API endpoint * version: 1 */ @@ -18,14 +18,14 @@ import { z } from 'zod'; import { NonEmptyString, User } from '../common_attributes.gen'; -export type BulkActionSkipReason = z.infer; -export const BulkActionSkipReason = z.literal('PROMPT_FIELD_NOT_MODIFIED'); +export type PromptsBulkActionSkipReason = z.infer; +export const PromptsBulkActionSkipReason = z.literal('PROMPT_FIELD_NOT_MODIFIED'); -export type BulkActionSkipResult = z.infer; -export const BulkActionSkipResult = z.object({ +export type PromptsBulkActionSkipResult = z.infer; +export const PromptsBulkActionSkipResult = z.object({ id: z.string(), name: z.string().optional(), - skip_reason: BulkActionSkipReason, + skip_reason: PromptsBulkActionSkipReason, }); export type PromptDetailsInError = z.infer; @@ -73,12 +73,12 @@ export const PromptResponse = z.object({ namespace: z.string().optional(), }); -export type BulkCrudActionResults = z.infer; -export const BulkCrudActionResults = z.object({ +export type PromptsBulkCrudActionResults = z.infer; +export const PromptsBulkCrudActionResults = z.object({ updated: z.array(PromptResponse), created: z.array(PromptResponse), deleted: z.array(z.string()), - skipped: z.array(BulkActionSkipResult), + skipped: z.array(PromptsBulkActionSkipResult), }); export type BulkCrudActionSummary = z.infer; @@ -89,14 +89,14 @@ export const BulkCrudActionSummary = z.object({ total: z.number().int(), }); -export type BulkCrudActionResponse = z.infer; -export const BulkCrudActionResponse = z.object({ +export type PromptsBulkCrudActionResponse = z.infer; +export const PromptsBulkCrudActionResponse = z.object({ success: z.boolean().optional(), status_code: z.number().int().optional(), message: z.string().optional(), prompts_count: z.number().int().optional(), attributes: z.object({ - results: BulkCrudActionResults, + results: PromptsBulkCrudActionResults, summary: BulkCrudActionSummary, errors: z.array(NormalizedPromptError).optional(), }), @@ -146,4 +146,4 @@ export const PerformBulkActionRequestBody = z.object({ export type PerformBulkActionRequestBodyInput = z.input; export type PerformBulkActionResponse = z.infer; -export const PerformBulkActionResponse = BulkCrudActionResponse; +export const PerformBulkActionResponse = PromptsBulkCrudActionResponse; diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/prompts/bulk_crud_prompts_route.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/prompts/bulk_crud_prompts_route.schema.yaml index 5be6bde140b85..f5b6ee918429c 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/prompts/bulk_crud_prompts_route.schema.yaml +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/prompts/bulk_crud_prompts_route.schema.yaml @@ -1,12 +1,13 @@ openapi: 3.0.0 info: - title: Bulk Actions API endpoint + title: Bulk Prompts Actions API endpoint version: '1' paths: - /internal/elastic_assistant/prompts/_bulk_action: + /api/security_ai_assistant/prompts/_bulk_action: post: - operationId: PerformBulkAction x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: PerformBulkAction summary: Applies a bulk action to multiple prompts description: The bulk action is applied to all prompts that match the filter or to the list of prompts by their IDs. tags: @@ -33,7 +34,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/BulkCrudActionResponse' + $ref: '#/components/schemas/PromptsBulkCrudActionResponse' 400: description: Generic Error content: @@ -50,12 +51,12 @@ paths: components: schemas: - BulkActionSkipReason: + PromptsBulkActionSkipReason: type: string enum: - PROMPT_FIELD_NOT_MODIFIED - BulkActionSkipResult: + PromptsBulkActionSkipResult: type: object properties: id: @@ -63,7 +64,7 @@ components: name: type: string skip_reason: - $ref: '#/components/schemas/BulkActionSkipReason' + $ref: '#/components/schemas/PromptsBulkActionSkipReason' required: - id - skip_reason @@ -149,7 +150,7 @@ components: type: string description: Kibana space - BulkCrudActionResults: + PromptsBulkCrudActionResults: type: object properties: updated: @@ -167,7 +168,7 @@ components: skipped: type: array items: - $ref: '#/components/schemas/BulkActionSkipResult' + $ref: '#/components/schemas/PromptsBulkActionSkipResult' required: - updated - created @@ -191,7 +192,7 @@ components: - succeeded - total - BulkCrudActionResponse: + PromptsBulkCrudActionResponse: type: object properties: success: @@ -206,7 +207,7 @@ components: type: object properties: results: - $ref: '#/components/schemas/BulkCrudActionResults' + $ref: '#/components/schemas/PromptsBulkCrudActionResults' summary: $ref: '#/components/schemas/BulkCrudActionSummary' errors: diff --git a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/prompts/find_prompts_route.schema.yaml b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/prompts/find_prompts_route.schema.yaml index 1902f4e9ae3d9..dbd5590b29ee1 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/prompts/find_prompts_route.schema.yaml +++ b/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/prompts/find_prompts_route.schema.yaml @@ -3,10 +3,11 @@ info: title: Find Prompts API endpoint version: '1' paths: - /internal/elastic_assistant/prompts/_find: + /api/security_ai_assistant/prompts/_find: get: - operationId: FindPrompts x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: FindPrompts description: Finds prompts that match the given query. summary: Finds prompts that match the given query. tags: diff --git a/x-pack/packages/kbn-elastic-assistant-common/scripts/openapi/bundle.js b/x-pack/packages/kbn-elastic-assistant-common/scripts/openapi/bundle.js index 138d1255b865b..eb45fe104ad48 100644 --- a/x-pack/packages/kbn-elastic-assistant-common/scripts/openapi/bundle.js +++ b/x-pack/packages/kbn-elastic-assistant-common/scripts/openapi/bundle.js @@ -8,12 +8,38 @@ require('../../../../../src/setup_node_env'); const { bundle } = require('@kbn/openapi-bundler'); // eslint-disable-next-line import/no-nodejs-modules -const { resolve } = require('path'); +const { join, resolve } = require('path'); const ELASTIC_ASSISTANT_ROOT = resolve(__dirname, '../..'); -bundle({ - rootDir: ELASTIC_ASSISTANT_ROOT, - sourceGlob: './impl/schemas/**/*.schema.yaml', - outputFilePath: './target/openapi/elastic_assistant.bundled.schema.yaml', -}); +(async () => { + await bundle({ + sourceGlob: join(ELASTIC_ASSISTANT_ROOT, 'impl/schemas/**/*.schema.yaml'), + outputFilePath: join( + ELASTIC_ASSISTANT_ROOT, + 'docs/openapi/serverless/elastic_assistant_api_{version}.bundled.schema.yaml' + ), + options: { + includeLabels: ['serverless'], + specInfo: { + title: 'Security AI Assistant API (Elastic Cloud Serverless)', + description: 'Manage and interact with Security Assistant resources.', + }, + }, + }); + + await bundle({ + sourceGlob: join(ELASTIC_ASSISTANT_ROOT, 'impl/schemas/**/*.schema.yaml'), + outputFilePath: join( + ELASTIC_ASSISTANT_ROOT, + 'docs/openapi/ess/elastic_assistant_api_{version}.bundled.schema.yaml' + ), + options: { + includeLabels: ['ess'], + specInfo: { + title: 'Security AI Assistant API (Elastic Cloud & self-hosted)', + description: 'Manage and interact with Security Assistant resources.', + }, + }, + }); +})(); diff --git a/x-pack/plugins/elastic_assistant/server/routes/anonymization_fields/bulk_actions_route.ts b/x-pack/plugins/elastic_assistant/server/routes/anonymization_fields/bulk_actions_route.ts index 94788d2d1d926..f7b87b49dd2a7 100644 --- a/x-pack/plugins/elastic_assistant/server/routes/anonymization_fields/bulk_actions_route.ts +++ b/x-pack/plugins/elastic_assistant/server/routes/anonymization_fields/bulk_actions_route.ts @@ -16,9 +16,9 @@ import { import { AnonymizationFieldResponse, - BulkActionSkipResult, - BulkCrudActionResponse, - BulkCrudActionResults, + AnonymizationFieldsBulkActionSkipResult, + AnonymizationFieldsBulkCrudActionResponse, + AnonymizationFieldsBulkCrudActionResults, BulkCrudActionSummary, PerformBulkActionRequestBody, PerformBulkActionResponse, @@ -63,9 +63,9 @@ const buildBulkResponse = ( updated?: AnonymizationFieldResponse[]; created?: AnonymizationFieldResponse[]; deleted?: string[]; - skipped?: BulkActionSkipResult[]; + skipped?: AnonymizationFieldsBulkActionSkipResult[]; } -): IKibanaResponse => { +): IKibanaResponse => { const numSucceeded = updated.length + created.length + deleted.length; const numSkipped = skipped.length; const numFailed = errors.length; @@ -77,7 +77,7 @@ const buildBulkResponse = ( total: numSucceeded + numFailed + numSkipped, }; - const results: BulkCrudActionResults = { + const results: AnonymizationFieldsBulkCrudActionResults = { updated, created, deleted, @@ -85,7 +85,7 @@ const buildBulkResponse = ( }; if (numFailed > 0) { - return response.custom({ + return response.custom({ headers: { 'content-type': 'application/json' }, body: { message: summary.succeeded > 0 ? 'Bulk edit partially failed' : 'Bulk edit failed', @@ -103,7 +103,7 @@ const buildBulkResponse = ( }); } - const responseBody: BulkCrudActionResponse = { + const responseBody: AnonymizationFieldsBulkCrudActionResponse = { success: true, anonymization_fields_count: summary.total, attributes: { results, summary }, diff --git a/x-pack/plugins/elastic_assistant/server/routes/prompts/bulk_actions_route.ts b/x-pack/plugins/elastic_assistant/server/routes/prompts/bulk_actions_route.ts index d90b01b78cfa7..c2713f28088d8 100644 --- a/x-pack/plugins/elastic_assistant/server/routes/prompts/bulk_actions_route.ts +++ b/x-pack/plugins/elastic_assistant/server/routes/prompts/bulk_actions_route.ts @@ -16,9 +16,9 @@ import { import { PromptResponse, - BulkActionSkipResult, - BulkCrudActionResponse, - BulkCrudActionResults, + PromptsBulkActionSkipResult, + PromptsBulkCrudActionResponse, + PromptsBulkCrudActionResults, BulkCrudActionSummary, PerformBulkActionRequestBody, PerformBulkActionResponse, @@ -60,9 +60,9 @@ const buildBulkResponse = ( updated?: PromptResponse[]; created?: PromptResponse[]; deleted?: string[]; - skipped?: BulkActionSkipResult[]; + skipped?: PromptsBulkActionSkipResult[]; } -): IKibanaResponse => { +): IKibanaResponse => { const numSucceeded = updated.length + created.length + deleted.length; const numSkipped = skipped.length; const numFailed = errors.length; @@ -74,7 +74,7 @@ const buildBulkResponse = ( total: numSucceeded + numFailed + numSkipped, }; - const results: BulkCrudActionResults = { + const results: PromptsBulkCrudActionResults = { updated, created, deleted, @@ -82,7 +82,7 @@ const buildBulkResponse = ( }; if (numFailed > 0) { - return response.custom({ + return response.custom({ headers: { 'content-type': 'application/json' }, body: { message: summary.succeeded > 0 ? 'Bulk edit partially failed' : 'Bulk edit failed', @@ -100,7 +100,7 @@ const buildBulkResponse = ( }); } - const responseBody: BulkCrudActionResponse = { + const responseBody: PromptsBulkCrudActionResponse = { success: true, prompts_count: summary.total, attributes: { results, summary }, diff --git a/x-pack/plugins/elastic_assistant/server/routes/user_conversations/bulk_actions_route.ts b/x-pack/plugins/elastic_assistant/server/routes/user_conversations/bulk_actions_route.ts index 56adf57a9b7a4..e084468749081 100644 --- a/x-pack/plugins/elastic_assistant/server/routes/user_conversations/bulk_actions_route.ts +++ b/x-pack/plugins/elastic_assistant/server/routes/user_conversations/bulk_actions_route.ts @@ -11,9 +11,9 @@ import type { IKibanaResponse, KibanaResponseFactory, Logger } from '@kbn/core/s import { transformError } from '@kbn/securitysolution-es-utils'; import { ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BULK_ACTION, - BulkActionSkipResult, - BulkCrudActionResponse, - BulkCrudActionResults, + ConversationsBulkActionSkipResult, + ConversationsBulkCrudActionResponse, + ConversationsBulkCrudActionResults, BulkCrudActionSummary, PerformBulkActionRequestBody, PerformBulkActionResponse, @@ -61,9 +61,9 @@ const buildBulkResponse = ( updated?: ConversationResponse[]; created?: ConversationResponse[]; deleted?: string[]; - skipped?: BulkActionSkipResult[]; + skipped?: ConversationsBulkActionSkipResult[]; } -): IKibanaResponse => { +): IKibanaResponse => { const numSucceeded = updated.length + created.length + deleted.length; const numSkipped = skipped.length; const numFailed = errors.length; @@ -75,7 +75,7 @@ const buildBulkResponse = ( total: numSucceeded + numFailed + numSkipped, }; - const results: BulkCrudActionResults = { + const results: ConversationsBulkCrudActionResults = { updated, created, deleted, @@ -83,7 +83,7 @@ const buildBulkResponse = ( }; if (numFailed > 0) { - return response.custom({ + return response.custom({ headers: { 'content-type': 'application/json' }, body: { message: summary.succeeded > 0 ? 'Bulk edit partially failed' : 'Bulk edit failed', @@ -101,7 +101,7 @@ const buildBulkResponse = ( }); } - const responseBody: BulkCrudActionResponse = { + const responseBody: ConversationsBulkCrudActionResponse = { success: true, conversations_count: summary.total, attributes: { results, summary },