Skip to content

Commit c022568

Browse files
Merge branch 'main' into litellm_faster_api_key_checking
2 parents 7a29fe9 + 86fe7a9 commit c022568

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+2330
-553
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
pip install "apscheduler==3.10.4"
4747
pip install "PyGithub==1.59.1"
4848
pip install argon2-cffi
49+
pip install python-multipart
4950
- save_cache:
5051
paths:
5152
- ./venv

.github/workflows/ghcr_deploy.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,38 @@ jobs:
146146
} catch (error) {
147147
core.setFailed(error.message);
148148
}
149+
- name: Fetch Release Notes
150+
id: release-notes
151+
uses: actions/github-script@v6
152+
with:
153+
github-token: "${{ secrets.GITHUB_TOKEN }}"
154+
script: |
155+
try {
156+
const response = await github.rest.repos.getRelease({
157+
owner: context.repo.owner,
158+
repo: context.repo.repo,
159+
release_id: process.env.RELEASE_ID,
160+
});
161+
return response.data.body;
162+
} catch (error) {
163+
core.setFailed(error.message);
164+
}
165+
env:
166+
RELEASE_ID: ${{ env.RELEASE_ID }}
149167
- name: Github Releases To Discord
150168
env:
151169
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
170+
REALEASE_TAG: ${{ env.RELEASE_TAG }}
171+
RELEASE_NOTES: ${{ steps.release-notes.outputs.result }}
152172
run: |
153173
curl -H "Content-Type: application/json" -X POST -d '{
154174
"content": "||@everyone||",
155175
"username": "Release Changelog",
156176
"avatar_url": "https://cdn.discordapp.com/avatars/487431320314576937/bd64361e4ba6313d561d54e78c9e7171.png",
157177
"embeds": [
158178
{
159-
"title": "Changelog",
160-
"description": "This is the changelog for the latest release.",
179+
"title": "Changelog for ${RELEASE_TAG}",
180+
"description": "${RELEASE_NOTES}",
161181
"color": 2105893
162182
}
163183
]

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,4 @@ deploy/charts/litellm/*.tgz
4444
deploy/charts/litellm/charts/*
4545
deploy/charts/*.tgz
4646
litellm/proxy/vertex_key.json
47+
**/.vim/

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ pip install 'litellm[proxy]'
143143
```shell
144144
$ litellm --model huggingface/bigcode/starcoder
145145

146-
#INFO: Proxy running on http://0.0.0.0:8000
146+
#INFO: Proxy running on http://0.0.0.0:4000
147147
```
148148

149149
### Step 2: Make ChatCompletions Request to Proxy
150150
```python
151151
import openai # openai v1.0.0+
152-
client = openai.OpenAI(api_key="anything",base_url="http://0.0.0.0:8000") # set proxy to base_url
152+
client = openai.OpenAI(api_key="anything",base_url="http://0.0.0.0:4000") # set proxy to base_url
153153
# request sent to model set on litellm proxy, `litellm --model`
154154
response = client.chat.completions.create(model="gpt-3.5-turbo", messages = [
155155
{
@@ -170,7 +170,7 @@ Set budgets and rate limits across multiple projects
170170

171171
### Request
172172
```shell
173-
curl 'http://0.0.0.0:8000/key/generate' \
173+
curl 'http://0.0.0.0:4000/key/generate' \
174174
--header 'Authorization: Bearer sk-1234' \
175175
--header 'Content-Type: application/json' \
176176
--data-raw '{"models": ["gpt-3.5-turbo", "gpt-4", "claude-2"], "duration": "20m","metadata": {"user": "[email protected]", "team": "core-infra"}}'

deploy/charts/litellm/Chart.lock

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
dependencies:
22
- name: postgresql
33
repository: oci://registry-1.docker.io/bitnamicharts
4-
version: 13.3.1
5-
digest: sha256:f5c129150f0d38dd06752ab37f3c8e143d7c14d30379af058767bcd9f4ba83dd
6-
generated: "2024-01-19T11:32:56.694808861+11:00"
4+
version: 14.3.1
5+
- name: redis
6+
repository: oci://registry-1.docker.io/bitnamicharts
7+
version: 18.19.1
8+
digest: sha256:8660fe6287f9941d08c0902f3f13731079b8cecd2a5da2fbc54e5b7aae4a6f62
9+
generated: "2024-03-10T02:28:52.275022+05:30"

deploy/charts/litellm/Chart.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ dependencies:
3131
version: ">=13.3.0"
3232
repository: oci://registry-1.docker.io/bitnamicharts
3333
condition: db.deployStandalone
34+
- name: redis
35+
version: ">=18.0.0"
36+
repository: oci://registry-1.docker.io/bitnamicharts
37+
condition: redis.enabled

deploy/charts/litellm/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ If `db.useStackgresOperator` is used (not yet implemented):
2828
| `imagePullSecrets` | Registry credentials for the LiteLLM and initContainer images. | `[]` |
2929
| `serviceAccount.create` | Whether or not to create a Kubernetes Service Account for this deployment. The default is `false` because LiteLLM has no need to access the Kubernetes API. | `false` |
3030
| `service.type` | Kubernetes Service type (e.g. `LoadBalancer`, `ClusterIP`, etc.) | `ClusterIP` |
31-
| `service.port` | TCP port that the Kubernetes Service will listen on. Also the TCP port within the Pod that the proxy will listen on. | `8000` |
31+
| `service.port` | TCP port that the Kubernetes Service will listen on. Also the TCP port within the Pod that the proxy will listen on. | `4000` |
3232
| `ingress.*` | See [values.yaml](./values.yaml) for example settings | N/A |
3333
| `proxy_config.*` | See [values.yaml](./values.yaml) for default settings. See [example_config_yaml](../../../litellm/proxy/example_config_yaml/) for configuration examples. | N/A |
3434

@@ -76,7 +76,7 @@ When browsing to the URL published per the settings in `ingress.*`, you will
7676
be prompted for **Admin Configuration**. The **Proxy Endpoint** is the internal
7777
(from the `litellm` pod's perspective) URL published by the `<RELEASE>-litellm`
7878
Kubernetes Service. If the deployment uses the default settings for this
79-
service, the **Proxy Endpoint** should be set to `http://<RELEASE>-litellm:8000`.
79+
service, the **Proxy Endpoint** should be set to `http://<RELEASE>-litellm:4000`.
8080

8181
The **Proxy Key** is the value specified for `masterkey` or, if a `masterkey`
8282
was not provided to the helm command line, the `masterkey` is a randomly

deploy/charts/litellm/templates/_helpers.tpl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,25 @@ Create the name of the service account to use
6060
{{- default "default" .Values.serviceAccount.name }}
6161
{{- end }}
6262
{{- end }}
63+
64+
{{/*
65+
Get redis service name
66+
*/}}
67+
{{- define "litellm.redis.serviceName" -}}
68+
{{- if and (eq .Values.redis.architecture "standalone") .Values.redis.sentinel.enabled -}}
69+
{{- printf "%s-%s" .Release.Name (default "redis" .Values.redis.nameOverride | trunc 63 | trimSuffix "-") -}}
70+
{{- else -}}
71+
{{- printf "%s-%s-master" .Release.Name (default "redis" .Values.redis.nameOverride | trunc 63 | trimSuffix "-") -}}
72+
{{- end -}}
73+
{{- end -}}
74+
75+
{{/*
76+
Get redis service port
77+
*/}}
78+
{{- define "litellm.redis.port" -}}
79+
{{- if .Values.redis.sentinel.enabled -}}
80+
{{ .Values.redis.sentinel.service.ports.sentinel }}
81+
{{- else -}}
82+
{{ .Values.redis.master.service.ports.redis }}
83+
{{- end -}}
84+
{{- end -}}

deploy/charts/litellm/templates/deployment.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,17 @@ spec:
142142
secretKeyRef:
143143
name: {{ include "litellm.fullname" . }}-masterkey
144144
key: masterkey
145+
{{- if .Values.redis.enabled }}
146+
- name: REDIS_HOST
147+
value: {{ include "litellm.redis.serviceName" . }}
148+
- name: REDIS_PORT
149+
value: {{ include "litellm.redis.port" . | quote }}
150+
- name: REDIS_PASSWORD
151+
valueFrom:
152+
secretKeyRef:
153+
name: {{ include "redis.secretName" .Subcharts.redis }}
154+
key: {{include "redis.secretPasswordKey" .Subcharts.redis }}
155+
{{- end }}
145156
envFrom:
146157
{{- range .Values.environmentSecrets }}
147158
- secretRef:

deploy/charts/litellm/values.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ environmentSecrets: []
5555

5656
service:
5757
type: ClusterIP
58-
port: 8000
58+
port: 4000
5959

6060
ingress:
6161
enabled: false
@@ -87,6 +87,8 @@ proxy_config:
8787
api_key: eXaMpLeOnLy
8888
general_settings:
8989
master_key: os.environ/PROXY_MASTER_KEY
90+
# litellm_settings:
91+
# cache: true
9092

9193
resources: {}
9294
# We usually recommend not to specify default resources and to leave this as a conscious
@@ -166,3 +168,10 @@ postgresql:
166168
# existingSecret: ""
167169
# secretKeys:
168170
# userPasswordKey: password
171+
172+
# requires cache: true in config file
173+
# either enable this or pass a secret for REDIS_HOST, REDIS_PORT, REDIS_PASSWORD or REDIS_URL
174+
# with cache: true to use existing redis instance
175+
redis:
176+
enabled: false
177+
architecture: standalone

0 commit comments

Comments
 (0)