Skip to content

Commit 05b8858

Browse files
committed
Fix chat completion package reference links
1 parent 5977ab7 commit 05b8858

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

docs/api-inference/tasks/chat-completion.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,20 @@ For more details, check out:
1515
## Chat Completion
1616

1717
Generate a response given a list of messages in a conversational context, supporting both conversational Language Models (LLMs) and conversational Vision-Language Models (VLMs).
18-
This is a subtask of [`text-generation`](./text_generation) and [`image-text-to-text`](./image_text_to_text).
18+
This is a subtask of [`text-generation`](https://huggingface.co/docs/api-inference/tasks/text-generation) and [`image-text-to-text`](https://huggingface.co/docs/api-inference/tasks/image-text-to-text).
1919

2020
### Recommended models
2121

2222
#### Conversational Large Language Models (LLMs)
23+
2324
- [google/gemma-2-2b-it](https://huggingface.co/google/gemma-2-2b-it): A text-generation model trained to follow instructions.
2425
- [meta-llama/Meta-Llama-3.1-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3.1-8B-Instruct): Very powerful text generation model trained to follow instructions.
2526
- [microsoft/Phi-3-mini-4k-instruct](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct): Small yet powerful text generation model.
2627
- [HuggingFaceH4/starchat2-15b-v0.1](https://huggingface.co/HuggingFaceH4/starchat2-15b-v0.1): Strong coding assistant model.
2728
- [mistralai/Mistral-Nemo-Instruct-2407](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407): Very strong open-source large language model.
2829

2930
#### Conversational Vision-Language Models (VLMs)
31+
3032
- [microsoft/Phi-3.5-vision-instruct](https://huggingface.co/microsoft/Phi-3.5-vision-instruct): Strong image-text-to-text model.
3133

3234
### Using the API
@@ -72,7 +74,7 @@ for message in client.chat_completion(
7274
print(message.choices[0].delta.content, end="")
7375
```
7476

75-
To use the Python client, see `huggingface_hub`'s [package reference](https://huggingface.co/docs/huggingface_hub/package_reference/inference_client#huggingface_hub.InferenceClient.conversational_text-generation).
77+
To use the Python client, see `huggingface_hub`'s [package reference](https://huggingface.co/docs/huggingface_hub/package_reference/inference_client#huggingface_hub.InferenceClient.chat_completion).
7678
</python>
7779

7880
<js>
@@ -90,7 +92,7 @@ for await (const chunk of inference.chatCompletionStream({
9092
}
9193
```
9294
93-
To use the JavaScript client, see `huggingface.js`'s [package reference](https://huggingface.co/docs/huggingface.js/inference/classes/HfInference#conversationaltext-generation).
95+
To use the JavaScript client, see `huggingface.js`'s [package reference](https://huggingface.co/docs/huggingface.js/inference/classes/HfInference#chatcompletion).
9496
</js>
9597
9698
</inferencesnippet>
@@ -150,7 +152,7 @@ for message in client.chat_completion(
150152
print(message.choices[0].delta.content, end="")
151153
```
152154
153-
To use the Python client, see `huggingface_hub`'s [package reference](https://huggingface.co/docs/huggingface_hub/package_reference/inference_client#huggingface_hub.InferenceClient.conversational_image-text-to-text).
155+
To use the Python client, see `huggingface_hub`'s [package reference](https://huggingface.co/docs/huggingface_hub/package_reference/inference_client#huggingface_hub.InferenceClient.chat_completion).
154156
</python>
155157
156158
<js>
@@ -177,7 +179,7 @@ for await (const chunk of inference.chatCompletionStream({
177179
}
178180
```
179181
180-
To use the JavaScript client, see `huggingface.js`'s [package reference](https://huggingface.co/docs/huggingface.js/inference/classes/HfInference#conversationalimage-text-to-text).
182+
To use the JavaScript client, see `huggingface.js`'s [package reference](https://huggingface.co/docs/huggingface.js/inference/classes/HfInference#chatcompletion).
181183
</js>
182184
183185
</inferencesnippet>

scripts/api-inference/scripts/generate.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,10 @@ TASKS.forEach((task) => {
450450
///////////////////////////////////////////////
451451

452452
function fetchChatCompletion() {
453+
const baseName = "chat-completion";
453454
const conversationalTasks = [
454455
{
455-
name: "conversational-text-generation",
456+
name: "chat-completion",
456457
baseName: "text-generation",
457458
pipelineTag: "text-generation"
458459
},
@@ -491,11 +492,10 @@ function fetchChatCompletion() {
491492
// @ts-ignore
492493
javascript: GET_SNIPPET_FN["js"](mainModelData, "hf_***"),
493494
};
494-
495495
DATA.snippets[task.name] = SNIPPETS_TEMPLATE({
496496
taskSnippets,
497-
taskSnakeCase: task.name.replace("-", "_"),
498-
taskAttached: task.name.replace("-", ""),
497+
taskSnakeCase: baseName.replace("-", "_"),
498+
taskAttached: baseName.replace("-", ""),
499499
});
500500

501501
});

scripts/api-inference/templates/task/chat-completion.handlebars

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ This is a subtask of [`text-generation`](https://huggingface.co/docs/api-inferen
66
### Recommended models
77

88
#### Conversational Large Language Models (LLMs)
9-
{{#each models.conversational-text-generation}}
9+
10+
{{#each models.chat-completion}}
1011
- [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}}
1112
{{/each}}
1213

1314
#### Conversational Vision-Language Models (VLMs)
15+
1416
{{#each models.conversational-image-text-to-text}}
1517
- [{{this.id}}](https://huggingface.co/{{this.id}}): {{this.description}}
1618
{{/each}}
@@ -25,7 +27,7 @@ The API supports:
2527

2628
#### Code snippet example for conversational LLMs
2729

28-
{{{snippets.conversational-text-generation}}}
30+
{{{snippets.chat-completion}}}
2931

3032
#### Code snippet example for conversational VLMs
3133

scripts/api-inference/templates/task/image-text-to-text.handlebars

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ Image-text-to-text models take in an image and text prompt and output text. Thes
1818

1919
### API specification
2020

21-
For the API specification for conversational image-text-to-text models, please refer to the [Chat Completion API documentation](https://huggingface.co/docs/api-inference/tasks/chat-completion#api-specification).
21+
For the API specification of conversational image-text-to-text models, please refer to the [Chat Completion API documentation](https://huggingface.co/docs/api-inference/tasks/chat-completion#api-specification).
2222

2323

0 commit comments

Comments
 (0)