Skip to content

Conversation

@philipph-askui
Copy link
Contributor

This PR implements the latest caching mechanism v0.1 with the following features

  • feat(caching): adds dynamic handover between agent and cache executor
  • feat(caching): introduces non-cacheable tools, that will always be executed by the agent
  • feat(caching): introduces placeholders, and automatic placeholder identification during cache generation
  • feat(caching): adds metadata to cache files
  • feat(caching): implements automatic cache invalidation
  • feat(caching): adds automatic cache file conversion from v0.0 format to v0.1 format
  • feat(caching, reporting): adds usage statistics, including consumed input and output tokens to cache files and reports
  • chore(caching): updates documentation

@@ -0,0 +1,351 @@
"""Manager for cache execution flow and state."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we move all the caching uitls to a caching sub folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in #e9e00987b01ccf6352cb7b00a324d7ff1fa213e7

)


class CacheManager:
Copy link
Collaborator

Choose a reason for hiding this comment

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

The functions here are verbose and long.

Is this realy necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in #34e372e6b5b91730c884ca201bb2d4ee6601f412

"""Raised when cache migration fails."""


class CacheMigration:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would remove the cache migration class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in #e6603eb703cdb81fa21676fe08423b55c8c07d0b

from askui.models.shared.settings import CacheFile


class CacheValidator(ABC):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we using the Validators already? Otherwise remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes we do. Per default, we use a composition (OR conjunction) of StepFailureCountValidator (invalidates if same step fails too many times), TotalFailureRateValidator (invalidates if overall failure rate is too high), and StaleCacheValidator (invalidates if cache is too hold and has at least one failure).

)
from askui.models.shared.tools import ToolCollection
from askui.utils.placeholder_handler import PlaceholderHandler
from askui.utils.placeholder_identifier import identify_placeholders

logger = logging.getLogger(__name__)


class CacheWriter:
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need to decouple here logic,

I would prefere that we introduce Domain Objects and delegate the placeholder replacement to them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in #21abeae0bdb843cd47d16f40f13555322f20d7d7

…ill be done automatically when reading v0.0 cache files
…ParameterHandler more consistently and renames `placeholder` to `caching_parameter`.
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.

3 participants