Skip to content

Commit

Permalink
Test if embedding classify works for no examples
Browse files Browse the repository at this point in the history
  • Loading branch information
NickyHavoc committed Oct 27, 2023
1 parent fe8698d commit c74b5f3
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/use_cases/classify/test_embedding_based_classify.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,39 @@ def test_embedding_based_classify_returns_score_for_all_labels(
assert classify_input.labels == set(r for r in classify_output.scores)


def test_embedding_based_classify_works_for_no_labels(
embedding_based_classify: EmbeddingBasedClassify,
) -> None:
classify_input = ClassifyInput(
chunk=Chunk("This is good"),
labels=frozenset(),
)
result = embedding_based_classify.run(classify_input, NoOpDebugLogger())
assert result.scores == {}


def test_embedding_based_classify_works_for_no_examples(
client: Client
) -> None:
labels_with_examples = [
LabelWithExamples(
name="positive",
examples=[],
),
LabelWithExamples(
name="negative",
examples=[],
),
]
embedding_based_classify = EmbeddingBasedClassify(labels_with_examples, client)
classify_input = ClassifyInput(
chunk=Chunk("This is good"),
labels=frozenset(),
)
result = embedding_based_classify.run(classify_input, NoOpDebugLogger())
assert result.scores == {}


def test_embedding_based_classify_raises_for_unknown_label(
embedding_based_classify: EmbeddingBasedClassify,
) -> None:
Expand Down

0 comments on commit c74b5f3

Please sign in to comment.