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 URL concatenation in anthropic/api.py #26

Closed
nero19960329 opened this issue Apr 25, 2023 · 1 comment · Fixed by #27
Closed

Fix URL concatenation in anthropic/api.py #26

nero19960329 opened this issue Apr 25, 2023 · 1 comment · Fixed by #27

Comments

@nero19960329
Copy link
Contributor

I noticed a small issue with the URL concatenation logic in

abs_url = urllib.parse.urljoin(self.api_url, path)
.
The current code uses urllib.parse.urljoin(self.api_url, path) to concatenate URLs, but this results in incorrect URLs when concatenating URLs like
http://localhost:5000/anthropic and /v1/complete, giving
http://localhost:5000/v1/complete instead of the expected
http://localhost:5000/anthropic/v1/complete.
A possible fix could be to directly concatenate the strings, like:
abs_url = "%s%s" % (self.api_base, url)
as implemented in the OpenAI API requestor:
https://github.com/openai/openai-python/blob/db3f3526f16ea518bcd16308508e035017f9259e/openai/api_requestor.py#L467

@nero19960329
Copy link
Contributor Author

A possible fix PR: #27

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 a pull request may close this issue.

1 participant