-
Notifications
You must be signed in to change notification settings - Fork 85
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
RFC: httpx #237
RFC: httpx #237
Conversation
python/langsmith/client.py
Outdated
filter_null_params: bool = True, | ||
) -> httpx.Response: | ||
"""Send a request with retries.""" | ||
with _request_error_handler(request_method, url) as handler_state: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thoughts on this error handling context manager to reduce duplicate handling code?
python/langsmith/client.py
Outdated
k: v for k, v in params.items() if v is not None | ||
} | ||
response = self._client.request(request_method, url, **request_kwargs) | ||
handler_state["response"] = response |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit weird way to add checking of response in the error handling...
0bf8b01
to
5131f01
Compare
5131f01
to
c0de1b1
Compare
f5d1de7
to
bcb371c
Compare
bcb371c
to
c6eda2a
Compare
return | ||
try: | ||
with concurrent.futures.ThreadPoolExecutor(1) as executor: | ||
executor.submit(lambda: asyncio.run(client.aclose())).result(timeout=10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may sometime lock if called explicitly in our tests if garbage collection isn't triggered explicitly beforehand (not always but sometimes). I'm not sure why at the moment.
ba89c2b
to
96bd67d
Compare
Would love feedback on this. Especially on the following: