fix whitespaces
Browse files
src/lib/components/InferencePlayground/InferencePlaygroundCodeSnippets.svelte
CHANGED
@@ -97,13 +97,13 @@ let out = "";
|
|
97 |
|
98 |
for await (const chunk of inference.chatCompletionStream({
|
99 |
model: "${conversation.model.id}",
|
100 |
-
messages: ${formattedMessages({ sep: ",\n
|
101 |
${formattedConfig({ sep: ",\n ", start: "", end: "" })}
|
102 |
})) {
|
103 |
if (chunk.choices && chunk.choices.length > 0) {
|
104 |
const newContent = chunk.choices[0].delta.content;
|
105 |
out += newContent;
|
106 |
-
|
107 |
}
|
108 |
}`,
|
109 |
});
|
@@ -116,9 +116,9 @@ for await (const chunk of inference.chatCompletionStream({
|
|
116 |
const inference = new HfInference("your access token")
|
117 |
|
118 |
const out = await inference.chatCompletion({
|
119 |
-
|
120 |
-
|
121 |
-
${formattedConfig({ sep: ",\n
|
122 |
});
|
123 |
|
124 |
console.log(out.choices[0].message);`,
|
|
|
97 |
|
98 |
for await (const chunk of inference.chatCompletionStream({
|
99 |
model: "${conversation.model.id}",
|
100 |
+
messages: ${formattedMessages({ sep: ",\n\t", start: "[\n\t", end: "\n ]" })},
|
101 |
${formattedConfig({ sep: ",\n ", start: "", end: "" })}
|
102 |
})) {
|
103 |
if (chunk.choices && chunk.choices.length > 0) {
|
104 |
const newContent = chunk.choices[0].delta.content;
|
105 |
out += newContent;
|
106 |
+
console.log(newContent);
|
107 |
}
|
108 |
}`,
|
109 |
});
|
|
|
116 |
const inference = new HfInference("your access token")
|
117 |
|
118 |
const out = await inference.chatCompletion({
|
119 |
+
model: "${conversation.model.id}",
|
120 |
+
messages: ${formattedMessages({ sep: ",\n\t\t", start: "[\n\t\t", end: "\n\t]" })},
|
121 |
+
${formattedConfig({ sep: ",\n\t", start: "", end: "" })}
|
122 |
});
|
123 |
|
124 |
console.log(out.choices[0].message);`,
|