pyrit.memory.MemoryEmbedding#
- class MemoryEmbedding(*, embedding_model: EmbeddingSupport | None = None)[source]#
Bases:
objectThe MemoryEmbedding class is responsible for encoding the memory embeddings.
- Parameters:
embedding_model (EmbeddingSupport) – An instance of a class that supports embedding generation.
- __init__(*, embedding_model: EmbeddingSupport | None = None)[source]#
Initialize the memory embedding helper with a backing embedding model.
- Parameters:
embedding_model (Optional[EmbeddingSupport]) – The embedding model used to generate text embeddings. If not provided, a ValueError is raised.
- Raises:
ValueError – If embedding_model is not provided.
Methods
__init__(*[, embedding_model])Initialize the memory embedding helper with a backing embedding model.
generate_embedding_memory_data(*, message_piece)Generate metadata for a message piece.
- generate_embedding_memory_data(*, message_piece: MessagePiece) EmbeddingDataEntry[source]#
Generate metadata for a message piece.
- Parameters:
message_piece (MessagePiece) – the message piece for which to generate a text embedding
- Returns:
The generated metadata.
- Return type:
- Raises:
ValueError – If the message piece is not of type text.