diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6538ca91..2b28d6ec 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.8.0" + ".": "0.8.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 657fb751..88fb080f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 0.8.1 (2023-11-24) + +Full Changelog: [v0.8.0...v0.8.1](https://github.com/Finch-API/finch-api-python/compare/v0.8.0...v0.8.1) + +### Chores + +* **internal:** options updates ([#195](https://github.com/Finch-API/finch-api-python/issues/195)) ([0dd9a28](https://github.com/Finch-API/finch-api-python/commit/0dd9a2830e69c0fe555ca8dc4fd164ecdaeda490)) +* **internal:** revert recent options change ([#197](https://github.com/Finch-API/finch-api-python/issues/197)) ([e10ebe4](https://github.com/Finch-API/finch-api-python/commit/e10ebe4151a6c55884967acfc83aa92163162db2)) +* **internal:** send more detailed x-stainless headers ([#198](https://github.com/Finch-API/finch-api-python/issues/198)) ([ca854cd](https://github.com/Finch-API/finch-api-python/commit/ca854cdb23af269eb9d89bc3407e5c6c18e0c0df)) + ## 0.8.0 (2023-11-21) Full Changelog: [v0.7.1...v0.8.0](https://github.com/Finch-API/finch-api-python/compare/v0.7.1...v0.8.0) diff --git a/pyproject.toml b/pyproject.toml index 3fa1fd1b..619023a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "finch-api" -version = "0.8.0" +version = "0.8.1" description = "The official Python library for the Finch API" readme = "README.md" license = "Apache-2.0" @@ -13,6 +13,7 @@ dependencies = [ "typing-extensions>=4.5, <5", "anyio>=3.5.0, <4", "distro>=1.7.0, <2", + "sniffio", ] requires-python = ">= 3.7" diff --git a/src/finch/_client.py b/src/finch/_client.py index a840d0d3..d5579f9f 100644 --- a/src/finch/_client.py +++ b/src/finch/_client.py @@ -22,7 +22,7 @@ AsyncTransport, RequestOptions, ) -from ._utils import is_given +from ._utils import is_given, get_async_library from ._version import __version__ from ._streaming import Stream as Stream from ._streaming import AsyncStream as AsyncStream @@ -156,6 +156,7 @@ def auth_headers(self) -> dict[str, str]: def default_headers(self) -> dict[str, str | Omit]: return { **super().default_headers, + "X-Stainless-Async": "false", "Finch-API-Version": "2020-09-17", **self._custom_headers, } @@ -459,6 +460,7 @@ def auth_headers(self) -> dict[str, str]: def default_headers(self) -> dict[str, str | Omit]: return { **super().default_headers, + "X-Stainless-Async": f"async:{get_async_library()}", "Finch-API-Version": "2020-09-17", **self._custom_headers, } diff --git a/src/finch/_utils/__init__.py b/src/finch/_utils/__init__.py index d3397212..400ca9b8 100644 --- a/src/finch/_utils/__init__.py +++ b/src/finch/_utils/__init__.py @@ -25,6 +25,7 @@ from ._utils import deepcopy_minimal as deepcopy_minimal from ._utils import extract_type_arg as extract_type_arg from ._utils import is_required_type as is_required_type +from ._utils import get_async_library as get_async_library from ._utils import is_annotated_type as is_annotated_type from ._utils import maybe_coerce_float as maybe_coerce_float from ._utils import get_required_header as get_required_header diff --git a/src/finch/_utils/_utils.py b/src/finch/_utils/_utils.py index 4b51dcb2..d2bfc91a 100644 --- a/src/finch/_utils/_utils.py +++ b/src/finch/_utils/_utils.py @@ -18,6 +18,8 @@ from pathlib import Path from typing_extensions import Required, Annotated, TypeGuard, get_args, get_origin +import sniffio + from .._types import Headers, NotGiven, FileTypes, NotGivenOr, HeadersLike from .._compat import is_union as _is_union from .._compat import parse_date as parse_date @@ -406,3 +408,10 @@ def get_required_header(headers: HeadersLike, header: str) -> str: return value raise ValueError(f"Could not find {header} header") + + +def get_async_library() -> str: + try: + return sniffio.current_async_library() + except Exception: + return "false" diff --git a/src/finch/_version.py b/src/finch/_version.py index ae244cf0..dfd10f6b 100644 --- a/src/finch/_version.py +++ b/src/finch/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. __title__ = "finch" -__version__ = "0.8.0" # x-release-please-version +__version__ = "0.8.1" # x-release-please-version