-
Notifications
You must be signed in to change notification settings - Fork 281
/
truefoundry.yaml
442 lines (433 loc) · 12.9 KB
/
truefoundry.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
type: application-set
name: cognita-app-set
components:
# indexer
- name: cas-indexer
env:
LOG_LEVEL: DEBUG
DATABASE_URL: postgresql://admin:[email protected]:5432/cognita-config
VECTOR_DB_CONFIG: >-
{"provider":"qdrant","url":"http://cas-qdrant.cognita-internal.svc.cluster.local:6333","api_key":""}
MODELS_CONFIG_PATH: ./models_config.truefoundry.yaml
METADATA_STORE_CONFIG: '{"provider":"prisma"}'
ML_REPO_NAME: cognita-internal
INFINITY_API_KEY: tfy-secret://internal:cognita:INFINITY_API_KEY
UNSTRUCTURED_IO_URL: http://cas-unstructured-io.cognita-internal.svc.cluster.local:8000
UNSTRUCTURED_IO_API_KEY: tfy-secret://internal:cognita:UNSTRUCTURED_IO_API_KEY
type: job
image:
type: build
build_spec:
type: dockerfile
command: >-
/bin/bash -c "set -e; prisma generate --schema ./backend/database/schema.prisma && python -m backend.indexer.main --collection_name {{collection_name}}
--data_source_fqn {{data_source_fqn}} --data_ingestion_run_name
{{data_ingestion_run_name}} --data_ingestion_mode {{data_ingestion_mode}}
--raise_error_on_failure {{raise_error_on_failure}}"
dockerfile_path: ./backend/Dockerfile
build_context_path: ./
build_source:
local_build: false
type: local
params:
- name: collection_name
param_type: string
- name: data_source_fqn
default: ""
param_type: string
- name: data_ingestion_run_name
default: ""
param_type: string
- name: data_ingestion_mode
default: INCREMENTAL
param_type: string
- name: raise_error_on_failure
default: "False"
param_type: string
retries: 0
trigger:
type: manual
resources:
node:
type: node_selector
capacity_type: spot_fallback_on_demand
cpu_limit: 1.5
cpu_request: 1
memory_limit: 1500
memory_request: 1000
ephemeral_storage_limit: 2000
ephemeral_storage_request: 1000
# Backend
- name: cas-backend
env:
DATABASE_URL: postgresql://admin:[email protected]:5432/cognita-config
LOG_LEVEL: DEBUG
VECTOR_DB_CONFIG: >-
{"provider":"qdrant","url":"http://cas-qdrant.cognita-internal.svc.cluster.local:6333","api_key":""}
JOB_COMPONENT_NAME: cognita-internal-indexer
JOB_FQN: tfy-prod-euwe1:cognita-internal:cas-indexer
MODELS_CONFIG_PATH: ./models_config.truefoundry.yaml
METADATA_STORE_CONFIG: '{"provider":"prisma"}'
ML_REPO_NAME: cognita-internal
INFINITY_API_KEY: tfy-secret://internal:cognita:INFINITY_API_KEY
UNSTRUCTURED_IO_URL: http://cas-unstructured-io.cognita-internal.svc.cluster.local:8000
UNSTRUCTURED_IO_API_KEY: tfy-secret://internal:cognita:UNSTRUCTURED_IO_API_KEY
BRAVE_API_KEY: tfy-secret://internal:cognita:BRAVE_API_KEY
type: service
image:
type: build
build_spec:
type: dockerfile
command: /bin/bash -c "set -e; prisma db push --schema ./backend/database/schema.prisma && uvicorn --host 0.0.0.0 --port 8000 backend.server.app:app"
dockerfile_path: ./backend/Dockerfile
build_context_path: ./
build_source:
local_build: false
type: local
ports:
- host: cas.truefoundry.com
path: /api/
port: 8000
expose: true
protocol: TCP
app_protocol: http
replicas: 1
resources:
node:
type: node_selector
capacity_type: spot_fallback_on_demand
cpu_limit: 1
cpu_request: 0.5
memory_limit: 1000
memory_request: 500
ephemeral_storage_limit: 2000
ephemeral_storage_request: 1000
liveness_probe:
config:
path: /health-check
port: 8000
type: http
period_seconds: 60
timeout_seconds: 2
failure_threshold: 5
success_threshold: 1
initial_delay_seconds: 10
readiness_probe:
config:
path: /health-check
port: 8000
type: http
period_seconds: 60
timeout_seconds: 2
failure_threshold: 5
success_threshold: 1
initial_delay_seconds: 10
mounts:
- type: string
mount_path: /models_config.truefoundry.yaml
data: |
model_providers:
- provider_name: truefoundry
api_format: openai
base_url: https://llm-gateway.truefoundry.com/api/inference/openai
api_key_env_var: TFY_API_KEY
llm_model_ids:
- "openai-main/gpt-4o-mini"
- "openai-main/gpt-4-turbo"
- "azure-openai/gpt-4"
- "together-ai/llama-3-70b-chat-hf"
embedding_model_ids:
- "openai-main/text-embedding-3-small"
- "openai-main/text-embedding-ada-002"
reranking_model_ids: []
default_headers:
"X-TFY-METADATA": '{"tfy_log_request": "true", "Custom-Metadata": "Cognita-LLM-Request"}'
- provider_name: local-infinity
api_format: openai
base_url: http://cas-infinity.cognita-internal.svc.cluster.local:8000
api_key_env_var: INFINITY_API_KEY
llm_model_ids: []
embedding_model_ids:
- "mixedbread-ai/mxbai-embed-large-v1"
reranking_model_ids:
- "mixedbread-ai/mxbai-rerank-xsmall-v1"
default_headers: {}
- provider_name: faster-whisper
api_format: openai
base_url: http://cas-whisper.cognita-internal.svc.cluster.local:8000
api_key_env_var: ""
llm_model_ids: []
embedding_model_ids: []
reranking_model_ids: []
audio_model_ids:
- "Systran/faster-distil-whisper-large-v3"
default_headers: {}
# Frontend
- name: cas-frontend
type: service
image:
type: build
build_spec:
type: dockerfile
build_args:
VITE_DOCS_QA_DELETE_COLLECTIONS: "true"
VITE_QA_FOUNDRY_URL: https://cas.truefoundry.com/api
VITE_DOCS_QA_STANDALONE_PATH: /
VITE_DOCS_QA_ENABLE_STANDALONE: "true"
VITE_DOCS_QA_MAX_UPLOAD_SIZE_MB: 200
dockerfile_path: ./frontend/Dockerfile
build_context_path: ./frontend
build_source:
local_build: false
type: local
ports:
- host: cas.truefoundry.com
port: 5000
expose: true
protocol: TCP
app_protocol: http
replicas: 1
resources:
cpu_limit: 0.1
cpu_request: 0.05
memory_limit: 200
memory_request: 100
ephemeral_storage_limit: 200
ephemeral_storage_request: 100
- name: cas-qdrant
type: helm
source:
type: helm-repo
chart: qdrant
version: 0.8.4
repo_url: https://qdrant.github.io/qdrant-helm
values:
service:
type: ClusterIP
ports:
- name: http
port: 6333
protocol: TCP
targetPort: 6333
checksEnabled: true
- name: grpc
port: 6334
protocol: TCP
targetPort: 6334
checksEnabled: false
- name: http-p2p
port: 6335
protocol: TCP
targetPort: 6335
checksEnabled: false
persistence:
size: 50G
tolerations:
- key: kubernetes.azure.com/scalesetpriority
value: spot
effect: NoSchedule
operator: Equal
- key: cloud.google.com/gke-spot
value: "true"
effect: NoSchedule
operator: Equal
replicaCount: 2
fullnameOverride: cas-qdrant
kustomize:
additions:
- kind: VirtualService
spec:
http:
- match:
- uri:
prefix: /qdrant/
route:
- destination:
host: cas-qdrant.cognita-internal.svc.cluster.local
port:
number: 6333
rewrite:
uri: /
- match:
- headers:
x-route-service:
exact: qdrant-ui
route:
- destination:
host: cas-qdrant.cognita-internal.svc.cluster.local
port:
number: 6333
rewrite:
uri: /
hosts:
- cas-qdrant-ui.truefoundry.com
gateways:
- istio-system/tfy-wildcard
metadata:
name: cas-qdrant
namespace: cognita-internal
apiVersion: networking.istio.io/v1alpha3
# Qdrant-UI
- name: cas-qdrant-ui
type: service
image:
type: build
build_source:
type: git
repo_url: https://github.com/truefoundry/qdrant-web-ui-new
branch_name: support-path-based-routing
ref: 038f5a4db22b54459e1820ab2ec51771f8f09919
build_spec:
type: dockerfile
dockerfile_path: ./Dockerfile
build_context_path: ./
ports:
- host: cas-qdrant-ui.truefoundry.com
path: /qdrant-ui/
port: 3000
expose: true
protocol: TCP
app_protocol: http
mounts: []
replicas: 1
resources:
node:
type: node_selector
capacity_type: spot_fallback_on_demand
cpu_request: 0.2
cpu_limit: 0.5
memory_request: 200
memory_limit: 500
ephemeral_storage_request: 1000
ephemeral_storage_limit: 2000
# Unstructured IO
- name: cas-unstructured-io
env:
UNSTRUCTURED_API_KEY: tfy-secret://internal:cognita:UNSTRUCTURED_IO_API_KEY
type: service
image:
type: image
image_uri: downloads.unstructured.io/unstructured-io/unstructured-api:0.0.73
ports:
- port: 8000
expose: false
protocol: TCP
app_protocol: http
mounts: []
replicas: 2
resources:
node:
type: node_selector
capacity_type: spot_fallback_on_demand
cpu_limit: 1.5
cpu_request: 0.8
memory_limit: 8000
memory_request: 4000
ephemeral_storage_limit: 2000
ephemeral_storage_request: 1500
# Infinity
- env:
PORT: "8000"
API_KEY: tfy-secret://internal:cognita:INFINITY_API_KEY
BATCH_SIZE: "4"
name: cas-infinity
type: service
image:
type: image
command: >-
infinity_emb v2 --model-id mixedbread-ai/mxbai-embed-large-v1 --model-id
mixedbread-ai/mxbai-rerank-xsmall-v1 --port $(PORT) --batch-size
$(BATCH_SIZE) --api-key $(API_KEY)
image_uri: michaelf34/infinity:0.0.63
ports:
- port: 8000
expose: false
protocol: TCP
app_protocol: http
mounts: []
replicas: 2
resources:
node:
type: node_selector
capacity_type: spot_fallback_on_demand
cpu_limit: 1
cpu_request: 0.8
memory_limit: 8000
memory_request: 4000
ephemeral_storage_limit: 2000
ephemeral_storage_request: 1500
# Database
- name: cas-db
type: helm
source:
type: oci-repo
oci_chart_url: oci://registry-1.docker.io/bitnamicharts/postgresql
version: 13.4.3
values:
auth:
database: cognita-config
password: password
username: admin
postgresPassword: password
enablePostgresUser: true
primary:
service:
ports:
postgresql: 5432
resources:
limits:
cpu: 100m
memory: 256Mi
requests:
cpu: 100m
memory: 256Mi
persistence:
size: 5Gi
architecture: standalone
# Whisper
- name: cas-whisper
env:
WHISPER_PORT: 8000
WHISPER__MODEL: Systran/faster-distil-whisper-large-v3
WHISPER__INFERENCE_DEVICE: auto
type: service
image:
type: image
image_uri: fedirz/faster-whisper-server:latest-cpu
ports:
- port: 8000
expose: false
protocol: TCP
app_protocol: http
mounts: []
replicas: 1
resources:
node:
type: node_selector
capacity_type: spot_fallback_on_demand
cpu_limit: 1
cpu_request: 0.8
memory_limit: 8000
memory_request: 4000
ephemeral_storage_limit: 4000
ephemeral_storage_request: 2500
liveness_probe:
config:
path: /health
port: 8000
type: http
period_seconds: 60
timeout_seconds: 2
failure_threshold: 5
success_threshold: 1
initial_delay_seconds: 10
readiness_probe:
config:
path: /health
port: 8000
type: http
period_seconds: 30
timeout_seconds: 2
failure_threshold: 5
success_threshold: 1
initial_delay_seconds: 10