-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #264 from whylabs/separate
Separate
- Loading branch information
Showing
4 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "langkit" | ||
version = "0.0.91" | ||
version = "0.0.92" | ||
description = "A language toolkit for monitoring LLM interactions" | ||
authors = ["WhyLabs.ai <[email protected]>"] | ||
homepage = "https://docs.whylabs.ai/docs/large-language-model-monitoring" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from typing import List | ||
|
||
from langkit.core.workflow import EvaluationWorkflow | ||
from langkit.metrics.library import lib | ||
|
||
|
||
def test_just_prompt(): | ||
wf = EvaluationWorkflow(metrics=[lib.presets.recommended()]) | ||
result = wf.run({"prompt": "hi"}) | ||
metrics = result.metrics | ||
|
||
metric_names: List[str] = metrics.columns.tolist() # pyright: ignore[reportUnknownMemberType] | ||
|
||
assert metric_names == [ | ||
"prompt.pii.phone_number", | ||
"prompt.pii.email_address", | ||
"prompt.pii.credit_card", | ||
"prompt.pii.us_ssn", | ||
"prompt.pii.us_bank_number", | ||
"prompt.pii.redacted", | ||
"prompt.stats.token_count", | ||
"prompt.stats.char_count", | ||
"prompt.similarity.injection", | ||
"prompt.similarity.jailbreak", | ||
"id", | ||
] | ||
|
||
|
||
def test_just_response(): | ||
wf = EvaluationWorkflow(metrics=[lib.presets.recommended()]) | ||
result = wf.run({"response": "I'm doing great!"}) | ||
metrics = result.metrics | ||
|
||
metric_names: List[str] = metrics.columns.tolist() # pyright: ignore[reportUnknownMemberType] | ||
|
||
assert metric_names == [ | ||
"response.pii.phone_number", | ||
"response.pii.email_address", | ||
"response.pii.credit_card", | ||
"response.pii.us_ssn", | ||
"response.pii.us_bank_number", | ||
"response.pii.redacted", | ||
"response.stats.token_count", | ||
"response.stats.char_count", | ||
"response.stats.flesch_reading_ease", | ||
"response.sentiment.sentiment_score", | ||
"response.toxicity.toxicity_score", | ||
"response.similarity.refusal", | ||
"id", | ||
] |