Skip to content

Add settings to Model base class #2136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

svilupp
Copy link
Contributor

@svilupp svilupp commented Jul 5, 2025

Fixes #2119

The implementation follows the suggestion by @DouweM

This PR:

  • implements a settings field in the Model class
  • adapts the settings resolution to go in this order: model settings < agent model settings < run-specific model settings
  • adds 2 updates to the docs to mention how to use this feature with FallbackModel and the new settings hierarchy
  • tests for the settings handling - it's in a separate file as it's a separate behavior, or should I merge it with other tests?

# Issues Encountered

  • Found various "special" model classes inheriting from the core Model superclass (instrumentedmodel, testmodel, wrappermodel, fallbackmodel)

I dediced on the following behaviour -- any thoughts?

  • Wrapper/Fallback Models: Should use the underlying model's settings, not have their own
  • Instrumented Models: Keep existing behaviour/fields unchanged (it literary has a field called settings, so I had to change the field definition to be self.settings: ModelSettings | InstrumentationSettings | None = settings
  • TestModel: Added settings field for API consistency

Next Steps

  • Agree the correct behavior/design for the complicated model classes
  • Perhaps I could refactor some wrapper code (tried to resolve the right settings in agent.run()) to be a separate utility with its own tests?

Copy link
Contributor

hyperlint-ai bot commented Jul 5, 2025

PR Change Summary

Enhanced the Model base class by introducing a settings field and updating the documentation to reflect the new settings hierarchy.

  • Implemented a settings field in the Model class.
  • Established a settings resolution order: model settings, agent model settings, and run-specific model settings.
  • Updated documentation to explain the new settings feature and hierarchy.
  • Added tests for settings handling.

Modified Files

  • docs/agents.md
  • docs/models/index.md

How can I customize these reviews?

Check out the Hyperlint AI Reviewer docs for more information on how to customize the review.

If you just want to ignore it on this PR, you can add the hyperlint-ignore label to the PR. Future changes won't trigger a Hyperlint review.

Note specifically for link checks, we only check the first 30 links in a file and we cache the results for several hours (for instance, if you just added a page, you might experience this). Our recommendation is to add hyperlint-ignore to the PR to ignore the link check for this PR.

@DouweM DouweM self-assigned this Jul 7, 2025
Copy link
Contributor

@DouweM DouweM left a comment

Choose a reason for hiding this comment

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

@svilupp Thanks for working on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FallbackModel to allow model_settings specific to each model
3 participants