RAG
Auxiliary types for RAG System
Query
¶
Bases: _MultiModalDataContainer
Query data structure.
This class represents a multimodal representation of a RAG query.
Attributes:
Name | Type | Description |
---|---|---|
text |
str
|
Text content of query. |
images |
list[Image] | None
|
Images content of query. |
audios |
list[Any] | None
|
Audios content of query. |
videos |
list[Any] | None
|
Videos content of query. |
Source code in src/fed_rag/data_structures/rag.py
Context
¶
Bases: _MultiModalDataContainer
Context data structure.
This class represents a multimodal representation of RAG context.
Attributes:
Name | Type | Description |
---|---|---|
text |
str
|
Text content of query. |
images |
list[Image] | None
|
Images content of query. |
audios |
list[Any] | None
|
Audios content of query. |
videos |
list[Any] | None
|
Videos content of query. |
Source code in src/fed_rag/data_structures/rag.py
Prompt
¶
Bases: _MultiModalDataContainer
Prompt data structure.
This class represents a multimodal representation of a prompt given to a multi-modal LLM.
Attributes:
Name | Type | Description |
---|---|---|
text |
str
|
Text content of query. |
images |
list[Image] | None
|
Images content of query. |
audios |
list[Any] | None
|
Audios content of query. |
videos |
list[Any] | None
|
Videos content of query. |
Source code in src/fed_rag/data_structures/rag.py
SourceNode
¶
Bases: BaseModel
Represents a source node with an associated score and a reference to a knowledge node.
This class is used to associate a score with a specific knowledge node, allowing for the evaluation or ranking of knowledge entities. It provides access to the underlying node's attributes and functionalities through a convenient getattr wrapper.
Attributes:
Name | Type | Description |
---|---|---|
score |
float
|
The score associated with the node, representing some metric of evaluation or importance. |
node |
KnowledgeNode
|
The knowledge node this source node is referencing. |
Source code in src/fed_rag/data_structures/rag.py
RAGResponse
¶
Bases: BaseModel
Represents a response object for a Retrieval-Augmented Generation (RAG) system.
This class is used to encapsulate information about the response including the generated response text, optional raw response details, and the source nodes leveraged in generating the response.
Attributes:
Name | Type | Description |
---|---|---|
response |
str
|
The generated response text from the RAG system. |
raw_response |
str | None
|
Optional raw response details, if available. |
source_nodes |
list[SourceNode]
|
A list of source nodes that were used to generate the response, each with an associated score and reference to a knowledge node. |