Skip to content

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

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
Jun 27, 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-d77f7f9f32373ca58fafe721c7c3bab1ba26d366ff00e7f5c59e6cf1058a9db2.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prompt-foundry%2Fprompt-foundry-sdk-2ed0eba8700d06f5263ff3848c714cdd3f07b4942b13bfa3c744d3720cca1615.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def create(
target_value: str,
tool_name: Optional[str],
type: Literal[
"EXACT_MATCH", "CONTAINS", "JSON_EXACT_MATCH", "JSON_CONTAINS", "TOOL_CALLED", "TOOL_CALLED_WITH"
"CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"
],
# 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 @@ -108,7 +108,7 @@ def update(
target_value: str,
tool_name: Optional[str],
type: Literal[
"EXACT_MATCH", "CONTAINS", "JSON_EXACT_MATCH", "JSON_CONTAINS", "TOOL_CALLED", "TOOL_CALLED_WITH"
"CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"
],
# 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 @@ -280,7 +280,7 @@ async def create(
target_value: str,
tool_name: Optional[str],
type: Literal[
"EXACT_MATCH", "CONTAINS", "JSON_EXACT_MATCH", "JSON_CONTAINS", "TOOL_CALLED", "TOOL_CALLED_WITH"
"CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"
],
# 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 @@ -336,7 +336,7 @@ async def update(
target_value: str,
tool_name: Optional[str],
type: Literal[
"EXACT_MATCH", "CONTAINS", "JSON_EXACT_MATCH", "JSON_CONTAINS", "TOOL_CALLED", "TOOL_CALLED_WITH"
"CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"
],
# 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
2 changes: 1 addition & 1 deletion src/prompt_foundry_python_sdk/types/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class AppendedMessage(BaseModel):
content: Optional[str] = None
"""Example: "Hello, {{city}}!" """

role: Literal["user", "assistant", "system", "tool"]
role: Literal["assistant", "system", "tool", "user"]

tool_call_id: Optional[str] = FieldInfo(alias="toolCallId", default=None)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ class EvaluationAssertion(BaseModel):
Only required when type is `TOOL_CALLED` or `TOOL_CALLED_WITH`.
"""

type: Literal["EXACT_MATCH", "CONTAINS", "JSON_EXACT_MATCH", "JSON_CONTAINS", "TOOL_CALLED", "TOOL_CALLED_WITH"]
type: Literal["CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"]
"""The type of evaluation matcher to use."""
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ class EvaluationAssertionCreateParams(TypedDict, total=False):
"""

type: Required[
Literal["EXACT_MATCH", "CONTAINS", "JSON_EXACT_MATCH", "JSON_CONTAINS", "TOOL_CALLED", "TOOL_CALLED_WITH"]
Literal["CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"]
]
"""The type of evaluation matcher to use."""
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ class EvaluationAssertionUpdateParams(TypedDict, total=False):
"""

type: Required[
Literal["EXACT_MATCH", "CONTAINS", "JSON_EXACT_MATCH", "JSON_CONTAINS", "TOOL_CALLED", "TOOL_CALLED_WITH"]
Literal["CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"]
]
"""The type of evaluation matcher to use."""
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class AppendedMessage(TypedDict, total=False):
content: Required[Optional[str]]
"""Example: "Hello, {{city}}!" """

role: Required[Literal["user", "assistant", "system", "tool"]]
role: Required[Literal["assistant", "system", "tool", "user"]]

tool_call_id: Required[Annotated[Optional[str], PropertyInfo(alias="toolCallId")]]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class AppendedMessage(TypedDict, total=False):
content: Required[Optional[str]]
"""Example: "Hello, {{city}}!" """

role: Required[Literal["user", "assistant", "system", "tool"]]
role: Required[Literal["assistant", "system", "tool", "user"]]

tool_call_id: Required[Annotated[Optional[str], PropertyInfo(alias="toolCallId")]]

Expand Down
4 changes: 2 additions & 2 deletions src/prompt_foundry_python_sdk/types/prompt_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Message(BaseModel):
content: Optional[str] = None
"""Example: "Hello, {{city}}!" """

role: Literal["user", "assistant", "system", "tool"]
role: Literal["assistant", "system", "tool", "user"]

tool_call_id: Optional[str] = FieldInfo(alias="toolCallId", default=None)

Expand All @@ -59,7 +59,7 @@ class Parameters(BaseModel):
presence_penalty: float = FieldInfo(alias="presencePenalty")
"""Example: 0"""

response_format: Literal["TEXT", "JSON"] = FieldInfo(alias="responseFormat")
response_format: Literal["JSON", "TEXT"] = FieldInfo(alias="responseFormat")
"""Example: PromptResponseFormat.TEXT"""

seed: Optional[float] = None
Expand Down
4 changes: 2 additions & 2 deletions src/prompt_foundry_python_sdk/types/prompt_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Message(TypedDict, total=False):
content: Required[Optional[str]]
"""Example: "Hello, {{city}}!" """

role: Required[Literal["user", "assistant", "system", "tool"]]
role: Required[Literal["assistant", "system", "tool", "user"]]

tool_call_id: Required[Annotated[Optional[str], PropertyInfo(alias="toolCallId")]]

Expand All @@ -69,7 +69,7 @@ class Parameters(TypedDict, total=False):
presence_penalty: Required[Annotated[float, PropertyInfo(alias="presencePenalty")]]
"""Example: 0"""

response_format: Required[Annotated[Literal["TEXT", "JSON"], PropertyInfo(alias="responseFormat")]]
response_format: Required[Annotated[Literal["JSON", "TEXT"], PropertyInfo(alias="responseFormat")]]
"""Example: PromptResponseFormat.TEXT"""

seed: Required[Optional[float]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class AppendMessage(TypedDict, total=False):
content: Required[Optional[str]]
"""Example: "Hello, {{city}}!" """

role: Required[Literal["user", "assistant", "system", "tool"]]
role: Required[Literal["assistant", "system", "tool", "user"]]

tool_call_id: Required[Annotated[Optional[str], PropertyInfo(alias="toolCallId")]]

Expand Down Expand Up @@ -99,7 +99,7 @@ class OverrideMessage(TypedDict, total=False):
content: Required[Optional[str]]
"""Example: "Hello, {{city}}!" """

role: Required[Literal["user", "assistant", "system", "tool"]]
role: Required[Literal["assistant", "system", "tool", "user"]]

tool_call_id: Required[Annotated[Optional[str], PropertyInfo(alias="toolCallId")]]

Expand Down
4 changes: 2 additions & 2 deletions src/prompt_foundry_python_sdk/types/prompt_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Message(TypedDict, total=False):
content: Required[Optional[str]]
"""Example: "Hello, {{city}}!" """

role: Required[Literal["user", "assistant", "system", "tool"]]
role: Required[Literal["assistant", "system", "tool", "user"]]

tool_call_id: Required[Annotated[Optional[str], PropertyInfo(alias="toolCallId")]]

Expand All @@ -69,7 +69,7 @@ class Parameters(TypedDict, total=False):
presence_penalty: Required[Annotated[float, PropertyInfo(alias="presencePenalty")]]
"""Example: 0"""

response_format: Required[Annotated[Literal["TEXT", "JSON"], PropertyInfo(alias="responseFormat")]]
response_format: Required[Annotated[Literal["JSON", "TEXT"], PropertyInfo(alias="responseFormat")]]
"""Example: PromptResponseFormat.TEXT"""

seed: Required[Optional[float]]
Expand Down
28 changes: 14 additions & 14 deletions tests/api_resources/test_evaluation_assertions.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_method_create(self, client: PromptFoundry) -> None:
json_path="string",
target_value="string",
tool_name="string",
type="EXACT_MATCH",
type="CONTAINS",
)
assert_matches_type(EvaluationAssertion, evaluation_assertion, path=["response"])

Expand All @@ -39,7 +39,7 @@ def test_raw_response_create(self, client: PromptFoundry) -> None:
json_path="string",
target_value="string",
tool_name="string",
type="EXACT_MATCH",
type="CONTAINS",
)

assert response.is_closed is True
Expand All @@ -54,7 +54,7 @@ def test_streaming_response_create(self, client: PromptFoundry) -> None:
json_path="string",
target_value="string",
tool_name="string",
type="EXACT_MATCH",
type="CONTAINS",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -72,7 +72,7 @@ def test_method_update(self, client: PromptFoundry) -> None:
json_path="string",
target_value="string",
tool_name="string",
type="EXACT_MATCH",
type="CONTAINS",
)
assert_matches_type(EvaluationAssertion, evaluation_assertion, path=["response"])

Expand All @@ -84,7 +84,7 @@ def test_raw_response_update(self, client: PromptFoundry) -> None:
json_path="string",
target_value="string",
tool_name="string",
type="EXACT_MATCH",
type="CONTAINS",
)

assert response.is_closed is True
Expand All @@ -100,7 +100,7 @@ def test_streaming_response_update(self, client: PromptFoundry) -> None:
json_path="string",
target_value="string",
tool_name="string",
type="EXACT_MATCH",
type="CONTAINS",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -119,7 +119,7 @@ def test_path_params_update(self, client: PromptFoundry) -> None:
json_path="string",
target_value="string",
tool_name="string",
type="EXACT_MATCH",
type="CONTAINS",
)

@parametrize
Expand Down Expand Up @@ -241,7 +241,7 @@ async def test_method_create(self, async_client: AsyncPromptFoundry) -> None:
json_path="string",
target_value="string",
tool_name="string",
type="EXACT_MATCH",
type="CONTAINS",
)
assert_matches_type(EvaluationAssertion, evaluation_assertion, path=["response"])

Expand All @@ -252,7 +252,7 @@ async def test_raw_response_create(self, async_client: AsyncPromptFoundry) -> No
json_path="string",
target_value="string",
tool_name="string",
type="EXACT_MATCH",
type="CONTAINS",
)

assert response.is_closed is True
Expand All @@ -267,7 +267,7 @@ async def test_streaming_response_create(self, async_client: AsyncPromptFoundry)
json_path="string",
target_value="string",
tool_name="string",
type="EXACT_MATCH",
type="CONTAINS",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -285,7 +285,7 @@ async def test_method_update(self, async_client: AsyncPromptFoundry) -> None:
json_path="string",
target_value="string",
tool_name="string",
type="EXACT_MATCH",
type="CONTAINS",
)
assert_matches_type(EvaluationAssertion, evaluation_assertion, path=["response"])

Expand All @@ -297,7 +297,7 @@ async def test_raw_response_update(self, async_client: AsyncPromptFoundry) -> No
json_path="string",
target_value="string",
tool_name="string",
type="EXACT_MATCH",
type="CONTAINS",
)

assert response.is_closed is True
Expand All @@ -313,7 +313,7 @@ async def test_streaming_response_update(self, async_client: AsyncPromptFoundry)
json_path="string",
target_value="string",
tool_name="string",
type="EXACT_MATCH",
type="CONTAINS",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -332,7 +332,7 @@ async def test_path_params_update(self, async_client: AsyncPromptFoundry) -> Non
json_path="string",
target_value="string",
tool_name="string",
type="EXACT_MATCH",
type="CONTAINS",
)

@parametrize
Expand Down
Loading