Skip to content

feat: Introduce ManagedModel and ModelRunner (PR-3)#104

Open
jsonbailey wants to merge 6 commits intomainfrom
jb/aic-1664/managed-model
Open

feat: Introduce ManagedModel and ModelRunner (PR-3)#104
jsonbailey wants to merge 6 commits intomainfrom
jb/aic-1664/managed-model

Conversation

@jsonbailey
Copy link
Contributor

@jsonbailey jsonbailey commented Mar 11, 2026

feat: Add ModelRunner ABC with invoke_model() and invoke_structured_model()
feat: Add ManagedModel replacing Chat; expose get_model_runner() escape hatch
feat!: Rename ChatResponse to ModelResponse in providers/types.py
feat!: Extract OpenAIModelRunner from OpenAIRunnerFactory; factory is now model-creation-only
feat!: Extract LangChainModelRunner from LangChainRunnerFactory; factory is now model-creation-only
feat: Add OpenAIHelper with shared utilities for model and future agent runners
feat: Add LangChainHelper with shared utilities for model and future agent runners
feat: Add create_model(); deprecate create_chat()


Note

High Risk
High risk because it introduces breaking API changes (ChatResponseModelResponse, create_chatcreate_model, provider factories now return ModelRunners) and rewires judge/model invocation plumbing, which could break downstream integrations despite added shims.

Overview
Introduces a new runtime abstraction for model execution. Adds ModelRunner and ManagedModel, shifting conversation management and metrics tracking into ManagedModel while providers now return configured runner instances.

API surface is refactored (with breaking changes + shims). ChatResponse is renamed to ModelResponse, LDAIClient.create_model() is added and create_chat() is deprecated (and ldai.chat.Chat becomes a deprecated alias of ManagedModel). Judge now depends on a ModelRunner instead of an AIProvider.

Provider packages are reorganized around runners and helpers. OpenAI and LangChain split invocation logic into *ModelRunner classes and extract shared utilities into *Helper; their *RunnerFactory classes are reduced to model construction only, with tests updated accordingly.

Written by Cursor Bugbot for commit c2f7475. This will update automatically on new commits. Configure here.

@jsonbailey jsonbailey changed the title feat!: Introduce ManagedModel and ModelRunner (PR 3) feat!: Introduce ManagedModel and ModelRunner (PR-3) Mar 11, 2026
@jsonbailey jsonbailey force-pushed the jb/aic-1664/managed-model branch from 39bac26 to 3fc5d47 Compare March 11, 2026 18:36
@jsonbailey jsonbailey force-pushed the jb/aic-1664/adapter-executor-factory branch from 4bef65c to e10be52 Compare March 25, 2026 14:33
Base automatically changed from jb/aic-1664/adapter-executor-factory to main March 25, 2026 17:20
feat: Add ModelRunner ABC with invoke_model() and invoke_structured_model()
feat: Add ManagedModel replacing Chat; expose get_model_runner() escape hatch
feat!: Rename ChatResponse to ModelResponse in providers/types.py
feat!: Extract OpenAIModelRunner from OpenAIRunnerFactory; factory is now model-creation-only
feat!: Extract LangChainModelRunner from LangChainRunnerFactory; factory is now model-creation-only
feat: Add OpenAIHelper with shared utilities for model and future agent runners
feat: Add LangChainHelper with shared utilities for model and future agent runners
feat!: LangChainRunnerFactory is now a no-arg factory; static helpers moved to LangChainHelper
fix: LDClient.create_chat() is deprecated in favour of create_model()
fix: Chat alias in ldai.chat is deprecated in favour of ManagedModel
fix: Rename ai_provider param to model_runner in Judge and ManagedModel
@jsonbailey jsonbailey force-pushed the jb/aic-1664/managed-model branch from 3fc5d47 to fc3880c Compare March 25, 2026 17:49
@jsonbailey jsonbailey marked this pull request as ready for review March 25, 2026 17:54
@jsonbailey jsonbailey requested a review from a team as a code owner March 25, 2026 17:54
@jsonbailey jsonbailey changed the title feat!: Introduce ManagedModel and ModelRunner (PR-3) feat: Introduce ManagedModel and ModelRunner (PR-3) Mar 25, 2026
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

…ve unused import

- Restore mutable structured_response pattern from f951dac so raw_response
  and usage are preserved even when an exception occurs after partial extraction
- Rename LangChainHelper.convert_messages -> convert_messages_to_langchain
- Rename OpenAIHelper.convert_messages -> convert_messages_to_openai
- Remove unused TokenUsage import from openai_model_runner.py
- Fix runner_factory.create_model return type to Optional[ModelRunner]
- Fix isort in langchain/openai runner and helper files
- Fix isort in ldai/__init__.py and client.py

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant