Feature: Per-preprocessor endpoint override (#973) - #1213
Conversation
…age init Co-authored-by: MansiDhanania <106432557+MansiDhanania@users.noreply.github.com>
|
Looks good, and I love that we have a more disciplined system. Couple things below. In addition, suggest:
|
This comment was marked as outdated.
This comment was marked as outdated.
aidanbruneel
left a comment
There was a problem hiding this comment.
@MansiDhanania I would like responses to these questions/concerns before approving.
aidanbruneel
left a comment
There was a problem hiding this comment.
Some further questions/concerns and also the PR description still shows the override at ./preprocessors/<name>/config/<name>.env, while the final implementation uses ./config/<preprocessor-name>.env. It also links to preprocessors/object-detection-llm/config/Readme.md, which doesn't appear to exist on this branch. Could you update the description to match the final implementation?
| The path to an environment file containing this variable should be provided in the `docker-compose.yml`, right in the `env_file` field of the `ocr-clouds-preprocessor` service. | ||
| ## Environment setup | ||
| The environment file (apis-and-selection.env) should contain the desired cloud service to be used, and the corresponding api keys. | ||
| The environment file (cloud-ocr.env) should contain the desired cloud service to be used, and the corresponding api keys. |
There was a problem hiding this comment.
This still seems inconsistent with the configuration above. cloud-ocr.env now contains the provider credentials, while CLOUD_SERVICE is selected directly in docker-compose.yml. Could we update this sentence accordingly?
| `docker-compose.yml` for the current list, as this may grow): | ||
| `content-categoriser`, `graphic-caption`, `text-followup`, `object-detection-llm`, `multistage-diagram-segmentation`. | ||
|
|
||
| The override functionality is applicable for any of the preprocessors. Check the preprocessor-specific `.env.example` file for setting env variables. |
There was a problem hiding this comment.
I see what you mean from your reply. I think this sentence is still a little ambiguous in this LLM-specific section, though. maps.env.example and cloud-ocr.env.example document shared/base configurations rather than examples of the <preprocessor-name>.env override described above. Could we say that the same layered env_file pattern can be used for other service configurations, while pointing LLM overrides specifically to llm.env.example?
aidanbruneel
left a comment
There was a problem hiding this comment.
Looks good to me :)
Related to #973
Summary
Extended and documented the per-preprocessor LLM configuration override pattern. This includes a shared default endpoint for all LLM-related preprocessors, with the ability for any individual preprocessor to override the endpoint/model independently.
Initial Tests and Results
@Miliya-Ai's tests showed that the specifications in
config/llm.envwork with any OpenAI-compatible cloud endpoint called viaclient.py. The endpoint is used for all preprocessors requiring this service.Changes made
In order to allow for different preprocessors, orchestrators or handlers to call a different endpoint, the following changes were incorporated:
The docker-compose.yml file was extended to include the paths to both a global and local
.envfile:The global llm.env is always loaded first. A preprocessor-specific file, if present, loads second and overrides only the variables it sets for that one preprocessor. If the override file doesn't exist, the preprocessor falls back to the shared default.
This addresses the issue as there now exists:
How I tested this
preprocessors/object-detection-llm/config/object-detection-llm.envcalling Qwen3.8 via Mallory, while leavingconfig/llm.envpointed at the default Gemma 4 Pegasus endpoint. Recreated only theobject-detection-llmcontainer via override and queried an image.object-detection-llmpicked up the Qwen override.content-categoriser) continued to call Gemma.Required Information
Coding/Commit Requirements
New Component Checklist (mandatory for new microservices)
docker-compose.ymlandbuild.yml..github/workflows.README.mdfile that describes what the component does and what it depends on (other microservices, ML models, etc.).OR