Skip to content

Commit 5156c35

Browse files
author
Fran
committed
Configurable temperature and top_p parameters
1 parent 400eca8 commit 5156c35

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

simplehtmleditor.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,11 @@ if (!("ncsedtRestorableObj" in window)) {
205205
usesLinearUndoHistory: true,
206206
mutationGroupingWindowMs: 200,
207207

208+
aiModelParams: {
209+
temperature: 0.5,
210+
top_p: 0.9
211+
},
212+
208213
aiBackends: {
209214
ollama: {
210215
enabled: true,
@@ -1824,8 +1829,8 @@ if (!("ncsedtRestorableObj" in window)) {
18241829
prompt: prompt,
18251830
stream: false,
18261831
options: {
1827-
temperature: 0.7,
1828-
top_p: 0.9
1832+
temperature: this.options.aiModelParams.temperature,
1833+
top_p: this.options.aiModelParams.top_p
18291834
}
18301835
})
18311836
})
@@ -1892,7 +1897,8 @@ if (!("ncsedtRestorableObj" in window)) {
18921897
role: 'user',
18931898
content: prompt
18941899
}],
1895-
temperature: 0.7,
1900+
temperature: this.options.aiModelParams.temperature,
1901+
top_p: this.options.aiModelParams.top_p,
18961902
max_tokens: 2000
18971903
})
18981904
})
@@ -1962,6 +1968,8 @@ if (!("ncsedtRestorableObj" in window)) {
19621968
role: 'user',
19631969
content: prompt
19641970
}],
1971+
temperature: this.options.aiModelParams.temperature,
1972+
top_p: this.options.aiModelParams.top_p,
19651973
max_tokens: 2000
19661974
})
19671975
})
@@ -2028,6 +2036,8 @@ if (!("ncsedtRestorableObj" in window)) {
20282036
role: 'user',
20292037
content: prompt
20302038
}],
2039+
temperature: this.options.aiModelParams.temperature,
2040+
top_p: this.options.aiModelParams.top_p,
20312041
max_tokens: 2000
20322042
})
20332043
})
@@ -2095,7 +2105,11 @@ if (!("ncsedtRestorableObj" in window)) {
20952105
parts: [{
20962106
text: prompt
20972107
}]
2098-
}]
2108+
}],
2109+
generationConfig: {
2110+
temperature: this.options.aiModelParams.temperature,
2111+
top_p: this.options.aiModelParams.top_p,
2112+
}
20992113
})
21002114
})
21012115
.then(response => {

simplehtmleditor.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)