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
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.0.0-alpha.27"
".": "2.0.0-alpha.28"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 36
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/replicate%2Freplicate-client-87c7c57bd75c54990c679c9e87d009851cdff572815a55d1b6ee4d4ee20adaa1.yml
openapi_spec_hash: d987f14befa536004eece7b49caad993
config_hash: a916e7f3559ab312c7b6696cd6b35fb5
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/replicate%2Freplicate-client-8b68f03c8602e25ede74e66221e04bb17ac1f3170b8de49b8311fbe492636245.yml
openapi_spec_hash: 81a7c6f32c6d77c1f329ca5a3c700a7a
config_hash: 407acf62c906ee301314f2d23cdb58b1
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 2.0.0-alpha.28 (2025-10-07)

Full Changelog: [v2.0.0-alpha.27...v2.0.0-alpha.28](https://github.com/replicate/replicate-python-stainless/compare/v2.0.0-alpha.27...v2.0.0-alpha.28)

### Chores

* do not install brew dependencies in ./scripts/bootstrap by default ([40f38a7](https://github.com/replicate/replicate-python-stainless/commit/40f38a774220bb1364e12de4d7aef9448fb60c58))
* **types:** change optional parameter type from NotGiven to Omit ([f331b97](https://github.com/replicate/replicate-python-stainless/commit/f331b97a15226c9ae17112567a3be01010439f21))
* update OpenAPI spec and rebuild SDKs ([8b43277](https://github.com/replicate/replicate-python-stainless/commit/8b432772af94ac3f471bc642671322c11c7d4ff0))
* update OpenAPI spec and rebuild SDKs ([77c9c21](https://github.com/replicate/replicate-python-stainless/commit/77c9c216dea9886a412fd5a1b8f0dfec2e0de155))
* update OpenAPI spec and rebuild SDKs ([d5ed889](https://github.com/replicate/replicate-python-stainless/commit/d5ed889c6f84e0ea48129f12db494d1d08e3ffbf))
* update OpenAPI spec and rebuild SDKs ([0a821f8](https://github.com/replicate/replicate-python-stainless/commit/0a821f8f63208585cd4730a50842907ce26a3139))
* update OpenAPI spec and rebuild SDKs ([a4bdae2](https://github.com/replicate/replicate-python-stainless/commit/a4bdae264cff81657e2e7dcd43eb41bbd1f15237))


### Documentation

* remove replicate.stream from README ([#78](https://github.com/replicate/replicate-python-stainless/issues/78)) ([9efac9a](https://github.com/replicate/replicate-python-stainless/commit/9efac9a97e7db41d5829c055959b29f154f4c175))

## 2.0.0-alpha.27 (2025-09-29)

Full Changelog: [v2.0.0-alpha.26...v2.0.0-alpha.27](https://github.com/replicate/replicate-python-stainless/compare/v2.0.0-alpha.26...v2.0.0-alpha.27)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "replicate"
version = "2.0.0-alpha.27"
version = "2.0.0-alpha.28"
description = "The official Python library for the replicate API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
14 changes: 11 additions & 3 deletions scripts/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ set -e

cd "$(dirname "$0")/.."

if ! command -v rye >/dev/null 2>&1 && [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then
if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then
brew bundle check >/dev/null 2>&1 || {
echo "==> Installing Homebrew dependencies…"
brew bundle
echo -n "==> Install Homebrew dependencies? (y/N): "
read -r response
case "$response" in
[yY][eE][sS]|[yY])
brew bundle
;;
*)
;;
esac
echo
}
fi

Expand Down
27 changes: 14 additions & 13 deletions src/replicate/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
from ._qs import Querystring
from .types import client_search_params
from ._types import (
NOT_GIVEN,
Body,
Omit,
Query,
Expand All @@ -39,6 +38,8 @@
Transport,
ProxiesTypes,
RequestOptions,
omit,
not_given,
)
from ._utils import (
is_given,
Expand Down Expand Up @@ -103,7 +104,7 @@ def __init__(
*,
bearer_token: str | None = None,
base_url: str | httpx.URL | None = None,
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
timeout: float | Timeout | None | NotGiven = not_given,
max_retries: int = DEFAULT_MAX_RETRIES,
default_headers: Mapping[str, str] | None = None,
default_query: Mapping[str, object] | None = None,
Expand Down Expand Up @@ -241,7 +242,7 @@ def run(
*,
file_encoding_strategy: Optional["FileEncodingStrategy"] = None,
use_file_output: bool = True,
wait: Union[int, bool, NotGiven] = NOT_GIVEN,
wait: Union[int, bool, NotGiven] = not_given,
**params: Unpack[PredictionCreateParamsWithoutVersion],
) -> Any:
"""
Expand Down Expand Up @@ -325,9 +326,9 @@ def copy(
*,
bearer_token: str | None = None,
base_url: str | httpx.URL | None = None,
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
timeout: float | Timeout | None | NotGiven = not_given,
http_client: httpx.Client | None = None,
max_retries: int | NotGiven = NOT_GIVEN,
max_retries: int | NotGiven = not_given,
default_headers: Mapping[str, str] | None = None,
set_default_headers: Mapping[str, str] | None = None,
default_query: Mapping[str, object] | None = None,
Expand Down Expand Up @@ -375,13 +376,13 @@ def search(
self,
*,
query: str,
limit: int | NotGiven = NOT_GIVEN,
limit: int | Omit = omit,
# 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.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SearchResponse:
"""
Search for public models, collections, and docs using a text query.
Expand Down Expand Up @@ -478,7 +479,7 @@ def __init__(
*,
bearer_token: str | None = None,
base_url: str | httpx.URL | None = None,
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
timeout: float | Timeout | None | NotGiven = not_given,
max_retries: int = DEFAULT_MAX_RETRIES,
default_headers: Mapping[str, str] | None = None,
default_query: Mapping[str, object] | None = None,
Expand Down Expand Up @@ -616,7 +617,7 @@ async def run(
*,
use_file_output: bool = True,
file_encoding_strategy: Optional["FileEncodingStrategy"] = None,
wait: Union[int, bool, NotGiven] = NOT_GIVEN,
wait: Union[int, bool, NotGiven] = not_given,
**params: Unpack[PredictionCreateParamsWithoutVersion],
) -> Any:
"""
Expand Down Expand Up @@ -700,9 +701,9 @@ def copy(
*,
bearer_token: str | None = None,
base_url: str | httpx.URL | None = None,
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
timeout: float | Timeout | None | NotGiven = not_given,
http_client: httpx.AsyncClient | None = None,
max_retries: int | NotGiven = NOT_GIVEN,
max_retries: int | NotGiven = not_given,
default_headers: Mapping[str, str] | None = None,
set_default_headers: Mapping[str, str] | None = None,
default_query: Mapping[str, object] | None = None,
Expand Down Expand Up @@ -750,13 +751,13 @@ async def search(
self,
*,
query: str,
limit: int | NotGiven = NOT_GIVEN,
limit: int | Omit = omit,
# 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.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SearchResponse:
"""
Search for public models, collections, and docs using a text query.
Expand Down
2 changes: 1 addition & 1 deletion src/replicate/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "replicate"
__version__ = "2.0.0-alpha.27" # x-release-please-version
__version__ = "2.0.0-alpha.28" # x-release-please-version
2 changes: 2 additions & 0 deletions src/replicate/resources/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def get(
"name": "Super resolution",
"slug": "super-resolution",
"description": "Upscaling models that create high-quality images from low-quality images.",
"full_description": "## Overview\n\nThese models generate high-quality images from low-quality images. Many of these models are based on **advanced upscaling techniques**.\n\n### Key Features\n\n- Enhance image resolution\n- Restore fine details\n- Improve overall image quality",
"models": [...]
}
```
Expand Down Expand Up @@ -229,6 +230,7 @@ async def get(
"name": "Super resolution",
"slug": "super-resolution",
"description": "Upscaling models that create high-quality images from low-quality images.",
"full_description": "## Overview\n\nThese models generate high-quality images from low-quality images. Many of these models are based on **advanced upscaling techniques**.\n\n### Key Features\n\n- Enhance image resolution\n- Restore fine details\n- Improve overall image quality",
"models": [...]
}
```
Expand Down
26 changes: 22 additions & 4 deletions src/replicate/resources/deployments/predictions.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def create(
webhook: str | Omit = omit,
webhook_events_filter: List[Literal["start", "output", "logs", "completed"]] | Omit = omit,
prefer: str | Omit = omit,
replicate_max_lifetime: str | Omit = omit,
# 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.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -111,7 +112,7 @@ def create(
[server-sent events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events).

This field is no longer needed as the returned prediction will always have a
`stream` entry in its `url` property if the model supports streaming.
`stream` entry in its `urls` property if the model supports streaming.

webhook: An HTTPS URL for receiving a webhook when the prediction has new output. The
webhook will be a POST request where the request body is the same as the
Expand Down Expand Up @@ -162,7 +163,15 @@ def create(
raise ValueError(f"Expected a non-empty value for `deployment_owner` but received {deployment_owner!r}")
if not deployment_name:
raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}")
extra_headers = {**strip_not_given({"Prefer": prefer}), **(extra_headers or {})}
extra_headers = {
**strip_not_given(
{
"Prefer": prefer,
"Replicate-Max-Lifetime": replicate_max_lifetime,
}
),
**(extra_headers or {}),
}
return self._post(
f"/deployments/{deployment_owner}/{deployment_name}/predictions",
body=maybe_transform(
Expand Down Expand Up @@ -211,6 +220,7 @@ async def create(
webhook: str | Omit = omit,
webhook_events_filter: List[Literal["start", "output", "logs", "completed"]] | Omit = omit,
prefer: str | Omit = omit,
replicate_max_lifetime: str | Omit = omit,
# 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.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -268,7 +278,7 @@ async def create(
[server-sent events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events).

This field is no longer needed as the returned prediction will always have a
`stream` entry in its `url` property if the model supports streaming.
`stream` entry in its `urls` property if the model supports streaming.

webhook: An HTTPS URL for receiving a webhook when the prediction has new output. The
webhook will be a POST request where the request body is the same as the
Expand Down Expand Up @@ -319,7 +329,15 @@ async def create(
raise ValueError(f"Expected a non-empty value for `deployment_owner` but received {deployment_owner!r}")
if not deployment_name:
raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}")
extra_headers = {**strip_not_given({"Prefer": prefer}), **(extra_headers or {})}
extra_headers = {
**strip_not_given(
{
"Prefer": prefer,
"Replicate-Max-Lifetime": replicate_max_lifetime,
}
),
**(extra_headers or {}),
}
return await self._post(
f"/deployments/{deployment_owner}/{deployment_name}/predictions",
body=await async_maybe_transform(
Expand Down
26 changes: 22 additions & 4 deletions src/replicate/resources/models/predictions.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def create(
webhook: str | Omit = omit,
webhook_events_filter: List[Literal["start", "output", "logs", "completed"]] | Omit = omit,
prefer: str | Omit = omit,
replicate_max_lifetime: str | Omit = omit,
file_encoding_strategy: Optional["FileEncodingStrategy"] = None,
# 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 @@ -118,7 +119,7 @@ def create(
[server-sent events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events).

This field is no longer needed as the returned prediction will always have a
`stream` entry in its `url` property if the model supports streaming.
`stream` entry in its `urls` property if the model supports streaming.

webhook: An HTTPS URL for receiving a webhook when the prediction has new output. The
webhook will be a POST request where the request body is the same as the
Expand Down Expand Up @@ -169,7 +170,15 @@ def create(
raise ValueError(f"Expected a non-empty value for `model_owner` but received {model_owner!r}")
if not model_name:
raise ValueError(f"Expected a non-empty value for `model_name` but received {model_name!r}")
extra_headers = {**strip_not_given({"Prefer": prefer}), **(extra_headers or {})}
extra_headers = {
**strip_not_given(
{
"Prefer": prefer,
"Replicate-Max-Lifetime": replicate_max_lifetime,
}
),
**(extra_headers or {}),
}
return self._post(
f"/models/{model_owner}/{model_name}/predictions",
body=maybe_transform(
Expand Down Expand Up @@ -218,6 +227,7 @@ async def create(
webhook: str | Omit = omit,
webhook_events_filter: List[Literal["start", "output", "logs", "completed"]] | Omit = omit,
prefer: str | Omit = omit,
replicate_max_lifetime: str | Omit = omit,
file_encoding_strategy: Optional["FileEncodingStrategy"] = None,
# 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 +290,7 @@ async def create(
[server-sent events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events).

This field is no longer needed as the returned prediction will always have a
`stream` entry in its `url` property if the model supports streaming.
`stream` entry in its `urls` property if the model supports streaming.

webhook: An HTTPS URL for receiving a webhook when the prediction has new output. The
webhook will be a POST request where the request body is the same as the
Expand Down Expand Up @@ -331,7 +341,15 @@ async def create(
raise ValueError(f"Expected a non-empty value for `model_owner` but received {model_owner!r}")
if not model_name:
raise ValueError(f"Expected a non-empty value for `model_name` but received {model_name!r}")
extra_headers = {**strip_not_given({"Prefer": prefer}), **(extra_headers or {})}
extra_headers = {
**strip_not_given(
{
"Prefer": prefer,
"Replicate-Max-Lifetime": replicate_max_lifetime,
}
),
**(extra_headers or {}),
}
return await self._post(
f"/models/{model_owner}/{model_name}/predictions",
body=await async_maybe_transform(
Expand Down
Loading