Skip to content

Commit c2bfedb

Browse files
author
erangi-ar
committed
Add prompt configuration management feature
1 parent 355ca1c commit c2bfedb

File tree

18 files changed

+345
-8
lines changed

18 files changed

+345
-8
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- liquibase formatted sql
2+
3+
-- changeset Erangi Ariyasena:rag-script-v5-changeset1
4+
CREATE TABLE public.prompt_configuration (
5+
id BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
6+
prompt TEXT
7+
);
8+

DSL/Liquibase/master.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ databaseChangeLog:
66
- include:
77
file: changelog/rag-search-script-v3-configuration.sql
88
- include:
9-
file: changelog/rag-search-script-v4-authority-data.xml
9+
file: changelog/rag-search-script-v4-authority-data.xml
10+
- include:
11+
file: changelog/rag-search-script-v5-prompt-config.sql
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
SELECT
2+
id,
3+
prompt
4+
FROM prompt_configuration
5+
LIMIT 1
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
INSERT INTO prompt_configuration (prompt)
2+
VALUES (:prompt)
3+
RETURNING id, prompt
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
UPDATE prompt_configuration
2+
SET prompt = :prompt
3+
WHERE id = :id
4+
RETURNING id, prompt
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
declaration:
2+
call: declare
3+
version: 0.1
4+
description: "Get prompt configuration"
5+
method: get
6+
accepts: json
7+
returns: json
8+
namespace: rag-search
9+
10+
get_prompt_configuration:
11+
call: http.get
12+
args:
13+
url: "[#RAG_SEARCH_RESQL]/get-prompt-configuration"
14+
result: prompt_result
15+
next: check_prompt_exists
16+
17+
check_prompt_exists:
18+
switch:
19+
- condition: "${prompt_result.response.body.length > 0}"
20+
next: transform_response
21+
next: transform_empty_response
22+
23+
transform_response:
24+
assign:
25+
data: ${prompt_result.response.body}
26+
next: return_success
27+
28+
transform_empty_response:
29+
assign:
30+
emptyData: []
31+
next: return_empty
32+
33+
return_success:
34+
return: ${data}
35+
next: end
36+
37+
return_empty:
38+
return: ${emptyData}
39+
next: end
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
declaration:
2+
call: declare
3+
version: 0.1
4+
description: "Update or insert prompt configuration"
5+
method: post
6+
accepts: json
7+
returns: json
8+
namespace: rag-search
9+
allowlist:
10+
body:
11+
- field: prompt
12+
type: string
13+
description: "Prompt text to save"
14+
15+
extract_request_data:
16+
assign:
17+
prompt: ${incoming.body.prompt ?? ""}
18+
next: get_existing_prompt
19+
20+
get_existing_prompt:
21+
call: http.get
22+
args:
23+
url: "[#RAG_SEARCH_RESQL]/get-prompt-configuration"
24+
result: existing_prompt
25+
next: check_if_exists
26+
27+
check_if_exists:
28+
switch:
29+
- condition: "${existing_prompt.response.body.length > 0}"
30+
next: update_prompt
31+
next: insert_prompt
32+
33+
update_prompt:
34+
call: http.post
35+
args:
36+
url: "[#RAG_SEARCH_RESQL]/update-prompt-configuration"
37+
body:
38+
id: ${existing_prompt.response.body[0].id}
39+
prompt: ${prompt}
40+
result: update_result
41+
next: return_update_success
42+
43+
insert_prompt:
44+
call: http.post
45+
args:
46+
url: "[#RAG_SEARCH_RESQL]/insert-prompt-configuration"
47+
body:
48+
prompt: ${prompt}
49+
result: insert_result
50+
next: return_insert_success
51+
52+
return_update_success:
53+
return: ${update_result.response.body[0]}
54+
next: end
55+
56+
return_insert_success:
57+
return: ${insert_result.response.body[0]}
58+
next: end

DSL/Ruuter.private/rag-search/POST/vault/secret/create.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ declaration:
55
method: post
66
accepts: json
77
returns: json
8-
namespace: classifier
8+
namespace: rag-search
99
allowlist:
1010
body:
1111
- field: connectionId

DSL/Ruuter.private/rag-search/POST/vault/secret/delete.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ declaration:
55
method: post
66
accepts: json
77
returns: json
8-
namespace: classifier
8+
namespace: rag-search
99
allowlist:
1010
body:
1111
- field: connectionId

GUI/src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import ViewLLMConnection from 'pages/LLMConnections/ViewLLMConnection';
1313
import UserManagement from 'pages/UserManagement';
1414
import TestLLM from 'pages/TestModel';
1515
import TestProductionLLM from 'pages/TestProductionLLM';
16+
import PromptConfigurations from 'pages/PromptConfigurations';
1617

1718
const App: FC = () => {
1819
const navigate = useNavigate();
@@ -62,6 +63,7 @@ const App: FC = () => {
6263
<Route path="/llm-connections" element={<LLMConnections />} />
6364
<Route path="/create-llm-connection" element={<CreateLLMConnection />} />
6465
<Route path="/view-llm-connection" element={<ViewLLMConnection />} />
66+
<Route path="/prompt-configurations" element={<PromptConfigurations />} />
6567
<Route path="/test-llm" element={<TestLLM />} />
6668
<Route path="/test-production-llm" element={<TestProductionLLM />} />
6769

0 commit comments

Comments
 (0)