Skip to content

Commit 75724b1

Browse files
authored
[Inference snippets]: no need to showcase max_tokens (huggingface#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 7706a0f commit 75724b1

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);

0 commit comments

Comments
 (0)