Description
Add an OpenAIEmbedder that calls the OpenAI Embeddings API (text-embedding-3-small by default).
Motivation
OpenAI embeddings are high-quality, widely used, and the most common starting point for RAG applications. This is the first "real" embedder that replaces the RandomEmbedder placeholder.
Acceptance criteria
Files to touch
ragframework/embeddings/openai.py — new file
ragframework/embeddings/__init__.py — export it
tests/test_embeddings/test_openai.py — new test file (use mocks)
Resources
Description
Add an
OpenAIEmbedderthat calls the OpenAI Embeddings API (text-embedding-3-smallby default).Motivation
OpenAI embeddings are high-quality, widely used, and the most common starting point for RAG applications. This is the first "real" embedder that replaces the
RandomEmbedderplaceholder.Acceptance criteria
OpenAIEmbedderinragframework/embeddings/openai.pyEmbedderfromragframework/base.pymodel(default:"text-embedding-3-small") andapi_key(falls back toOPENAI_API_KEYenv var)openaiSDK (already in[openai]extra inpyproject.toml)EmbedderErroron failureunittest.mockto avoid real API callsragframework/embeddings/__init__.pyexamples/or READMECHANGELOG.mdupdated under[Unreleased]Files to touch
ragframework/embeddings/openai.py— new fileragframework/embeddings/__init__.py— export ittests/test_embeddings/test_openai.py— new test file (use mocks)Resources
RandomEmbedderinragframework/embeddings/random_embedder.pyas reference