-
Notifications
You must be signed in to change notification settings - Fork 5
Memiris: Harden memory management
#456
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
Hialus
wants to merge
19
commits into
main
Choose a base branch
from
chore/memiris/improve-prompts
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
6545aa8
Improve Memiris prompts
Hialus cd14e15
Improve prompts and add retry logic
Hialus e0eddc3
Actually configure retry logic in Iris
Hialus 68e91bd
Improve prompts further
Hialus a7fa41b
Improve prompts further
Hialus 8208fd7
Add memiris stage to exercise chat
Hialus 3b450d2
Enable memory reporting for exercise chat
Hialus e732a91
Fine tune memory connector
Hialus 91c6181
Experimental: Improve learning extraction prompts
Hialus c8b1228
Encourage Memiris usage
Hialus 0521732
Improve memory creator prompt
Hialus e80812d
Improve memory creator prompt
Hialus 3b23f58
Improve memory creator parser
Hialus 2c9b4c4
Improve memory sleep
Hialus 2f88bd0
Encourage Memiris usage
Hialus bd9366f
Log memiris tool usage
Hialus 6286aad
Encourage Memiris usage
Hialus fcf46b2
Clear vectors in tools
Hialus ccae387
Improve focus prompts further
Hialus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| """ | ||
| API-level service for configuring global LLM behaviour. | ||
|
|
||
| Example:: | ||
|
|
||
| from memiris.api.llm_config_service import LlmConfigService | ||
| from memiris.llm.retry_config import RetryConfig | ||
|
|
||
| LlmConfigService.configure_retry( | ||
| RetryConfig(max_attempts=5, initial_delay=2.0, backoff_factor=2.0) | ||
| ) | ||
| """ | ||
|
|
||
| from typing import Optional, Tuple, Type | ||
|
|
||
| from memiris.llm.retry_config import ( | ||
| RetryConfig, | ||
| get_retry_config, | ||
| set_retry_config, | ||
| ) | ||
|
|
||
Hialus marked this conversation as resolved.
Show resolved
Hide resolved
Hialus marked this conversation as resolved.
Show resolved
Hide resolved
Hialus marked this conversation as resolved.
Show resolved
Hide resolved
Hialus marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| class LlmConfigService: | ||
| """Service for reading and updating the global LLM configuration. | ||
|
|
||
| All methods are class-methods so no instantiation is required. | ||
| """ | ||
|
|
||
| @classmethod | ||
| def configure_retry( | ||
| cls, | ||
| config: RetryConfig, | ||
| ) -> None: | ||
| """Replace the process-wide LLM retry configuration. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| config: | ||
| The new :class:`~memiris.llm.retry_config.RetryConfig` to apply | ||
| to every subsequent LLM call in the process. | ||
| """ | ||
| set_retry_config(config) | ||
|
|
||
| @classmethod | ||
| def configure_retry_params( | ||
| cls, | ||
| *, | ||
| max_attempts: Optional[int] = None, | ||
| initial_delay: Optional[float] = None, | ||
| backoff_factor: Optional[float] = None, | ||
| exceptions: Optional[Tuple[Type[BaseException], ...]] = None, | ||
| ) -> None: | ||
| """Update individual retry parameters while keeping the rest unchanged. | ||
|
|
||
| Only the keyword arguments that are explicitly provided will be | ||
| changed; all others are taken from the currently active config. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| max_attempts: | ||
| Total number of attempts (1 = no retry). | ||
| initial_delay: | ||
| Seconds to wait before the first retry. | ||
| backoff_factor: | ||
| Multiplier applied to the delay after each failed attempt. | ||
| exceptions: | ||
| Tuple of exception types that should trigger a retry. | ||
| """ | ||
| current = get_retry_config() | ||
| set_retry_config( | ||
| RetryConfig( | ||
| max_attempts=( | ||
| max_attempts if max_attempts is not None else current.max_attempts | ||
| ), | ||
| initial_delay=( | ||
| initial_delay | ||
| if initial_delay is not None | ||
| else current.initial_delay | ||
| ), | ||
| backoff_factor=( | ||
| backoff_factor | ||
| if backoff_factor is not None | ||
| else current.backoff_factor | ||
| ), | ||
| exceptions=exceptions if exceptions is not None else current.exceptions, | ||
| ) | ||
| ) | ||
|
|
||
| @classmethod | ||
| def get_retry_config(cls) -> RetryConfig: | ||
| """Return the currently active process-wide retry configuration.""" | ||
| return get_retry_config() | ||
|
|
||
| @classmethod | ||
| def reset_retry_config(cls) -> None: | ||
| """Reset the retry configuration to the built-in defaults.""" | ||
| set_retry_config(RetryConfig()) | ||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.