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

Promote chat_completion in inference guide #2366

Merged
merged 8 commits into from
Jul 2, 2024
Merged

Conversation

Wauplin
Copy link
Contributor

@Wauplin Wauplin commented Jul 2, 2024

cc @gary149 who suggested it on slack. This PR adds a chat_completion example in the Getting started section of the guide.


In the example above, we initialized an [`InferenceClient`] with the default parameters. The only thing you need to know is the [task](#supported-tasks) you want to perform. By default, the client will connect to the Inference API and select a model to complete the task. In our example, we generated an image from a text prompt. The returned value is a `PIL.Image` object that can be saved to a file. For more details, check out the [`~InferenceClient.text_to_image`] documentation.

Let's now see an example using the chat-completion API. This task uses an LLM to generate a response from a list of messages:
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe specify what kind of models are compatible with the chat-completion API.

Copy link
Contributor

@gary149 gary149 Jul 2, 2024

Choose a reason for hiding this comment

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

chat-completion -> chat_completion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@gary149 gary149 left a comment

Choose a reason for hiding this comment

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

Nice! cc @merveenoyan maybe a chat completion example + short explanation on https://huggingface.co/tasks/text-generation could be nice too.

@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.

@Wauplin Wauplin merged commit e58b5cc into main Jul 2, 2024
16 of 17 checks passed
@Wauplin Wauplin deleted the promote-chat-completion branch July 2, 2024 10:27
MoritzLaurer pushed a commit to MoritzLaurer/huggingface_hub that referenced this pull request Jul 3, 2024
* Promote chat_completion in inference guide

* fix KO docs

* update example + list conversational models

* feedback

* fix KO?

* fix fix KO

* ko

* fix fix fix
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