fleet-memory/hindsight-api/hindsight_api/engine/providers
Nicolò Boschi 861295dd7c
refactor: replace set_gemini_safety_settings() with LLMProvider.with_config() (#474)
* refactor: replace set_gemini_safety_settings() with LLMProvider.with_config()

Removes the fragile ContextVar-setter pattern where callers had to remember
to call set_gemini_safety_settings() at every operation entry point.

Instead, LLMProvider.with_config(resolved_config) returns a
ConfiguredLLMProvider wrapper that:
- injects per-bank settings (Gemini safety settings) on every call via
  token-based ContextVar set/reset — properly scoped, no leakage
- proxies all attribute access to the underlying provider via __getattr__
- requires zero changes to LLMInterface or any provider implementations

Call sites (retain, reflect, consolidation) now pass
llm_config.with_config(resolved_config) to sub-components instead of
setting a global context var and hoping nothing else runs in between.
This pattern also composes naturally with a future per-bank provider
factory: callers always receive something with a .call() method.

* fix: pass messages/tools as kwargs in ConfiguredLLMProvider to preserve class-level patch compatibility
2026-03-03 15:00:32 +01:00
..
__init__.py feat: support for codex and claude-code as llm (#276) 2026-02-02 12:54:44 +01:00
anthropic_llm.py feat: add otel traceability (#330) 2026-02-10 12:20:48 +01:00
claude_code_llm.py fix: resolve JSON serialization and logging exception propagation in claude_code_llm (#458, #459) (#461) 2026-03-02 10:14:16 +01:00
codex_llm.py feat: add otel traceability (#330) 2026-02-10 12:20:48 +01:00
gemini_llm.py refactor: replace set_gemini_safety_settings() with LLMProvider.with_config() (#474) 2026-03-03 15:00:32 +01:00
mock_llm.py fix(performance): improve recall and retain performance on large banks (#469) 2026-03-03 13:35:22 +01:00
openai_compatible_llm.py feat: support Batch API for retain (openai/groq) (#365) 2026-02-16 13:31:50 +01:00