diff --git a/oas_docs/output/kibana.serverless.yaml b/oas_docs/output/kibana.serverless.yaml index 3263bcb23efe9..523cbc2db18e6 100644 --- a/oas_docs/output/kibana.serverless.yaml +++ b/oas_docs/output/kibana.serverless.yaml @@ -53519,6 +53519,100 @@ paths: x-metaTags: - content: Kibana, Elastic Cloud Serverless name: product_name + /api/security_ai_assistant/knowledge_base: + get: + description: |- + **Spaces method and path for this operation:** + +
get /s/{space_id}/api/security_ai_assistant/knowledge_base
+ + Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information. + + Read a single KB + operationId: GetKnowledgeBase + responses: + '200': + content: + application/json: + examples: + KnowledgeBaseReadResponse200Example2: + summary: A response that returns information about the knowledge base. + value: + defend_insights_exists: true + elser_exists: false + is_setup_available: true + is_setup_in_progress: true + product_documentation_status: installed + security_labs_exists: false + user_data_exists: true + schema: + $ref: '#/components/schemas/Security_AI_Assistant_API_KnowledgeBaseReadResponse200' + description: Indicates a successful call. + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/Security_AI_Assistant_API_KnowledgeBaseResponse400' + description: Generic Error + summary: Read a KnowledgeBase + tags: + - Security AI Assistant API + x-metaTags: + - content: Kibana, Elastic Cloud Serverless + name: product_name + post: + operationId: PostKnowledgeBase + parameters: + - description: ELSER modelId to use when setting up the Knowledge Base. If not provided, a default model will be used. + example: elser-model-001 + in: query + name: modelId + required: false + schema: + type: string + - description: Indicates whether we should or should not install Security Labs docs when setting up the Knowledge Base. Defaults to `false`. + example: true + in: query + name: ignoreSecurityLabs + required: false + schema: + default: false + type: boolean + responses: + '200': + content: + application/json: + examples: + KnowledgeBaseResponse200Example2: + summary: A response that indicates that the request was successful. + value: + success: true + schema: + $ref: '#/components/schemas/Security_AI_Assistant_API_KnowledgeBaseResponse' + description: Indicates a successful call. + '400': + content: + application/json: + examples: + KnowledgeBaseResponse400Example2: + summary: A response for a request that failed due to an invalid query parameter value. + value: | + statusCode: 400 error: Bad Request message: "[request query]: ignoreSecurityLabs: Invalid enum value. Expected 'true' | 'false', received 'yes', ignoreSecurityLabs: Expected boolean, received string" + schema: + $ref: '#/components/schemas/Security_AI_Assistant_API_KnowledgeBaseResponse400' + description: Generic Error + summary: Create a KnowledgeBase + tags: + - Security AI Assistant API + x-metaTags: + - content: Kibana, Elastic Cloud Serverless + name: product_name + description: |- + **Spaces method and path for this operation:** + +
post /s/{space_id}/api/security_ai_assistant/knowledge_base
+ + Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information. /api/security_ai_assistant/knowledge_base/{resource}: get: description: |- @@ -53528,71 +53622,41 @@ paths: Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information. - Read a single KB + Read a knowledge base with a specific resource identifier. operationId: ReadKnowledgeBase parameters: - description: The KnowledgeBase `resource` value. example: kb12345 in: path name: resource + required: true schema: type: string responses: '200': content: application/json: - schema: - type: object - properties: - defend_insights_exists: - description: Indicates if Defend Insights documentation exists in the KnowledgeBase. - example: true - type: boolean - elser_exists: - description: Indicates if the ELSER model exists for the KnowledgeBase. - example: true - type: boolean - is_setup_available: - description: Indicates if the setup process is available for the KnowledgeBase. - example: true - type: boolean - is_setup_in_progress: - description: Indicates if the setup process is currently in progress. - example: false - type: boolean - product_documentation_status: - description: The status of the product documentation in the KnowledgeBase. - example: complete - type: string - security_labs_exists: - description: Indicates if Security Labs documentation exists in the KnowledgeBase. - example: true - type: boolean - user_data_exists: - description: Indicates if user data exists in the KnowledgeBase. - example: false - type: boolean + examples: + KnowledgeBaseReadResponse200Example1: + summary: A response that returns information about the knowledge base. + value: + defend_insights_exists: true + elser_exists: false + is_setup_available: true + is_setup_in_progress: true + product_documentation_status: installed + security_labs_exists: false + user_data_exists: true + schema: + $ref: '#/components/schemas/Security_AI_Assistant_API_KnowledgeBaseReadResponse200' description: Indicates a successful call. '400': content: application/json: schema: - type: object - properties: - error: - description: A short description of the error. - example: Bad Request - type: string - message: - description: A detailed error message. - example: Invalid resource ID provided. - type: string - statusCode: - description: The HTTP status code of the error. - example: 400 - type: number + $ref: '#/components/schemas/Security_AI_Assistant_API_KnowledgeBaseResponse400' description: Generic Error - summary: Read a KnowledgeBase + summary: Read a KnowledgeBase for a resource tags: - Security AI Assistant API x-metaTags: @@ -53606,13 +53670,14 @@ paths: Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information. - Create a KnowledgeBase + Create a knowledge base with a specific resource identifier. operationId: CreateKnowledgeBase parameters: - description: The KnowledgeBase `resource` value. example: kb12345 in: path name: resource + required: true schema: type: string - description: ELSER modelId to use when setting up the Knowledge Base. If not provided, a default model will be used. @@ -53634,29 +53699,26 @@ paths: '200': content: application/json: + examples: + KnowledgeBaseResponse200Example1: + summary: A response that indicates that the request was successful. + value: + success: true schema: $ref: '#/components/schemas/Security_AI_Assistant_API_KnowledgeBaseResponse' description: Indicates a successful call. '400': content: application/json: + examples: + KnowledgeBaseResponse400Example1: + summary: A response for a request that failed due to an invalid query parameter value. + value: | + statusCode: 400 error: Bad Request message: "[request query]: ignoreSecurityLabs: Invalid enum value. Expected 'true' | 'false', received 'yes', ignoreSecurityLabs: Expected boolean, received string" schema: - type: object - properties: - error: - description: A short description of the error. - example: Bad Request - type: string - message: - description: A detailed error message. - example: Invalid resource ID provided. - type: string - statusCode: - description: The HTTP status code of the error. - example: 400 - type: number + $ref: '#/components/schemas/Security_AI_Assistant_API_KnowledgeBaseResponse400' description: Generic Error - summary: Create a KnowledgeBase + summary: Create a KnowledgeBase for a resource tags: - Security AI Assistant API x-metaTags: @@ -76907,6 +76969,37 @@ components: - $ref: '#/components/schemas/Security_AI_Assistant_API_IndexEntryCreateFields' discriminator: propertyName: type + Security_AI_Assistant_API_KnowledgeBaseReadResponse200: + type: object + properties: + defend_insights_exists: + description: Indicates if Defend Insights documentation exists in the KnowledgeBase. + example: true + type: boolean + elser_exists: + description: Indicates if the ELSER model exists for the KnowledgeBase. + example: true + type: boolean + is_setup_available: + description: Indicates if the setup process is available for the KnowledgeBase. + example: true + type: boolean + is_setup_in_progress: + description: Indicates if the setup process is currently in progress. + example: false + type: boolean + product_documentation_status: + description: The status of the product documentation in the KnowledgeBase. + example: complete + type: string + security_labs_exists: + description: Indicates if Security Labs documentation exists in the KnowledgeBase. + example: true + type: boolean + user_data_exists: + description: Indicates if user data exists in the KnowledgeBase. + example: false + type: boolean Security_AI_Assistant_API_KnowledgeBaseResource: description: Knowledge Base resource name for grouping entries, e.g. 'security_labs', 'user', etc. enum: @@ -76923,6 +77016,21 @@ components: description: Identify the success of the method execution. example: true type: boolean + Security_AI_Assistant_API_KnowledgeBaseResponse400: + type: object + properties: + error: + description: A short description of the error. + example: Bad Request + type: string + message: + description: A detailed error message. + example: Invalid resource ID provided. + type: string + statusCode: + description: The HTTP status code of the error. + example: 400 + type: number Security_AI_Assistant_API_Message: description: AI assistant conversation message. type: object diff --git a/oas_docs/output/kibana.yaml b/oas_docs/output/kibana.yaml index ddcf792f4b1ec..9c0829c14d67e 100644 --- a/oas_docs/output/kibana.yaml +++ b/oas_docs/output/kibana.yaml @@ -57304,6 +57304,100 @@ paths: x-metaTags: - content: Kibana name: product_name + /api/security_ai_assistant/knowledge_base: + get: + description: |- + **Spaces method and path for this operation:** + +
get /s/{space_id}/api/security_ai_assistant/knowledge_base
+ + Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information. + + Read a single KB + operationId: GetKnowledgeBase + responses: + '200': + content: + application/json: + examples: + KnowledgeBaseReadResponse200Example2: + summary: A response that returns information about the knowledge base. + value: + defend_insights_exists: true + elser_exists: false + is_setup_available: true + is_setup_in_progress: true + product_documentation_status: installed + security_labs_exists: false + user_data_exists: true + schema: + $ref: '#/components/schemas/Security_AI_Assistant_API_KnowledgeBaseReadResponse200' + description: Indicates a successful call. + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/Security_AI_Assistant_API_KnowledgeBaseResponse400' + description: Generic Error + summary: Read a KnowledgeBase + tags: + - Security AI Assistant API + x-metaTags: + - content: Kibana + name: product_name + post: + operationId: PostKnowledgeBase + parameters: + - description: ELSER modelId to use when setting up the Knowledge Base. If not provided, a default model will be used. + example: elser-model-001 + in: query + name: modelId + required: false + schema: + type: string + - description: Indicates whether we should or should not install Security Labs docs when setting up the Knowledge Base. Defaults to `false`. + example: true + in: query + name: ignoreSecurityLabs + required: false + schema: + default: false + type: boolean + responses: + '200': + content: + application/json: + examples: + KnowledgeBaseResponse200Example2: + summary: A response that indicates that the request was successful. + value: + success: true + schema: + $ref: '#/components/schemas/Security_AI_Assistant_API_KnowledgeBaseResponse' + description: Indicates a successful call. + '400': + content: + application/json: + examples: + KnowledgeBaseResponse400Example2: + summary: A response for a request that failed due to an invalid query parameter value. + value: | + statusCode: 400 error: Bad Request message: "[request query]: ignoreSecurityLabs: Invalid enum value. Expected 'true' | 'false', received 'yes', ignoreSecurityLabs: Expected boolean, received string" + schema: + $ref: '#/components/schemas/Security_AI_Assistant_API_KnowledgeBaseResponse400' + description: Generic Error + summary: Create a KnowledgeBase + tags: + - Security AI Assistant API + x-metaTags: + - content: Kibana + name: product_name + description: |- + **Spaces method and path for this operation:** + +
post /s/{space_id}/api/security_ai_assistant/knowledge_base
+ + Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information. /api/security_ai_assistant/knowledge_base/{resource}: get: description: |- @@ -57313,71 +57407,41 @@ paths: Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information. - Read a single KB + Read a knowledge base with a specific resource identifier. operationId: ReadKnowledgeBase parameters: - description: The KnowledgeBase `resource` value. example: kb12345 in: path name: resource + required: true schema: type: string responses: '200': content: application/json: - schema: - type: object - properties: - defend_insights_exists: - description: Indicates if Defend Insights documentation exists in the KnowledgeBase. - example: true - type: boolean - elser_exists: - description: Indicates if the ELSER model exists for the KnowledgeBase. - example: true - type: boolean - is_setup_available: - description: Indicates if the setup process is available for the KnowledgeBase. - example: true - type: boolean - is_setup_in_progress: - description: Indicates if the setup process is currently in progress. - example: false - type: boolean - product_documentation_status: - description: The status of the product documentation in the KnowledgeBase. - example: complete - type: string - security_labs_exists: - description: Indicates if Security Labs documentation exists in the KnowledgeBase. - example: true - type: boolean - user_data_exists: - description: Indicates if user data exists in the KnowledgeBase. - example: false - type: boolean + examples: + KnowledgeBaseReadResponse200Example1: + summary: A response that returns information about the knowledge base. + value: + defend_insights_exists: true + elser_exists: false + is_setup_available: true + is_setup_in_progress: true + product_documentation_status: installed + security_labs_exists: false + user_data_exists: true + schema: + $ref: '#/components/schemas/Security_AI_Assistant_API_KnowledgeBaseReadResponse200' description: Indicates a successful call. '400': content: application/json: schema: - type: object - properties: - error: - description: A short description of the error. - example: Bad Request - type: string - message: - description: A detailed error message. - example: Invalid resource ID provided. - type: string - statusCode: - description: The HTTP status code of the error. - example: 400 - type: number + $ref: '#/components/schemas/Security_AI_Assistant_API_KnowledgeBaseResponse400' description: Generic Error - summary: Read a KnowledgeBase + summary: Read a KnowledgeBase for a resource tags: - Security AI Assistant API x-metaTags: @@ -57391,13 +57455,14 @@ paths: Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information. - Create a KnowledgeBase + Create a knowledge base with a specific resource identifier. operationId: CreateKnowledgeBase parameters: - description: The KnowledgeBase `resource` value. example: kb12345 in: path name: resource + required: true schema: type: string - description: ELSER modelId to use when setting up the Knowledge Base. If not provided, a default model will be used. @@ -57419,29 +57484,26 @@ paths: '200': content: application/json: + examples: + KnowledgeBaseResponse200Example1: + summary: A response that indicates that the request was successful. + value: + success: true schema: $ref: '#/components/schemas/Security_AI_Assistant_API_KnowledgeBaseResponse' description: Indicates a successful call. '400': content: application/json: + examples: + KnowledgeBaseResponse400Example1: + summary: A response for a request that failed due to an invalid query parameter value. + value: | + statusCode: 400 error: Bad Request message: "[request query]: ignoreSecurityLabs: Invalid enum value. Expected 'true' | 'false', received 'yes', ignoreSecurityLabs: Expected boolean, received string" schema: - type: object - properties: - error: - description: A short description of the error. - example: Bad Request - type: string - message: - description: A detailed error message. - example: Invalid resource ID provided. - type: string - statusCode: - description: The HTTP status code of the error. - example: 400 - type: number + $ref: '#/components/schemas/Security_AI_Assistant_API_KnowledgeBaseResponse400' description: Generic Error - summary: Create a KnowledgeBase + summary: Create a KnowledgeBase for a resource tags: - Security AI Assistant API x-metaTags: @@ -87398,6 +87460,37 @@ components: - $ref: '#/components/schemas/Security_AI_Assistant_API_IndexEntryCreateFields' discriminator: propertyName: type + Security_AI_Assistant_API_KnowledgeBaseReadResponse200: + type: object + properties: + defend_insights_exists: + description: Indicates if Defend Insights documentation exists in the KnowledgeBase. + example: true + type: boolean + elser_exists: + description: Indicates if the ELSER model exists for the KnowledgeBase. + example: true + type: boolean + is_setup_available: + description: Indicates if the setup process is available for the KnowledgeBase. + example: true + type: boolean + is_setup_in_progress: + description: Indicates if the setup process is currently in progress. + example: false + type: boolean + product_documentation_status: + description: The status of the product documentation in the KnowledgeBase. + example: complete + type: string + security_labs_exists: + description: Indicates if Security Labs documentation exists in the KnowledgeBase. + example: true + type: boolean + user_data_exists: + description: Indicates if user data exists in the KnowledgeBase. + example: false + type: boolean Security_AI_Assistant_API_KnowledgeBaseResource: description: Knowledge Base resource name for grouping entries, e.g. 'security_labs', 'user', etc. enum: @@ -87414,6 +87507,21 @@ components: description: Identify the success of the method execution. example: true type: boolean + Security_AI_Assistant_API_KnowledgeBaseResponse400: + type: object + properties: + error: + description: A short description of the error. + example: Bad Request + type: string + message: + description: A detailed error message. + example: Invalid resource ID provided. + type: string + statusCode: + description: The HTTP status code of the error. + example: 400 + type: number Security_AI_Assistant_API_Message: description: AI assistant conversation message. type: object diff --git a/src/platform/packages/private/kbn-validate-oas/src/oas_error_baseline.json b/src/platform/packages/private/kbn-validate-oas/src/oas_error_baseline.json index 3da7af58e55dd..0e0cc0871491d 100644 --- a/src/platform/packages/private/kbn-validate-oas/src/oas_error_baseline.json +++ b/src/platform/packages/private/kbn-validate-oas/src/oas_error_baseline.json @@ -1,4 +1,4 @@ { - "./oas_docs/output/kibana.yaml": 1286, - "./oas_docs/output/kibana.serverless.yaml": 1174 + "./oas_docs/output/kibana.yaml": 1276, + "./oas_docs/output/kibana.serverless.yaml": 1164 } \ No newline at end of file diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant-common/docs/openapi/ess/elastic_assistant_api_2023_10_31.bundled.schema.yaml b/x-pack/platform/packages/shared/kbn-elastic-assistant-common/docs/openapi/ess/elastic_assistant_api_2023_10_31.bundled.schema.yaml index 308bca674c520..ee247893af5c1 100644 --- a/x-pack/platform/packages/shared/kbn-elastic-assistant-common/docs/openapi/ess/elastic_assistant_api_2023_10_31.bundled.schema.yaml +++ b/x-pack/platform/packages/shared/kbn-elastic-assistant-common/docs/openapi/ess/elastic_assistant_api_2023_10_31.bundled.schema.yaml @@ -856,92 +856,145 @@ paths: tags: - Security AI Assistant API - Conversation API - /api/security_ai_assistant/knowledge_base/{resource}: + /api/security_ai_assistant/knowledge_base: get: description: Read a single KB + operationId: GetKnowledgeBase + responses: + '200': + content: + application/json: + examples: + KnowledgeBaseReadResponse200Example2: + summary: >- + A response that returns information about the knowledge + base. + value: + defend_insights_exists: true + elser_exists: false + is_setup_available: true + is_setup_in_progress: true + product_documentation_status: installed + security_labs_exists: false + user_data_exists: true + schema: + $ref: '#/components/schemas/KnowledgeBaseReadResponse200' + description: Indicates a successful call. + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/KnowledgeBaseResponse400' + description: Generic Error + summary: Read a KnowledgeBase + tags: + - Security AI Assistant API + - KnowledgeBase API + post: + operationId: PostKnowledgeBase + parameters: + - description: >- + ELSER modelId to use when setting up the Knowledge Base. If not + provided, a default model will be used. + example: elser-model-001 + in: query + name: modelId + required: false + schema: + type: string + - description: >- + Indicates whether we should or should not install Security Labs docs + when setting up the Knowledge Base. Defaults to `false`. + example: true + in: query + name: ignoreSecurityLabs + required: false + schema: + default: false + type: boolean + responses: + '200': + content: + application/json: + examples: + KnowledgeBaseResponse200Example2: + summary: A response that indicates that the request was successful. + value: + success: true + schema: + $ref: '#/components/schemas/KnowledgeBaseResponse' + description: Indicates a successful call. + '400': + content: + application/json: + examples: + KnowledgeBaseResponse400Example2: + summary: >- + A response for a request that failed due to an invalid query + parameter value. + value: > + statusCode: 400 error: Bad Request message: "[request + query]: ignoreSecurityLabs: Invalid enum value. Expected + 'true' | 'false', received 'yes', ignoreSecurityLabs: + Expected boolean, received string" + schema: + $ref: '#/components/schemas/KnowledgeBaseResponse400' + description: Generic Error + summary: Create a KnowledgeBase + tags: + - Security AI Assistant API + - KnowledgeBase API + /api/security_ai_assistant/knowledge_base/{resource}: + get: + description: Read a knowledge base with a specific resource identifier. operationId: ReadKnowledgeBase parameters: - description: The KnowledgeBase `resource` value. example: kb12345 in: path name: resource + required: true schema: type: string responses: '200': content: application/json: + examples: + KnowledgeBaseReadResponse200Example1: + summary: >- + A response that returns information about the knowledge + base. + value: + defend_insights_exists: true + elser_exists: false + is_setup_available: true + is_setup_in_progress: true + product_documentation_status: installed + security_labs_exists: false + user_data_exists: true schema: - type: object - properties: - defend_insights_exists: - description: >- - Indicates if Defend Insights documentation exists in the - KnowledgeBase. - example: true - type: boolean - elser_exists: - description: Indicates if the ELSER model exists for the KnowledgeBase. - example: true - type: boolean - is_setup_available: - description: >- - Indicates if the setup process is available for the - KnowledgeBase. - example: true - type: boolean - is_setup_in_progress: - description: Indicates if the setup process is currently in progress. - example: false - type: boolean - product_documentation_status: - description: >- - The status of the product documentation in the - KnowledgeBase. - example: complete - type: string - security_labs_exists: - description: >- - Indicates if Security Labs documentation exists in the - KnowledgeBase. - example: true - type: boolean - user_data_exists: - description: Indicates if user data exists in the KnowledgeBase. - example: false - type: boolean + $ref: '#/components/schemas/KnowledgeBaseReadResponse200' description: Indicates a successful call. '400': content: application/json: schema: - type: object - properties: - error: - description: A short description of the error. - example: Bad Request - type: string - message: - description: A detailed error message. - example: Invalid resource ID provided. - type: string - statusCode: - description: The HTTP status code of the error. - example: 400 - type: number + $ref: '#/components/schemas/KnowledgeBaseResponse400' description: Generic Error - summary: Read a KnowledgeBase + summary: Read a KnowledgeBase for a resource tags: - Security AI Assistant API - KnowledgeBase API post: - description: Create a KnowledgeBase + description: Create a knowledge base with a specific resource identifier. operationId: CreateKnowledgeBase parameters: - description: The KnowledgeBase `resource` value. example: kb12345 in: path name: resource + required: true schema: type: string - description: >- @@ -967,29 +1020,31 @@ paths: '200': content: application/json: + examples: + KnowledgeBaseResponse200Example1: + summary: A response that indicates that the request was successful. + value: + success: true schema: $ref: '#/components/schemas/KnowledgeBaseResponse' description: Indicates a successful call. '400': content: application/json: + examples: + KnowledgeBaseResponse400Example1: + summary: >- + A response for a request that failed due to an invalid query + parameter value. + value: > + statusCode: 400 error: Bad Request message: "[request + query]: ignoreSecurityLabs: Invalid enum value. Expected + 'true' | 'false', received 'yes', ignoreSecurityLabs: + Expected boolean, received string" schema: - type: object - properties: - error: - description: A short description of the error. - example: Bad Request - type: string - message: - description: A detailed error message. - example: Invalid resource ID provided. - type: string - statusCode: - description: The HTTP status code of the error. - example: 400 - type: number + $ref: '#/components/schemas/KnowledgeBaseResponse400' description: Generic Error - summary: Create a KnowledgeBase + summary: Create a KnowledgeBase for a resource tags: - Security AI Assistant API - KnowledgeBase API @@ -2781,6 +2836,41 @@ components: - $ref: '#/components/schemas/IndexEntryCreateFields' discriminator: propertyName: type + KnowledgeBaseReadResponse200: + type: object + properties: + defend_insights_exists: + description: >- + Indicates if Defend Insights documentation exists in the + KnowledgeBase. + example: true + type: boolean + elser_exists: + description: Indicates if the ELSER model exists for the KnowledgeBase. + example: true + type: boolean + is_setup_available: + description: Indicates if the setup process is available for the KnowledgeBase. + example: true + type: boolean + is_setup_in_progress: + description: Indicates if the setup process is currently in progress. + example: false + type: boolean + product_documentation_status: + description: The status of the product documentation in the KnowledgeBase. + example: complete + type: string + security_labs_exists: + description: >- + Indicates if Security Labs documentation exists in the + KnowledgeBase. + example: true + type: boolean + user_data_exists: + description: Indicates if user data exists in the KnowledgeBase. + example: false + type: boolean KnowledgeBaseResource: description: >- Knowledge Base resource name for grouping entries, e.g. 'security_labs', @@ -2799,6 +2889,21 @@ components: description: Identify the success of the method execution. example: true type: boolean + KnowledgeBaseResponse400: + type: object + properties: + error: + description: A short description of the error. + example: Bad Request + type: string + message: + description: A detailed error message. + example: Invalid resource ID provided. + type: string + statusCode: + description: The HTTP status code of the error. + example: 400 + type: number Message: description: AI assistant conversation message. type: object diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant-common/docs/openapi/serverless/elastic_assistant_api_2023_10_31.bundled.schema.yaml b/x-pack/platform/packages/shared/kbn-elastic-assistant-common/docs/openapi/serverless/elastic_assistant_api_2023_10_31.bundled.schema.yaml index 8a02c80a4c127..4685dc7405e78 100644 --- a/x-pack/platform/packages/shared/kbn-elastic-assistant-common/docs/openapi/serverless/elastic_assistant_api_2023_10_31.bundled.schema.yaml +++ b/x-pack/platform/packages/shared/kbn-elastic-assistant-common/docs/openapi/serverless/elastic_assistant_api_2023_10_31.bundled.schema.yaml @@ -856,92 +856,145 @@ paths: tags: - Security AI Assistant API - Conversation API - /api/security_ai_assistant/knowledge_base/{resource}: + /api/security_ai_assistant/knowledge_base: get: description: Read a single KB + operationId: GetKnowledgeBase + responses: + '200': + content: + application/json: + examples: + KnowledgeBaseReadResponse200Example2: + summary: >- + A response that returns information about the knowledge + base. + value: + defend_insights_exists: true + elser_exists: false + is_setup_available: true + is_setup_in_progress: true + product_documentation_status: installed + security_labs_exists: false + user_data_exists: true + schema: + $ref: '#/components/schemas/KnowledgeBaseReadResponse200' + description: Indicates a successful call. + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/KnowledgeBaseResponse400' + description: Generic Error + summary: Read a KnowledgeBase + tags: + - Security AI Assistant API + - KnowledgeBase API + post: + operationId: PostKnowledgeBase + parameters: + - description: >- + ELSER modelId to use when setting up the Knowledge Base. If not + provided, a default model will be used. + example: elser-model-001 + in: query + name: modelId + required: false + schema: + type: string + - description: >- + Indicates whether we should or should not install Security Labs docs + when setting up the Knowledge Base. Defaults to `false`. + example: true + in: query + name: ignoreSecurityLabs + required: false + schema: + default: false + type: boolean + responses: + '200': + content: + application/json: + examples: + KnowledgeBaseResponse200Example2: + summary: A response that indicates that the request was successful. + value: + success: true + schema: + $ref: '#/components/schemas/KnowledgeBaseResponse' + description: Indicates a successful call. + '400': + content: + application/json: + examples: + KnowledgeBaseResponse400Example2: + summary: >- + A response for a request that failed due to an invalid query + parameter value. + value: > + statusCode: 400 error: Bad Request message: "[request + query]: ignoreSecurityLabs: Invalid enum value. Expected + 'true' | 'false', received 'yes', ignoreSecurityLabs: + Expected boolean, received string" + schema: + $ref: '#/components/schemas/KnowledgeBaseResponse400' + description: Generic Error + summary: Create a KnowledgeBase + tags: + - Security AI Assistant API + - KnowledgeBase API + /api/security_ai_assistant/knowledge_base/{resource}: + get: + description: Read a knowledge base with a specific resource identifier. operationId: ReadKnowledgeBase parameters: - description: The KnowledgeBase `resource` value. example: kb12345 in: path name: resource + required: true schema: type: string responses: '200': content: application/json: + examples: + KnowledgeBaseReadResponse200Example1: + summary: >- + A response that returns information about the knowledge + base. + value: + defend_insights_exists: true + elser_exists: false + is_setup_available: true + is_setup_in_progress: true + product_documentation_status: installed + security_labs_exists: false + user_data_exists: true schema: - type: object - properties: - defend_insights_exists: - description: >- - Indicates if Defend Insights documentation exists in the - KnowledgeBase. - example: true - type: boolean - elser_exists: - description: Indicates if the ELSER model exists for the KnowledgeBase. - example: true - type: boolean - is_setup_available: - description: >- - Indicates if the setup process is available for the - KnowledgeBase. - example: true - type: boolean - is_setup_in_progress: - description: Indicates if the setup process is currently in progress. - example: false - type: boolean - product_documentation_status: - description: >- - The status of the product documentation in the - KnowledgeBase. - example: complete - type: string - security_labs_exists: - description: >- - Indicates if Security Labs documentation exists in the - KnowledgeBase. - example: true - type: boolean - user_data_exists: - description: Indicates if user data exists in the KnowledgeBase. - example: false - type: boolean + $ref: '#/components/schemas/KnowledgeBaseReadResponse200' description: Indicates a successful call. '400': content: application/json: schema: - type: object - properties: - error: - description: A short description of the error. - example: Bad Request - type: string - message: - description: A detailed error message. - example: Invalid resource ID provided. - type: string - statusCode: - description: The HTTP status code of the error. - example: 400 - type: number + $ref: '#/components/schemas/KnowledgeBaseResponse400' description: Generic Error - summary: Read a KnowledgeBase + summary: Read a KnowledgeBase for a resource tags: - Security AI Assistant API - KnowledgeBase API post: - description: Create a KnowledgeBase + description: Create a knowledge base with a specific resource identifier. operationId: CreateKnowledgeBase parameters: - description: The KnowledgeBase `resource` value. example: kb12345 in: path name: resource + required: true schema: type: string - description: >- @@ -967,29 +1020,31 @@ paths: '200': content: application/json: + examples: + KnowledgeBaseResponse200Example1: + summary: A response that indicates that the request was successful. + value: + success: true schema: $ref: '#/components/schemas/KnowledgeBaseResponse' description: Indicates a successful call. '400': content: application/json: + examples: + KnowledgeBaseResponse400Example1: + summary: >- + A response for a request that failed due to an invalid query + parameter value. + value: > + statusCode: 400 error: Bad Request message: "[request + query]: ignoreSecurityLabs: Invalid enum value. Expected + 'true' | 'false', received 'yes', ignoreSecurityLabs: + Expected boolean, received string" schema: - type: object - properties: - error: - description: A short description of the error. - example: Bad Request - type: string - message: - description: A detailed error message. - example: Invalid resource ID provided. - type: string - statusCode: - description: The HTTP status code of the error. - example: 400 - type: number + $ref: '#/components/schemas/KnowledgeBaseResponse400' description: Generic Error - summary: Create a KnowledgeBase + summary: Create a KnowledgeBase for a resource tags: - Security AI Assistant API - KnowledgeBase API @@ -2781,6 +2836,41 @@ components: - $ref: '#/components/schemas/IndexEntryCreateFields' discriminator: propertyName: type + KnowledgeBaseReadResponse200: + type: object + properties: + defend_insights_exists: + description: >- + Indicates if Defend Insights documentation exists in the + KnowledgeBase. + example: true + type: boolean + elser_exists: + description: Indicates if the ELSER model exists for the KnowledgeBase. + example: true + type: boolean + is_setup_available: + description: Indicates if the setup process is available for the KnowledgeBase. + example: true + type: boolean + is_setup_in_progress: + description: Indicates if the setup process is currently in progress. + example: false + type: boolean + product_documentation_status: + description: The status of the product documentation in the KnowledgeBase. + example: complete + type: string + security_labs_exists: + description: >- + Indicates if Security Labs documentation exists in the + KnowledgeBase. + example: true + type: boolean + user_data_exists: + description: Indicates if user data exists in the KnowledgeBase. + example: false + type: boolean KnowledgeBaseResource: description: >- Knowledge Base resource name for grouping entries, e.g. 'security_labs', @@ -2799,6 +2889,21 @@ components: description: Identify the success of the method execution. example: true type: boolean + KnowledgeBaseResponse400: + type: object + properties: + error: + description: A short description of the error. + example: Bad Request + type: string + message: + description: A detailed error message. + example: Invalid resource ID provided. + type: string + statusCode: + description: The HTTP status code of the error. + example: 400 + type: number Message: description: AI assistant conversation message. type: object diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant-common/impl/schemas/index.ts b/x-pack/platform/packages/shared/kbn-elastic-assistant-common/impl/schemas/index.ts index 78c996d16cdcb..d3403aada559a 100644 --- a/x-pack/platform/packages/shared/kbn-elastic-assistant-common/impl/schemas/index.ts +++ b/x-pack/platform/packages/shared/kbn-elastic-assistant-common/impl/schemas/index.ts @@ -116,11 +116,26 @@ export * from './conversations/find_conversations_route.gen'; export * from './actions_connector/post_actions_connector_execute_route.gen'; // Knowledge Base Schemas +import type { z } from '@kbn/zod'; +import { + CreateKnowledgeBaseRequestParams as CreateKnowledgeBaseRequestParamsBase, + ReadKnowledgeBaseRequestParams as ReadKnowledgeBaseRequestParamsBase, +} from './knowledge_base/crud_kb_route.gen'; export * from './knowledge_base/crud_kb_route.gen'; export * from './knowledge_base/entries/bulk_crud_knowledge_base_entries_route.gen'; export * from './knowledge_base/entries/common_attributes.gen'; export * from './knowledge_base/entries/crud_knowledge_base_entries_route.gen'; export * from './knowledge_base/entries/find_knowledge_base_entries_route.gen'; +// OAS does not support optional path parameters, so we override the generated schema +export const CreateKnowledgeBaseRequestParams = CreateKnowledgeBaseRequestParamsBase.extend({ + resource: CreateKnowledgeBaseRequestParamsBase.shape.resource.optional(), +}); +export type CreateKnowledgeBaseRequestParams = z.infer; + +export const ReadKnowledgeBaseRequestParams = ReadKnowledgeBaseRequestParamsBase.extend({ + resource: ReadKnowledgeBaseRequestParamsBase.shape.resource.optional(), +}); +export type ReadKnowledgeBaseRequestParams = z.infer; export * from './anonymization_fields/bulk_crud_anonymization_fields_route.gen'; export * from './anonymization_fields/find_anonymization_fields_route.gen'; diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_kb_route.gen.ts b/x-pack/platform/packages/shared/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_kb_route.gen.ts index bd29fe6fb26a6..3457ccbb0f0d5 100644 --- a/x-pack/platform/packages/shared/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_kb_route.gen.ts +++ b/x-pack/platform/packages/shared/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_kb_route.gen.ts @@ -28,44 +28,24 @@ export const KnowledgeBaseResponse = z.object({ success: z.boolean().optional(), }); -export type CreateKnowledgeBaseRequestQuery = z.infer; -export const CreateKnowledgeBaseRequestQuery = z.object({ +export type KnowledgeBaseResponse400 = z.infer; +export const KnowledgeBaseResponse400 = z.object({ /** - * ELSER modelId to use when setting up the Knowledge Base. If not provided, a default model will be used. + * The HTTP status code of the error. */ - modelId: z.string().optional(), + statusCode: z.number().optional(), /** - * Indicates whether we should or should not install Security Labs docs when setting up the Knowledge Base. Defaults to `false`. + * A short description of the error. */ - ignoreSecurityLabs: BooleanFromString.optional().default(false), -}); -export type CreateKnowledgeBaseRequestQueryInput = z.input; - -export type CreateKnowledgeBaseRequestParams = z.infer; -export const CreateKnowledgeBaseRequestParams = z.object({ + error: z.string().optional(), /** - * The KnowledgeBase `resource` value. + * A detailed error message. */ - resource: z.string().optional(), + message: z.string().optional(), }); -export type CreateKnowledgeBaseRequestParamsInput = z.input< - typeof CreateKnowledgeBaseRequestParams ->; -export type CreateKnowledgeBaseResponse = z.infer; -export const CreateKnowledgeBaseResponse = KnowledgeBaseResponse; - -export type ReadKnowledgeBaseRequestParams = z.infer; -export const ReadKnowledgeBaseRequestParams = z.object({ - /** - * The KnowledgeBase `resource` value. - */ - resource: z.string().optional(), -}); -export type ReadKnowledgeBaseRequestParamsInput = z.input; - -export type ReadKnowledgeBaseResponse = z.infer; -export const ReadKnowledgeBaseResponse = z.object({ +export type KnowledgeBaseReadResponse200 = z.infer; +export const KnowledgeBaseReadResponse200 = z.object({ /** * Indicates if the ELSER model exists for the KnowledgeBase. */ @@ -95,3 +75,60 @@ export const ReadKnowledgeBaseResponse = z.object({ */ product_documentation_status: z.string().optional(), }); + +export type CreateKnowledgeBaseRequestQuery = z.infer; +export const CreateKnowledgeBaseRequestQuery = z.object({ + /** + * ELSER modelId to use when setting up the Knowledge Base. If not provided, a default model will be used. + */ + modelId: z.string().optional(), + /** + * Indicates whether we should or should not install Security Labs docs when setting up the Knowledge Base. Defaults to `false`. + */ + ignoreSecurityLabs: BooleanFromString.optional().default(false), +}); +export type CreateKnowledgeBaseRequestQueryInput = z.input; + +export type CreateKnowledgeBaseRequestParams = z.infer; +export const CreateKnowledgeBaseRequestParams = z.object({ + /** + * The KnowledgeBase `resource` value. + */ + resource: z.string(), +}); +export type CreateKnowledgeBaseRequestParamsInput = z.input< + typeof CreateKnowledgeBaseRequestParams +>; + +export type CreateKnowledgeBaseResponse = z.infer; +export const CreateKnowledgeBaseResponse = KnowledgeBaseResponse; + +export type GetKnowledgeBaseResponse = z.infer; +export const GetKnowledgeBaseResponse = KnowledgeBaseReadResponse200; +export type PostKnowledgeBaseRequestQuery = z.infer; +export const PostKnowledgeBaseRequestQuery = z.object({ + /** + * ELSER modelId to use when setting up the Knowledge Base. If not provided, a default model will be used. + */ + modelId: z.string().optional(), + /** + * Indicates whether we should or should not install Security Labs docs when setting up the Knowledge Base. Defaults to `false`. + */ + ignoreSecurityLabs: BooleanFromString.optional().default(false), +}); +export type PostKnowledgeBaseRequestQueryInput = z.input; + +export type PostKnowledgeBaseResponse = z.infer; +export const PostKnowledgeBaseResponse = KnowledgeBaseResponse; + +export type ReadKnowledgeBaseRequestParams = z.infer; +export const ReadKnowledgeBaseRequestParams = z.object({ + /** + * The KnowledgeBase `resource` value. + */ + resource: z.string(), +}); +export type ReadKnowledgeBaseRequestParamsInput = z.input; + +export type ReadKnowledgeBaseResponse = z.infer; +export const ReadKnowledgeBaseResponse = KnowledgeBaseReadResponse200; diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_kb_route.schema.yaml b/x-pack/platform/packages/shared/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_kb_route.schema.yaml index 58747c45f8679..9ee3d52b1a064 100644 --- a/x-pack/platform/packages/shared/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_kb_route.schema.yaml +++ b/x-pack/platform/packages/shared/kbn-elastic-assistant-common/impl/schemas/knowledge_base/crud_kb_route.schema.yaml @@ -8,8 +8,8 @@ paths: x-codegen-enabled: true x-labels: [ess, serverless] operationId: CreateKnowledgeBase - summary: Create a KnowledgeBase - description: Create a KnowledgeBase + summary: Create a KnowledgeBase for a resource + description: Create a knowledge base with a specific resource identifier. tags: - KnowledgeBase API parameters: @@ -19,6 +19,7 @@ paths: schema: type: string example: "kb12345" + required: true - name: modelId in: query description: ELSER modelId to use when setting up the Knowledge Base. If not provided, a default model will be used. @@ -41,31 +42,30 @@ paths: application/json: schema: $ref: '#/components/schemas/KnowledgeBaseResponse' + examples: + KnowledgeBaseResponse200Example1: + summary: A response that indicates that the request was successful. + value: + success: true 400: description: Generic Error content: application/json: schema: - type: object - properties: - statusCode: - type: number - description: The HTTP status code of the error. - example: 400 - error: - type: string - description: A short description of the error. - example: "Bad Request" - message: - type: string - description: A detailed error message. - example: "Invalid resource ID provided." + $ref: '#/components/schemas/KnowledgeBaseResponse400' + examples: + KnowledgeBaseResponse400Example1: + summary: A response for a request that failed due to an invalid query parameter value. + value: > + statusCode: 400 + error: Bad Request + message: "[request query]: ignoreSecurityLabs: Invalid enum value. Expected 'true' | 'false', received 'yes', ignoreSecurityLabs: Expected boolean, received string" get: x-codegen-enabled: true x-labels: [ess, serverless] operationId: ReadKnowledgeBase - description: Read a single KB - summary: Read a KnowledgeBase + description: Read a knowledge base with a specific resource identifier. + summary: Read a KnowledgeBase for a resource tags: - KnowledgeBase API parameters: @@ -75,62 +75,113 @@ paths: schema: type: string example: "kb12345" + required: true responses: 200: description: Indicates a successful call. content: application/json: schema: - type: object - properties: - elser_exists: - type: boolean - description: Indicates if the ELSER model exists for the KnowledgeBase. - example: true - is_setup_available: - type: boolean - description: Indicates if the setup process is available for the KnowledgeBase. - example: true - is_setup_in_progress: - type: boolean - description: Indicates if the setup process is currently in progress. - example: false - security_labs_exists: - type: boolean - description: Indicates if Security Labs documentation exists in the KnowledgeBase. - example: true - defend_insights_exists: - type: boolean - description: Indicates if Defend Insights documentation exists in the KnowledgeBase. - example: true - user_data_exists: - type: boolean - description: Indicates if user data exists in the KnowledgeBase. - example: false - product_documentation_status: - type: string - description: The status of the product documentation in the KnowledgeBase. - example: "complete" + $ref: '#/components/schemas/KnowledgeBaseReadResponse200' + examples: + KnowledgeBaseReadResponse200Example1: + summary: A response that returns information about the knowledge base. + value: + elser_exists: false + is_setup_in_progress: true + is_setup_available: true + security_labs_exists: false + defend_insights_exists: true + user_data_exists: true + product_documentation_status: installed 400: description: Generic Error content: application/json: schema: - type: object - properties: - statusCode: - type: number - description: The HTTP status code of the error. - example: 400 - error: - type: string - description: A short description of the error. - example: "Bad Request" - message: - type: string - description: A detailed error message. - example: "Invalid resource ID provided." - + $ref: '#/components/schemas/KnowledgeBaseResponse400' + /api/security_ai_assistant/knowledge_base: + post: + x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: PostKnowledgeBase + summary: Create a KnowledgeBase + # description: + tags: + - KnowledgeBase API + parameters: + - name: modelId + in: query + description: ELSER modelId to use when setting up the Knowledge Base. If not provided, a default model will be used. + required: false + schema: + type: string + example: "elser-model-001" + - name: ignoreSecurityLabs + in: query + description: Indicates whether we should or should not install Security Labs docs when setting up the Knowledge Base. Defaults to `false`. + required: false + schema: + type: boolean + default: false + example: true + responses: + 200: + description: Indicates a successful call. + content: + application/json: + schema: + $ref: '#/components/schemas/KnowledgeBaseResponse' + examples: + KnowledgeBaseResponse200Example2: + summary: A response that indicates that the request was successful. + value: + success: true + 400: + description: Generic Error + content: + application/json: + schema: + $ref: '#/components/schemas/KnowledgeBaseResponse400' + examples: + KnowledgeBaseResponse400Example2: + summary: A response for a request that failed due to an invalid query parameter value. + value: > + statusCode: 400 + error: Bad Request + message: "[request query]: ignoreSecurityLabs: Invalid enum value. Expected 'true' | 'false', received 'yes', ignoreSecurityLabs: Expected boolean, received string" + get: + x-codegen-enabled: true + x-labels: [ess, serverless] + operationId: GetKnowledgeBase + description: Read a single KB + summary: Read a KnowledgeBase + tags: + - KnowledgeBase API + responses: + 200: + description: Indicates a successful call. + content: + application/json: + schema: + $ref: '#/components/schemas/KnowledgeBaseReadResponse200' + examples: + KnowledgeBaseReadResponse200Example2: + summary: A response that returns information about the knowledge base. + value: + elser_exists: false + is_setup_in_progress: true + is_setup_available: true + security_labs_exists: false + defend_insights_exists: true + user_data_exists: true + product_documentation_status: installed + 400: + description: Generic Error + content: + application/json: + schema: + $ref: '#/components/schemas/KnowledgeBaseResponse400' components: schemas: KnowledgeBaseResponse: @@ -141,3 +192,50 @@ components: type: boolean description: Identify the success of the method execution. example: true + KnowledgeBaseResponse400: + type: object + properties: + statusCode: + type: number + description: The HTTP status code of the error. + example: 400 + error: + type: string + description: A short description of the error. + example: "Bad Request" + message: + type: string + description: A detailed error message. + example: "Invalid resource ID provided." + KnowledgeBaseReadResponse200: + type: object + properties: + elser_exists: + type: boolean + description: Indicates if the ELSER model exists for the KnowledgeBase. + example: true + is_setup_available: + type: boolean + description: Indicates if the setup process is available for the KnowledgeBase. + example: true + is_setup_in_progress: + type: boolean + description: Indicates if the setup process is currently in progress. + example: false + security_labs_exists: + type: boolean + description: Indicates if Security Labs documentation exists in the KnowledgeBase. + example: true + defend_insights_exists: + type: boolean + description: Indicates if Defend Insights documentation exists in the KnowledgeBase. + example: true + user_data_exists: + type: boolean + description: Indicates if user data exists in the KnowledgeBase. + example: false + product_documentation_status: + type: string + description: The status of the product documentation in the KnowledgeBase. + example: "complete" +