Skip to content

Commit 27e1e7b

Browse files
author
erangi-ar
committed
Merge branch 'wip' of https://github.com/rootcodelabs/RAG-Module into kubernetes
2 parents 4a18a65 + fadd2f3 commit 27e1e7b

29 files changed

Lines changed: 698 additions & 185 deletions

File tree

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ venv/
3636
ENV/
3737
env.bak/
3838
venv.bak/
39+
myenv/
3940

4041
# IDE
4142
.vscode/
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

DSL/Ruuter.private/rag-search/POST/llm-connections/edit.yml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,38 @@ check_connection_exists:
119119
validate_connection_exists:
120120
switch:
121121
- condition: "${existing_connection.response.body.length > 0}"
122-
next: update_llm_connection
122+
next: check_deployment_environment
123123
next: return_not_found
124124

125+
check_deployment_environment:
126+
switch:
127+
- condition: ${environment == "production" && existing_connection.response.body[0].environment == "testing"}
128+
next: get_existing_production_connection
129+
next: update_llm_connection
130+
131+
get_existing_production_connection:
132+
call: http.post
133+
args:
134+
url: "[#RAG_SEARCH_RESQL]/get-production-connection"
135+
result: existing_production_result
136+
next: update_existing_production_to_testing
137+
138+
update_existing_production_to_testing:
139+
switch:
140+
- condition: ${existing_production_result.response.body && existing_production_result.response.body.length > 0}
141+
next: update_production_connection
142+
next: update_llm_connection
143+
144+
update_production_connection:
145+
call: http.post
146+
args:
147+
url: "[#RAG_SEARCH_RESQL]/update-llm-connection-environment"
148+
body:
149+
connection_id: ${existing_production_result.response.body[0].id}
150+
environment: "testing"
151+
result: update_result
152+
next: update_llm_connection
153+
125154
update_llm_connection:
126155
call: http.post
127156
args:
@@ -169,4 +198,4 @@ return_invalid_environment:
169198
return_unauthorized:
170199
status: 401
171200
return: "error: unauthorized"
172-
next: end
201+
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

0 commit comments

Comments
 (0)