apache_beam.ml.rag.ingestion.test_utils module

class apache_beam.ml.rag.ingestion.test_utils.TestRow(id, embedding, content, metadata)

Bases: tuple

Create new instance of TestRow(id, embedding, content, metadata)

content: str

Alias for field number 2

embedding: List[float]

Alias for field number 1

id: str

Alias for field number 0

metadata: str

Alias for field number 3

apache_beam.ml.rag.ingestion.test_utils.row_to_chunk(row) Chunk[source]
class apache_beam.ml.rag.ingestion.test_utils.ChunkTestUtils[source]

Bases: object

Helper functions for generating test Chunks.

static from_seed(seed: int, content_prefix: str, seed_multiplier: int) Chunk[source]

Creates a deterministic Chunk from a seed value.

static get_expected_values(range_start: int, range_end: int, content_prefix: str = 'Testval', seed_multiplier: int = 1) List[Chunk][source]

Returns a range of test Chunks.

class apache_beam.ml.rag.ingestion.test_utils.HashingFn(*unused_args, **unused_kwargs)[source]

Bases: CombineFn

Hashing function for verification.

create_accumulator()[source]
add_input(accumulator, input)[source]
merge_accumulators(accumulators)[source]
extract_output(accumulator)[source]
apache_beam.ml.rag.ingestion.test_utils.generate_expected_hash(num_records: int) str[source]
apache_beam.ml.rag.ingestion.test_utils.key_on_id(chunk)[source]