Skip to content

Commit 3f4794c

Browse files
authored
Merge branch 'main' into keycloak
2 parents dfeca28 + 7163fb1 commit 3f4794c

25 files changed

+466
-88
lines changed

app-backend/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ RUN useradd -m -s /bin/bash user && \
1212
chown -R user /home/user/
1313

1414
WORKDIR /home/user/
15-
RUN git clone https://github.com/opea-project/GenAIComps.git
15+
# temporary pointing to v1.1 GenAIComps for Gateway dependency
16+
RUN git clone https://github.com/opea-project/GenAIComps.git -b v1.1rc
1617

1718
WORKDIR /home/user/GenAIComps
1819
RUN pip install --no-cache-dir --upgrade pip==24.3.1 setuptools==75.3.0 && \

app-backend/app_gateway.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,22 @@
3131
class AppGateway(Gateway):
3232
def __init__(self, megaservice, host='0.0.0.0', port=8888):
3333
try:
34-
with open('config/project-info.json', 'r') as f:
35-
self.project_info = json.load(f)
34+
with open('config/workflow-info.json', 'r') as f:
35+
self.workflow_info = json.load(f)
3636
except:
37-
logging.error('Failed to load project-info.json')
37+
logging.error('Failed to load workflow-info.json')
3838
super().__init__(
3939
megaservice, host, port, '/v1/app-backend', ChatCompletionRequest, ChatCompletionResponse
4040
)
4141

4242
async def handle_request(self, request: Request):
4343
data = await request.json()
4444
print('\n'*5, '====== handle_request ======\n', data)
45-
if 'chat_completion_ids' in self.project_info:
45+
if 'chat_completion_ids' in self.workflow_info:
4646
prompt = self._handle_message(data['messages'])
4747
params = {}
4848
llm_parameters = None
49-
for id, node in self.project_info['nodes'].items():
49+
for id, node in self.workflow_info['nodes'].items():
5050
if node['category'] in category_params_map:
5151
param_class = category_params_map[node['category']]()
5252
param_keys = [key for key in dir(param_class) if not key.startswith('__') and not callable(getattr(param_class, key))]

app-backend/megaservice.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ def __init__(self, host="0.0.0.0", port=8000):
1919
self.host = host
2020
self.port = port
2121
self.megaservice = ServiceOrchestrator()
22-
with open('config/project-info.json', 'r') as f:
23-
self.project_info = json.load(f)
22+
with open('config/workflow-info.json', 'r') as f:
23+
self.workflow_info = json.load(f)
2424

2525
def import_all_microservices_from_template(self):
2626
template_dir = os.path.join(os.path.dirname(__file__), 'templates', 'microservices')
@@ -35,13 +35,13 @@ def import_all_microservices_from_template(self):
3535
def add_remote_service(self):
3636
print("add_remote_service")
3737
templates = self.import_all_microservices_from_template()
38-
if 'chat_input_ids' not in self.project_info:
39-
raise Exception('chat_input_ids not found in project_info')
40-
nodes = self.project_info['chat_input_ids']
38+
if 'chat_input_ids' not in self.workflow_info:
39+
raise Exception('chat_input_ids not found in workflow_info')
40+
nodes = self.workflow_info['chat_input_ids']
4141
services = {}
4242
while nodes:
4343
node_id = nodes.pop(0)
44-
node = self.project_info['nodes'][node_id]
44+
node = self.workflow_info['nodes'][node_id]
4545
print('node', node)
4646
if node['inMegaservice']:
4747
print('adding Node', node_id)
Lines changed: 316 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,316 @@
1+
{
2+
"nodes": [
3+
{
4+
"id": "chat_input_0",
5+
"position": {
6+
"x": -104.87337962629226,
7+
"y": 133.0786252446273
8+
},
9+
"type": "customNode",
10+
"data": {
11+
"label": "Chat Input",
12+
"name": "chat_input",
13+
"version": 1,
14+
"type": "ChatCompletionRequest",
15+
"icon": "/usr/src/packages/server/src/nodes/opea-icon-color.svg",
16+
"category": "Controls",
17+
"description": "User Input from Chat Window",
18+
"baseClasses": [
19+
"ChatCompletionRequest"
20+
],
21+
"tags": [
22+
"OPEA"
23+
],
24+
"inMegaservice": false,
25+
"filePath": "/usr/src/packages/server/src/nodes/chat_input.js",
26+
"inputAnchors": [],
27+
"inputParams": [],
28+
"inputs": {},
29+
"outputs": {},
30+
"outputAnchors": [
31+
{
32+
"id": "chat_input_0-output-chat_input-ChatCompletionRequest",
33+
"name": "chat_input",
34+
"label": "ChatCompletionRequest",
35+
"description": "User Input from Chat Window",
36+
"type": "ChatCompletionRequest"
37+
}
38+
],
39+
"id": "chat_input_0",
40+
"selected": false
41+
},
42+
"width": 300,
43+
"height": 143,
44+
"selected": false,
45+
"positionAbsolute": {
46+
"x": -104.87337962629226,
47+
"y": 133.0786252446273
48+
},
49+
"dragging": false
50+
},
51+
{
52+
"id": "opea_service@llm_tgi_0",
53+
"position": {
54+
"x": 320.28599745224875,
55+
"y": 74.42581341053906
56+
},
57+
"type": "customNode",
58+
"data": {
59+
"label": "LLM Text Generation",
60+
"name": "opea_service@llm_tgi",
61+
"version": 1,
62+
"type": "GeneratedDoc",
63+
"icon": "/usr/src/packages/server/src/nodes/opea-icon-color.svg",
64+
"category": "LLM",
65+
"description": "LLM Text Generation Inference",
66+
"baseClasses": [
67+
"GeneratedDoc",
68+
"StreamingResponse",
69+
"ChatCompletion"
70+
],
71+
"tags": [
72+
"OPEA"
73+
],
74+
"inMegaservice": true,
75+
"dependent_services": {
76+
"tgi": {
77+
"modelName": "",
78+
"huggingFaceToken": "NA"
79+
}
80+
},
81+
"inputs": {
82+
"text": "{{chat_input_0.data.instance}}",
83+
"modelName": "Intel/neural-chat-7b-v3-3",
84+
"huggingFaceToken": "",
85+
"max_tokens": 17,
86+
"top_k": 10,
87+
"top_p": 0.95,
88+
"typical_p": 0.95,
89+
"temperature": 0.01,
90+
"presence_penalty": 1.03,
91+
"frequency_penalty": "",
92+
"streaming": true,
93+
"chat_template": "### You are a helpful, respectful and honest assistant to help the user with questions.\n### Context: {context}\n### Question: {question}\n### Answer:"
94+
},
95+
"filePath": "/usr/src/packages/server/src/nodes/llm.js",
96+
"inputAnchors": [
97+
{
98+
"label": "LLM Params Document",
99+
"name": "text",
100+
"type": "LLMParamsDoc|ChatCompletionRequest|SearchedDoc",
101+
"id": "opea_service@llm_tgi_0-input-text-LLMParamsDoc|ChatCompletionRequest|SearchedDoc"
102+
}
103+
],
104+
"inputParams": [
105+
{
106+
"label": "Model Name",
107+
"name": "modelName",
108+
"type": "options",
109+
"default": "Intel/neural-chat-7b-v3-3",
110+
"options": [
111+
{
112+
"name": "Intel/neural-chat-7b-v3-3",
113+
"label": "Intel/neural-chat-7b-v3-3"
114+
},
115+
{
116+
"name": "Llama-2-7b-chat-hf",
117+
"label": "Llama-2-7b-chat-hf"
118+
},
119+
{
120+
"name": "Llama-2-70b-chat-hf",
121+
"label": "Llama-2-70b-chat-hf"
122+
},
123+
{
124+
"name": "Meta-Llama-3-8B-Instruct",
125+
"label": "Meta-Llama-3-8B-Instruct"
126+
},
127+
{
128+
"name": "Meta-Llama-3-70B-Instruct",
129+
"label": "Meta-Llama-3-70B-Instruct"
130+
},
131+
{
132+
"name": "Phi-3",
133+
"label": "Phi-3"
134+
}
135+
],
136+
"id": "opea_service@llm_tgi_0-input-modelName-options"
137+
},
138+
{
139+
"label": "HuggingFace Token",
140+
"name": "huggingFaceToken",
141+
"type": "password",
142+
"optional": true,
143+
"id": "opea_service@llm_tgi_0-input-huggingFaceToken-password"
144+
},
145+
{
146+
"label": "Maximum Tokens",
147+
"name": "max_tokens",
148+
"type": "number",
149+
"default": 17,
150+
"optional": true,
151+
"additionalParams": true,
152+
"id": "opea_service@llm_tgi_0-input-max_tokens-number"
153+
},
154+
{
155+
"label": "Top K",
156+
"name": "top_k",
157+
"type": "number",
158+
"default": 10,
159+
"optional": true,
160+
"additionalParams": true,
161+
"id": "opea_service@llm_tgi_0-input-top_k-number"
162+
},
163+
{
164+
"label": "Top P",
165+
"name": "top_p",
166+
"type": "number",
167+
"default": 0.95,
168+
"optional": true,
169+
"additionalParams": true,
170+
"id": "opea_service@llm_tgi_0-input-top_p-number"
171+
},
172+
{
173+
"label": "Typical P",
174+
"name": "typical_p",
175+
"type": "number",
176+
"default": 0.95,
177+
"optional": true,
178+
"additionalParams": true,
179+
"id": "opea_service@llm_tgi_0-input-typical_p-number"
180+
},
181+
{
182+
"label": "Temperature",
183+
"name": "temperature",
184+
"type": "number",
185+
"default": 0.01,
186+
"optional": true,
187+
"additionalParams": true,
188+
"id": "opea_service@llm_tgi_0-input-temperature-number"
189+
},
190+
{
191+
"label": "Presence Penalty",
192+
"name": "presence_penalty",
193+
"type": "number",
194+
"default": 1.03,
195+
"optional": true,
196+
"additionalParams": true,
197+
"id": "opea_service@llm_tgi_0-input-presence_penalty-number"
198+
},
199+
{
200+
"label": "Frequency Penalty",
201+
"name": "frequency_penalty",
202+
"type": "number",
203+
"default": 0,
204+
"optional": true,
205+
"additionalParams": true,
206+
"id": "opea_service@llm_tgi_0-input-frequency_penalty-number"
207+
},
208+
{
209+
"label": "Streaming",
210+
"name": "streaming",
211+
"type": "boolean",
212+
"default": true,
213+
"optional": true,
214+
"additionalParams": true,
215+
"id": "opea_service@llm_tgi_0-input-streaming-boolean"
216+
},
217+
{
218+
"label": "Chat Template",
219+
"name": "chat_template",
220+
"type": "string",
221+
"rows": true,
222+
"default": "### You are a helpful, respectful and honest assistant to help the user with questions.\n### Context: {context}\n### Question: {question}\n### Answer:",
223+
"optional": true,
224+
"additionalParams": true,
225+
"id": "opea_service@llm_tgi_0-input-chat_template-string"
226+
}
227+
],
228+
"outputs": {},
229+
"outputAnchors": [
230+
{
231+
"id": "opea_service@llm_tgi_0-output-opea_service@llm_tgi-GeneratedDoc|StreamingResponse|ChatCompletion",
232+
"name": "opea_service@llm_tgi",
233+
"label": "GeneratedDoc",
234+
"description": "LLM Text Generation Inference",
235+
"type": "GeneratedDoc | StreamingResponse | ChatCompletion"
236+
}
237+
],
238+
"id": "opea_service@llm_tgi_0",
239+
"selected": false
240+
},
241+
"width": 300,
242+
"height": 478,
243+
"selected": false,
244+
"positionAbsolute": {
245+
"x": 320.28599745224875,
246+
"y": 74.42581341053906
247+
},
248+
"dragging": false
249+
},
250+
{
251+
"id": "chat_completion_0",
252+
"position": {
253+
"x": 856.6184063184758,
254+
"y": 137.45379050568326
255+
},
256+
"type": "customNode",
257+
"data": {
258+
"label": "Chat Completion",
259+
"name": "chat_completion",
260+
"version": 1,
261+
"type": "ChatCompletion",
262+
"icon": "/usr/src/packages/server/src/nodes/opea-icon-color.svg",
263+
"category": "Controls",
264+
"description": "Send Chat Response to UI",
265+
"baseClasses": [],
266+
"tags": [
267+
"OPEA"
268+
],
269+
"inMegaservice": false,
270+
"inputs": {
271+
"llm_response": "{{opea_service@llm_tgi_0.data.instance}}"
272+
},
273+
"hideOutput": true,
274+
"filePath": "/usr/src/packages/server/src/nodes/chat_completion.js",
275+
"inputAnchors": [
276+
{
277+
"label": "LLM Response",
278+
"name": "llm_response",
279+
"type": "ChatCompletion",
280+
"id": "chat_completion_0-input-llm_response-ChatCompletion"
281+
}
282+
],
283+
"inputParams": [],
284+
"outputs": {},
285+
"outputAnchors": [],
286+
"id": "chat_completion_0",
287+
"selected": false
288+
},
289+
"width": 300,
290+
"height": 143,
291+
"positionAbsolute": {
292+
"x": 856.6184063184758,
293+
"y": 137.45379050568326
294+
},
295+
"selected": false
296+
}
297+
],
298+
"edges": [
299+
{
300+
"source": "chat_input_0",
301+
"sourceHandle": "chat_input_0-output-chat_input-ChatCompletionRequest",
302+
"target": "opea_service@llm_tgi_0",
303+
"targetHandle": "opea_service@llm_tgi_0-input-text-LLMParamsDoc|ChatCompletionRequest|SearchedDoc",
304+
"type": "buttonedge",
305+
"id": "chat_input_0-chat_input_0-output-chat_input-ChatCompletionRequest-opea_service@llm_tgi_0-opea_service@llm_tgi_0-input-text-LLMParamsDoc|ChatCompletionRequest|SearchedDoc"
306+
},
307+
{
308+
"source": "opea_service@llm_tgi_0",
309+
"sourceHandle": "opea_service@llm_tgi_0-output-opea_service@llm_tgi-GeneratedDoc|StreamingResponse|ChatCompletion",
310+
"target": "chat_completion_0",
311+
"targetHandle": "chat_completion_0-input-llm_response-ChatCompletion",
312+
"type": "buttonedge",
313+
"id": "opea_service@llm_tgi_0-opea_service@llm_tgi_0-output-opea_service@llm_tgi-GeneratedDoc|StreamingResponse|ChatCompletion-chat_completion_0-chat_completion_0-input-llm_response-ChatCompletion"
314+
}
315+
]
316+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: internal-dns-config
5+
namespace: studio
6+
data:
7+
GRAFANA_DNS: "kube-prometheus-stack-grafana.monitoring.svc.cluster.local"
8+
STUDIO_FRONTEND_DNS: "studio-frontend.studio.svc.cluster.local:3000"
9+
APP_FRONTEND_DNS: "app-frontend.$namespace.svc.cluster.local:5175"
10+
APP_BACKEND_DNS: "app-backend.$namespace.svc.cluster.local:8888"
11+
PREPARE_DOC_REDIS_PREP_DNS: "prepare-doc-redis-prep-0.$namespace.svc.cluster.local:6007"
12+
STUDIO_BACKEND_DNS: "studio-backend.studio.svc.cluster.local:5000"

0 commit comments

Comments
 (0)