fleet-memory/hindsight-docs/docs/developer
Nicolò Boschi e408b7e072
feat: support litellm-sdk as reranker and embeddings (#357)
* feat: support litellm-sdk for reranker endpoint

* feat: support litellm-sdk for reranker endpoint

* fix: make litellm SDK cohere test fixture async function-scoped

* fix: store litellm module reference during initialization to avoid import issues

* feat: add LiteLLM SDK embeddings support

- Add LiteLLMSDKEmbeddings class for direct API access without proxy
- Support multiple providers: Cohere, OpenAI, Together AI, HuggingFace, Voyage AI
- Automatic dimension detection via test embedding
- Provider-specific API key mapping
- Batch processing support (configurable batch size)
- Comprehensive test coverage (17 unit tests)
- Update documentation with configuration examples

Implements embeddings in same PR as reranker per user request

* fix: correct config mocking in embeddings factory tests

- Mock get_config() from its source module (hindsight_api.config)
- Fixes factory tests that were returning LocalSTEmbeddings instead of LiteLLMSDKEmbeddings
- All 17 unit tests now passing

* fix: skip Cohere integration tests when API key is invalid

- Catch initialization errors and skip tests instead of failing
- Prevents CI failures when COHERE_API_KEY is set but invalid
- Integration tests now properly skip when authentication fails

* fix: skip Cohere reranker integration tests when API key is invalid

- Add same error handling as embeddings tests
- Prevents CI failures when COHERE_API_KEY is set but invalid
- Tests now properly skip when authentication fails

* Revert "fix: skip Cohere reranker integration tests when API key is invalid"

This reverts commit 655dacaffb25851ff48e202b4379fc8332a66df7.

* Revert "fix: skip Cohere integration tests when API key is invalid"

This reverts commit 5d00548e39faa3da6b427ace89589a216816f9e7.

* fix: pass API key directly to litellm SDK functions

- Add api_key parameter to arerank(), rerank(), aembedding(), and embedding() calls
- Prevents authentication issues in multi-process environments (pytest-xdist)
- More reliable than relying solely on environment variables
- Update test assertions to expect api_key parameter

* feat: pass api_base parameter to litellm SDK calls and remove hasattr check

* fix: raise errors instead of silently returning 0.0 scores

* refactor: pass API keys directly in kwargs instead of setting env vars
2026-02-12 23:53:12 +01:00
..
api fix: misc fixes for observations and mental models (#209) 2026-01-27 15:37:57 +01:00
admin-cli.md chore: internal renames (#204) 2026-01-27 09:53:28 +01:00
configuration.md feat: support litellm-sdk as reranker and embeddings (#357) 2026-02-12 23:53:12 +01:00
development.md rename to hindsight (#2) 2025-11-25 19:28:26 +01:00
extensions.md doc: prepare doc for 0.4.10 (#325) 2026-02-09 11:42:37 +01:00
index.md fix: misc fixes for observations and mental models (#209) 2026-01-27 15:37:57 +01:00
installation.md Replace waitlist links with direct Hindsight Cloud signup URL (#349) 2026-02-11 20:51:32 +01:00
mcp-server.md Fix incorrect MCP tool parameters in docs (#358) 2026-02-12 08:52:05 -07:00
models.md doc: update claude-code usage terms (#315) 2026-02-06 16:53:12 +01:00
monitoring.md feat: add otel traceability (#330) 2026-02-10 12:20:48 +01:00
multilingual.md chore: internal renames (#204) 2026-01-27 09:53:28 +01:00
observations.mdx fix: misc fixes for observations and mental models (#209) 2026-01-27 15:37:57 +01:00
performance.md fix: misc fixes for observations and mental models (#209) 2026-01-27 15:37:57 +01:00
rag-vs-hindsight.md doc: mental models (#199) 2026-01-26 14:27:08 +01:00
reflect.mdx fix: misc fixes for observations and mental models (#209) 2026-01-27 15:37:57 +01:00
retain.md chore: internal renames (#204) 2026-01-27 09:53:28 +01:00
retrieval.md chore: internal renames (#204) 2026-01-27 09:53:28 +01:00
services.md doc: mental models (#199) 2026-01-26 14:27:08 +01:00
storage.md bump pg0 0.11.x and improve documentation (#33) 2025-12-16 13:33:01 +01:00