|
17 | 17 | from ...types import ( |
18 | 18 | scenario_list_params, |
19 | 19 | scenario_create_params, |
| 20 | + scenario_update_params, |
20 | 21 | scenario_start_run_params, |
21 | 22 | scenario_list_public_params, |
22 | 23 | ) |
@@ -182,6 +183,78 @@ def retrieve( |
182 | 183 | cast_to=ScenarioView, |
183 | 184 | ) |
184 | 185 |
|
| 186 | + def update( |
| 187 | + self, |
| 188 | + id: str, |
| 189 | + *, |
| 190 | + input_context: InputContextParam, |
| 191 | + name: str, |
| 192 | + scoring_contract: ScoringContractParam, |
| 193 | + environment_parameters: Optional[ScenarioEnvironmentParam] | NotGiven = NOT_GIVEN, |
| 194 | + metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, |
| 195 | + reference_output: Optional[str] | NotGiven = NOT_GIVEN, |
| 196 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 197 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 198 | + extra_headers: Headers | None = None, |
| 199 | + extra_query: Query | None = None, |
| 200 | + extra_body: Body | None = None, |
| 201 | + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
| 202 | + idempotency_key: str | None = None, |
| 203 | + ) -> ScenarioView: |
| 204 | + """ |
| 205 | + Update a Scenario, a repeatable AI coding evaluation test that defines the |
| 206 | + starting environment as well as evaluation success criteria. |
| 207 | +
|
| 208 | + Args: |
| 209 | + input_context: The input context for the Scenario. |
| 210 | +
|
| 211 | + name: Name of the scenario. |
| 212 | +
|
| 213 | + scoring_contract: The scoring contract for the Scenario. |
| 214 | +
|
| 215 | + environment_parameters: The Environment in which the Scenario will run. |
| 216 | +
|
| 217 | + metadata: User defined metadata to attach to the scenario for organization. |
| 218 | +
|
| 219 | + reference_output: A string representation of the reference output to solve the scenario. Commonly |
| 220 | + can be the result of a git diff or a sequence of command actions to apply to the |
| 221 | + environment. |
| 222 | +
|
| 223 | + extra_headers: Send extra headers |
| 224 | +
|
| 225 | + extra_query: Add additional query parameters to the request |
| 226 | +
|
| 227 | + extra_body: Add additional JSON properties to the request |
| 228 | +
|
| 229 | + timeout: Override the client-level default timeout for this request, in seconds |
| 230 | +
|
| 231 | + idempotency_key: Specify a custom idempotency key for this request |
| 232 | + """ |
| 233 | + if not id: |
| 234 | + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") |
| 235 | + return self._post( |
| 236 | + f"/v1/scenarios/{id}", |
| 237 | + body=maybe_transform( |
| 238 | + { |
| 239 | + "input_context": input_context, |
| 240 | + "name": name, |
| 241 | + "scoring_contract": scoring_contract, |
| 242 | + "environment_parameters": environment_parameters, |
| 243 | + "metadata": metadata, |
| 244 | + "reference_output": reference_output, |
| 245 | + }, |
| 246 | + scenario_update_params.ScenarioUpdateParams, |
| 247 | + ), |
| 248 | + options=make_request_options( |
| 249 | + extra_headers=extra_headers, |
| 250 | + extra_query=extra_query, |
| 251 | + extra_body=extra_body, |
| 252 | + timeout=timeout, |
| 253 | + idempotency_key=idempotency_key, |
| 254 | + ), |
| 255 | + cast_to=ScenarioView, |
| 256 | + ) |
| 257 | + |
185 | 258 | def list( |
186 | 259 | self, |
187 | 260 | *, |
@@ -474,6 +547,78 @@ async def retrieve( |
474 | 547 | cast_to=ScenarioView, |
475 | 548 | ) |
476 | 549 |
|
| 550 | + async def update( |
| 551 | + self, |
| 552 | + id: str, |
| 553 | + *, |
| 554 | + input_context: InputContextParam, |
| 555 | + name: str, |
| 556 | + scoring_contract: ScoringContractParam, |
| 557 | + environment_parameters: Optional[ScenarioEnvironmentParam] | NotGiven = NOT_GIVEN, |
| 558 | + metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, |
| 559 | + reference_output: Optional[str] | NotGiven = NOT_GIVEN, |
| 560 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 561 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 562 | + extra_headers: Headers | None = None, |
| 563 | + extra_query: Query | None = None, |
| 564 | + extra_body: Body | None = None, |
| 565 | + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
| 566 | + idempotency_key: str | None = None, |
| 567 | + ) -> ScenarioView: |
| 568 | + """ |
| 569 | + Update a Scenario, a repeatable AI coding evaluation test that defines the |
| 570 | + starting environment as well as evaluation success criteria. |
| 571 | +
|
| 572 | + Args: |
| 573 | + input_context: The input context for the Scenario. |
| 574 | +
|
| 575 | + name: Name of the scenario. |
| 576 | +
|
| 577 | + scoring_contract: The scoring contract for the Scenario. |
| 578 | +
|
| 579 | + environment_parameters: The Environment in which the Scenario will run. |
| 580 | +
|
| 581 | + metadata: User defined metadata to attach to the scenario for organization. |
| 582 | +
|
| 583 | + reference_output: A string representation of the reference output to solve the scenario. Commonly |
| 584 | + can be the result of a git diff or a sequence of command actions to apply to the |
| 585 | + environment. |
| 586 | +
|
| 587 | + extra_headers: Send extra headers |
| 588 | +
|
| 589 | + extra_query: Add additional query parameters to the request |
| 590 | +
|
| 591 | + extra_body: Add additional JSON properties to the request |
| 592 | +
|
| 593 | + timeout: Override the client-level default timeout for this request, in seconds |
| 594 | +
|
| 595 | + idempotency_key: Specify a custom idempotency key for this request |
| 596 | + """ |
| 597 | + if not id: |
| 598 | + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") |
| 599 | + return await self._post( |
| 600 | + f"/v1/scenarios/{id}", |
| 601 | + body=await async_maybe_transform( |
| 602 | + { |
| 603 | + "input_context": input_context, |
| 604 | + "name": name, |
| 605 | + "scoring_contract": scoring_contract, |
| 606 | + "environment_parameters": environment_parameters, |
| 607 | + "metadata": metadata, |
| 608 | + "reference_output": reference_output, |
| 609 | + }, |
| 610 | + scenario_update_params.ScenarioUpdateParams, |
| 611 | + ), |
| 612 | + options=make_request_options( |
| 613 | + extra_headers=extra_headers, |
| 614 | + extra_query=extra_query, |
| 615 | + extra_body=extra_body, |
| 616 | + timeout=timeout, |
| 617 | + idempotency_key=idempotency_key, |
| 618 | + ), |
| 619 | + cast_to=ScenarioView, |
| 620 | + ) |
| 621 | + |
477 | 622 | def list( |
478 | 623 | self, |
479 | 624 | *, |
@@ -646,6 +791,9 @@ def __init__(self, scenarios: ScenariosResource) -> None: |
646 | 791 | self.retrieve = to_raw_response_wrapper( |
647 | 792 | scenarios.retrieve, |
648 | 793 | ) |
| 794 | + self.update = to_raw_response_wrapper( |
| 795 | + scenarios.update, |
| 796 | + ) |
649 | 797 | self.list = to_raw_response_wrapper( |
650 | 798 | scenarios.list, |
651 | 799 | ) |
@@ -675,6 +823,9 @@ def __init__(self, scenarios: AsyncScenariosResource) -> None: |
675 | 823 | self.retrieve = async_to_raw_response_wrapper( |
676 | 824 | scenarios.retrieve, |
677 | 825 | ) |
| 826 | + self.update = async_to_raw_response_wrapper( |
| 827 | + scenarios.update, |
| 828 | + ) |
678 | 829 | self.list = async_to_raw_response_wrapper( |
679 | 830 | scenarios.list, |
680 | 831 | ) |
@@ -704,6 +855,9 @@ def __init__(self, scenarios: ScenariosResource) -> None: |
704 | 855 | self.retrieve = to_streamed_response_wrapper( |
705 | 856 | scenarios.retrieve, |
706 | 857 | ) |
| 858 | + self.update = to_streamed_response_wrapper( |
| 859 | + scenarios.update, |
| 860 | + ) |
707 | 861 | self.list = to_streamed_response_wrapper( |
708 | 862 | scenarios.list, |
709 | 863 | ) |
@@ -733,6 +887,9 @@ def __init__(self, scenarios: AsyncScenariosResource) -> None: |
733 | 887 | self.retrieve = async_to_streamed_response_wrapper( |
734 | 888 | scenarios.retrieve, |
735 | 889 | ) |
| 890 | + self.update = async_to_streamed_response_wrapper( |
| 891 | + scenarios.update, |
| 892 | + ) |
736 | 893 | self.list = async_to_streamed_response_wrapper( |
737 | 894 | scenarios.list, |
738 | 895 | ) |
|
0 commit comments