Skip to content

Commit

Permalink
🔧 Refactor extraction tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shroominic committed Nov 15, 2023
1 parent 8b0cd29 commit 79f1221
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions tests/extraction_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from funcchain import achain, chain, settings, BaseModel

settings.MODEL_TEMPERATURE = 0
settings.MODEL_NAME = "gpt-3.5-turbo-1106"


class Task(BaseModel):
Expand All @@ -22,36 +23,33 @@ def description(task: Task) -> str:

async def extract_task(task_description: str) -> Task:
"""
EXTRACT TASK: {task_description}
Extract the task based on the task description:
{task_description}
"""
return await achain()


def compare_tasks(task: Task, task2: Task) -> bool:
def compare_tasks(task1: Task, task2: Task) -> bool:
"""
COMPARE TASKS:
1: {task}
2: {task2}
Are the tasks kind of equal?
Are the task1 and task2 similar?
"""
return chain()


def test_extraction() -> None:
from asyncio import run as _await

task = Task(
task1 = Task(
name="Do dishes",
description="Do the dishes in the kitchen.",
difficulty="easy",
keywords=["kitchen", "dishes"],
)

task_description = description(task)
_task = _await(extract_task(task_description))
task_description = description(task1)
task2 = _await(extract_task(task_description))

assert compare_tasks(task, _task)
assert compare_tasks(task1, task2)


if __name__ == "__main__":
Expand Down

0 comments on commit 79f1221

Please sign in to comment.