Skip to content

Commit 435a3fe

Browse files
committed
fix comment
1 parent cf0ac82 commit 435a3fe

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ To use the Python client, see `huggingface_hub`'s [package reference](https://hu
135135

136136
<js>
137137
```js
138-
# With huggingface_hub client
138+
// With huggingface_hub client
139139

140140
import { HfInference } from "@huggingface/inference"
141141

@@ -162,7 +162,7 @@ for await (const chunk of stream) {
162162
}
163163
}
164164

165-
# With openai client
165+
// With openai client
166166

167167
import { OpenAI } from "openai"
168168

@@ -315,7 +315,7 @@ To use the Python client, see `huggingface_hub`'s [package reference](https://hu
315315

316316
<js>
317317
```js
318-
# With huggingface_hub client
318+
// With huggingface_hub client
319319

320320
import { HfInference } from "@huggingface/inference"
321321

@@ -353,7 +353,7 @@ for await (const chunk of stream) {
353353
}
354354
}
355355

356-
# With openai client
356+
// With openai client
357357

358358
import { OpenAI } from "openai"
359359

scripts/api-inference/scripts/generate.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,17 @@ const formatSnippets = (result: snippets.types.InferenceSnippet | snippets.types
106106
return snippet.content;
107107
}
108108

109-
// For multiple snippets, add comments between them
109+
// Get the appropriate comment
110+
const commentPrefix = {
111+
'py': '#',
112+
'js': '//',
113+
'bash': '#'
114+
}[language] || '#';
115+
116+
// Show the snippet for each client
110117
return result
111118
.map(snippet =>
112-
`# With ${snippet.client || defaultClient} client\n\n${snippet.content}`
119+
`${commentPrefix} With ${snippet.client || defaultClient} client\n\n${snippet.content}`
113120
)
114121
.join('\n\n');
115122
};

0 commit comments

Comments
 (0)