Skip to content

Commit 7387d5a

Browse files
committed
update the compose file
Signed-off-by: Mustafa <[email protected]> initial Signed-off-by: Mustafa <[email protected]> update codegen Signed-off-by: Mustafa <[email protected]> update for codegen Signed-off-by: Mustafa <[email protected]> add agents Signed-off-by: Mustafa <[email protected]> env updates Signed-off-by: Mustafa <[email protected]> update codegen Signed-off-by: Mustafa <[email protected]> merged to main Signed-off-by: Mustafa <[email protected]> updates Signed-off-by: Mustafa <[email protected]> update the env variables Signed-off-by: Mustafa <[email protected]> update compose.yaml Signed-off-by: Mustafa <[email protected]> compose.yaml updates Signed-off-by: Mustafa <[email protected]> update readme file Signed-off-by: Mustafa <[email protected]> update readme Signed-off-by: Mustafa <[email protected]> Gradio UI for CodeGen (#4) * update the compose file Signed-off-by: Mustafa <[email protected]> initial Signed-off-by: Mustafa <[email protected]> added microservice ports Signed-off-by: okhleif-IL <[email protected]> update codegen Signed-off-by: Mustafa <[email protected]> update for codegen Signed-off-by: Mustafa <[email protected]> Initial commit for Gradio UI Signed-off-by: okhleif-IL <[email protected]> New UI Signed-off-by: okhleif-IL <[email protected]> prepare for merge Signed-off-by: okhleif-IL <[email protected]> add agents Signed-off-by: Mustafa <[email protected]> env updates Signed-off-by: Mustafa <[email protected]> update codegen Signed-off-by: Mustafa <[email protected]> merged to main Signed-off-by: Mustafa <[email protected]> updates Signed-off-by: Mustafa <[email protected]> UI Updates Signed-off-by: okhleif-IL <[email protected]> added dockerfile Signed-off-by: okhleif-IL <[email protected]> removed files dataframe Signed-off-by: okhleif-IL <[email protected]> updated file upload Signed-off-by: okhleif-IL <[email protected]> added checkbox for agent Signed-off-by: okhleif-IL <[email protected]> key_index_name --> index_name Signed-off-by: okhleif-IL <[email protected]> added / removed print statements Signed-off-by: okhleif-IL <[email protected]> Support for data streaming (from Melanie) Signed-off-by: okhleif-IL <[email protected]> fixed file not supported bug Signed-off-by: okhleif-IL <[email protected]> added refresh button to index Signed-off-by: okhleif-IL <[email protected]> simplified README Signed-off-by: okhleif-IL <[email protected]> * updated readme and fixed merge Signed-off-by: okhleif-IL <[email protected]> * reverted changes Signed-off-by: okhleif-IL <[email protected]> --------- Signed-off-by: okhleif-IL <[email protected]> Co-authored-by: Mustafa <[email protected]> add cpu xeon test Signed-off-by: Mustafa <[email protected]> add cpu xeon test Signed-off-by: Mustafa <[email protected]>
1 parent d4dcbd1 commit 7387d5a

File tree

15 files changed

+1150
-77
lines changed

15 files changed

+1150
-77
lines changed

CodeGen/Dockerfile

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,51 @@
11
# Copyright (C) 2024 Intel Corporation
22
# SPDX-License-Identifier: Apache-2.0
33

4-
ARG BASE_TAG=latest
5-
FROM opea/comps-base:$BASE_TAG
4+
# Stage 1: base setup used by other stages
5+
FROM python:3.11-slim AS base
6+
7+
# get security updates
8+
RUN apt-get update && apt-get upgrade -y && \
9+
apt-get clean && rm -rf /var/lib/apt/lists/*
10+
11+
ENV HOME=/home/user
12+
13+
RUN useradd -m -s /bin/bash user && \
14+
mkdir -p $HOME && \
15+
chown -R user $HOME
16+
17+
WORKDIR $HOME
18+
19+
20+
# Stage 2: latest GenAIComps sources
21+
FROM base AS git
22+
23+
RUN apt-get update && apt-get install -y --no-install-recommends git
24+
# RUN git clone --depth 1 https://github.com/opea-project/GenAIComps.git
25+
COPY GenAIComps GenAIComps
26+
27+
28+
# Stage 3: common layer shared by services using GenAIComps
29+
FROM base AS comps-base
30+
31+
# copy just relevant parts
32+
COPY --from=git $HOME/GenAIComps/comps $HOME/GenAIComps/comps
33+
COPY --from=git $HOME/GenAIComps/*.* $HOME/GenAIComps/LICENSE $HOME/GenAIComps/
34+
35+
WORKDIR $HOME/GenAIComps
36+
RUN pip install --no-cache-dir --upgrade pip setuptools && \
37+
pip install --no-cache-dir -r $HOME/GenAIComps/requirements.txt
38+
WORKDIR $HOME
39+
40+
ENV PYTHONPATH=$PYTHONPATH:$HOME/GenAIComps
41+
42+
USER user
43+
44+
45+
# Stage 4: unique part
46+
FROM comps-base
47+
48+
ENV LANG=C.UTF-8
649

750
COPY ./codegen.py $HOME/codegen.py
851

CodeGen/README.md

Lines changed: 59 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Code Generation Application
22

3-
Code Generation (CodeGen) Large Language Models (LLMs) are specialized AI models designed for the task of generating computer code. Such models undergo training with datasets that encompass repositories, specialized documentation, programming code, relevant web content, and other related data. They possess a deep understanding of various programming languages, coding patterns, and software development concepts. CodeGen LLMs are engineered to assist developers and programmers. When these LLMs are seamlessly integrated into the developer's Integrated Development Environment (IDE), they possess a comprehensive understanding of the coding context, which includes elements such as comments, function names, and variable names. This contextual awareness empowers them to provide more refined and contextually relevant coding suggestions.
3+
Code Generation (CodeGen) Large Language Models (LLMs) are specialized AI models designed for the task of generating computer code. Such models undergo training with datasets that encompass repositories, specialized documentation, programming code, relevant web content, and other related data. They possess a deep understanding of various programming languages, coding patterns, and software development concepts. CodeGen LLMs are engineered to assist developers and programmers. When these LLMs are seamlessly integrated into the developer's Integrated Development Environment (IDE), they possess a comprehensive understanding of the coding context, which includes elements such as comments, function names, and variable names. This contextual awareness empowers them to provide more refined and contextually relevant coding suggestions. Additionally Retrieval-Augmented Generation (RAG) and Agents are parts of the CodeGen example which provide an additional layer of intelligence and adaptability, ensuring that the generated code is not only relevant but also accurate, efficient, and tailored to the specific needs of the developers and programmers.
44

55
The capabilities of CodeGen LLMs include:
66

@@ -20,6 +20,7 @@ The workflow falls into the following architecture:
2020

2121
The CodeGen example is implemented using the component-level microservices defined in [GenAIComps](https://github.com/opea-project/GenAIComps). The flow chart below shows the information flow between different microservices for this example.
2222

23+
2324
```mermaid
2425
---
2526
config:
@@ -28,7 +29,7 @@ config:
2829
rankSpacing: 100
2930
curve: linear
3031
themeVariables:
31-
fontSize: 50px
32+
fontSize: 25px
3233
---
3334
flowchart LR
3435
%% Colors %%
@@ -37,34 +38,56 @@ flowchart LR
3738
classDef orchid fill:#C26DBC,stroke:#ADD8E6,stroke-width:2px,fill-opacity:0.5
3839
classDef invisible fill:transparent,stroke:transparent;
3940
style CodeGen-MegaService stroke:#000000
40-
4141
%% Subgraphs %%
42-
subgraph CodeGen-MegaService["CodeGen MegaService "]
42+
subgraph CodeGen-MegaService["CodeGen-MegaService"]
4343
direction LR
44-
LLM([LLM MicroService]):::blue
44+
EM([Embedding<br>MicroService]):::blue
45+
RET([Retrieval<br>MicroService]):::blue
46+
RER([Agents]):::blue
47+
LLM([LLM<br>MicroService]):::blue
4548
end
46-
subgraph UserInterface[" User Interface "]
49+
subgraph User Interface
4750
direction LR
48-
a([User Input Query]):::orchid
49-
UI([UI server<br>]):::orchid
51+
a([Submit Query Tab]):::orchid
52+
UI([UI server]):::orchid
53+
Ingest([Manage Resources]):::orchid
5054
end
5155
56+
CLIP_EM{{Embedding<br>service}}
57+
VDB{{Vector DB}}
58+
V_RET{{Retriever<br>service}}
59+
Ingest{{Ingest data}}
60+
DP([Data Preparation]):::blue
61+
LLM_gen{{TGI Service}}
62+
GW([CodeGen GateWay]):::orange
5263
53-
LLM_gen{{LLM Service <br>}}
54-
GW([CodeGen GateWay<br>]):::orange
55-
64+
%% Data Preparation flow
65+
%% Ingest data flow
66+
direction LR
67+
Ingest[Ingest data] --> UI
68+
UI --> DP
69+
DP <-.-> CLIP_EM
5670
5771
%% Questions interaction
5872
direction LR
5973
a[User Input Query] --> UI
6074
UI --> GW
6175
GW <==> CodeGen-MegaService
76+
EM ==> RET
77+
RET ==> RER
78+
RER ==> LLM
6279
6380
6481
%% Embedding service flow
6582
direction LR
83+
EM <-.-> CLIP_EM
84+
RET <-.-> V_RET
6685
LLM <-.-> LLM_gen
6786
87+
direction TB
88+
%% Vector DB interaction
89+
V_RET <-.->VDB
90+
DP <-.->VDB
6891
```
6992

7093
## Deploy CodeGen Service
@@ -138,11 +161,25 @@ Refer to the [Gaudi Guide](./docker_compose/intel/hpu/gaudi/README.md) to build
138161

139162
Find the corresponding [compose.yaml](./docker_compose/intel/cpu/xeon/compose.yaml).
140163

164+
Start CodeGen based on TGI service:
165+
141166
```bash
142-
cd GenAIExamples/CodeGen/docker_compose/intel/cpu/xeon
143-
docker compose up -d
167+
cd GenAIExamples/CodeGen/docker_compose
168+
source set_env.sh
169+
cd intel/cpu/xeon
170+
docker compose --profile codegen-xeon-tgi up -d
171+
```
172+
173+
Start CodeGen based on vLLM service:
174+
175+
```bash
176+
cd GenAIExamples/CodeGen/docker_compose
177+
source set_env.sh
178+
cd intel/cpu/xeon
179+
docker compose --profile codegen-xeon-vllm up -d
144180
```
145181

182+
146183
Refer to the [Xeon Guide](./docker_compose/intel/cpu/xeon/README.md) for more instructions on building docker images from source.
147184

148185
### Deploy CodeGen on Kubernetes using Helm Chart
@@ -161,6 +198,15 @@ Two ways of consuming CodeGen Service:
161198
-d '{"messages": "Implement a high-level API for a TODO list application. The API takes as input an operation request and updates the TODO list in place. If the request is invalid, raise an exception."}'
162199
```
163200

201+
If the user wants a CodeGen service with RAG and Agents based on dedicated documentation.
202+
203+
```bash
204+
curl http://localhost:7778/v1/codegen \
205+
-H "Content-Type: application/json" \
206+
-d '{"agents_flag": "True", "index_name": "my_API_document", "messages": "Implement a high-level API for a TODO list application. The API takes as input an operation request and updates the TODO list in place. If the request is invalid, raise an exception."}'
207+
208+
```
209+
164210
2. Access via frontend
165211

166212
To access the frontend, open the following URL in your browser: http://{host_ip}:5173.

0 commit comments

Comments
 (0)