Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
clemlesne committed Jul 10, 2023
2 parents fa76771 + a7f5107 commit f81ebbe
Show file tree
Hide file tree
Showing 38 changed files with 885 additions and 201 deletions.
27 changes: 27 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: ""
target-branch: develop
schedule:
interval: daily
- package-ecosystem: pip
directory: src/conversation-api
target-branch: develop
schedule:
interval: daily
- package-ecosystem: docker
directory: src/conversation-api
target-branch: develop
schedule:
interval: daily
- package-ecosystem: npm
directory: src/conversation-ui
target-branch: develop
schedule:
interval: daily
- package-ecosystem: docker
directory: src/conversation-ui
target-branch: develop
schedule:
interval: daily
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# 🔒 Private GPT

> 👋🏻 Demo available at [private-gpt.shopping-cart-devops-demo.lesne.pro](https://private-gpt.shopping-cart-devops-demo.lesne.pro).
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.

Includes:
Expand All @@ -9,6 +11,7 @@ Includes:
- Dead simple interface
- Deployable on any Kubernetes cluster, with its Helm chart
- Manage users effortlessly with OpenID Connect
- Monitoring with Azure App Insights (logs, traces, user behaviors)
- More than 150 tones and personalities (accountant, advisor, debater, excel sheet, instructor, logistician, etc.) to better help employees in their specific daily tasks
- 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).
- Possibility to send temporary messages, for confidentiality
Expand All @@ -27,7 +30,7 @@ Create a local configuration file, a file named `config.toml` at the root of the

```toml
# config.toml
# Values are for example only, you should change them
# /!\ All the file values are for example, you must change them
[persistence]
# Enum: "qdrant"
search = "qdrant"
Expand All @@ -39,6 +42,9 @@ stream = "redis"
[api]
root_path = ""

[appinsights]
connection_str = "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com"

[openai]
ada_deploy_id = "ada"
ada_max_tokens = 2049
Expand Down
3 changes: 3 additions & 0 deletions cicd/helm/private-gpt/templates/conversation-api-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ data:
[api]
root_path = "/{{ include "private-gpt.fullname" . }}-conversation-api"
[appinsights]
connection_str = {{ .Values.appinsights.connection_str | required "A value for .Values.appinsights.connection_str" | quote }}
[openai]
ada_deploy_id = {{ .Values.api.openai.ada_deploy_id | quote }}
ada_max_tokens = 2049
Expand Down
22 changes: 18 additions & 4 deletions cicd/helm/private-gpt/templates/conversation-api-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,42 @@ spec:
containerPort: 8080
protocol: TCP
resources: {{- toYaml .Values.resources | nindent 12 | required "A value for .Values.resources is required" }}
startupProbe:
periodSeconds: 5
failureThreshold: 30
tcpSocket:
port: http
livenessProbe:
periodSeconds: 5
timeoutSeconds: 5
httpGet:
path: /health/liveness
port: http
startupProbe:
periodSeconds: 5
failureThreshold: 30
tcpSocket:
readinessProbe:
periodSeconds: 15
timeoutSeconds: 5
httpGet:
path: /health/readiness
port: http
volumeMounts:
- name: config
mountPath: /app/config.toml
subPath: config.toml
- name: tmp
mountPath: /app/tmp
env:
- name: PG_ACS_API_TOKEN
valueFrom:
secretKeyRef:
name: {{ include "private-gpt.fullname" . }}-conversation-api
key: PG_ACS_API_TOKEN
- name: TMPDIR
value: /app/tmp
volumes:
# Store app configuration
- name: config
configMap:
name: {{ include "private-gpt.fullname" . }}-conversation-api
# Store Azure App Insight telemetry buffer
- name: tmp
emptyDir: {}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ spec:
- type: memory
metadata:
type: Utilization
value: "50"
value: "75"
2 changes: 2 additions & 0 deletions cicd/helm/private-gpt/templates/conversation-ui-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ data:
sub_filter 'https://login.microsoftonline.com/common/v2.0' '{{ .Values.oidc.authority | required "A value for .Values.oidc.authority is required" }}';
# Rewrite the OIDC API audience
sub_filter 'e9d5f20f-7f14-4204-a9a2-0d91d6af5c82' '{{ .Values.oidc.api_audience | required "A value for .Values.oidc.api_audience is required" }}';
# Rewrite the Azure App Insights connection string
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" }}';
# Rewrite recursively
sub_filter_once off;
# Rewrite every content type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ spec:
- type: memory
metadata:
type: Utilization
value: "50"
value: "75"
3 changes: 3 additions & 0 deletions cicd/helm/private-gpt/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ resources:
cpu: .5
memory: 512Mi

appinsights:
connection_str: null

oidc:
algorithms: []
api_audience: null
Expand Down
5 changes: 2 additions & 3 deletions src/conversation-api/ai/openai.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Import utils
from uuid import UUID
from utils import (build_logger, get_config, hash_token)
from utils import (build_logger, get_config, hash_token, AZ_CREDENTIAL)

# Import misc
from azure.identity import DefaultAzureCredential
Expand Down Expand Up @@ -33,8 +33,7 @@ async def refresh_oai_token_background():
"""
while True:
logger.info("Refreshing OpenAI token")
oai_cred = DefaultAzureCredential()
oai_token = oai_cred.get_token("https://cognitiveservices.azure.com/.default")
oai_token = AZ_CREDENTIAL.get_token("https://cognitiveservices.azure.com/.default")
openai.api_key = oai_token.token
# Execute every 20 minutes
await asyncio.sleep(15 * 60)
Expand Down
Loading

0 comments on commit f81ebbe

Please sign in to comment.