Skip to content

Feat/context windows#816

Merged
jmharold merged 10 commits intodevelopfrom
feat/context-windows
Mar 11, 2026
Merged

Feat/context windows#816
jmharold merged 10 commits intodevelopfrom
feat/context-windows

Conversation

@jmharold
Copy link
Contributor

@jmharold jmharold commented Mar 5, 2026

Description of changes:

  • Adds a new step in our create model state machine to infer the context window of LISA hosted and Third Party models.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_window for 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.


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", {})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised we aren't maintaining this as a field.

@jmharold jmharold marked this pull request as ready for review March 11, 2026 15:59
@jmharold jmharold merged commit 913d895 into develop Mar 11, 2026
12 checks passed
@jmharold jmharold deleted the feat/context-windows branch March 11, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants