Skip to content

Commit

Permalink
Merge pull request #12610 from AnuGayan/master-AI-API-temp
Browse files Browse the repository at this point in the history
Fix issues in AI related db queries
  • Loading branch information
RakhithaRR authored Sep 28, 2024
2 parents d38d930 + 04f4de8 commit e41582f
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,7 @@ public static API addAPIWithGeneratedSwaggerDefinition(APIDTO apiDto, String oas
apiDto);

// AWS Lambda: secret key encryption while creating the API
if (apiDto.getEndpointConfig() != null) {
if (endpointConfig.containsKey(APIConstants.AMZN_SECRET_KEY)) {
String secretKey = (String) endpointConfig.get(APIConstants.AMZN_SECRET_KEY);
if (!StringUtils.isEmpty(secretKey)) {
Expand All @@ -1156,13 +1157,8 @@ public static API addAPIWithGeneratedSwaggerDefinition(APIDTO apiDto, String oas
apiDto.setEndpointConfig(endpointConfig);
}
}
}

/* if (isWSAPI) {
ArrayList<String> websocketTransports = new ArrayList<>();
websocketTransports.add(APIConstants.WS_PROTOCOL);
websocketTransports.add(APIConstants.WSS_PROTOCOL);
apiDto.setTransport(websocketTransports);
}*/
API apiToAdd = prepareToCreateAPIByDTO(apiDto, apiProvider, username, organization);
validateScopes(apiToAdd);
//validate API categories
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3278,14 +3278,13 @@ CREATE TABLE AM_LLM_PROVIDER (

CREATE TABLE AM_API_AI_CONFIGURATION (
AI_CONFIGURATION_UUID VARCHAR(255) NOT NULL,
API_UUID VARCHAR(255) NOT NULL,
API_UUID VARCHAR(256) NOT NULL,
API_REVISION_UUID VARCHAR(255),
LLM_PROVIDER_UUID VARCHAR(255) NOT NULL,
ENDPOINT_CONFIGURATION VARCHAR(2048) NOT NULL,
THROTTLING_CONFIGURATIONS VARCHAR(1024) NOT NULL,
PRIMARY KEY (AI_CONFIGURATION_UUID),
FOREIGN KEY (API_UUID) REFERENCES AM_API(API_UUID) ON DELETE CASCADE,
FOREIGN KEY (API_REVISION_UUID) REFERENCES AM_REVISION(REVISION_UUID) ON DELETE CASCADE,
FOREIGN KEY (LLM_PROVIDER_UUID) REFERENCES AM_LLM_PROVIDER(UUID)
)
/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2482,14 +2482,13 @@ CREATE TABLE IF NOT EXISTS AM_LLM_PROVIDER (

CREATE TABLE IF NOT EXISTS AM_API_AI_CONFIGURATION (
AI_CONFIGURATION_UUID VARCHAR(255) NOT NULL,
API_UUID VARCHAR(255) NOT NULL,
API_UUID VARCHAR(256) NOT NULL,
API_REVISION_UUID VARCHAR(255),
LLM_PROVIDER_UUID VARCHAR(255) NOT NULL,
ENDPOINT_CONFIGURATION VARCHAR(2048) NOT NULL,
THROTTLING_CONFIGURATIONS VARCHAR(1024) NOT NULL,
PRIMARY KEY (AI_CONFIGURATION_UUID),
FOREIGN KEY (API_UUID) REFERENCES AM_API(API_UUID) ON DELETE CASCADE,
FOREIGN KEY (API_REVISION_UUID) REFERENCES AM_REVISION(REVISION_UUID) ON DELETE CASCADE,
FOREIGN KEY (LLM_PROVIDER_UUID) REFERENCES AM_LLM_PROVIDER(UUID)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2756,14 +2756,13 @@ CREATE TABLE AM_LLM_PROVIDER (
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AM_API_AI_CONFIGURATION]') AND TYPE IN (N'U'))
CREATE TABLE AM_API_AI_CONFIGURATION (
AI_CONFIGURATION_UUID VARCHAR(255) NOT NULL,
API_UUID VARCHAR(255) NOT NULL,
API_UUID VARCHAR(256) NOT NULL,
API_REVISION_UUID VARCHAR(255) NOT NULL,
LLM_PROVIDER_UUID VARCHAR(255) NOT NULL,
ENDPOINT_CONFIGURATION VARCHAR(2048) NOT NULL,
THROTTLING_CONFIGURATIONS VARCHAR(1024) NOT NULL,
PRIMARY KEY (AI_CONFIGURATION_UUID),
FOREIGN KEY (API_UUID) REFERENCES AM_API(API_UUID) ON DELETE CASCADE,
FOREIGN KEY (API_REVISION_UUID) REFERENCES AM_REVISION(REVISION_UUID) ON DELETE CASCADE,
FOREIGN KEY (LLM_PROVIDER_UUID) REFERENCES AM_LLM_PROVIDER(UUID)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2516,14 +2516,13 @@ CREATE TABLE IF NOT EXISTS AM_LLM_PROVIDER (

CREATE TABLE IF NOT EXISTS AM_API_AI_CONFIGURATION (
AI_CONFIGURATION_UUID VARCHAR(255) NOT NULL,
API_UUID VARCHAR(255) NOT NULL,
API_UUID VARCHAR(256) NOT NULL,
API_REVISION_UUID VARCHAR(255),
LLM_PROVIDER_UUID VARCHAR(255) NOT NULL,
ENDPOINT_CONFIGURATION VARCHAR(2048) NOT NULL,
THROTTLING_CONFIGURATIONS VARCHAR(1024) NOT NULL,
PRIMARY KEY (AI_CONFIGURATION_UUID),
FOREIGN KEY (API_UUID) REFERENCES AM_API(API_UUID) ON DELETE CASCADE,
FOREIGN KEY (API_REVISION_UUID) REFERENCES AM_REVISION(REVISION_UUID) ON DELETE CASCADE,
FOREIGN KEY (LLM_PROVIDER_UUID) REFERENCES AM_LLM_PROVIDER(UUID)
) ENGINE INNODB;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2668,14 +2668,13 @@ CREATE TABLE IF NOT EXISTS AM_LLM_PROVIDER (

CREATE TABLE IF NOT EXISTS AM_API_AI_CONFIGURATION (
AI_CONFIGURATION_UUID VARCHAR(255) NOT NULL,
API_UUID VARCHAR(255) NOT NULL,
API_UUID VARCHAR(256) NOT NULL,
API_REVISION_UUID VARCHAR(255),
LLM_PROVIDER_UUID VARCHAR(255) NOT NULL,
ENDPOINT_CONFIGURATION VARCHAR(2048) NOT NULL,
THROTTLING_CONFIGURATIONS VARCHAR(1024) NOT NULL,
PRIMARY KEY (AI_CONFIGURATION_UUID),
FOREIGN KEY (API_UUID) REFERENCES AM_API(API_UUID) ON DELETE CASCADE,
FOREIGN KEY (API_REVISION_UUID) REFERENCES AM_REVISION(REVISION_UUID) ON DELETE CASCADE,
FOREIGN KEY (LLM_PROVIDER_UUID) REFERENCES AM_LLM_PROVIDER(UUID)
) ENGINE=NDB;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3870,14 +3870,13 @@ CREATE TABLE AM_LLM_PROVIDER (

CREATE TABLE AM_API_AI_CONFIGURATION (
AI_CONFIGURATION_UUID VARCHAR(255) NOT NULL,
API_UUID VARCHAR(255) NOT NULL,
API_UUID VARCHAR(256) NOT NULL,
API_REVISION_UUID VARCHAR(255) NOT NULL,
LLM_PROVIDER_UUID VARCHAR(255) NOT NULL,
ENDPOINT_CONFIGURATION VARCHAR(2048) NOT NULL,
THROTTLING_CONFIGURATIONS VARCHAR(1024) NOT NULL,
PRIMARY KEY (AI_CONFIGURATION_UUID),
FOREIGN KEY (API_UUID) REFERENCES AM_API(API_UUID) ON DELETE CASCADE,
FOREIGN KEY (API_REVISION_UUID) REFERENCES AM_REVISION(REVISION_UUID) ON DELETE CASCADE,
FOREIGN KEY (LLM_PROVIDER_UUID) REFERENCES AM_LLM_PROVIDER(UUID)
)
/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3870,14 +3870,13 @@ CREATE TABLE AM_LLM_PROVIDER (

CREATE TABLE AM_API_AI_CONFIGURATION (
AI_CONFIGURATION_UUID VARCHAR(255) NOT NULL,
API_UUID VARCHAR(255) NOT NULL,
API_UUID VARCHAR(256) NOT NULL,
API_REVISION_UUID VARCHAR(255) NOT NULL,
LLM_PROVIDER_UUID VARCHAR(255) NOT NULL,
ENDPOINT_CONFIGURATION VARCHAR(2048) NOT NULL,
THROTTLING_CONFIGURATIONS VARCHAR(1024) NOT NULL,
PRIMARY KEY (AI_CONFIGURATION_UUID),
FOREIGN KEY (API_UUID) REFERENCES AM_API(API_UUID) ON DELETE CASCADE,
FOREIGN KEY (API_REVISION_UUID) REFERENCES AM_REVISION(REVISION_UUID) ON DELETE CASCADE,
FOREIGN KEY (LLM_PROVIDER_UUID) REFERENCES AM_LLM_PROVIDER(UUID)
)
/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3841,14 +3841,13 @@ CREATE TABLE AM_LLM_PROVIDER (

CREATE TABLE AM_API_AI_CONFIGURATION (
AI_CONFIGURATION_UUID VARCHAR(255) NOT NULL,
API_UUID VARCHAR(255) NOT NULL,
API_UUID VARCHAR(256) NOT NULL,
API_REVISION_UUID VARCHAR(255) NOT NULL,
LLM_PROVIDER_UUID VARCHAR(255) NOT NULL,
ENDPOINT_CONFIGURATION VARCHAR(2048) NOT NULL,
THROTTLING_CONFIGURATIONS VARCHAR(1024) NOT NULL,
PRIMARY KEY (AI_CONFIGURATION_UUID),
FOREIGN KEY (API_UUID) REFERENCES AM_API(API_UUID) ON DELETE CASCADE,
FOREIGN KEY (API_REVISION_UUID) REFERENCES AM_REVISION(REVISION_UUID) ON DELETE CASCADE,
FOREIGN KEY (LLM_PROVIDER_UUID) REFERENCES AM_LLM_PROVIDER(UUID)
)
/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2857,14 +2857,13 @@ CREATE TABLE IF NOT EXISTS AM_LLM_PROVIDER (
DROP TABLE IF EXISTS AM_API_AI_CONFIGURATION;
CREATE TABLE IF NOT EXISTS AM_API_AI_CONFIGURATION (
AI_CONFIGURATION_UUID VARCHAR(255) NOT NULL,
API_UUID VARCHAR(255) NOT NULL,
API_UUID VARCHAR(256) NOT NULL,
API_REVISION_UUID VARCHAR(255) NOT NULL,
LLM_PROVIDER_UUID VARCHAR(255) NOT NULL,
ENDPOINT_CONFIGURATION VARCHAR(2048) NOT NULL,
THROTTLING_CONFIGURATIONS VARCHAR(1024) NOT NULL,
PRIMARY KEY (AI_CONFIGURATION_UUID),
FOREIGN KEY (API_UUID) REFERENCES AM_API(API_UUID) ON DELETE CASCADE,
FOREIGN KEY (API_REVISION_UUID) REFERENCES AM_REVISION(REVISION_UUID) ON DELETE CASCADE,
FOREIGN KEY (LLM_PROVIDER_UUID) REFERENCES AM_LLM_PROVIDER(UUID)
);

Expand Down

0 comments on commit e41582f

Please sign in to comment.