Skip to content

Commit 2603179

Browse files
WauplinDeep-Unlearning
authored andcommitted
[Inference snippets]: no need to showcase max_tokens (#1401)
_Originally by @julien-c / @gary149 on slack:_ > mais dans le snippet moi j'enlèverai compl!tement max_tokens, to be honest => let's remove `max_tokens` entirely from the inference snippets
1 parent 04fc182 commit 2603179

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1
-55
lines changed

packages/inference/src/snippets/getInferenceSnippets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ const prepareConversationalInput = (
272272
return {
273273
messages: opts?.messages ?? getModelInputSnippet(model),
274274
...(opts?.temperature ? { temperature: opts?.temperature } : undefined),
275-
max_tokens: opts?.max_tokens ?? 512,
275+
...(opts?.max_tokens ? { max_tokens: opts?.max_tokens } : undefined),
276276
...(opts?.top_p ? { top_p: opts?.top_p } : undefined),
277277
};
278278
};

packages/tasks-gen/snippets-fixtures/bill-to-param/js/huggingface.js/0.hf-inference.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const chatCompletion = await client.chatCompletion({
1111
content: "What is the capital of France?",
1212
},
1313
],
14-
max_tokens: 512,
1514
}, {
1615
billTo: "huggingface",
1716
});

packages/tasks-gen/snippets-fixtures/bill-to-param/js/openai/0.hf-inference.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const chatCompletion = await client.chat.completions.create({
1616
content: "What is the capital of France?",
1717
},
1818
],
19-
max_tokens: 512,
2019
});
2120

2221
console.log(chatCompletion.choices[0].message);

packages/tasks-gen/snippets-fixtures/bill-to-param/python/huggingface_hub/0.hf-inference.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
"content": "What is the capital of France?"
1515
}
1616
],
17-
max_tokens=512,
1817
)
1918

2019
print(completion.choices[0].message)

packages/tasks-gen/snippets-fixtures/bill-to-param/python/openai/0.hf-inference.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"content": "What is the capital of France?"
1717
}
1818
],
19-
max_tokens=512,
2019
)
2120

2221
print(completion.choices[0].message)

packages/tasks-gen/snippets-fixtures/bill-to-param/python/requests/0.hf-inference.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ def query(payload):
1717
"content": "What is the capital of France?"
1818
}
1919
],
20-
"max_tokens": 512,
2120
"model": "meta-llama/Llama-3.1-8B-Instruct"
2221
})
2322

packages/tasks-gen/snippets-fixtures/bill-to-param/sh/curl/0.hf-inference.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ curl https://router.huggingface.co/hf-inference/models/meta-llama/Llama-3.1-8B-I
99
"content": "What is the capital of France?"
1010
}
1111
],
12-
"max_tokens": 512,
1312
"model": "meta-llama/Llama-3.1-8B-Instruct",
1413
"stream": false
1514
}'

packages/tasks-gen/snippets-fixtures/conversational-llm-non-stream/js/huggingface.js/0.hf-inference.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const chatCompletion = await client.chatCompletion({
1111
content: "What is the capital of France?",
1212
},
1313
],
14-
max_tokens: 512,
1514
});
1615

1716
console.log(chatCompletion.choices[0].message);

packages/tasks-gen/snippets-fixtures/conversational-llm-non-stream/js/huggingface.js/0.together.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const chatCompletion = await client.chatCompletion({
1111
content: "What is the capital of France?",
1212
},
1313
],
14-
max_tokens: 512,
1514
});
1615

1716
console.log(chatCompletion.choices[0].message);

packages/tasks-gen/snippets-fixtures/conversational-llm-non-stream/js/openai/0.hf-inference.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const chatCompletion = await client.chat.completions.create({
1313
content: "What is the capital of France?",
1414
},
1515
],
16-
max_tokens: 512,
1716
});
1817

1918
console.log(chatCompletion.choices[0].message);

packages/tasks-gen/snippets-fixtures/conversational-llm-non-stream/js/openai/0.together.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const chatCompletion = await client.chat.completions.create({
1313
content: "What is the capital of France?",
1414
},
1515
],
16-
max_tokens: 512,
1716
});
1817

1918
console.log(chatCompletion.choices[0].message);

packages/tasks-gen/snippets-fixtures/conversational-llm-non-stream/python/huggingface_hub/0.hf-inference.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"content": "What is the capital of France?"
1414
}
1515
],
16-
max_tokens=512,
1716
)
1817

1918
print(completion.choices[0].message)

packages/tasks-gen/snippets-fixtures/conversational-llm-non-stream/python/huggingface_hub/0.together.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"content": "What is the capital of France?"
1414
}
1515
],
16-
max_tokens=512,
1716
)
1817

1918
print(completion.choices[0].message)

packages/tasks-gen/snippets-fixtures/conversational-llm-non-stream/python/openai/0.hf-inference.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"content": "What is the capital of France?"
1414
}
1515
],
16-
max_tokens=512,
1716
)
1817

1918
print(completion.choices[0].message)

packages/tasks-gen/snippets-fixtures/conversational-llm-non-stream/python/openai/0.together.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"content": "What is the capital of France?"
1414
}
1515
],
16-
max_tokens=512,
1716
)
1817

1918
print(completion.choices[0].message)

packages/tasks-gen/snippets-fixtures/conversational-llm-non-stream/python/requests/0.hf-inference.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ def query(payload):
1616
"content": "What is the capital of France?"
1717
}
1818
],
19-
"max_tokens": 512,
2019
"model": "meta-llama/Llama-3.1-8B-Instruct"
2120
})
2221

packages/tasks-gen/snippets-fixtures/conversational-llm-non-stream/python/requests/0.together.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ def query(payload):
1616
"content": "What is the capital of France?"
1717
}
1818
],
19-
"max_tokens": 512,
2019
"model": "<together alias for meta-llama/Llama-3.1-8B-Instruct>"
2120
})
2221

packages/tasks-gen/snippets-fixtures/conversational-llm-non-stream/sh/curl/0.hf-inference.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ curl https://router.huggingface.co/hf-inference/models/meta-llama/Llama-3.1-8B-I
88
"content": "What is the capital of France?"
99
}
1010
],
11-
"max_tokens": 512,
1211
"model": "meta-llama/Llama-3.1-8B-Instruct",
1312
"stream": false
1413
}'

packages/tasks-gen/snippets-fixtures/conversational-llm-non-stream/sh/curl/0.together.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ curl https://api.together.xyz/v1/chat/completions \
88
"content": "What is the capital of France?"
99
}
1010
],
11-
"max_tokens": 512,
1211
"model": "<together alias for meta-llama/Llama-3.1-8B-Instruct>",
1312
"stream": false
1413
}'

packages/tasks-gen/snippets-fixtures/conversational-llm-stream/js/huggingface.js/0.hf-inference.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const stream = client.chatCompletionStream({
1313
content: "What is the capital of France?",
1414
},
1515
],
16-
max_tokens: 512,
1716
});
1817

1918
for await (const chunk of stream) {

packages/tasks-gen/snippets-fixtures/conversational-llm-stream/js/huggingface.js/0.together.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const stream = client.chatCompletionStream({
1313
content: "What is the capital of France?",
1414
},
1515
],
16-
max_tokens: 512,
1716
});
1817

1918
for await (const chunk of stream) {

packages/tasks-gen/snippets-fixtures/conversational-llm-stream/js/openai/0.hf-inference.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const stream = await client.chat.completions.create({
1313
content: "What is the capital of France?",
1414
},
1515
],
16-
max_tokens: 512,
1716
stream: true,
1817
});
1918

packages/tasks-gen/snippets-fixtures/conversational-llm-stream/js/openai/0.together.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const stream = await client.chat.completions.create({
1313
content: "What is the capital of France?",
1414
},
1515
],
16-
max_tokens: 512,
1716
stream: true,
1817
});
1918

packages/tasks-gen/snippets-fixtures/conversational-llm-stream/python/huggingface_hub/0.hf-inference.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"content": "What is the capital of France?"
1414
}
1515
],
16-
max_tokens=512,
1716
stream=True,
1817
)
1918

packages/tasks-gen/snippets-fixtures/conversational-llm-stream/python/huggingface_hub/0.together.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"content": "What is the capital of France?"
1414
}
1515
],
16-
max_tokens=512,
1716
stream=True,
1817
)
1918

packages/tasks-gen/snippets-fixtures/conversational-llm-stream/python/openai/0.hf-inference.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"content": "What is the capital of France?"
1414
}
1515
],
16-
max_tokens=512,
1716
stream=True,
1817
)
1918

packages/tasks-gen/snippets-fixtures/conversational-llm-stream/python/openai/0.together.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"content": "What is the capital of France?"
1414
}
1515
],
16-
max_tokens=512,
1716
stream=True,
1817
)
1918

packages/tasks-gen/snippets-fixtures/conversational-llm-stream/python/requests/0.hf-inference.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ def query(payload):
2222
"content": "What is the capital of France?"
2323
}
2424
],
25-
"max_tokens": 512,
2625
"model": "meta-llama/Llama-3.1-8B-Instruct",
2726
"stream": True,
2827
})

packages/tasks-gen/snippets-fixtures/conversational-llm-stream/python/requests/0.together.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ def query(payload):
2222
"content": "What is the capital of France?"
2323
}
2424
],
25-
"max_tokens": 512,
2625
"model": "<together alias for meta-llama/Llama-3.1-8B-Instruct>",
2726
"stream": True,
2827
})

packages/tasks-gen/snippets-fixtures/conversational-llm-stream/sh/curl/0.hf-inference.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ curl https://router.huggingface.co/hf-inference/models/meta-llama/Llama-3.1-8B-I
88
"content": "What is the capital of France?"
99
}
1010
],
11-
"max_tokens": 512,
1211
"model": "meta-llama/Llama-3.1-8B-Instruct",
1312
"stream": true
1413
}'

packages/tasks-gen/snippets-fixtures/conversational-llm-stream/sh/curl/0.together.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ curl https://api.together.xyz/v1/chat/completions \
88
"content": "What is the capital of France?"
99
}
1010
],
11-
"max_tokens": 512,
1211
"model": "<together alias for meta-llama/Llama-3.1-8B-Instruct>",
1312
"stream": true
1413
}'

packages/tasks-gen/snippets-fixtures/conversational-vlm-non-stream/js/huggingface.js/0.fireworks-ai.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const chatCompletion = await client.chatCompletion({
2222
],
2323
},
2424
],
25-
max_tokens: 512,
2625
});
2726

2827
console.log(chatCompletion.choices[0].message);

packages/tasks-gen/snippets-fixtures/conversational-vlm-non-stream/js/huggingface.js/0.hf-inference.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const chatCompletion = await client.chatCompletion({
2222
],
2323
},
2424
],
25-
max_tokens: 512,
2625
});
2726

2827
console.log(chatCompletion.choices[0].message);

packages/tasks-gen/snippets-fixtures/conversational-vlm-non-stream/js/openai/0.fireworks-ai.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const chatCompletion = await client.chat.completions.create({
2424
],
2525
},
2626
],
27-
max_tokens: 512,
2827
});
2928

3029
console.log(chatCompletion.choices[0].message);

packages/tasks-gen/snippets-fixtures/conversational-vlm-non-stream/js/openai/0.hf-inference.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const chatCompletion = await client.chat.completions.create({
2424
],
2525
},
2626
],
27-
max_tokens: 512,
2827
});
2928

3029
console.log(chatCompletion.choices[0].message);

packages/tasks-gen/snippets-fixtures/conversational-vlm-non-stream/python/huggingface_hub/0.fireworks-ai.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
]
2525
}
2626
],
27-
max_tokens=512,
2827
)
2928

3029
print(completion.choices[0].message)

packages/tasks-gen/snippets-fixtures/conversational-vlm-non-stream/python/huggingface_hub/0.hf-inference.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
]
2525
}
2626
],
27-
max_tokens=512,
2827
)
2928

3029
print(completion.choices[0].message)

packages/tasks-gen/snippets-fixtures/conversational-vlm-non-stream/python/openai/0.fireworks-ai.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
]
2525
}
2626
],
27-
max_tokens=512,
2827
)
2928

3029
print(completion.choices[0].message)

packages/tasks-gen/snippets-fixtures/conversational-vlm-non-stream/python/openai/0.hf-inference.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
]
2525
}
2626
],
27-
max_tokens=512,
2827
)
2928

3029
print(completion.choices[0].message)

packages/tasks-gen/snippets-fixtures/conversational-vlm-non-stream/python/requests/0.fireworks-ai.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ def query(payload):
2727
]
2828
}
2929
],
30-
"max_tokens": 512,
3130
"model": "<fireworks-ai alias for meta-llama/Llama-3.2-11B-Vision-Instruct>"
3231
})
3332

packages/tasks-gen/snippets-fixtures/conversational-vlm-non-stream/python/requests/0.hf-inference.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ def query(payload):
2727
]
2828
}
2929
],
30-
"max_tokens": 512,
3130
"model": "meta-llama/Llama-3.2-11B-Vision-Instruct"
3231
})
3332

packages/tasks-gen/snippets-fixtures/conversational-vlm-non-stream/sh/curl/0.fireworks-ai.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ curl https://api.fireworks.ai/inference/v1/chat/completions \
1919
]
2020
}
2121
],
22-
"max_tokens": 512,
2322
"model": "<fireworks-ai alias for meta-llama/Llama-3.2-11B-Vision-Instruct>",
2423
"stream": false
2524
}'

packages/tasks-gen/snippets-fixtures/conversational-vlm-non-stream/sh/curl/0.hf-inference.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ curl https://router.huggingface.co/hf-inference/models/meta-llama/Llama-3.2-11B-
1919
]
2020
}
2121
],
22-
"max_tokens": 512,
2322
"model": "meta-llama/Llama-3.2-11B-Vision-Instruct",
2423
"stream": false
2524
}'

packages/tasks-gen/snippets-fixtures/conversational-vlm-stream/js/huggingface.js/0.fireworks-ai.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const stream = client.chatCompletionStream({
2424
],
2525
},
2626
],
27-
max_tokens: 512,
2827
});
2928

3029
for await (const chunk of stream) {

packages/tasks-gen/snippets-fixtures/conversational-vlm-stream/js/huggingface.js/0.hf-inference.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const stream = client.chatCompletionStream({
2424
],
2525
},
2626
],
27-
max_tokens: 512,
2827
});
2928

3029
for await (const chunk of stream) {

packages/tasks-gen/snippets-fixtures/conversational-vlm-stream/js/openai/0.fireworks-ai.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const stream = await client.chat.completions.create({
2424
],
2525
},
2626
],
27-
max_tokens: 512,
2827
stream: true,
2928
});
3029

0 commit comments

Comments
 (0)