Skip to content

Commit

Permalink
Docstring fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
claudevdm committed Dec 13, 2024
1 parent 47e8758 commit 13f3160
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
12 changes: 3 additions & 9 deletions sdks/python/apache_beam/ml/rag/embeddings/huggingface.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,14 @@


class HuggingfaceTextEmbeddings(EmbeddingsManager):
"""SentenceTransformer embeddings for RAG pipeline.
Extends EmbeddingsManager to work with RAG-specific types:
- Input: Chunk objects containing text to embed
- Output: Chunk objects with embedding property set
"""
def __init__(
self, model_name: str, *, max_seq_length: Optional[int] = None, **kwargs):
"""Initialize RAG embeddings.
"""Utilizes huggingface SentenceTransformer embeddings for RAG pipeline.
Args:
model_name: Name of the sentence-transformers model to use
max_seq_length: Maximum sequence length for the model
**kwargs: Additional arguments passed to parent
**kwargs: Additional arguments including ModelHandlers arguments
"""
super().__init__(type_adapter=create_rag_adapter(), **kwargs)
self.model_name = model_name
Expand Down
7 changes: 5 additions & 2 deletions sdks/python/apache_beam/ml/rag/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
@dataclass
class Content:
"""Container for embeddable content. Add new types as when as necessary.
Args:
text: Text content to be embedded
"""
text: Optional[str] = None

Expand All @@ -42,7 +45,7 @@ class Content:
class Embedding:
"""Represents vector embeddings.
Attributes:
Args:
dense_embedding: Dense vector representation
sparse_embedding: Optional sparse vector representation for hybrid
search
Expand All @@ -56,7 +59,7 @@ class Embedding:
class Chunk:
"""Represents a chunk of embeddable content with metadata.
Attributes:
Args:
content: The actual content of the chunk
id: Unique identifier for the chunk
index: Index of this chunk within the original document
Expand Down

0 comments on commit 13f3160

Please sign in to comment.