Skip to content

Commit 96cfab8

Browse files
feat(api): OpenAPI spec update via Stainless API (#174)
1 parent 84de40a commit 96cfab8

File tree

6 files changed

+182
-59
lines changed

6 files changed

+182
-59
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 21
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prompt-foundry%2Fprompt-foundry-sdk-ec010a81f2e8cfe74de9842b6fcd84599fd1d3f439ba3eb868fb5bdbfa2fa260.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prompt-foundry%2Fprompt-foundry-sdk-101dab0674c0098868baea52c37050f14ce1dffeadecc3978c77e7b8a47c608c.yml

src/prompt_foundry_python_sdk/resources/evaluation_assertions.py

Lines changed: 65 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
5+
from typing import List, Optional
66
from typing_extensions import Literal
77

88
import httpx
@@ -47,11 +47,21 @@ def create(
4747
*,
4848
evaluation_id: str,
4949
json_path: Optional[str],
50-
target_value: Optional[str],
50+
target_threshold: Optional[float],
51+
target_values: Optional[List[str]],
5152
tool_name: Optional[str],
5253
type: Literal[
53-
"CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"
54+
"CONTAINS_ALL",
55+
"CONTAINS_ANY",
56+
"COST",
57+
"EXACT_MATCH",
58+
"LATENCY",
59+
"STARTS_WITH",
60+
"TOOL_CALLED",
61+
"TOOL_CALLED_WITH",
5462
],
63+
ignore_case: bool | NotGiven = NOT_GIVEN,
64+
negate: bool | NotGiven = NOT_GIVEN,
5565
weight: float | NotGiven = NOT_GIVEN,
5666
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5767
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -88,9 +98,12 @@ def create(
8898
{
8999
"evaluation_id": evaluation_id,
90100
"json_path": json_path,
91-
"target_value": target_value,
101+
"target_threshold": target_threshold,
102+
"target_values": target_values,
92103
"tool_name": tool_name,
93104
"type": type,
105+
"ignore_case": ignore_case,
106+
"negate": negate,
94107
"weight": weight,
95108
},
96109
evaluation_assertion_create_params.EvaluationAssertionCreateParams,
@@ -107,11 +120,21 @@ def update(
107120
*,
108121
evaluation_id: str,
109122
json_path: Optional[str],
110-
target_value: Optional[str],
123+
target_threshold: Optional[float],
124+
target_values: Optional[List[str]],
111125
tool_name: Optional[str],
112126
type: Literal[
113-
"CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"
127+
"CONTAINS_ALL",
128+
"CONTAINS_ANY",
129+
"COST",
130+
"EXACT_MATCH",
131+
"LATENCY",
132+
"STARTS_WITH",
133+
"TOOL_CALLED",
134+
"TOOL_CALLED_WITH",
114135
],
136+
ignore_case: bool | NotGiven = NOT_GIVEN,
137+
negate: bool | NotGiven = NOT_GIVEN,
115138
weight: float | NotGiven = NOT_GIVEN,
116139
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
117140
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -150,9 +173,12 @@ def update(
150173
{
151174
"evaluation_id": evaluation_id,
152175
"json_path": json_path,
153-
"target_value": target_value,
176+
"target_threshold": target_threshold,
177+
"target_values": target_values,
154178
"tool_name": tool_name,
155179
"type": type,
180+
"ignore_case": ignore_case,
181+
"negate": negate,
156182
"weight": weight,
157183
},
158184
evaluation_assertion_update_params.EvaluationAssertionUpdateParams,
@@ -283,11 +309,21 @@ async def create(
283309
*,
284310
evaluation_id: str,
285311
json_path: Optional[str],
286-
target_value: Optional[str],
312+
target_threshold: Optional[float],
313+
target_values: Optional[List[str]],
287314
tool_name: Optional[str],
288315
type: Literal[
289-
"CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"
316+
"CONTAINS_ALL",
317+
"CONTAINS_ANY",
318+
"COST",
319+
"EXACT_MATCH",
320+
"LATENCY",
321+
"STARTS_WITH",
322+
"TOOL_CALLED",
323+
"TOOL_CALLED_WITH",
290324
],
325+
ignore_case: bool | NotGiven = NOT_GIVEN,
326+
negate: bool | NotGiven = NOT_GIVEN,
291327
weight: float | NotGiven = NOT_GIVEN,
292328
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
293329
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -324,9 +360,12 @@ async def create(
324360
{
325361
"evaluation_id": evaluation_id,
326362
"json_path": json_path,
327-
"target_value": target_value,
363+
"target_threshold": target_threshold,
364+
"target_values": target_values,
328365
"tool_name": tool_name,
329366
"type": type,
367+
"ignore_case": ignore_case,
368+
"negate": negate,
330369
"weight": weight,
331370
},
332371
evaluation_assertion_create_params.EvaluationAssertionCreateParams,
@@ -343,11 +382,21 @@ async def update(
343382
*,
344383
evaluation_id: str,
345384
json_path: Optional[str],
346-
target_value: Optional[str],
385+
target_threshold: Optional[float],
386+
target_values: Optional[List[str]],
347387
tool_name: Optional[str],
348388
type: Literal[
349-
"CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"
389+
"CONTAINS_ALL",
390+
"CONTAINS_ANY",
391+
"COST",
392+
"EXACT_MATCH",
393+
"LATENCY",
394+
"STARTS_WITH",
395+
"TOOL_CALLED",
396+
"TOOL_CALLED_WITH",
350397
],
398+
ignore_case: bool | NotGiven = NOT_GIVEN,
399+
negate: bool | NotGiven = NOT_GIVEN,
351400
weight: float | NotGiven = NOT_GIVEN,
352401
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
353402
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -386,9 +435,12 @@ async def update(
386435
{
387436
"evaluation_id": evaluation_id,
388437
"json_path": json_path,
389-
"target_value": target_value,
438+
"target_threshold": target_threshold,
439+
"target_values": target_values,
390440
"tool_name": tool_name,
391441
"type": type,
442+
"ignore_case": ignore_case,
443+
"negate": negate,
392444
"weight": weight,
393445
},
394446
evaluation_assertion_update_params.EvaluationAssertionUpdateParams,

src/prompt_foundry_python_sdk/types/evaluation_assertion.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import Optional
3+
from typing import List, Optional
44
from typing_extensions import Literal
55

66
from pydantic import Field as FieldInfo
@@ -21,16 +21,31 @@ class EvaluationAssertion(BaseModel):
2121
Only required when type is `JSON_EXACT_MATCH` or `JSON_CONTAINS`.
2222
"""
2323

24-
target_value: Optional[str] = FieldInfo(alias="targetValue", default=None)
24+
target_threshold: Optional[float] = FieldInfo(alias="targetThreshold", default=None)
25+
26+
target_values: Optional[List[str]] = FieldInfo(alias="targetValues", default=None)
2527

2628
tool_name: Optional[str] = FieldInfo(alias="toolName", default=None)
2729
"""The name of the tool to match.
2830
2931
Only required when type is `TOOL_CALLED` or `TOOL_CALLED_WITH`.
3032
"""
3133

32-
type: Literal["CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"]
34+
type: Literal[
35+
"CONTAINS_ALL",
36+
"CONTAINS_ANY",
37+
"COST",
38+
"EXACT_MATCH",
39+
"LATENCY",
40+
"STARTS_WITH",
41+
"TOOL_CALLED",
42+
"TOOL_CALLED_WITH",
43+
]
3344
"""The type of evaluation matcher to use."""
3445

46+
ignore_case: Optional[bool] = FieldInfo(alias="ignoreCase", default=None)
47+
48+
negate: Optional[bool] = None
49+
3550
weight: Optional[float] = None
3651
"""How heavily to weigh the assertion within the evaluation."""

src/prompt_foundry_python_sdk/types/evaluation_assertion_create_params.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
5+
from typing import List, Optional
66
from typing_extensions import Literal, Required, Annotated, TypedDict
77

88
from .._utils import PropertyInfo
@@ -19,7 +19,9 @@ class EvaluationAssertionCreateParams(TypedDict, total=False):
1919
Only required when type is `JSON_EXACT_MATCH` or `JSON_CONTAINS`.
2020
"""
2121

22-
target_value: Required[Annotated[Optional[str], PropertyInfo(alias="targetValue")]]
22+
target_threshold: Required[Annotated[Optional[float], PropertyInfo(alias="targetThreshold")]]
23+
24+
target_values: Required[Annotated[Optional[List[str]], PropertyInfo(alias="targetValues")]]
2325

2426
tool_name: Required[Annotated[Optional[str], PropertyInfo(alias="toolName")]]
2527
"""The name of the tool to match.
@@ -28,9 +30,22 @@ class EvaluationAssertionCreateParams(TypedDict, total=False):
2830
"""
2931

3032
type: Required[
31-
Literal["CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"]
33+
Literal[
34+
"CONTAINS_ALL",
35+
"CONTAINS_ANY",
36+
"COST",
37+
"EXACT_MATCH",
38+
"LATENCY",
39+
"STARTS_WITH",
40+
"TOOL_CALLED",
41+
"TOOL_CALLED_WITH",
42+
]
3243
]
3344
"""The type of evaluation matcher to use."""
3445

46+
ignore_case: Annotated[bool, PropertyInfo(alias="ignoreCase")]
47+
48+
negate: bool
49+
3550
weight: float
3651
"""How heavily to weigh the assertion within the evaluation."""

src/prompt_foundry_python_sdk/types/evaluation_assertion_update_params.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
5+
from typing import List, Optional
66
from typing_extensions import Literal, Required, Annotated, TypedDict
77

88
from .._utils import PropertyInfo
@@ -19,7 +19,9 @@ class EvaluationAssertionUpdateParams(TypedDict, total=False):
1919
Only required when type is `JSON_EXACT_MATCH` or `JSON_CONTAINS`.
2020
"""
2121

22-
target_value: Required[Annotated[Optional[str], PropertyInfo(alias="targetValue")]]
22+
target_threshold: Required[Annotated[Optional[float], PropertyInfo(alias="targetThreshold")]]
23+
24+
target_values: Required[Annotated[Optional[List[str]], PropertyInfo(alias="targetValues")]]
2325

2426
tool_name: Required[Annotated[Optional[str], PropertyInfo(alias="toolName")]]
2527
"""The name of the tool to match.
@@ -28,9 +30,22 @@ class EvaluationAssertionUpdateParams(TypedDict, total=False):
2830
"""
2931

3032
type: Required[
31-
Literal["CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"]
33+
Literal[
34+
"CONTAINS_ALL",
35+
"CONTAINS_ANY",
36+
"COST",
37+
"EXACT_MATCH",
38+
"LATENCY",
39+
"STARTS_WITH",
40+
"TOOL_CALLED",
41+
"TOOL_CALLED_WITH",
42+
]
3243
]
3344
"""The type of evaluation matcher to use."""
3445

46+
ignore_case: Annotated[bool, PropertyInfo(alias="ignoreCase")]
47+
48+
negate: bool
49+
3550
weight: float
3651
"""How heavily to weigh the assertion within the evaluation."""

0 commit comments

Comments
 (0)