Conversation
There was a problem hiding this comment.
Pull request overview
Adds “context window” (max input tokens) enrichment to model metadata, both during model creation and via new admin APIs for retroactive enrichment / manual override.
Changes:
- Adds a new CreateModel state-machine step to infer and persist
context_windowfor LISA-hosted (S3 config) and third-party/Bedrock (LiteLLM) models. - Introduces admin API endpoints to bulk-enrich missing context windows and to manually set a model’s context window.
- Extends model domain/API output to include
contextWindow, with accompanying unit tests.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
lib/models/state-machine/create-model.ts |
Adds EnrichContextWindow Lambda step after adding model to LiteLLM. |
lambda/models/state_machine/create_model.py |
Implements enrichment helpers and handle_enrich_context_window to update DDB. |
lib/models/model-api.ts |
Wires env vars and IAM needed for enrichment and new handlers. |
lambda/models/lambda_functions.py |
Adds admin endpoints for bulk enrich and manual context-window update. |
lambda/models/handler/bulk_enrich_context_window_handler.py |
New handler to scan DDB and backfill context_window via LiteLLM/S3. |
lambda/models/handler/update_context_window_handler.py |
New handler to manually override context_window per model. |
lambda/models/handler/utils.py |
Maps DDB context_window to API field contextWindow. |
lambda/models/domain_objects.py |
Adds contextWindow to LISAModel + request/response models for new endpoints. |
test/lambda/test_create_model_state_machine.py |
Adds unit tests for enrichment logic and helpers. |
test/lambda/test_litellm.py |
Adds unit tests around get_model returning context window info. |
test/lambda/test_bulk_enrich_context_window_handler.py |
New unit test suite for bulk enrichment handler. |
package-lock.json |
Updates lockfile (workspace dependency graph changes). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bedanley
reviewed
Mar 10, 2026
bedanley
reviewed
Mar 10, 2026
|
|
||
| def _is_lisa_managed(model_item: dict) -> bool: | ||
| """Determine if a model is LISA-managed (has self-hosted ECS infrastructure).""" | ||
| model_config = model_item.get("model_config", {}) |
Contributor
There was a problem hiding this comment.
I'm surprised we aren't maintaining this as a field.
estohlmann
approved these changes
Mar 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.