-
Notifications
You must be signed in to change notification settings - Fork 0
[azure] only add deployment in url path for deployment-based APIs #8
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
base: main
Are you sure you want to change the base?
Conversation
src/openai/lib/azure.py
Outdated
if "/deployments" in str(self.base_url.path) and url not in _deployments_endpoints: | ||
merge_url = httpx.URL(url) | ||
if merge_url.is_relative_url: | ||
merge_path = f"{self.base_url.path.rsplit('/deployments', maxsplit=1)[0]}/{merge_url.path.lstrip('/')}" |
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.
Rather than adding it and then removing it, did we consider adding it only when needed?
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.
Yes, that would be the better way of dealing with it. However, we'd have to change the current value of client.base_url
to take that approach which could break users.
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.
Should we split on/find '/deployments/'
? I guess it is unlikely that one would name a deployment "deployments"
(and we do a maxsplit=1 so it is only a problem if we have a deployments "to the right" of the intended split point).
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.
Sure, the base_url property enforces a trailing slash so it will always be there, regardless of whether the user added it.
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.
LGTM!
|
||
|
||
@pytest.mark.parametrize( | ||
"client,base_url,api_path,json_data,expected", |
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.
I think we can come up with a couple of additional tests here - e.g. have a dns name with deployments in it, add a deployment called deployments, add a couple of deployments to the azure_endpoint url etc.
No description provided.