Skip to content

Commit f81ebbe

Browse files
committed
Merge branch 'develop' into main
2 parents fa76771 + a7f5107 commit f81ebbe

38 files changed

+885
-201
lines changed

.github/dependabot.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: ""
5+
target-branch: develop
6+
schedule:
7+
interval: daily
8+
- package-ecosystem: pip
9+
directory: src/conversation-api
10+
target-branch: develop
11+
schedule:
12+
interval: daily
13+
- package-ecosystem: docker
14+
directory: src/conversation-api
15+
target-branch: develop
16+
schedule:
17+
interval: daily
18+
- package-ecosystem: npm
19+
directory: src/conversation-ui
20+
target-branch: develop
21+
schedule:
22+
interval: daily
23+
- package-ecosystem: docker
24+
directory: src/conversation-ui
25+
target-branch: develop
26+
schedule:
27+
interval: daily

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# 🔒 Private GPT
22

3+
> 👋🏻 Demo available at [private-gpt.shopping-cart-devops-demo.lesne.pro](https://private-gpt.shopping-cart-devops-demo.lesne.pro).
4+
35
Private GPT is a local version of Chat GPT, using Azure OpenAI. It is an enterprise grade platform to deploy a ChatGPT-like interface for your employees.
46

57
Includes:
@@ -9,6 +11,7 @@ Includes:
911
- Dead simple interface
1012
- Deployable on any Kubernetes cluster, with its Helm chart
1113
- Manage users effortlessly with OpenID Connect
14+
- Monitoring with Azure App Insights (logs, traces, user behaviors)
1215
- More than 150 tones and personalities (accountant, advisor, debater, excel sheet, instructor, logistician, etc.) to better help employees in their specific daily tasks
1316
- Plug and play storage system, including [Azure Cosmos DB](https://learn.microsoft.com/en-us/azure/cosmos-db/), [Redis](https://github.com/redis/redis) and [Qdrant](https://github.com/qdrant/qdrant).
1417
- Possibility to send temporary messages, for confidentiality
@@ -27,7 +30,7 @@ Create a local configuration file, a file named `config.toml` at the root of the
2730

2831
```toml
2932
# config.toml
30-
# Values are for example only, you should change them
33+
# /!\ All the file values are for example, you must change them
3134
[persistence]
3235
# Enum: "qdrant"
3336
search = "qdrant"
@@ -39,6 +42,9 @@ stream = "redis"
3942
[api]
4043
root_path = ""
4144

45+
[appinsights]
46+
connection_str = "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com"
47+
4248
[openai]
4349
ada_deploy_id = "ada"
4450
ada_max_tokens = 2049

cicd/helm/private-gpt/templates/conversation-api-config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ data:
1515
[api]
1616
root_path = "/{{ include "private-gpt.fullname" . }}-conversation-api"
1717
18+
[appinsights]
19+
connection_str = {{ .Values.appinsights.connection_str | required "A value for .Values.appinsights.connection_str" | quote }}
20+
1821
[openai]
1922
ada_deploy_id = {{ .Values.api.openai.ada_deploy_id | quote }}
2023
ada_max_tokens = 2049

cicd/helm/private-gpt/templates/conversation-api-deployment.yaml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,42 @@ spec:
3030
containerPort: 8080
3131
protocol: TCP
3232
resources: {{- toYaml .Values.resources | nindent 12 | required "A value for .Values.resources is required" }}
33+
startupProbe:
34+
periodSeconds: 5
35+
failureThreshold: 30
36+
tcpSocket:
37+
port: http
3338
livenessProbe:
3439
periodSeconds: 5
3540
timeoutSeconds: 5
3641
httpGet:
3742
path: /health/liveness
3843
port: http
39-
startupProbe:
40-
periodSeconds: 5
41-
failureThreshold: 30
42-
tcpSocket:
44+
readinessProbe:
45+
periodSeconds: 15
46+
timeoutSeconds: 5
47+
httpGet:
48+
path: /health/readiness
4349
port: http
4450
volumeMounts:
4551
- name: config
4652
mountPath: /app/config.toml
4753
subPath: config.toml
54+
- name: tmp
55+
mountPath: /app/tmp
4856
env:
4957
- name: PG_ACS_API_TOKEN
5058
valueFrom:
5159
secretKeyRef:
5260
name: {{ include "private-gpt.fullname" . }}-conversation-api
5361
key: PG_ACS_API_TOKEN
62+
- name: TMPDIR
63+
value: /app/tmp
5464
volumes:
65+
# Store app configuration
5566
- name: config
5667
configMap:
5768
name: {{ include "private-gpt.fullname" . }}-conversation-api
69+
# Store Azure App Insight telemetry buffer
70+
- name: tmp
71+
emptyDir: {}

cicd/helm/private-gpt/templates/conversation-api-scaler.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ spec:
1717
- type: memory
1818
metadata:
1919
type: Utilization
20-
value: "50"
20+
value: "75"

cicd/helm/private-gpt/templates/conversation-ui-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ data:
3737
sub_filter 'https://login.microsoftonline.com/common/v2.0' '{{ .Values.oidc.authority | required "A value for .Values.oidc.authority is required" }}';
3838
# Rewrite the OIDC API audience
3939
sub_filter 'e9d5f20f-7f14-4204-a9a2-0d91d6af5c82' '{{ .Values.oidc.api_audience | required "A value for .Values.oidc.api_audience is required" }}';
40+
# Rewrite the Azure App Insights connection string
41+
sub_filter 'InstrumentationKey=0b860d29-2a55-4d29-ab57-88cdd85a8da0;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com' '{{ .Values.appinsights.connection_str | required "A value for .Values.appinsights.connection_str" }}';
4042
# Rewrite recursively
4143
sub_filter_once off;
4244
# Rewrite every content type

cicd/helm/private-gpt/templates/conversation-ui-scaler.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ spec:
1717
- type: memory
1818
metadata:
1919
type: Utilization
20-
value: "50"
20+
value: "75"

cicd/helm/private-gpt/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ resources:
2323
cpu: .5
2424
memory: 512Mi
2525

26+
appinsights:
27+
connection_str: null
28+
2629
oidc:
2730
algorithms: []
2831
api_audience: null

src/conversation-api/ai/openai.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Import utils
22
from uuid import UUID
3-
from utils import (build_logger, get_config, hash_token)
3+
from utils import (build_logger, get_config, hash_token, AZ_CREDENTIAL)
44

55
# Import misc
66
from azure.identity import DefaultAzureCredential
@@ -33,8 +33,7 @@ async def refresh_oai_token_background():
3333
"""
3434
while True:
3535
logger.info("Refreshing OpenAI token")
36-
oai_cred = DefaultAzureCredential()
37-
oai_token = oai_cred.get_token("https://cognitiveservices.azure.com/.default")
36+
oai_token = AZ_CREDENTIAL.get_token("https://cognitiveservices.azure.com/.default")
3837
openai.api_key = oai_token.token
3938
# Execute every 20 minutes
4039
await asyncio.sleep(15 * 60)

0 commit comments

Comments
 (0)