mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
# Backport This will backport the following commits from `main` to `8.11`: - [[Security solution] AI connector changes (#170150)](https://github.com/elastic/kibana/pull/170150) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Steph Milovic","email":"stephanie.milovic@elastic.co"},"sourceCommit":{"committedDate":"2023-10-30T22:31:47Z","message":"[Security solution] AI connector changes (#170150)","sha":"75586c8233ff83ab0df403d13d5a674c216d0271","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Threat Hunting","Team: SecuritySolution","Team:Threat Hunting:Explore","v8.11.0","v8.12.0"],"number":170150,"url":"https://github.com/elastic/kibana/pull/170150","mergeCommit":{"message":"[Security solution] AI connector changes (#170150)","sha":"75586c8233ff83ab0df403d13d5a674c216d0271"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/170150","number":170150,"mergeCommit":{"message":"[Security solution] AI connector changes (#170150)","sha":"75586c8233ff83ab0df403d13d5a674c216d0271"}}]}] BACKPORT--> Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
This commit is contained in:
parent
2e0caad089
commit
7cbcc53064
3 changed files with 11 additions and 0 deletions
|
@ -93,6 +93,8 @@ export class BedrockConnector extends SubActionConnector<Config, Secrets> {
|
|||
},
|
||||
body,
|
||||
path,
|
||||
// Despite AWS docs, this value does not always get inferred. We need to always send it
|
||||
service: 'bedrock',
|
||||
},
|
||||
{
|
||||
secretAccessKey: this.secrets.secret,
|
||||
|
|
|
@ -85,6 +85,7 @@ describe('OpenAIConnector', () => {
|
|||
const response = await connector.runApi({ body: JSON.stringify(sampleOpenAiBody) });
|
||||
expect(mockRequest).toBeCalledTimes(1);
|
||||
expect(mockRequest).toHaveBeenCalledWith({
|
||||
timeout: 120000,
|
||||
url: 'https://api.openai.com/v1/chat/completions',
|
||||
method: 'post',
|
||||
responseSchema: RunActionResponseSchema,
|
||||
|
@ -102,6 +103,7 @@ describe('OpenAIConnector', () => {
|
|||
const response = await connector.runApi({ body: JSON.stringify(requestBody) });
|
||||
expect(mockRequest).toBeCalledTimes(1);
|
||||
expect(mockRequest).toHaveBeenCalledWith({
|
||||
timeout: 120000,
|
||||
url: 'https://api.openai.com/v1/chat/completions',
|
||||
method: 'post',
|
||||
responseSchema: RunActionResponseSchema,
|
||||
|
@ -118,6 +120,7 @@ describe('OpenAIConnector', () => {
|
|||
const response = await connector.runApi({ body: JSON.stringify(sampleOpenAiBody) });
|
||||
expect(mockRequest).toBeCalledTimes(1);
|
||||
expect(mockRequest).toHaveBeenCalledWith({
|
||||
timeout: 120000,
|
||||
url: 'https://api.openai.com/v1/chat/completions',
|
||||
method: 'post',
|
||||
responseSchema: RunActionResponseSchema,
|
||||
|
@ -148,6 +151,7 @@ describe('OpenAIConnector', () => {
|
|||
});
|
||||
expect(mockRequest).toBeCalledTimes(1);
|
||||
expect(mockRequest).toHaveBeenCalledWith({
|
||||
timeout: 120000,
|
||||
url: 'https://api.openai.com/v1/chat/completions',
|
||||
method: 'post',
|
||||
responseSchema: RunActionResponseSchema,
|
||||
|
@ -269,6 +273,7 @@ describe('OpenAIConnector', () => {
|
|||
const response = await connector.invokeAI(sampleOpenAiBody);
|
||||
expect(mockRequest).toBeCalledTimes(1);
|
||||
expect(mockRequest).toHaveBeenCalledWith({
|
||||
timeout: 120000,
|
||||
url: 'https://api.openai.com/v1/chat/completions',
|
||||
method: 'post',
|
||||
responseSchema: RunActionResponseSchema,
|
||||
|
@ -379,6 +384,7 @@ describe('OpenAIConnector', () => {
|
|||
const response = await connector.runApi({ body: JSON.stringify(sampleAzureAiBody) });
|
||||
expect(mockRequest).toBeCalledTimes(1);
|
||||
expect(mockRequest).toHaveBeenCalledWith({
|
||||
timeout: 120000,
|
||||
url: 'https://My-test-resource-123.openai.azure.com/openai/deployments/NEW-DEPLOYMENT-321/chat/completions?api-version=2023-05-15',
|
||||
method: 'post',
|
||||
responseSchema: RunActionResponseSchema,
|
||||
|
@ -405,6 +411,7 @@ describe('OpenAIConnector', () => {
|
|||
});
|
||||
expect(mockRequest).toBeCalledTimes(1);
|
||||
expect(mockRequest).toHaveBeenCalledWith({
|
||||
timeout: 120000,
|
||||
url: 'https://My-test-resource-123.openai.azure.com/openai/deployments/NEW-DEPLOYMENT-321/chat/completions?api-version=2023-05-15',
|
||||
method: 'post',
|
||||
responseSchema: RunActionResponseSchema,
|
||||
|
|
|
@ -114,6 +114,8 @@ export class OpenAIConnector extends SubActionConnector<Config, Secrets> {
|
|||
method: 'post',
|
||||
responseSchema: RunActionResponseSchema,
|
||||
data: sanitizedBody,
|
||||
// give up to 2 minutes for response
|
||||
timeout: 120000,
|
||||
...axiosOptions,
|
||||
});
|
||||
return response.data;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue