Skip to content

Commit d50f26d

Browse files
committed
fix: <pre> tag by wrapping it in a <detail> tag
1 parent d226461 commit d50f26d

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

docs/source/pipelines.md

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -178,44 +178,37 @@ const streamer = new TextStreamer(generator.tokenizer, {
178178
const result = await generator(messages, { max_new_tokens: 512, do_sample: false, streamer });
179179
```
180180

181-
<pre>
182-
183181
Logging `result[0].generated_text` to the console gives:
184182

185183

184+
<details>
185+
<summary>Click to view the console output</summary>
186+
<pre>
186187
```python
187188
def quick_sort(arr):
188189
if len(arr) <= 1:
189190
return arr
190-
191191
pivot = arr[len(arr) // 2]
192192
left = [x for x in arr if x < pivot]
193193
middle = [x for x in arr if x == pivot]
194194
right = [x for x in arr if x > pivot]
195-
196195
return quick_sort(left) + middle + quick_sort(right)
197-
198196
# Example usage:
199197
arr = [3, 6, 8, 10, 1, 2]
200198
sorted_arr = quick_sort(arr)
201199
print(sorted_arr)
202200
```
203-
204201
### Explanation:
205-
206202
- **Base Case**: If the array has less than or equal to one element (i.e., `len(arr)` is less than or equal to `1`), it is already sorted and can be returned as is.
207-
208203
- **Pivot Selection**: The pivot is chosen as the middle element of the array.
209-
210204
- **Partitioning**: The array is partitioned into three parts: elements less than the pivot (`left`), elements equal to the pivot (`middle`), and elements greater than the pivot (`right`). These partitions are then recursively sorted.
211-
212205
- **Recursive Sorting**: The subarrays are sorted recursively using `quick_sort`.
213-
214206
This approach ensures that each recursive call reduces the problem size by half until it reaches a base case.
215207
```
216208
</pre>
209+
</details>
217210

218-
This allows you to process the output as it is generated, rather than waiting for the entire output to be generated before processing it.
211+
This streaming feature allows you to process the output as it is generated, rather than waiting for the entire output to be generated before processing it.
219212

220213

221214
For more information on the available options for each pipeline, refer to the [API Reference](./api/pipelines).

0 commit comments

Comments
 (0)