Skip to content

Commit

Permalink
Merge pull request #19 from weavel-ai/fix/response-format
Browse files Browse the repository at this point in the history
fix: remove ape dependency
  • Loading branch information
aschung01 authored Sep 13, 2024
2 parents 9d97189 + 42b4ea5 commit 47fbff2
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion weavel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

from .utils import *

__version___ = "1.8.1"
__version___ = "1.8.2"
3 changes: 1 addition & 2 deletions weavel/_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion weavel/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions weavel/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -19,4 +19,5 @@
"TrackEvent",
"Trace",
"Session",
]
"ResponseFormat"
]
1 change: 0 additions & 1 deletion weavel/types/datasets.py
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
13 changes: 13 additions & 0 deletions weavel/types/response_format.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 47fbff2

Please sign in to comment.