Context enricher
Defines a base class for context enrichers used in Gen AI applications.
References
[1] https://learn.microsoft.com/en-us/azure/architecture/ai-ml/guide/rag/rag-enrichment-phase
BaseContextEnricher
Bases: Component, ABC
An abstract base class for the context enrichers used in Gen AI applications.
This class extends the Component base class to provide context enrichment functionality for chunks of text or binary data. Subclasses must implement the enrich method to define specific enrichment behavior.
enrich(chunks)
abstractmethod
async
Enrich a list of chunks with additional context.
This abstract method must be implemented by subclasses to define their specific enrichment behavior.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chunks |
list[Chunk]
|
List of Chunk objects to enrich. Must not be None. |
required |
Returns:
| Type | Description |
|---|---|
list[Chunk]
|
list[Chunk]: List of enriched Chunk objects. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the method is not implemented. |