Reorganize the `config` module
What does this merge request do and why?
This MR reorganizes the config
module to make it less error-prone, stable, and generic.
Note that we are not changing the configuration logic and are still using env variables with slightly updated names and the additional type validation provided by pydantic
and pydantic_settings
.
Changes:
- all env variables related to the old
config.py
have been prefixed withAIGW_
, i.e., AI Gateway. - we have 8 groups of options:
logging
,fastapi
,auth
,google_cloud_profiler
,f
,snowplow
,vertex_text_model
,model_engine_concurrency_limits
. - setting group options now requires adding an extra underscore to the env variable. E.g.,
AIGW_FASTAPI__API_HOST
is translated toconfig.fast_api.api_host
. - legacy env variables, such as
F_IS_THIRD_PARTY_AI_DEFAULT
, have been removed. - several env variables, such as
PALM_TEXT_PROJECT
have been renamed.
Related conversation - https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist/-/issues/359#note_1680248624
Blocked by - !530 (merged)
How to set up and validate locally
- Check out to this merge request's branch.
- Ensure a local Docker image built successfully.
docker buildx build --platform linux/amd64 \ -t ai-gateway:dev .
- Run a local service on Docker.
docker run --platform linux/amd64 --rm \ -p 5052:5052 \ -e AIGW_AUTH__BYPASS_EXTERNAL=true \ -v $PWD:/app -it ai-gateway:dev
Merge request checklist
-
Tests added for new functionality. If not, please raise an issue to follow up. -
Documentation added/updated, if needed.
Edited by Tan Le