Commit c3bf626
authored
[Inference Snippet] Add adirectRequest option (false by default) (#1516)
Fix after #1514.
Now that we use a placeholder for access token to load from env, there
is no direct way to explictly generatea snippet for either a "direct
request" or a "routed request" (determined
[here](https://github.com/huggingface/huggingface.js/blob/1131b562d74c7c7b95966ec757fea94773a024f1/packages/inference/src/lib/makeRequestOptions.ts#L124-L141)
using `accessToken.startsWith("hf_")`). This PR adds a `directRequest?:
boolean;` option to the parameters which solves this problem.
Will require a follow-up PR in moon-landing.
cc @SBrandeis who found out the root cause
### expected behavior
display routed request by default in
https://huggingface.co/deepseek-ai/DeepSeek-R1-0528?inference_api=true&inference_provider=fireworks-ai&language=sh
1 parent 1131b56 commit c3bf626
File tree
28 files changed
+203
-61
lines changed- packages
- inference/src/snippets
- tasks-gen
- scripts
- snippets-fixtures
- conversational-llm-non-stream
- js/openai
- python
- openai
- requests
- sh/curl
- conversational-llm-stream
- js/openai
- python
- openai
- requests
- sh/curl
- conversational-vlm-non-stream
- js/openai
- python
- openai
- requests
- sh/curl
- conversational-vlm-stream
- js/openai
- python
- openai
- requests
- sh/curl
- explicit-direct-request
- js
- huggingface.js
- openai
- python
- huggingface_hub
- openai
- requests
- sh/curl
- text-to-image--lora/js/fetch
- text-to-image/js/fetch
- text-to-speech
- js/fetch
- python/requests
28 files changed
+203
-61
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
124 | 126 | | |
125 | 127 | | |
126 | 128 | | |
127 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
128 | 133 | | |
129 | 134 | | |
130 | 135 | | |
| |||
153 | 158 | | |
154 | 159 | | |
155 | 160 | | |
156 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
157 | 166 | | |
158 | 167 | | |
159 | 168 | | |
| |||
255 | 264 | | |
256 | 265 | | |
257 | 266 | | |
258 | | - | |
259 | | - | |
| 267 | + | |
| 268 | + | |
260 | 269 | | |
261 | 270 | | |
262 | 271 | | |
| |||
431 | 440 | | |
432 | 441 | | |
433 | 442 | | |
| 443 | + | |
| 444 | + | |
434 | 445 | | |
435 | 446 | | |
436 | 447 | | |
| |||
439 | 450 | | |
440 | 451 | | |
441 | 452 | | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
448 | 462 | | |
449 | 463 | | |
450 | 464 | | |
451 | 465 | | |
452 | | - | |
| 466 | + | |
453 | 467 | | |
454 | 468 | | |
455 | 469 | | |
456 | 470 | | |
457 | 471 | | |
458 | | - | |
| 472 | + | |
459 | 473 | | |
460 | 474 | | |
461 | 475 | | |
462 | | - | |
| 476 | + | |
463 | 477 | | |
464 | 478 | | |
465 | 479 | | |
466 | | - | |
| 480 | + | |
467 | 481 | | |
468 | 482 | | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
469 | 487 | | |
470 | 488 | | |
471 | | - | |
| 489 | + | |
472 | 490 | | |
473 | 491 | | |
474 | 492 | | |
475 | | - | |
| 493 | + | |
476 | 494 | | |
477 | 495 | | |
478 | 496 | | |
479 | | - | |
| 497 | + | |
480 | 498 | | |
481 | 499 | | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
482 | 504 | | |
483 | 505 | | |
484 | 506 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
255 | 267 | | |
256 | 268 | | |
257 | 269 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
| 4 | + | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
| 5 | + | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
| 4 | + | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
| 5 | + | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
0 commit comments