Merged
Conversation
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideFixes a misspelled LLM configuration field for memory length limit across config, implementation, and tests, and bumps the project patch version to reflect the bugfix. Class diagram for LLMConfig memory_length_limit field renameclassDiagram
class LLMConfig {
+bool force_tool_usage
+int memory_length_limit
+int max_tokens
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- Renaming
memory_lenth_limittomemory_length_limitinLLMConfigis a breaking config change; consider adding a backwards-compatible alias or input validation that accepts the old key to avoid silently breaking existing user configs.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Renaming `memory_lenth_limit` to `memory_length_limit` in `LLMConfig` is a breaking config change; consider adding a backwards-compatible alias or input validation that accepts the old key to avoid silently breaking existing user configs.
## Individual Comments
### Comment 1
<location> `src/amrita_core/config.py:81` </location>
<code_context>
description="Whether to force at least one tool to be used per call",
)
- memory_lenth_limit: int = Field(
+ memory_length_limit: int = Field(
default=50, description="Maximum number of messages in memory context"
)
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Consider keeping a backward-compatible alias for the old `memory_lenth_limit` field name.
This rename fixes the typo but may break existing configs or stored data that still reference `memory_lenth_limit` (e.g., JSON/YAML config files or env vars). In Pydantic, you can keep `memory_length_limit` as the primary field while defining `memory_lenth_limit` as an alias (via `alias`/`field_alias` or model config) so older configs continue to work without errors.
Suggested implementation:
```python
# `memory_lenth_limit` kept as an alias for backward compatibility with existing configs
memory_length_limit: int = Field(
default=50,
description="Maximum number of messages in memory context",
alias="memory_lenth_limit",
)
```
Depending on your Pydantic version and how this model is used, you may also want to:
1. For Pydantic v1: in the model's `Config` class, set `allow_population_by_field_name = True` so both `memory_length_limit` and `memory_lenth_limit` can be used for input.
2. For Pydantic v2: in the model, set `model_config = ConfigDict(populate_by_name=True)` (or equivalent) to allow population by the new field name as well as the alias.
3. If there are serializers or exported schemas, confirm whether you want the new field name (`memory_length_limit`) to be emitted (via `by_alias=False`) or the legacy name (`memory_lenth_limit`) (`by_alias=True`).
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
Summary by Sourcery
Fix a typo in the LLM configuration memory limit field and propagate the corrected name across code and tests.
Bug Fixes:
Build:
Tests: