Skip to content

Commit

Permalink
Fix python async client not filtering out params with None values
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkRx committed Dec 27, 2024
1 parent f4214a4 commit 60d6520
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions python/langsmith/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ async def _arequest_with_retries(
) -> httpx.Response:
"""Make an async HTTP request with retries."""
max_retries = cast(int, self._retry_config.get("max_retries", 3))

# Python requests library used by the normal Client filters out params with None values
# The httpx library does not. Filter them out here to keep behavior consistent
if 'params' in kwargs:
params = kwargs['params']
filtered_params = {k: v for k, v in params.items() if v is not None}
kwargs['params'] = filtered_params

for attempt in range(max_retries):
try:
response = await self._client.request(method, endpoint, **kwargs)
Expand Down

0 comments on commit 60d6520

Please sign in to comment.