Skip to content

Commit

Permalink
Merge pull request #13 from guardrails-ai/guard-use-support
Browse files Browse the repository at this point in the history
make prompt optional
  • Loading branch information
CalebCourier authored Apr 16, 2024
2 parents 78f0152 + 45d2bb7 commit c4f236c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
17 changes: 9 additions & 8 deletions guardrails-api-client/guardrails_api_client/models/rail_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,22 @@ class RailSpec:
Attributes:
output_schema (Schema):
prompt (str):
version (RailSpecVersion): Default: RailSpecVersion.VALUE_0.
input_schema (Union[Unset, Schema]):
instructions (Union[Unset, str]):
prompt (Union[Unset, str]):
"""

output_schema: "Schema"
prompt: str
version: RailSpecVersion = RailSpecVersion.VALUE_0
input_schema: Union[Unset, "Schema"] = UNSET
instructions: Union[Unset, str] = UNSET
prompt: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)

def to_dict(self) -> Dict[str, Any]:
output_schema = self.output_schema.to_dict()

prompt = self.prompt

version = self.version.value

input_schema: Union[Unset, Dict[str, Any]] = UNSET
Expand All @@ -45,19 +43,22 @@ def to_dict(self) -> Dict[str, Any]:

instructions = self.instructions

prompt = self.prompt

field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update(
{
"outputSchema": output_schema,
"prompt": prompt,
"version": version,
}
)
if input_schema is not UNSET:
field_dict["inputSchema"] = input_schema
if instructions is not UNSET:
field_dict["instructions"] = instructions
if prompt is not UNSET:
field_dict["prompt"] = prompt

return field_dict

Expand All @@ -68,8 +69,6 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
output_schema = Schema.from_dict(d.pop("outputSchema"))

prompt = d.pop("prompt")

version = RailSpecVersion(d.pop("version"))

_input_schema = d.pop("inputSchema", UNSET)
Expand All @@ -81,12 +80,14 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:

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

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

rail_spec = cls(
output_schema=output_schema,
prompt=prompt,
version=version,
input_schema=input_schema,
instructions=instructions,
prompt=prompt,
)

rail_spec.additional_properties = d
Expand Down
1 change: 0 additions & 1 deletion open-api-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,6 @@ components:
- "0.1"
required:
- outputSchema
- prompt
- version
Schema:
type: object
Expand Down
1 change: 0 additions & 1 deletion service-specs/guardrails-service-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ components:
- "0.1"
required:
- outputSchema
- prompt
- version
Schema:
type: object
Expand Down

0 comments on commit c4f236c

Please sign in to comment.