Skip to content

Commit 650ad75

Browse files
authored
Question validation disable option (#767)
* add RHDH system prompt Signed-off-by: Stephanie <yangcao@redhat.com> * add optional boolean value to config Signed-off-by: Stephanie <yangcao@redhat.com> * remove system prompt from lightspeed plugin Signed-off-by: Stephanie <yangcao@redhat.com> --------- Signed-off-by: Stephanie <yangcao@redhat.com>
1 parent 3c71547 commit 650ad75

3 files changed

Lines changed: 6 additions & 109 deletions

File tree

workspaces/lightspeed/plugins/lightspeed-backend/config.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,10 @@ export interface Config {
3737
*/
3838
token?: string;
3939
}>;
40+
/**
41+
* If turn on query restriction validation.
42+
* @visibility frontend
43+
*/
44+
disableQuestionValidation?: boolean;
4045
};
4146
}

workspaces/lightspeed/plugins/lightspeed-backend/src/service/prompt.ts

Lines changed: 0 additions & 101 deletions
This file was deleted.

workspaces/lightspeed/plugins/lightspeed-backend/src/service/router.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import {
3232
} from '@red-hat-developer-hub/backstage-plugin-lightspeed-common';
3333

3434
import { userPermissionAuthorization } from './permission';
35-
import { QUERY_SYSTEM_INSTRUCTION } from './prompt';
3635
import {
3736
DEFAULT_HISTORY_LENGTH,
3837
QueryRequestBody,
@@ -158,10 +157,7 @@ export async function createRouter(
158157
'/v1/query',
159158
validateCompletionsRequest,
160159
async (request, response) => {
161-
const {
162-
provider,
163-
system_prompt,
164-
}: Pick<QueryRequestBody, 'provider' | 'system_prompt'> = request.body;
160+
const { provider }: Pick<QueryRequestBody, 'provider'> = request.body;
165161
try {
166162
const credentials = await httpAuth.credentials(request);
167163
const userEntity = await userInfo.getUserInfo(credentials);
@@ -174,9 +170,6 @@ export async function createRouter(
174170
credentials,
175171
);
176172
const userQueryParam = `user_id=${encodeURIComponent(user_id)}`;
177-
if (!system_prompt) {
178-
request.body.system_prompt = QUERY_SYSTEM_INSTRUCTION;
179-
}
180173
request.body.media_type = 'application/json'; // set media_type to receive start and end event
181174
const requestBody = JSON.stringify(request.body);
182175
const fetchResponse = await fetch(

0 commit comments

Comments
 (0)