From 46255c1696b188f38f7f01a8db8f42b220b26d09 Mon Sep 17 00:00:00 2001 From: shamuiscoding Date: Thu, 12 Sep 2024 09:31:25 +0900 Subject: [PATCH 1/2] fix: remove ape dependency --- setup.py | 2 +- weavel/__init__.py | 2 +- weavel/_worker.py | 2 +- weavel/client.py | 2 +- weavel/types/datasets.py | 2 +- weavel/types/response_format.py | 13 +++++++++++++ 6 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 weavel/types/response_format.py diff --git a/setup.py b/setup.py index c7100e4..e011ee5 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( name="weavel", - version="1.8.1", + version="1.8.2", packages=find_namespace_packages(), entry_points={}, description="Weavel, Prompt Optimization and Evaluation for LLM Applications", diff --git a/weavel/__init__.py b/weavel/__init__.py index fca40e3..c703a0c 100644 --- a/weavel/__init__.py +++ b/weavel/__init__.py @@ -4,4 +4,4 @@ from .utils import * -__version___ = "1.8.1" +__version___ = "1.8.2" diff --git a/weavel/_worker.py b/weavel/_worker.py index dcd2bbc..fcaa14c 100644 --- a/weavel/_worker.py +++ b/weavel/_worker.py @@ -41,7 +41,7 @@ from weavel._api_client import APIClient, AsyncAPIClient from weavel.utils import logger from weavel.types.datasets import DatasetItem, Dataset, Prompt, PromptVersion -from ape.types import ResponseFormat +from weavel.types.response_format import ResponseFormat class Worker: _instance = None diff --git a/weavel/client.py b/weavel/client.py index 3c9edb6..9a9c8e1 100644 --- a/weavel/client.py +++ b/weavel/client.py @@ -8,7 +8,7 @@ import time from typing import Callable, Dict, List, Optional, Any, Union from uuid import uuid4 -from ape.types import ResponseFormat +from weavel.types.response_format import ResponseFormat from dotenv import load_dotenv from weavel._worker import Worker diff --git a/weavel/types/datasets.py b/weavel/types/datasets.py index a3444b3..82726e9 100644 --- a/weavel/types/datasets.py +++ b/weavel/types/datasets.py @@ -1,6 +1,6 @@ from typing import Any, Dict, List, Optional, Union from pydantic import BaseModel -from ape.types import ResponseFormat +from response_format import ResponseFormat class DatasetItem(BaseModel): uuid: Optional[str] = None diff --git a/weavel/types/response_format.py b/weavel/types/response_format.py new file mode 100644 index 0000000..9871365 --- /dev/null +++ b/weavel/types/response_format.py @@ -0,0 +1,13 @@ +from typing import Any, Dict, Literal, Optional +from pydantic import BaseModel + + +class JsonSchema(BaseModel): + name: str + schema: Dict[str, Any] + strict: bool = True + + +class ResponseFormat(BaseModel): + type: Literal["json_object", "json_schema", "xml"] + json_schema: Optional[JsonSchema] = None From eccf9d699a2c5d140192202a5ed1270c8106f30a Mon Sep 17 00:00:00 2001 From: shamuiscoding Date: Thu, 12 Sep 2024 09:34:22 +0900 Subject: [PATCH 2/2] fix: minor fixes --- weavel/_worker.py | 3 +-- weavel/client.py | 2 +- weavel/types/__init__.py | 1 + weavel/types/datasets.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/weavel/_worker.py b/weavel/_worker.py index fcaa14c..fb3b2e0 100644 --- a/weavel/_worker.py +++ b/weavel/_worker.py @@ -40,8 +40,7 @@ from weavel._buffer_storage import BufferStorage from weavel._api_client import APIClient, AsyncAPIClient from weavel.utils import logger -from weavel.types.datasets import DatasetItem, Dataset, Prompt, PromptVersion -from weavel.types.response_format import ResponseFormat +from weavel.types import DatasetItem, Dataset, Prompt, PromptVersion, ResponseFormat class Worker: _instance = None diff --git a/weavel/client.py b/weavel/client.py index 9a9c8e1..f241da1 100644 --- a/weavel/client.py +++ b/weavel/client.py @@ -8,7 +8,7 @@ import time from typing import Callable, Dict, List, Optional, Any, Union from uuid import uuid4 -from weavel.types.response_format import ResponseFormat +from weavel.types import ResponseFormat from dotenv import load_dotenv from weavel._worker import Worker diff --git a/weavel/types/__init__.py b/weavel/types/__init__.py index da2d553..40bd4f9 100644 --- a/weavel/types/__init__.py +++ b/weavel/types/__init__.py @@ -2,3 +2,4 @@ from .observations import * from .records import * from .session import * +from .response_format import * \ No newline at end of file diff --git a/weavel/types/datasets.py b/weavel/types/datasets.py index 82726e9..a6bdd18 100644 --- a/weavel/types/datasets.py +++ b/weavel/types/datasets.py @@ -1,6 +1,6 @@ from typing import Any, Dict, List, Optional, Union from pydantic import BaseModel -from response_format import ResponseFormat +from weavel.types import ResponseFormat class DatasetItem(BaseModel): uuid: Optional[str] = None