Skip to content

Commit

Permalink
SDK regeneration
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Oct 17, 2024
1 parent 877d78e commit 6754a15
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 5 deletions.
9 changes: 9 additions & 0 deletions .mock/definition/__package__.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2358,6 +2358,15 @@ types:
total_cost_usd:
type: optional<string>
docs: Total cost of the inference (in USD)
error:
type: optional<boolean>
docs: Whether an error occurred or not
error_type:
type: optional<string>
docs: Type of error (e.g. "Timeout", "Rate Limit", etc)
error_message:
type: optional<string>
docs: Error message details
source:
openapi: openapi/openapi.yaml
RefinedPromptResponseRefinementStatus:
Expand Down
3 changes: 3 additions & 0 deletions .mock/definition/prompts/versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ service:
prompt_cost_usd: prompt_cost_usd
completion_cost_usd: completion_cost_usd
total_cost_usd: total_cost_usd
error: true
error_type: error_type
error_message: error_message
audiences:
- public
get_refined_prompt:
Expand Down
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions src/label_studio_sdk/types/inference_run_cost_estimate.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@ class InferenceRunCostEstimate(pydantic_v1.BaseModel):
Total cost of the inference (in USD)
"""

error: typing.Optional[bool] = pydantic_v1.Field(default=None)
"""
Whether an error occurred or not
"""

error_type: typing.Optional[str] = pydantic_v1.Field(default=None)
"""
Type of error (e.g. "Timeout", "Rate Limit", etc)
"""

error_message: typing.Optional[str] = pydantic_v1.Field(default=None)
"""
Error message details
"""

def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
return super().json(**kwargs_with_defaults)
Expand Down
12 changes: 11 additions & 1 deletion tests/prompts/test_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,18 @@ async def test_cost_estimate(client: LabelStudio, async_client: AsyncLabelStudio
"prompt_cost_usd": "prompt_cost_usd",
"completion_cost_usd": "completion_cost_usd",
"total_cost_usd": "total_cost_usd",
"error": True,
"error_type": "error_type",
"error_message": "error_message",
}
expected_types: typing.Any = {
"prompt_cost_usd": None,
"completion_cost_usd": None,
"total_cost_usd": None,
"error": None,
"error_type": None,
"error_message": None,
}
expected_types: typing.Any = {"prompt_cost_usd": None, "completion_cost_usd": None, "total_cost_usd": None}
response = client.prompts.versions.cost_estimate(prompt_id=1, version_id=1, project_id=1, project_subset=1)
validate_response(response, expected_response, expected_types)

Expand Down

0 comments on commit 6754a15

Please sign in to comment.