Skip to content

feat(api): OpenAPI spec update via Stainless API #174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 25, 2024
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
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 21
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prompt-foundry%2Fprompt-foundry-sdk-ec010a81f2e8cfe74de9842b6fcd84599fd1d3f439ba3eb868fb5bdbfa2fa260.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prompt-foundry%2Fprompt-foundry-sdk-101dab0674c0098868baea52c37050f14ce1dffeadecc3978c77e7b8a47c608c.yml
78 changes: 65 additions & 13 deletions src/prompt_foundry_python_sdk/resources/evaluation_assertions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Optional
from typing import List, Optional
from typing_extensions import Literal

import httpx
Expand Down Expand Up @@ -47,11 +47,21 @@ def create(
*,
evaluation_id: str,
json_path: Optional[str],
target_value: Optional[str],
target_threshold: Optional[float],
target_values: Optional[List[str]],
tool_name: Optional[str],
type: Literal[
"CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"
"CONTAINS_ALL",
"CONTAINS_ANY",
"COST",
"EXACT_MATCH",
"LATENCY",
"STARTS_WITH",
"TOOL_CALLED",
"TOOL_CALLED_WITH",
],
ignore_case: bool | NotGiven = NOT_GIVEN,
negate: bool | NotGiven = NOT_GIVEN,
weight: float | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand Down Expand Up @@ -88,9 +98,12 @@ def create(
{
"evaluation_id": evaluation_id,
"json_path": json_path,
"target_value": target_value,
"target_threshold": target_threshold,
"target_values": target_values,
"tool_name": tool_name,
"type": type,
"ignore_case": ignore_case,
"negate": negate,
"weight": weight,
},
evaluation_assertion_create_params.EvaluationAssertionCreateParams,
Expand All @@ -107,11 +120,21 @@ def update(
*,
evaluation_id: str,
json_path: Optional[str],
target_value: Optional[str],
target_threshold: Optional[float],
target_values: Optional[List[str]],
tool_name: Optional[str],
type: Literal[
"CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"
"CONTAINS_ALL",
"CONTAINS_ANY",
"COST",
"EXACT_MATCH",
"LATENCY",
"STARTS_WITH",
"TOOL_CALLED",
"TOOL_CALLED_WITH",
],
ignore_case: bool | NotGiven = NOT_GIVEN,
negate: bool | NotGiven = NOT_GIVEN,
weight: float | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand Down Expand Up @@ -150,9 +173,12 @@ def update(
{
"evaluation_id": evaluation_id,
"json_path": json_path,
"target_value": target_value,
"target_threshold": target_threshold,
"target_values": target_values,
"tool_name": tool_name,
"type": type,
"ignore_case": ignore_case,
"negate": negate,
"weight": weight,
},
evaluation_assertion_update_params.EvaluationAssertionUpdateParams,
Expand Down Expand Up @@ -283,11 +309,21 @@ async def create(
*,
evaluation_id: str,
json_path: Optional[str],
target_value: Optional[str],
target_threshold: Optional[float],
target_values: Optional[List[str]],
tool_name: Optional[str],
type: Literal[
"CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"
"CONTAINS_ALL",
"CONTAINS_ANY",
"COST",
"EXACT_MATCH",
"LATENCY",
"STARTS_WITH",
"TOOL_CALLED",
"TOOL_CALLED_WITH",
],
ignore_case: bool | NotGiven = NOT_GIVEN,
negate: bool | NotGiven = NOT_GIVEN,
weight: float | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand Down Expand Up @@ -324,9 +360,12 @@ async def create(
{
"evaluation_id": evaluation_id,
"json_path": json_path,
"target_value": target_value,
"target_threshold": target_threshold,
"target_values": target_values,
"tool_name": tool_name,
"type": type,
"ignore_case": ignore_case,
"negate": negate,
"weight": weight,
},
evaluation_assertion_create_params.EvaluationAssertionCreateParams,
Expand All @@ -343,11 +382,21 @@ async def update(
*,
evaluation_id: str,
json_path: Optional[str],
target_value: Optional[str],
target_threshold: Optional[float],
target_values: Optional[List[str]],
tool_name: Optional[str],
type: Literal[
"CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"
"CONTAINS_ALL",
"CONTAINS_ANY",
"COST",
"EXACT_MATCH",
"LATENCY",
"STARTS_WITH",
"TOOL_CALLED",
"TOOL_CALLED_WITH",
],
ignore_case: bool | NotGiven = NOT_GIVEN,
negate: bool | NotGiven = NOT_GIVEN,
weight: float | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand Down Expand Up @@ -386,9 +435,12 @@ async def update(
{
"evaluation_id": evaluation_id,
"json_path": json_path,
"target_value": target_value,
"target_threshold": target_threshold,
"target_values": target_values,
"tool_name": tool_name,
"type": type,
"ignore_case": ignore_case,
"negate": negate,
"weight": weight,
},
evaluation_assertion_update_params.EvaluationAssertionUpdateParams,
Expand Down
21 changes: 18 additions & 3 deletions src/prompt_foundry_python_sdk/types/evaluation_assertion.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing import List, Optional
from typing_extensions import Literal

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

target_value: Optional[str] = FieldInfo(alias="targetValue", default=None)
target_threshold: Optional[float] = FieldInfo(alias="targetThreshold", default=None)

target_values: Optional[List[str]] = FieldInfo(alias="targetValues", default=None)

tool_name: Optional[str] = FieldInfo(alias="toolName", default=None)
"""The name of the tool to match.

Only required when type is `TOOL_CALLED` or `TOOL_CALLED_WITH`.
"""

type: Literal["CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"]
type: Literal[
"CONTAINS_ALL",
"CONTAINS_ANY",
"COST",
"EXACT_MATCH",
"LATENCY",
"STARTS_WITH",
"TOOL_CALLED",
"TOOL_CALLED_WITH",
]
"""The type of evaluation matcher to use."""

ignore_case: Optional[bool] = FieldInfo(alias="ignoreCase", default=None)

negate: Optional[bool] = None

weight: Optional[float] = None
"""How heavily to weigh the assertion within the evaluation."""
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Optional
from typing import List, Optional
from typing_extensions import Literal, Required, Annotated, TypedDict

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

target_value: Required[Annotated[Optional[str], PropertyInfo(alias="targetValue")]]
target_threshold: Required[Annotated[Optional[float], PropertyInfo(alias="targetThreshold")]]

target_values: Required[Annotated[Optional[List[str]], PropertyInfo(alias="targetValues")]]

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

type: Required[
Literal["CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"]
Literal[
"CONTAINS_ALL",
"CONTAINS_ANY",
"COST",
"EXACT_MATCH",
"LATENCY",
"STARTS_WITH",
"TOOL_CALLED",
"TOOL_CALLED_WITH",
]
]
"""The type of evaluation matcher to use."""

ignore_case: Annotated[bool, PropertyInfo(alias="ignoreCase")]

negate: bool

weight: float
"""How heavily to weigh the assertion within the evaluation."""
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Optional
from typing import List, Optional
from typing_extensions import Literal, Required, Annotated, TypedDict

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

target_value: Required[Annotated[Optional[str], PropertyInfo(alias="targetValue")]]
target_threshold: Required[Annotated[Optional[float], PropertyInfo(alias="targetThreshold")]]

target_values: Required[Annotated[Optional[List[str]], PropertyInfo(alias="targetValues")]]

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

type: Required[
Literal["CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"]
Literal[
"CONTAINS_ALL",
"CONTAINS_ANY",
"COST",
"EXACT_MATCH",
"LATENCY",
"STARTS_WITH",
"TOOL_CALLED",
"TOOL_CALLED_WITH",
]
]
"""The type of evaluation matcher to use."""

ignore_case: Annotated[bool, PropertyInfo(alias="ignoreCase")]

negate: bool

weight: float
"""How heavily to weigh the assertion within the evaluation."""
Loading