summaryrefslogtreecommitdiffstats
path: root/src/client/ollama.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-04-24 16:12:38 +0800
committerGitHub <noreply@github.com>2024-04-24 16:12:38 +0800
commita17f349daa0609402c51205929b9f2b32f6fb1bb (patch)
tree380dd9c158f8d9278355634a8d474df3a90f8d25 /src/client/ollama.rs
parent040c48b9b392e3329d3f1de8eeb1b8773129773c (diff)
downloadaichat-a17f349daa0609402c51205929b9f2b32f6fb1bb.tar.gz
feat: support customizing `top_p` parameter (#434)
Diffstat (limited to 'src/client/ollama.rs')
-rw-r--r--src/client/ollama.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/client/ollama.rs b/src/client/ollama.rs
index 055730a..434e487 100644
--- a/src/client/ollama.rs
+++ b/src/client/ollama.rs
@@ -122,6 +122,7 @@ fn build_body(data: SendData, model: &Model) -> Result<Value> {
let SendData {
messages,
temperature,
+ top_p,
stream,
} = data;
@@ -185,6 +186,9 @@ fn build_body(data: SendData, model: &Model) -> Result<Value> {
if let Some(temperature) = temperature {
body["options"]["temperature"] = temperature.into();
}
+ if let Some(top_p) = top_p {
+ body["options"]["top_p"] = top_p.into();
+ }
Ok(body)
}