Skip to content

feat: add retriever providers + embedder abstraction#16

Merged
himanshu231204 merged 6 commits into
mainfrom
feat/retriever-providers-embedder
Jul 9, 2026
Merged

feat: add retriever providers + embedder abstraction#16
himanshu231204 merged 6 commits into
mainfrom
feat/retriever-providers-embedder

Conversation

@himanshu231204

Copy link
Copy Markdown
Contributor

Summary

Expands the retriever layer from a single ChromaDB adapter to a full set of pluggable providers, and adds an Embedder abstraction so vector retrievers can embed queries/documents locally with Sentence-Transformers.

New retrievers (all lazy-imported, optional-dep gated)

  • memory — in-memory cosine vector store (NumPy, no external service) [tested]
  • bm25 — lexical BM25 baseline (rank-bm25) [tested]
  • http — generic REST/HTTP search endpoint (httpx) [tested]
  • qdrant, pinecone, weaviate, faiss, pgvector, elasticsearch — server/cloud vector & lexical stores

Embedder abstraction

  • Embedder base + SentenceTransformerEmbedder (all-MiniLM-L6-v2) + MockEmbedder
  • Wired via RetrieverConfig.embedder; auto-injected into vector retrievers by the factory

Other

  • Extracted shared score-normalization util (_scoring.py); refactored Chroma to use it
  • Added generate_with_usage to the Groq provider (the pipeline requires it)
  • Registered all providers in providers/factory.py; added pyproject.toml extras (qdrant, pinecone, weaviate, faiss, pgvector, elasticsearch, bm25)
  • Unit tests for scoring, embedders, memory/BM25/HTTP retrievers, and factory
  • Docs: docs/12_retrievers.md + updated docs/08_plugin_system.md

Verification

  • scripts/run_real_eval.py runs the full pipeline end-to-end against the real Groq API (llama-3.3-70b-versatile) with Sentence-Transformers embeddings + the in-memory retriever: 3/3 items evaluated, 0 failures, ~406 tokens, ~307ms avg latency.
  • tests/unit/test_providers/... + config/metrics suites: 150 passed, 2 skipped.

Notes

  • The 6 server/cloud retrievers are implemented and import-safe but not live-tested (require their respective services/API keys).
  • Pre-existing, out-of-scope gap: openai.py imports tiktoken but it is not declared in dependencies, so test_openai.py cannot collect in this environment.

Generated with OpenAgent Eval.

Test User added 2 commits July 10, 2026 01:30
…etrics)

The core pipeline was a stub that produced empty results. This wires the
full RAG evaluation flow and fixes several correctness/robustness bugs.

- Rewrite Pipeline._evaluate_item to retrieve, generate, and score per item
- Engine builds providers via providers.factory and resolves metrics from registry
- Add mock LLM + retriever for offline dry-run (no API keys required)
- Executor.gather for bounded parallel evaluation (honors D006)
- Fix recall_at_k to true recall (was binary, duplicated hit_rate)
- Pipeline._compute_summary now reports the real error count
- Hallucination metric no longer swallows all exceptions
- Cache heavy models (SentenceTransformer/Ragas) per metric instance
- Align config template + MetricsConfig defaults to registry metric names
- Add DatasetItemModel.ground_truth_contexts for retrieval evaluation
- Add mock end-to-end integration test + recall_at_k unit test
- Correct .ai/03_CONTEXT.md and 05_TASKS.md false 'complete' status
…weaviate, faiss, pgvector, elasticsearch) + embedder abstraction

- Add Embedder abstraction (sentence-transformers, mock) wired via RetrieverConfig.embedder
- Add in-memory cosine vector retriever (NumPy, no external service)
- Add BM25 lexical retriever and generic HTTP/REST retriever (httpx)
- Add Qdrant, Pinecone, Weaviate, FAISS, pgvector, Elasticsearch adapters (lazy, optional-dep gated)
- Extract shared score-normalization util; refactor Chroma to use it
- Add generate_with_usage to Groq provider (required by the pipeline)
- Register all providers in the factory; add pyproject optional-dependency extras
- Add unit tests for scoring, embedders, memory/BM25/HTTP retrievers, and factory
- Add docs/12_retrievers.md and update docs/08_plugin_system.md
- Add scripts/run_real_eval.py (verified end-to-end with real Groq + ST embeddings)
Copilot AI review requested due to automatic review settings July 9, 2026 20:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@himanshu231204 himanshu231204 self-assigned this Jul 9, 2026
…ization; skip HallucinationDetection tests without OPENAI_API_KEY

- BM25Retriever: handle empty corpus gracefully (return []) instead of raising
- BM25Retriever: convert get_scores ndarray to list before minmax_normalize
- test_generation: skip DeepEval-based HallucinationDetection tests when OPENAI_API_KEY is unset (pre-existing CI failure, unrelated to retriever work)
Returns:
List of vectors, one per input text, each of length ``dimension``.
"""
...
Comment thread openagent_eval/providers/retrievers/bm25.py Fixed
Comment thread openagent_eval/providers/retrievers/elasticsearch.py Fixed
Comment thread tests/unit/test_providers/test_http.py Fixed
himanshu231204 and others added 3 commits July 10, 2026 03:18
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
@himanshu231204 himanshu231204 merged commit a76d20a into main Jul 9, 2026
11 checks passed
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.

2 participants