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

fix: Prepare for breaking change in upcoming unstructured-client #379

Closed
wants to merge 1 commit into from

Conversation

awalker4
Copy link
Contributor

@awalker4 awalker4 commented Feb 10, 2025

In the unreleased 0.30.0 of unstructured-client, handling of the server_url is changing. We need to do this to integrate the platform API functions. Now, different parts of the SDK are talking to different backend services, and so it's preferred that we set the server_url per endpoint.

Note that for compatibility with the current version, we need to strip the /general/v0/general path off of the URL. We have logic to do this in the SDK, but in versions before 0.30.0 this only applies to the server_url passed to the client instance. So, it's a bit of a chicken and egg. Once 0.30.0 is published and pulled in this repo, we can remove these lines if we want.

Related core library fix: Unstructured-IO/unstructured#3916

In the unreleased 0.30.0 of `unstructured-client`, handling of the `server_url` is changing. We need
to do this to integrate the platform API functions. Now, different parts of the SDK are talking to
different backend services, and so it's preferred that we set the `server_url` per endpoint.

Note that for compatibility with the current SDK, we need to strip the `/general/v0/general` path
off of the URL. We have logic to do this in the SDK, but in versions before 0.30.0 this doesn't take
effect when you pass the URL in the endpoint like this.
@@ -87,13 +87,16 @@ async def call_api_async(
"""
from unstructured_client import UnstructuredClient

# Note(austin) - the sdk takes the base url, but users may pass the full endpoint
# For consistency, strip off the path when it's given
base_url = server_url[:-19] if "/general/v0/general" in server_url else server_url

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be safer to split on /general/v0/general in case there are trailing spaces or tabs.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also server_url is an optional parameter, so it would make sense to check if it exists.

@raiderrobert raiderrobert changed the title fix/NEXUS-777: Prepare for breaking change in upcoming unstructured-client fix: Prepare for breaking change in upcoming unstructured-client Feb 14, 2025
@awalker4
Copy link
Contributor Author

Closing in preference of an upstream fix: Unstructured-IO/unstructured-python-client#226

@awalker4 awalker4 closed this Feb 18, 2025
auto-merge was automatically disabled February 18, 2025 20:48

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants