Skip to content

Conversation

TomeHirata
Copy link
Collaborator

Resolve #8717

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a fallback mechanism for the DSPy cache to gracefully handle environments where disk cache cannot be initialized (e.g., AWS Lambda). When disk cache creation fails, the system now falls back to a memory-only cache instead of failing completely.

Key changes:

  • Added a _get_dspy_cache() function that wraps cache initialization in a try-catch block
  • Modified cache initialization to fallback to memory-only cache when disk cache fails
  • Added test coverage for the fallback behavior in restricted environments

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
dspy/clients/init.py Implements cache fallback logic with new _get_dspy_cache() function
tests/clients/test_cache.py Adds test case for cache fallback behavior in restricted environments

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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.

[Bug] Disk caching is unconditionally enabled during initialization
1 participant