-
Notifications
You must be signed in to change notification settings - Fork 843
[Inference Providers] fix inference with URL endpoints #3041
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f13e733
fix inference with url endpoints
hanouticelina d89024a
style
hanouticelina 8529f23
parentheses
hanouticelina 2757d8e
add test
hanouticelina 1a9cf0a
Merge branch 'main' into fix-endpoints
hanouticelina 82be638
Update tests/test_inference_client.py
hanouticelina 68059d3
Update tests/test_inference_client.py
hanouticelina ea62959
Update tests/test_inference_client.py
Wauplin 8e38f01
Merge branch 'main' into fix-endpoints
Wauplin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Are we sure this is the expected behavior? In the past I've made a difference between
InferenceClient(model="https://...").chat_completionandInferenceClient(base_url="https://...").chat_completionbut I haven't tested it for a very long time. My reasoning is that if we always add/v1/chat/completionsto the URL, we can't provide a URL that does not support it (what if"https://..."is already the URL to the endpoint handling chat_completion?)but ok to remove this distinction if it helps with clarity / aligns better with JS client
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 might be mistaken but I'm not sure we had this distinction in the pre-provider implementation of
InferenceClienthuggingface_hub/src/huggingface_hub/inference/_client.py
Line 849 in 10e403d
modelorbase_url), when you callchat_completionyou're calling/chat/completionsroute by default (same behavior as the OpenAI client), but agree that we cannot customize this route, which is a bit annoying but I'm not sure if it's worth doing 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.
Thanks for checking back. I took a look at #2540 and always adding (/v1)/chat/completions seems indeed the way to go (more consistent). Looks like we merged both behaviors even before the "pre-provider" implementation ^^