From 6a97c59c145e785bf683d6829abacb17c6d77b04 Mon Sep 17 00:00:00 2001 From: Shroominic Date: Fri, 26 Jan 2024 19:26:44 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=91=EF=B8=8F=20Remove=20openai=5Ftest.?= =?UTF-8?q?py=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/openai_test.py | 64 -------------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 tests/openai_test.py diff --git a/tests/openai_test.py b/tests/openai_test.py deleted file mode 100644 index efbabed..0000000 --- a/tests/openai_test.py +++ /dev/null @@ -1,64 +0,0 @@ -from funcchain import chain, settings -from pydantic import BaseModel, Field - - -class Task(BaseModel): - name: str - description: str - - -class TodoList(BaseModel): - tasks: list[Task] - - -def todo_list(job_title: str) -> TodoList: - """ - Create a todo list for a perfect day for the given job. - """ - return chain() - - -def test_gpt_35_turbo() -> None: - settings.llm = "openai/gpt-3.5-turbo" - - assert isinstance( - todo_list("software engineer"), - TodoList, - ) - - -def test_gpt4() -> None: - settings.llm = "openai/gpt-4" - - assert isinstance( - todo_list("software engineer"), - TodoList, - ) - - -def test_vision() -> None: - from funcchain import Image - - settings.llm = "openai/gpt-4-vision-preview" - - class Analysis(BaseModel): - description: str = Field(description="A description of the image") - objects: list[str] = Field(description="A list of objects found in the image") - - def analyse(image: Image) -> Analysis: - """ - Analyse the image and extract its - theme, description and objects. - """ - return chain() - - assert isinstance( - analyse(Image.from_file("examples/assets/old_chinese_temple.jpg")), - Analysis, - ) - - -if __name__ == "__main__": - test_gpt_35_turbo() - test_gpt4() - test_vision()