Spaces:
Running on Zero
Running on Zero
Download Embedding/base.py from nitish12309/Correctra-Rag: direct link, hf CLI and curl.
- Browser
- Download file 737 Bytes
-
https://huggingface.co/spaces/nitish12309/Correctra-Rag/resolve/main/Embedding/base.py
- Command line
-
hf download hf://spaces/nitish12309/Correctra-Rag/Embedding/base.py
-
curl -L -o base.py https://huggingface.co/spaces/nitish12309/Correctra-Rag/resolve/main/Embedding/base.py
737 Bytes
| from abc import ABC, abstractmethod | |
| class BaseEmbedding(ABC): | |
| """ | |
| Abstract Base Class for all Embedding Providers in the RAG pipeline. | |
| Enforces a consistent contract across local models (BGE) and remote APIs (Gemini/OpenAI). | |
| """ | |
| def dimension(self) -> int: | |
| """Returns the embedding vector size (e.g. 768 for BGE-base).""" | |
| pass | |
| def embed_query(self, query: str) -> list[float]: | |
| """Converts a single user query into an embedding vector.""" | |
| pass | |
| def embed_documents(self, documents: list[str]) -> list[list[float]]: | |
| """Converts a list of document chunks into embedding vectors.""" | |
| pass |