Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
stephmilovic committed Sep 26, 2023
1 parent bc6c2a2 commit 71d2b0c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ import {
} from '../../../common/open_ai/constants';
import { ConfigSchema, SecretsSchema } from '../../../common/open_ai/schema';
import { Config, Secrets } from '../../../common/open_ai/types';
import { GenAiConnector } from './open_ai';
import { OpenAIConnector } from './open_ai';
import { renderParameterTemplates } from './render';

export const getConnectorType = (): SubActionConnectorType<Config, Secrets> => ({
id: OPEN_AI_CONNECTOR_ID,
name: OPEN_AI_TITLE,
Service: GenAiConnector,
Service: OpenAIConnector,
schema: {
config: ConfigSchema,
secrets: SecretsSchema,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { GenAiConnector } from './open_ai';
import { OpenAIConnector } from './open_ai';
import { actionsConfigMock } from '@kbn/actions-plugin/server/actions_config.mock';
import {
DEFAULT_OPENAI_MODEL,
Expand All @@ -18,7 +18,7 @@ import { RunActionResponseSchema, StreamingResponseSchema } from '../../../commo
import { initDashboard } from './create_dashboard';
jest.mock('./create_dashboard');

describe('GenAiConnector', () => {
describe('OpenAIConnector', () => {
let mockRequest: jest.Mock;
let mockError: jest.Mock;
const mockResponseString = 'Hello! How can I assist you today?';
Expand Down Expand Up @@ -46,7 +46,7 @@ describe('GenAiConnector', () => {
});

describe('OpenAI', () => {
const connector = new GenAiConnector({
const connector = new OpenAIConnector({
configurationUtilities: actionsConfigMock.create(),
connector: { id: '1', type: OPEN_AI_CONNECTOR_ID },
config: {
Expand Down Expand Up @@ -285,7 +285,7 @@ describe('GenAiConnector', () => {
});

describe('AzureAI', () => {
const connector = new GenAiConnector({
const connector = new OpenAIConnector({
configurationUtilities: actionsConfigMock.create(),
connector: { id: '1', type: OPEN_AI_CONNECTOR_ID },
config: {
Expand Down Expand Up @@ -455,7 +455,7 @@ describe('GenAiConnector', () => {
});

describe('Token dashboard', () => {
const connector = new GenAiConnector({
const connector = new OpenAIConnector({
configurationUtilities: actionsConfigMock.create(),
connector: { id: '1', type: OPEN_AI_CONNECTOR_ID },
config: { apiUrl: 'https://example.com/api', apiProvider: OpenAiProviderType.AzureAi },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
sanitizeRequest,
} from './lib/utils';

export class GenAiConnector extends SubActionConnector<Config, Secrets> {
export class OpenAIConnector extends SubActionConnector<Config, Secrets> {
private url;
private provider;
private key;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import http from 'http';

import { ProxyArgs, Simulator } from './simulator';

export class GenAiSimulator extends Simulator {
export class OpenAISimulator extends Simulator {
private readonly returnError: boolean;

constructor({ returnError = false, proxy }: { returnError?: boolean; proxy?: ProxyArgs }) {
Expand All @@ -24,10 +24,10 @@ export class GenAiSimulator extends Simulator {
data: Record<string, unknown>
) {
if (this.returnError) {
return GenAiSimulator.sendErrorResponse(response);
return OpenAISimulator.sendErrorResponse(response);
}

return GenAiSimulator.sendResponse(response);
return OpenAISimulator.sendResponse(response);
}

private static sendResponse(response: http.ServerResponse) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import expect from '@kbn/expect';

import {
GenAiSimulator,
OpenAISimulator,
genAiSuccessResponse,
} from '@kbn/actions-simulators-plugin/server/gen_ai_simulation';
} from '@kbn/actions-simulators-plugin/server/open_ai_simulation';
import { FtrProviderContext } from '../../../../../common/ftr_provider_context';
import { getUrlPrefix, ObjectRemover } from '../../../../../common/lib';

Expand Down Expand Up @@ -51,7 +51,7 @@ export default function genAiTest({ getService }: FtrProviderContext) {
objectRemover.removeAll();
});
describe('action creation', () => {
const simulator = new GenAiSimulator({
const simulator = new OpenAISimulator({
returnError: false,
proxy: {
config: configService.get('kbnTestServer.serverArgs'),
Expand Down Expand Up @@ -217,7 +217,7 @@ export default function genAiTest({ getService }: FtrProviderContext) {

describe('executor', () => {
describe('validation', () => {
const simulator = new GenAiSimulator({
const simulator = new OpenAISimulator({
proxy: {
config: configService.get('kbnTestServer.serverArgs'),
},
Expand Down Expand Up @@ -272,7 +272,7 @@ export default function genAiTest({ getService }: FtrProviderContext) {

describe('execution', () => {
describe('successful response simulator', () => {
const simulator = new GenAiSimulator({
const simulator = new OpenAISimulator({
proxy: {
config: configService.get('kbnTestServer.serverArgs'),
},
Expand Down Expand Up @@ -377,7 +377,7 @@ export default function genAiTest({ getService }: FtrProviderContext) {
});
});
describe('non-default space simulator', () => {
const simulator = new GenAiSimulator({
const simulator = new OpenAISimulator({
proxy: {
config: configService.get('kbnTestServer.serverArgs'),
},
Expand Down Expand Up @@ -428,7 +428,7 @@ export default function genAiTest({ getService }: FtrProviderContext) {
});

describe('error response simulator', () => {
const simulator = new GenAiSimulator({
const simulator = new OpenAISimulator({
returnError: true,
proxy: {
config: configService.get('kbnTestServer.serverArgs'),
Expand Down

0 comments on commit 71d2b0c

Please sign in to comment.