Skip to content
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
5 changes: 3 additions & 2 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ jobs:
publish:
name: publish
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand All @@ -24,5 +27,3 @@ jobs:
- name: Publish to PyPI
run: |
bash ./bin/publish-pypi
env:
PYPI_TOKEN: ${{ secrets.PAYI_PYPI_TOKEN || secrets.PYPI_TOKEN }}
1 change: 0 additions & 1 deletion .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ jobs:
bash ./bin/check-release-environment
env:
RELEASE_PLEASE_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }}
PYPI_TOKEN: ${{ secrets.PAYI_PYPI_TOKEN || secrets.PYPI_TOKEN }}
7 changes: 5 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ from payi.types import (
CostData,
CostDetails,
DefaultResponse,
Limit,
LimitHistoryResponse,
LimitResponse,
RequestsData,
TotalCostData,
LimitListResponse,
)
```

Expand All @@ -35,7 +35,7 @@ Methods:
- <code title="post /api/v1/limits">client.limits.<a href="./src/payi/resources/limits/limits.py">create</a>(\*\*<a href="src/payi/types/limit_create_params.py">params</a>) -> <a href="./src/payi/types/limit_response.py">LimitResponse</a></code>
- <code title="get /api/v1/limits/{limit_id}">client.limits.<a href="./src/payi/resources/limits/limits.py">retrieve</a>(limit_id) -> <a href="./src/payi/types/limit_response.py">LimitResponse</a></code>
- <code title="put /api/v1/limits/{limit_id}">client.limits.<a href="./src/payi/resources/limits/limits.py">update</a>(limit_id, \*\*<a href="src/payi/types/limit_update_params.py">params</a>) -> <a href="./src/payi/types/limit_response.py">LimitResponse</a></code>
- <code title="get /api/v1/limits">client.limits.<a href="./src/payi/resources/limits/limits.py">list</a>(\*\*<a href="src/payi/types/limit_list_params.py">params</a>) -> <a href="./src/payi/types/limit_list_response.py">SyncCursorPage[LimitListResponse]</a></code>
- <code title="get /api/v1/limits">client.limits.<a href="./src/payi/resources/limits/limits.py">list</a>(\*\*<a href="src/payi/types/limit_list_params.py">params</a>) -> <a href="./src/payi/types/limit.py">SyncCursorPage[Limit]</a></code>
- <code title="delete /api/v1/limits/{limit_id}">client.limits.<a href="./src/payi/resources/limits/limits.py">delete</a>(limit_id) -> <a href="./src/payi/types/default_response.py">DefaultResponse</a></code>
- <code title="post /api/v1/limits/{limit_id}/reset">client.limits.<a href="./src/payi/resources/limits/limits.py">reset</a>(limit_id, \*\*<a href="src/payi/types/limit_reset_params.py">params</a>) -> <a href="./src/payi/types/limit_history_response.py">LimitHistoryResponse</a></code>

Expand All @@ -59,6 +59,7 @@ Types:
from payi.types import (
BulkIngestRequest,
BulkIngestResponse,
FunctionCallInfo,
IngestRequest,
IngestResponse,
PayICommonModelsAPIRouterHeaderInfo,
Expand All @@ -76,6 +77,8 @@ Types:

```python
from payi.types import (
CategoryResourceMappedResource,
CategoryResourcePriceUnits,
CategoryResourceResponse,
CategoryResponse,
CategoryDeleteResponse,
Expand Down
4 changes: 0 additions & 4 deletions bin/check-release-environment
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ if [ -z "${RELEASE_PLEASE_TOKEN}" ]; then
errors+=("The RELEASE_PLEASE_TOKEN secret has not been set. Create a fine-grained GitHub PAT and add it as a repository secret.")
fi

if [ -z "${PYPI_TOKEN}" ]; then
errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
fi

lenErrors=${#errors[@]}

if [[ lenErrors -gt 0 ]]; then
Expand Down
6 changes: 5 additions & 1 deletion bin/publish-pypi
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ set -eux
rm -rf dist
mkdir -p dist
uv build
uv publish --token=$PYPI_TOKEN
if [ -n "${PYPI_TOKEN:-}" ]; then
uv publish --token=$PYPI_TOKEN
else
uv publish
fi
2 changes: 1 addition & 1 deletion scripts/mock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/payi/resources/categories/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from ..._base_client import AsyncPaginator, make_request_options
from ...types.categories import resource_list_params, resource_create_params
from ...types.category_resource_response import CategoryResourceResponse
from ...types.category_resource_price_units_param import CategoryResourcePriceUnitsParam

__all__ = ["ResourcesResource", "AsyncResourcesResource"]

Expand Down Expand Up @@ -52,7 +53,7 @@ def create(
resource: str,
*,
category: str,
units: Dict[str, resource_create_params.Units],
units: Dict[str, CategoryResourcePriceUnitsParam],
max_input_units: Optional[int] | Omit = omit,
max_output_units: Optional[int] | Omit = omit,
max_total_units: Optional[int] | Omit = omit,
Expand Down Expand Up @@ -267,7 +268,7 @@ async def create(
resource: str,
*,
category: str,
units: Dict[str, resource_create_params.Units],
units: Dict[str, CategoryResourcePriceUnitsParam],
max_input_units: Optional[int] | Omit = omit,
max_output_units: Optional[int] | Omit = omit,
max_total_units: Optional[int] | Omit = omit,
Expand Down
7 changes: 3 additions & 4 deletions src/payi/resources/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from .._base_client import make_request_options
from ..types.ingest_response import IngestResponse
from ..types.bulk_ingest_response import BulkIngestResponse
from ..types.function_call_info_param import FunctionCallInfoParam
from ..types.bulk_ingest_request_param import BulkIngestRequestParam
from ..types.shared_params.ingest_units import IngestUnits
from ..types.pay_i_common_models_api_router_header_info_param import PayICommonModelsAPIRouterHeaderInfoParam
Expand Down Expand Up @@ -110,8 +111,7 @@ def units(
provider_request_headers: Optional[Iterable[PayICommonModelsAPIRouterHeaderInfoParam]] | Omit = omit,
provider_request_json: Optional[str] | Omit = omit,
provider_request_reasoning_json: Optional[str] | Omit = omit,
provider_response_function_calls: Optional[Iterable[ingest_units_params.ProviderResponseFunctionCall]]
| Omit = omit,
provider_response_function_calls: Optional[Iterable[FunctionCallInfoParam]] | Omit = omit,
provider_response_headers: Optional[Iterable[PayICommonModelsAPIRouterHeaderInfoParam]] | Omit = omit,
provider_response_id: Optional[str] | Omit = omit,
provider_response_json: Union[str, SequenceNotStr[str], None] | Omit = omit,
Expand Down Expand Up @@ -341,8 +341,7 @@ async def units(
provider_request_headers: Optional[Iterable[PayICommonModelsAPIRouterHeaderInfoParam]] | Omit = omit,
provider_request_json: Optional[str] | Omit = omit,
provider_request_reasoning_json: Optional[str] | Omit = omit,
provider_response_function_calls: Optional[Iterable[ingest_units_params.ProviderResponseFunctionCall]]
| Omit = omit,
provider_response_function_calls: Optional[Iterable[FunctionCallInfoParam]] | Omit = omit,
provider_response_headers: Optional[Iterable[PayICommonModelsAPIRouterHeaderInfoParam]] | Omit = omit,
provider_response_id: Optional[str] | Omit = omit,
provider_response_json: Union[str, SequenceNotStr[str], None] | Omit = omit,
Expand Down
14 changes: 7 additions & 7 deletions src/payi/resources/limits/limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
async_to_streamed_response_wrapper,
)
from ...pagination import SyncCursorPage, AsyncCursorPage
from ...types.limit import Limit
from ..._base_client import AsyncPaginator, make_request_options
from ...types.limit_response import LimitResponse
from ...types.default_response import DefaultResponse
from ...types.limit_list_response import LimitListResponse
from ...types.limit_history_response import LimitHistoryResponse

__all__ = ["LimitsResource", "AsyncLimitsResource"]
Expand Down Expand Up @@ -199,7 +199,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncCursorPage[LimitListResponse]:
) -> SyncCursorPage[Limit]:
"""
Get all Limits

Expand All @@ -214,7 +214,7 @@ def list(
"""
return self._get_api_list(
"/api/v1/limits",
page=SyncCursorPage[LimitListResponse],
page=SyncCursorPage[Limit],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand All @@ -230,7 +230,7 @@ def list(
limit_list_params.LimitListParams,
),
),
model=LimitListResponse,
model=Limit,
)

def delete(
Expand Down Expand Up @@ -469,7 +469,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[LimitListResponse, AsyncCursorPage[LimitListResponse]]:
) -> AsyncPaginator[Limit, AsyncCursorPage[Limit]]:
"""
Get all Limits

Expand All @@ -484,7 +484,7 @@ def list(
"""
return self._get_api_list(
"/api/v1/limits",
page=AsyncCursorPage[LimitListResponse],
page=AsyncCursorPage[Limit],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand All @@ -500,7 +500,7 @@ def list(
limit_list_params.LimitListParams,
),
),
model=LimitListResponse,
model=Limit,
)

async def delete(
Expand Down
6 changes: 5 additions & 1 deletion src/payi/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

from .limit import Limit as Limit
from .shared import (
APIError as APIError,
IngestUnits as IngestUnits,
Expand All @@ -26,17 +27,20 @@
from .limit_reset_params import LimitResetParams as LimitResetParams
from .ingest_units_params import IngestUnitsParams as IngestUnitsParams
from .limit_create_params import LimitCreateParams as LimitCreateParams
from .limit_list_response import LimitListResponse as LimitListResponse
from .limit_update_params import LimitUpdateParams as LimitUpdateParams
from .bulk_ingest_response import BulkIngestResponse as BulkIngestResponse
from .category_list_params import CategoryListParams as CategoryListParams
from .limit_history_response import LimitHistoryResponse as LimitHistoryResponse
from .category_delete_response import CategoryDeleteResponse as CategoryDeleteResponse
from .function_call_info_param import FunctionCallInfoParam as FunctionCallInfoParam
from .bulk_ingest_request_param import BulkIngestRequestParam as BulkIngestRequestParam
from .category_resource_response import CategoryResourceResponse as CategoryResourceResponse
from .use_case_instance_response import UseCaseInstanceResponse as UseCaseInstanceResponse
from .category_resource_price_units import CategoryResourcePriceUnits as CategoryResourcePriceUnits
from .category_list_resources_params import CategoryListResourcesParams as CategoryListResourcesParams
from .category_delete_resource_response import CategoryDeleteResourceResponse as CategoryDeleteResourceResponse
from .category_resource_mapped_resource import CategoryResourceMappedResource as CategoryResourceMappedResource
from .category_resource_price_units_param import CategoryResourcePriceUnitsParam as CategoryResourcePriceUnitsParam
from .pay_i_common_models_api_router_header_info_param import (
PayICommonModelsAPIRouterHeaderInfoParam as PayICommonModelsAPIRouterHeaderInfoParam,
)
11 changes: 3 additions & 8 deletions src/payi/types/bulk_ingest_request_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@

from .._types import SequenceNotStr
from .._utils import PropertyInfo
from .function_call_info_param import FunctionCallInfoParam
from .shared_params.ingest_units import IngestUnits
from .pay_i_common_models_api_router_header_info_param import PayICommonModelsAPIRouterHeaderInfoParam

__all__ = ["BulkIngestRequestParam", "ProviderResponseFunctionCall"]


class ProviderResponseFunctionCall(TypedDict, total=False):
name: Required[str]

arguments: Optional[str]
__all__ = ["BulkIngestRequestParam"]


class BulkIngestRequestParam(TypedDict, total=False):
Expand All @@ -43,7 +38,7 @@ class BulkIngestRequestParam(TypedDict, total=False):

provider_request_reasoning_json: Optional[str]

provider_response_function_calls: Optional[Iterable[ProviderResponseFunctionCall]]
provider_response_function_calls: Optional[Iterable[FunctionCallInfoParam]]

provider_response_headers: Optional[Iterable[PayICommonModelsAPIRouterHeaderInfoParam]]

Expand Down
11 changes: 3 additions & 8 deletions src/payi/types/categories/resource_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
from typing_extensions import Required, Annotated, TypedDict

from ..._utils import PropertyInfo
from ..category_resource_price_units_param import CategoryResourcePriceUnitsParam

__all__ = ["ResourceCreateParams", "Units"]
__all__ = ["ResourceCreateParams"]


class ResourceCreateParams(TypedDict, total=False):
category: Required[str]

units: Required[Dict[str, Units]]
units: Required[Dict[str, CategoryResourcePriceUnitsParam]]

max_input_units: Optional[int]

Expand All @@ -23,9 +24,3 @@ class ResourceCreateParams(TypedDict, total=False):
max_total_units: Optional[int]

start_timestamp: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]


class Units(TypedDict, total=False):
input_price: float

output_price: float
18 changes: 18 additions & 0 deletions src/payi/types/category_resource_mapped_resource.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing_extensions import Literal

from .._models import BaseModel

__all__ = ["CategoryResourceMappedResource"]


class CategoryResourceMappedResource(BaseModel):
category: Optional[str] = None

resource: Optional[str] = None

scope: Optional[Literal["global", "datazone", "region"]] = None

sub_scope: Optional[str] = None
13 changes: 13 additions & 0 deletions src/payi/types/category_resource_price_units.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional

from .._models import BaseModel

__all__ = ["CategoryResourcePriceUnits"]


class CategoryResourcePriceUnits(BaseModel):
input_price: Optional[float] = None

output_price: Optional[float] = None
13 changes: 13 additions & 0 deletions src/payi/types/category_resource_price_units_param.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing_extensions import TypedDict

__all__ = ["CategoryResourcePriceUnitsParam"]


class CategoryResourcePriceUnitsParam(TypedDict, total=False):
input_price: float

output_price: float
32 changes: 5 additions & 27 deletions src/payi/types/category_resource_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,14 @@

from typing import Dict, Optional
from datetime import datetime
from typing_extensions import Literal

from pydantic import Field as FieldInfo

from .._models import BaseModel
from .category_resource_price_units import CategoryResourcePriceUnits
from .category_resource_mapped_resource import CategoryResourceMappedResource

__all__ = [
"CategoryResourceResponse",
"Units",
"AwsBedrockResource",
"AzureResource",
"GoogleVertexResource",
"MappedResource",
]


class Units(BaseModel):
input_price: Optional[float] = None

output_price: Optional[float] = None
__all__ = ["CategoryResourceResponse", "AwsBedrockResource", "AzureResource", "GoogleVertexResource"]


class AwsBedrockResource(BaseModel):
Expand All @@ -36,16 +24,6 @@ class GoogleVertexResource(BaseModel):
gsus: int


class MappedResource(BaseModel):
category: Optional[str] = None

resource: Optional[str] = None

scope: Optional[Literal["global", "datazone", "region"]] = None

sub_scope: Optional[str] = None


class CategoryResourceResponse(BaseModel):
active: bool

Expand All @@ -59,7 +37,7 @@ class CategoryResourceResponse(BaseModel):

start_timestamp: datetime

units: Dict[str, Units]
units: Dict[str, CategoryResourcePriceUnits]

aliased_resource: Optional[str] = None

Expand All @@ -81,7 +59,7 @@ class CategoryResourceResponse(BaseModel):

large_context_threshold: Optional[int] = None

mapped_resource: Optional[MappedResource] = None
mapped_resource: Optional[CategoryResourceMappedResource] = None

max_input_units: Optional[int] = None

Expand Down
Loading