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

Default to base_url if provided #2805

Merged
merged 2 commits into from
Jan 30, 2025
Merged

Conversation

Wauplin
Copy link
Contributor

@Wauplin Wauplin commented Jan 30, 2025

Fix #2804.

base_url was first introduced to match OpenAI chat completion API. It has the exact same behavior as self.model when using client.chat_completion. However, since it's a public parameter also for other tasks, I do think it makes sense to use it if provided. The problem in #2804 was that user provided a URL as base_url and expected it to be used in text_generation (which seems fair) but wasn't. Therefore it defaults to Inference API with default model which in not intended. This small PR should prevent this.


Not related at all but I took the opportunity to rephrase a bit the error raised in case of a 422 unprocessable entity. Usually the response body provides information about what's missing/not valid. Let's add it to the error message as a string.

@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

@hanouticelina hanouticelina left a comment

Choose a reason for hiding this comment

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

thanks for adding more context in the error message using the response body, it was a bit annoying to parse manually the response to know where the error is coming from 😄 I was going to open a PR for that too, so perfect! 👌

@Wauplin Wauplin merged commit 1033d0a into main Jan 30, 2025
17 checks passed
@Wauplin Wauplin deleted the default-to-base-url-if-provided branch January 30, 2025 16:02
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.

local TGI model gives http request error of a different model
3 participants