Exemplo n.º 1
0
def test_step_should_embed_data_without_encoding():
    """A Step should be able to embed data without an encoding"""
    # given
    step = Step(1, "keyword", "used_keyword", "text", None, None, None, None)

    # when
    step.embed("data", encode_data_to_base64=False)

    # then
    assert step.embeddings == [{"data": "data", "mime_type": "text/plain"}]
Exemplo n.º 2
0
def test_step_should_embed_data_with_base64_encoding():
    """A Step should be able to embed data base64 encoded"""
    # given
    step = Step(1, "keyword", "used_keyword", "text", None, None, None, None)
    data_b64_encoded = "ZGF0YQ=="  # == "data"

    # when
    step.embed("data", encode_data_to_base64=True)

    # then
    assert step.embeddings == [{"data": data_b64_encoded, "mime_type": "text/plain"}]