Skip to content

Implemented Schema-Aware In-Session Caching to Optimize LLM Visualization Recommendations#69

Open
ojumah20 wants to merge 1 commit into
PlotSenseAI:developfrom
ojumah20:ojumah20-visual_suggestion
Open

Implemented Schema-Aware In-Session Caching to Optimize LLM Visualization Recommendations#69
ojumah20 wants to merge 1 commit into
PlotSenseAI:developfrom
ojumah20:ojumah20-visual_suggestion

Conversation

@ojumah20
Copy link
Copy Markdown
Contributor

@ojumah20 ojumah20 commented Nov 7, 2025

Summary

This PR introduces a robust in-session caching layer for the visualization recommendation pipeline.
It significantly improves performance, reduces duplicate LLM calls, and ensures deterministic, privacy-safe caching across sessions.

Key Changes

Added viz_cache.py:

Implements MemoryTTLCache (thread-safe, TTL, LRU, dogpile-safe).

Includes metrics (hits, misses, evictions, hit_rate, etc.).

Supports namespaced keys (model: / ensemble:).

Optional background cleanup and TTL jitter.

Updated recommender.py:

Integrated caching at model-response and ensemble-result levels.

Added version pins (code_version, prompt_version) to auto-invalidate old cache entries.

Added debug mode cache stats for visibility.

Introduced schema_signature()-based keys to ensure privacy (no row data stored).

Updated package-level init.py for clean imports and reusability.

@christianchimezie
Copy link
Copy Markdown
Collaborator

christianchimezie commented Nov 13, 2025

Hi @ojumah20, there are some conflicts that need to be addressed before the merge; can you investigate, please?

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

Labels

enhancement New feature or request

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants