feat(api): update via SDK Studio

This commit is contained in:
stainless-app[bot] 2025-06-27 14:47:07 +00:00
parent ddb79fc19d
commit a6cf7c5b2a
109 changed files with 159 additions and 153 deletions

View file

@ -89,12 +89,12 @@ _setup_logging()
# Update the __module__ attribute for exported symbols so that
# error messages point to this module instead of the module
# it was originally defined in, e.g.
# opencode._exceptions.NotFoundError -> opencode.NotFoundError
# opencode_ai._exceptions.NotFoundError -> opencode_ai.NotFoundError
__locals = locals()
for __name in __all__:
if not __name.startswith("__"):
try:
__locals[__name].__module__ = "opencode"
__locals[__name].__module__ = "opencode_ai"
except (TypeError, AttributeError):
# Some of our exported symbols are builtins which we can't set attributes for.
pass

View file

@ -389,7 +389,7 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
if max_retries is None: # pyright: ignore[reportUnnecessaryComparison]
raise TypeError(
"max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `opencode.DEFAULT_MAX_RETRIES`"
"max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `opencode_ai.DEFAULT_MAX_RETRIES`"
)
def _enforce_trailing_slash(self, url: URL) -> URL:

View file

@ -217,7 +217,9 @@ class BaseAPIResponse(Generic[R]):
and not issubclass(origin, BaseModel)
and issubclass(origin, pydantic.BaseModel)
):
raise TypeError("Pydantic models must subclass our base model type, e.g. `from opencode import BaseModel`")
raise TypeError(
"Pydantic models must subclass our base model type, e.g. `from opencode_ai import BaseModel`"
)
if (
cast_to is not object
@ -283,7 +285,7 @@ class APIResponse(BaseAPIResponse[R]):
the `to` argument, e.g.
```py
from opencode import BaseModel
from opencode_ai import BaseModel
class MyModel(BaseModel):
@ -385,7 +387,7 @@ class AsyncAPIResponse(BaseAPIResponse[R]):
the `to` argument, e.g.
```py
from opencode import BaseModel
from opencode_ai import BaseModel
class MyModel(BaseModel):
@ -556,7 +558,7 @@ class AsyncStreamedBinaryAPIResponse(AsyncAPIResponse[bytes]):
class MissingStreamClassError(TypeError):
def __init__(self) -> None:
super().__init__(
"The `stream` argument was set to `True` but the `stream_cls` argument was not given. See `opencode._streaming` for reference",
"The `stream` argument was set to `True` but the `stream_cls` argument was not given. See `opencode_ai._streaming` for reference",
)

View file

@ -81,7 +81,7 @@ HttpxRequestFiles = Union[Mapping[str, HttpxFileTypes], Sequence[Tuple[str, Http
# This unfortunately means that you will either have
# to import this type and pass it explicitly:
#
# from opencode import NoneType
# from opencode_ai import NoneType
# client.get('/foo', cast_to=NoneType)
#
# or build it yourself:

View file

@ -1,12 +1,12 @@
import os
import logging
logger: logging.Logger = logging.getLogger("opencode")
logger: logging.Logger = logging.getLogger("opencode_ai")
httpx_logger: logging.Logger = logging.getLogger("httpx")
def _basic_config() -> None:
# e.g. [2023-10-05 14:12:26 - opencode._base_client:818 - DEBUG] HTTP Request: POST http://127.0.0.1:4010/foo/bar "200 OK"
# e.g. [2023-10-05 14:12:26 - opencode_ai._base_client:818 - DEBUG] HTTP Request: POST http://127.0.0.1:4010/foo/bar "200 OK"
logging.basicConfig(
format="[%(asctime)s - %(name)s:%(lineno)d - %(levelname)s] %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",

View file

@ -7,17 +7,17 @@ from ._proxy import LazyProxy
class ResourcesProxy(LazyProxy[Any]):
"""A proxy for the `opencode.resources` module.
"""A proxy for the `opencode_ai.resources` module.
This is used so that we can lazily import `opencode.resources` only when
needed *and* so that users can just import `opencode` and reference `opencode.resources`
This is used so that we can lazily import `opencode_ai.resources` only when
needed *and* so that users can just import `opencode_ai` and reference `opencode_ai.resources`
"""
@override
def __load__(self) -> Any:
import importlib
mod = importlib.import_module("opencode.resources")
mod = importlib.import_module("opencode_ai.resources")
return mod

View file

@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
__title__ = "opencode"
__title__ = "opencode_ai"
__version__ = "0.1.0-alpha.1" # x-release-please-version

View file

@ -0,0 +1,4 @@
File generated from our OpenAPI spec by Stainless.
This directory can be used to store custom files to expand the SDK.
It is ignored by Stainless code generation and its content (other than this keep file) won't be touched.