From 6f2e3d56c624acae5439d07d09690c3f2e3b54cd Mon Sep 17 00:00:00 2001 From: Jason Liu Date: Sun, 22 Oct 2023 17:46:25 -0400 Subject: [PATCH] clean up tests --- instructor/distil.py | 2 +- tests/test_multitask.py | 67 +++-------------------------------------- 2 files changed, 5 insertions(+), 64 deletions(-) diff --git a/instructor/distil.py b/instructor/distil.py index 94f02c8..894764a 100644 --- a/instructor/distil.py +++ b/instructor/distil.py @@ -172,7 +172,7 @@ class Instructions: if finetune_format == FinetuneFormat.MESSAGES: openai_kwargs = self.openai_kwargs(name, fn, args, kwargs, base_model) - openai_kwargs.append( + openai_kwargs["messages"].append( { "role": "assistant", "function_call": { diff --git a/tests/test_multitask.py b/tests/test_multitask.py index 9e24949..04bd014 100644 --- a/tests/test_multitask.py +++ b/tests/test_multitask.py @@ -10,67 +10,8 @@ def test_multi_task(): query: str multitask = MultiTask(Search) - assert multitask.openai_schema == { - "description": "Correct segmentation of `Search` tasks", - "name": "MultiSearch", - "parameters": { - "$defs": { - "Search": { - "properties": { - "id": {"type": "integer"}, - "query": {"type": "string"}, - }, - "required": ["id", "query"], - "description": "This is the search docstring", - "type": "object", - } - }, - "properties": { - "tasks": { - "description": "Correctly segmented list of `Search` tasks", - "items": {"$ref": "#/$defs/Search"}, - "type": "array", - } - }, - "required": ["tasks"], - "type": "object", - }, - } - - -def test_multi_task_with_name_and_desc(): - class Search(OpenAISchema): - """This is the search docstring""" - - id: int - query: str - - multitask = MultiTask( - subtask_class=Search, name="MyCustomName", description="MyCustomDesc" + assert multitask.openai_schema["name"] == "MultiSearch" + assert ( + multitask.openai_schema["description"] + == "Correct segmentation of `Search` tasks" ) - assert multitask.openai_schema == { - "description": "MyCustomDesc", - "name": "MultiMyCustomName", - "parameters": { - "$defs": { - "Search": { - "properties": { - "id": {"type": "integer"}, - "query": {"type": "string"}, - }, - "required": ["id", "query"], - "description": "This is the search docstring", - "type": "object", - } - }, - "properties": { - "tasks": { - "description": "Correctly segmented list of `MyCustomName` tasks", - "items": {"$ref": "#/$defs/Search"}, - "type": "array", - } - }, - "required": ["tasks"], - "type": "object", - }, - }