Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 0.2.0-alpha.40 #395

Merged
merged 6 commits into from
Dec 10, 2024
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 @@
{
".": "0.2.0-alpha.39"
".": "0.2.0-alpha.40"
}
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## 0.2.0-alpha.40 (2024-12-10)

Full Changelog: [v0.2.0-alpha.39...v0.2.0-alpha.40](https://github.com/openlayer-ai/openlayer-python/compare/v0.2.0-alpha.39...v0.2.0-alpha.40)

### Bug Fixes

* **client:** compat with new httpx 0.28.0 release ([#394](https://github.com/openlayer-ai/openlayer-python/issues/394)) ([c05fb39](https://github.com/openlayer-ai/openlayer-python/commit/c05fb39d3ce2f54b01f1f4536f612f73f5511b69))


### Chores

* **internal:** codegen related update ([#396](https://github.com/openlayer-ai/openlayer-python/issues/396)) ([6d0d530](https://github.com/openlayer-ai/openlayer-python/commit/6d0d5309210d82076f31df5c13feefaa71ee7e44))
* **internal:** codegen related update ([#399](https://github.com/openlayer-ai/openlayer-python/issues/399)) ([5927ddc](https://github.com/openlayer-ai/openlayer-python/commit/5927ddc54cfbf56ef5b1c85f23ace9ae4aa54505))
* **internal:** exclude mypy from running on tests ([#392](https://github.com/openlayer-ai/openlayer-python/issues/392)) ([2ce3de0](https://github.com/openlayer-ai/openlayer-python/commit/2ce3de0cdd36063bffd68ef34cb4062e675c9fe6))
* make the `Omit` type public ([#398](https://github.com/openlayer-ai/openlayer-python/issues/398)) ([f8aaafa](https://github.com/openlayer-ai/openlayer-python/commit/f8aaafa2ba06516ef986407be382caf8ec141ed8))

## 0.2.0-alpha.39 (2024-11-26)

Full Changelog: [v0.2.0-alpha.38...v0.2.0-alpha.39](https://github.com/openlayer-ai/openlayer-python/compare/v0.2.0-alpha.38...v0.2.0-alpha.39)
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,18 +386,19 @@ can also get all the extra fields on the Pydantic model as a dict with

You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:

- Support for proxies
- Custom transports
- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)
- Custom [transports](https://www.python-httpx.org/advanced/transports/)
- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality

```python
import httpx
from openlayer import Openlayer, DefaultHttpxClient

client = Openlayer(
# Or use the `OPENLAYER_BASE_URL` env var
base_url="http://my.test.server.example.com:8083",
http_client=DefaultHttpxClient(
proxies="http://my.test.proxy.example.com",
proxy="http://my.test.proxy.example.com",
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
),
)
Expand Down
7 changes: 2 additions & 5 deletions examples/tracing/groq/groq_tracing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,11 @@
"source": [
"chat_completion = groq_client.chat.completions.create(\n",
" messages=[\n",
" {\n",
" \"role\": \"system\",\n",
" \"content\": \"You are a helpful assistant.\"\n",
" },\n",
" {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n",
" {\n",
" \"role\": \"user\",\n",
" \"content\": \"Explain the importance of fast language models\",\n",
" }\n",
" },\n",
" ],\n",
" model=\"llama3-8b-8192\",\n",
")"
Expand Down
12 changes: 6 additions & 6 deletions examples/tracing/mistral/mistral_tracing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@
"source": [
"response = mistral_client.chat.complete(\n",
" model=\"mistral-large-latest\",\n",
" messages = [\n",
" messages=[\n",
" {\n",
" \"role\": \"user\",\n",
" \"content\": \"What is the best French cheese?\",\n",
" },\n",
" ]\n",
" ],\n",
")"
]
},
Expand All @@ -109,14 +109,14 @@
"outputs": [],
"source": [
"stream_response = mistral_client.chat.stream(\n",
" model = \"mistral-large-latest\",\n",
" messages = [\n",
" model=\"mistral-large-latest\",\n",
" messages=[\n",
" {\n",
" \"role\": \"user\",\n",
" \"content\": \"What's the meaning of life?\",\n",
" },\n",
" ]\n",
") "
" ],\n",
")"
]
},
{
Expand Down
5 changes: 1 addition & 4 deletions examples/tracing/ollama/ollama_tracing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,7 @@
"metadata": {},
"outputs": [],
"source": [
"chat = ChatOllama(\n",
" model=\"llama3.1\",\n",
" callbacks=[openlayer_handler]\n",
")"
"chat = ChatOllama(model=\"llama3.1\", callbacks=[openlayer_handler])"
]
},
{
Expand Down
5 changes: 1 addition & 4 deletions examples/tracing/vertex-ai/vertex_ai_tracing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,7 @@
"metadata": {},
"outputs": [],
"source": [
"chat = ChatVertexAI(\n",
" model=\"gemini-1.5-flash-001\",\n",
" callbacks=[openlayer_handler]\n",
")"
"chat = ChatVertexAI(model=\"gemini-1.5-flash-001\", callbacks=[openlayer_handler])"
]
},
{
Expand Down
5 changes: 4 additions & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ show_error_codes = True
# Exclude _files.py because mypy isn't smart enough to apply
# the correct type narrowing and as this is an internal module
# it's fine to just use Pyright.
exclude = ^(src/openlayer/_files\.py|_dev/.*\.py|src/openlayer/lib/.*\.py|examples/.*\.py)$
#
# We also exclude our `tests` as mypy doesn't always infer
# types correctly and Pyright will still catch any type errors.
exclude = ^(src/openlayer/_files\.py|_dev/.*\.py|src/openlayer/lib/.*\.py|examples/.*\.py|tests/.*)$

strict_equality = True
implicit_reexport = True
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 = "openlayer"
version = "0.2.0-alpha.39"
version = "0.2.0-alpha.40"
description = "The official Python library for the openlayer API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
25 changes: 22 additions & 3 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ argcomplete==3.1.2
certifi==2023.7.22
# via httpcore
# via httpx
# via requests
charset-normalizer==3.4.0
# via requests
colorlog==6.7.0
# via nox
dirty-equals==0.6.0
Expand All @@ -41,6 +44,7 @@ httpx==0.25.2
idna==3.4
# via anyio
# via httpx
# via requests
importlib-metadata==7.0.0
iniconfig==2.0.0
# via pytest
Expand All @@ -56,7 +60,9 @@ nodeenv==1.8.0
# via pyright
nox==2023.4.22
numpy==1.26.4
# via openlayer
# via pandas
# via pyarrow
packaging==23.2
# via nox
# via pytest
Expand All @@ -66,13 +72,15 @@ platformdirs==3.11.0
# via virtualenv
pluggy==1.5.0
# via pytest
pydantic==2.9.2
pyarrow==14.0.1
# via openlayer
pydantic==2.10.3
# via openlayer
pydantic-core==2.23.4
pydantic-core==2.27.1
# via pydantic
pygments==2.18.0
# via rich
pyright==1.1.380
pyright==1.1.389
pytest==8.3.3
# via pytest-asyncio
pytest-asyncio==0.24.0
Expand All @@ -82,6 +90,12 @@ python-dateutil==2.8.2
pytz==2023.3.post1
# via dirty-equals
# via pandas
pyyaml==6.0.2
# via openlayer
requests==2.32.3
# via requests-toolbelt
requests-toolbelt==1.0.0
# via openlayer
respx==0.20.2
rich==13.7.1
ruff==0.6.9
Expand All @@ -97,14 +111,19 @@ time-machine==2.9.0
tomli==2.0.2
# via mypy
# via pytest
tqdm==4.67.1
# via openlayer
typing-extensions==4.12.2
# via anyio
# via mypy
# via openlayer
# via pydantic
# via pydantic-core
# via pyright
tzdata==2024.1
# via pandas
urllib3==2.2.3
# via requests
virtualenv==20.24.5
# via nox
zipp==3.17.0
Expand Down
22 changes: 20 additions & 2 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ anyio==4.4.0
certifi==2023.7.22
# via httpcore
# via httpx
# via requests
charset-normalizer==3.4.0
# via requests
distro==1.8.0
# via openlayer
exceptiongroup==1.2.2
Expand All @@ -30,28 +33,43 @@ httpx==0.25.2
idna==3.4
# via anyio
# via httpx
# via requests
numpy==1.26.4
# via openlayer
# via pandas
# via pyarrow
pandas==2.2.2
# via openlayer
pydantic==2.9.2
pyarrow==14.0.1
# via openlayer
pydantic==2.10.3
# via openlayer
pydantic-core==2.23.4
pydantic-core==2.27.1
# via pydantic
python-dateutil==2.9.0.post0
# via pandas
pytz==2024.1
# via pandas
pyyaml==6.0.2
# via openlayer
requests==2.32.3
# via requests-toolbelt
requests-toolbelt==1.0.0
# via openlayer
six==1.16.0
# via python-dateutil
sniffio==1.3.0
# via anyio
# via httpx
# via openlayer
tqdm==4.67.1
# via openlayer
typing-extensions==4.12.2
# via anyio
# via openlayer
# via pydantic
# via pydantic-core
tzdata==2024.1
# via pandas
urllib3==2.2.3
# via requests
3 changes: 2 additions & 1 deletion src/openlayer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from . import types
from ._types import NOT_GIVEN, NoneType, NotGiven, Transport, ProxiesTypes
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
from ._utils import file_from_path
from ._client import (
Client,
Expand Down Expand Up @@ -46,6 +46,7 @@
"ProxiesTypes",
"NotGiven",
"NOT_GIVEN",
"Omit",
"OpenlayerError",
"APIError",
"APIStatusError",
Expand Down
12 changes: 8 additions & 4 deletions src/openlayer/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,7 @@ def __init__(
custom_query: Mapping[str, object] | None = None,
_strict_response_validation: bool,
) -> None:
kwargs: dict[str, Any] = {}
if limits is not None:
warnings.warn(
"The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
Expand All @@ -804,6 +805,7 @@ def __init__(
limits = DEFAULT_CONNECTION_LIMITS

if transport is not None:
kwargs["transport"] = transport
warnings.warn(
"The `transport` argument is deprecated. The `http_client` argument should be passed instead",
category=DeprecationWarning,
Expand All @@ -813,6 +815,7 @@ def __init__(
raise ValueError("The `http_client` argument is mutually exclusive with `transport`")

if proxies is not None:
kwargs["proxies"] = proxies
warnings.warn(
"The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
category=DeprecationWarning,
Expand Down Expand Up @@ -856,10 +859,9 @@ def __init__(
base_url=base_url,
# cast to a valid type because mypy doesn't understand our type narrowing
timeout=cast(Timeout, timeout),
proxies=proxies,
transport=transport,
limits=limits,
follow_redirects=True,
**kwargs, # type: ignore
)

def is_closed(self) -> bool:
Expand Down Expand Up @@ -1358,6 +1360,7 @@ def __init__(
custom_headers: Mapping[str, str] | None = None,
custom_query: Mapping[str, object] | None = None,
) -> None:
kwargs: dict[str, Any] = {}
if limits is not None:
warnings.warn(
"The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
Expand All @@ -1370,6 +1373,7 @@ def __init__(
limits = DEFAULT_CONNECTION_LIMITS

if transport is not None:
kwargs["transport"] = transport
warnings.warn(
"The `transport` argument is deprecated. The `http_client` argument should be passed instead",
category=DeprecationWarning,
Expand All @@ -1379,6 +1383,7 @@ def __init__(
raise ValueError("The `http_client` argument is mutually exclusive with `transport`")

if proxies is not None:
kwargs["proxies"] = proxies
warnings.warn(
"The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
category=DeprecationWarning,
Expand Down Expand Up @@ -1422,10 +1427,9 @@ def __init__(
base_url=base_url,
# cast to a valid type because mypy doesn't understand our type narrowing
timeout=cast(Timeout, timeout),
proxies=proxies,
transport=transport,
limits=limits,
follow_redirects=True,
**kwargs, # type: ignore
)

def is_closed(self) -> bool:
Expand Down
6 changes: 2 additions & 4 deletions src/openlayer/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,8 @@ def get(self, __key: str) -> str | None: ...
StrBytesIntFloat = Union[str, bytes, int, float]

# Note: copied from Pydantic
# https://github.com/pydantic/pydantic/blob/32ea570bf96e84234d2992e1ddf40ab8a565925a/pydantic/main.py#L49
IncEx: TypeAlias = Union[
Set[int], Set[str], Mapping[int, Union["IncEx", Literal[True]]], Mapping[str, Union["IncEx", Literal[True]]]
]
# https://github.com/pydantic/pydantic/blob/6f31f8f68ef011f84357330186f603ff295312fd/pydantic/main.py#L79
IncEx: TypeAlias = Union[Set[int], Set[str], Mapping[int, Union["IncEx", bool]], Mapping[str, Union["IncEx", bool]]]

PostParser = Callable[[Any], Any]

Expand Down
2 changes: 1 addition & 1 deletion src/openlayer/_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__ = "openlayer"
__version__ = "0.2.0-alpha.39" # x-release-please-version
__version__ = "0.2.0-alpha.40" # x-release-please-version
3 changes: 1 addition & 2 deletions src/openlayer/lib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Openlayer lib.
"""
"""Openlayer lib."""

__all__ = [
"trace",
Expand Down
Loading
Loading