Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions guardrails-api-client/guardrails_api_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ class Client:
"""

raise_on_unexpected_status: bool = field(default=False, kw_only=True)
_base_url: str
_cookies: Dict[str, str] = field(factory=dict, kw_only=True)
_headers: Dict[str, str] = field(factory=dict, kw_only=True)
_timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True)
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True)
_follow_redirects: bool = field(default=False, kw_only=True)
_httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True)
_base_url: str = field(alias="base_url")
_cookies: Dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
_headers: Dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
_timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
_httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
_client: Optional[httpx.Client] = field(default=None, init=False)
_async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)

Expand Down Expand Up @@ -165,13 +165,13 @@ class AuthenticatedClient:
"""

raise_on_unexpected_status: bool = field(default=False, kw_only=True)
_base_url: str
_cookies: Dict[str, str] = field(factory=dict, kw_only=True)
_headers: Dict[str, str] = field(factory=dict, kw_only=True)
_timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True)
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True)
_follow_redirects: bool = field(default=False, kw_only=True)
_httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True)
_base_url: str = field(alias="base_url")
_cookies: Dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
_headers: Dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
_timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
_httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
_client: Optional[httpx.Client] = field(default=None, init=False)
_async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SchemaElement:
"""
Attributes:
type (str):
name (str):
name (Union[Unset, str]):
description (Union[Unset, str]):
strict (Union[Unset, bool]):
date_format (Union[Unset, str]):
Expand All @@ -28,7 +28,7 @@ class SchemaElement:
"""

type: str
name: str
name: Union[Unset, str] = UNSET
description: Union[Unset, str] = UNSET
strict: Union[Unset, bool] = UNSET
date_format: Union[Unset, str] = UNSET
Expand Down Expand Up @@ -67,9 +67,10 @@ def to_dict(self) -> Dict[str, Any]:
field_dict.update(
{
"type": type,
"name": name,
}
)
if name is not UNSET:
field_dict["name"] = name
if description is not UNSET:
field_dict["description"] = description
if strict is not UNSET:
Expand All @@ -94,7 +95,7 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
type = d.pop("type")

name = d.pop("name")
name = d.pop("name", UNSET)

description = d.pop("description", UNSET)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union
from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast

from attrs import define as _attrs_define
from attrs import field as _attrs_field

from ..types import UNSET, Unset

if TYPE_CHECKING:
from ..models.any_object import AnyObject
from ..models.history import History


Expand All @@ -17,21 +18,29 @@ class ValidationOutput:
"""
Attributes:
result (bool): Whether the validation passed or failed
validated_output (Union[Unset, str]):
validated_output (Union['AnyObject', Unset, str]):
session_history (Union[Unset, List['History']]):
raw_llm_response (Union[Unset, str]):
"""

result: bool
validated_output: Union[Unset, str] = UNSET
validated_output: Union["AnyObject", Unset, str] = UNSET
session_history: Union[Unset, List["History"]] = UNSET
raw_llm_response: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)

def to_dict(self) -> Dict[str, Any]:
from ..models.any_object import AnyObject

result = self.result

validated_output = self.validated_output
validated_output: Union[Dict[str, Any], Unset, str]
if isinstance(self.validated_output, Unset):
validated_output = UNSET
elif isinstance(self.validated_output, AnyObject):
validated_output = self.validated_output.to_dict()
else:
validated_output = self.validated_output

session_history: Union[Unset, List[Dict[str, Any]]] = UNSET
if not isinstance(self.session_history, Unset):
Expand Down Expand Up @@ -60,12 +69,26 @@ def to_dict(self) -> Dict[str, Any]:

@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
from ..models.any_object import AnyObject
from ..models.history import History

d = src_dict.copy()
result = d.pop("result")

validated_output = d.pop("validatedOutput", UNSET)
def _parse_validated_output(data: object) -> Union["AnyObject", Unset, str]:
if isinstance(data, Unset):
return data
try:
if not isinstance(data, dict):
raise TypeError()
validated_output_type_0 = AnyObject.from_dict(data)

return validated_output_type_0
except: # noqa: E722
pass
return cast(Union["AnyObject", Unset, str], data)

validated_output = _parse_validated_output(d.pop("validatedOutput", UNSET))

session_history = []
_session_history = d.pop("sessionHistory", UNSET)
Expand Down
5 changes: 3 additions & 2 deletions open-api-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,6 @@ components:
model:
type: string
required:
- name
- type
OnFail:
type: object
Expand All @@ -678,7 +677,9 @@ components:
type: boolean
description: Whether the validation passed or failed
validatedOutput:
type: string
oneOf:
- $ref: "#/components/schemas/AnyObject"
- type: string
sessionHistory:
type: array
items:
Expand Down
5 changes: 3 additions & 2 deletions service-specs/guardrails-service-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ components:
model:
type: string
required:
- name
- type
OnFail:
type: object
Expand Down Expand Up @@ -388,7 +387,9 @@ components:
type: boolean
description: Whether the validation passed or failed
validatedOutput:
type: string
oneOf:
- $ref: "#/components/schemas/AnyObject"
- type: string
sessionHistory:
type: array
items:
Expand Down