Skip to content

Commit 5bc694b

Browse files
committed
fix undefined keys
1 parent a444cac commit 5bc694b

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

packages/tasks/src/snippets/curl.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ export const snippetTextGeneration = (
5454
];
5555

5656
const config = {
57-
temperature: opts?.temperature,
57+
...(opts?.temperature ? { temperature: opts.temperature } : undefined),
5858
max_tokens: opts?.max_tokens ?? 500,
59-
top_p: opts?.top_p,
59+
...(opts?.top_p ? { top_p: opts.top_p } : undefined),
6060
};
6161
return {
6262
content: `curl 'https://api-inference.huggingface.co/models/${model.id}/v1/chat/completions' \\

packages/tasks/src/snippets/js.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ export const snippetTextGeneration = (
6060
const messagesStr = formatGenerationMessages({ messages, sep: ",\n\t\t", start: "[\n\t\t", end: "\n\t]" });
6161

6262
const config = {
63-
temperature: opts?.temperature,
63+
...(opts?.temperature ? { temperature: opts.temperature } : undefined),
6464
max_tokens: opts?.max_tokens ?? 500,
65-
top_p: opts?.top_p,
65+
...(opts?.top_p ? { top_p: opts.top_p } : undefined),
6666
};
6767
const configStr = formatGenerationConfig({ config, sep: ",\n\t", start: "", end: "" });
6868

packages/tasks/src/snippets/python.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ export const snippetConversational = (
3636
const messagesStr = formatGenerationMessages({ messages, sep: ",\n\t", start: `[\n\t`, end: `\n]` });
3737

3838
const config = {
39-
temperature: opts?.temperature,
39+
...(opts?.temperature ? { temperature: opts.temperature } : undefined),
4040
max_tokens: opts?.max_tokens ?? 500,
41-
top_p: opts?.top_p,
41+
...(opts?.top_p ? { top_p: opts.top_p } : undefined),
4242
};
4343
const configStr = formatGenerationConfig({ config, sep: ",\n\t", start: "", end: "", connector: "=" });
4444

0 commit comments

Comments
 (0)