diff --git a/setup.py b/setup.py index 58aaf29..95c6c27 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( name="weavel", - version="1.9.1", + version="1.9.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 1905cc6..aaccc1a 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 import DatasetItem, Dataset, Prompt, PromptVersion -from ape.types import ResponseFormat +from weavel.types import DatasetItem, Dataset, Prompt, PromptVersion, ResponseFormat class Worker: diff --git a/weavel/client.py b/weavel/client.py index 54c7d76..b899c98 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 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 823b357..10f2fb7 100644 --- a/weavel/types/__init__.py +++ b/weavel/types/__init__.py @@ -3,7 +3,7 @@ from .observations import Observation, Span, Generation, Log from .records import Record, Message, TrackEvent, Trace from .session import Session - +from .response_format import ResponseFormat __all__ = [ "Dataset", @@ -19,4 +19,5 @@ "TrackEvent", "Trace", "Session", -] + "ResponseFormat" +] \ No newline at end of file diff --git a/weavel/types/datasets.py b/weavel/types/datasets.py index ed48da6..56734b5 100644 --- a/weavel/types/datasets.py +++ b/weavel/types/datasets.py @@ -1,7 +1,6 @@ from typing import Any, Dict, List, Optional, Union from pydantic import BaseModel - class DatasetItem(BaseModel): uuid: Optional[str] = None inputs: Union[Dict[str, Any], List[Any], str] 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