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

Document the difference between model and base_url #2431

Merged
merged 2 commits into from
Aug 12, 2024

Conversation

Wauplin
Copy link
Contributor

@Wauplin Wauplin commented Jul 30, 2024

cc @MoritzLaurer who pinged me about this on slack (private link).

It is wrong to say that base_url and model have the exact same behavior since #2410 have been merged. The base URL is used to build the complete URL by appending (/v1)?/chat/completions to it. On the contrary, when an URL is passed as model, we use it directly without appending anything (e.g. we don't consider it as a "base url").

This PR fixes this confusion in the docs.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Contributor

@MoritzLaurer MoritzLaurer left a comment

Choose a reason for hiding this comment

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

Thank you for adding the clarification!
Small point: I assume that not all users will be aware of chat completion and the chat/completions suffix. Maybe you could add a note like "... appended to the base URL (see the TGI Messages API documentation for details) ...".

@MoritzLaurer
Copy link
Contributor

MoritzLaurer commented Aug 12, 2024

Does the use of base_url always append the chat completions suffix and is therefore only compatible with models in a TGI container? if so, this could maybe be made more explicit (If using base_url for chat completion sounds like I can also use base_url for other things than chat completion).

@Wauplin
Copy link
Contributor Author

Wauplin commented Aug 12, 2024

Thanks for the review @MoritzLaurer! I think we are good to merge now :)

Small point: I assume that not all users will be aware of chat completion and the chat/completions suffix. Maybe you could add a note

Good idea! Addressed it in b589816

Does the use of base_url always append the chat completions suffix and is therefore only compatible with models in a TGI container?

Yes it always append the chat completions suffix when using client.chat_completion. This means it's compatible with TGI but also all OpenAI-compatible providers.
If the user sets base_url for another task (say text_to_image), no suffix will be appended so it should work as well. This is not really a recommended/expected behavior but "it works" (passing base_url or model for any non-Chat Completion method is strictly the same).

@Wauplin Wauplin merged commit 9a9b8c1 into main Aug 12, 2024
15 of 17 checks passed
@Wauplin Wauplin deleted the doc-difference-base-url-model branch August 12, 2024 14:19
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.

3 participants