-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c9be4ab
commit 7b12d14
Showing
4 changed files
with
36 additions
and
14 deletions.
There are no files selected for viewing
Binary file not shown.
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,29 @@ | ||
import pytest | ||
import mall | ||
import polars as pl | ||
import pyarrow | ||
import shutil | ||
import os | ||
|
||
if os._exists("_test_cache"): | ||
shutil.rmtree("_test_cache", ignore_errors=True) | ||
|
||
|
||
def test_classify(): | ||
df = pl.DataFrame(dict(x=["one", "two", "three"])) | ||
df.llm.use("test", "echo", _cache="_test_cache") | ||
x = df.llm.classify("x", ["one", "two"]) | ||
assert ( | ||
x.select("classify").to_pandas().to_string() | ||
== " classify\n0 one\n1 two\n2 None" | ||
) | ||
|
||
|
||
def test_classify_dict(): | ||
df = pl.DataFrame(dict(x=[1, 2, 3])) | ||
df.llm.use("test", "echo", _cache="_test_cache") | ||
x = df.llm.classify("x", {"one": 1, "two": 2}) | ||
assert ( | ||
x.select("classify").to_pandas().to_string() | ||
== " classify\n0 1.0\n1 2.0\n2 NaN" | ||
) |
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 |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
import mall | ||
import polars as pl | ||
import pyarrow | ||
|
||
import shutil | ||
import os | ||
|
||
|
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