Skip to content

Commit fe230e6

Browse files
committed
feat: Add config for temperature and top_p
1 parent 30235ba commit fe230e6

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/main/scala/com/supercoder/base/Agent.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ abstract class BaseChatAgent(prompt: String, model: String = AgentConfig.OpenAIM
113113
.builder()
114114
.addSystemMessage(AgentConfig.BasePrompt + prompt)
115115
.model(selectedModel)
116+
.temperature(AppConfig.temperature)
117+
.topP(AppConfig.top_p)
116118

117119
// Add all messages from chat history
118120
chatHistory.foreach(params.addMessage)

src/main/scala/com/supercoder/config/ArgsParser.scala

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ package com.supercoder.config
22

33
import scopt.OParser
44

5-
case class Config(useCursorRules: Boolean = false, model: String = "", isDebugMode: Boolean = false)
5+
case class Config(
6+
useCursorRules: Boolean = false,
7+
model: String = "",
8+
isDebugMode: Boolean = false,
9+
temperature: Double = 0.2,
10+
top_p: Double = 0.1
11+
)
612

713
object ArgsParser {
814
def parse(args: Array[String]): Option[Config] = {
@@ -20,6 +26,12 @@ object ArgsParser {
2026
opt[String]('d', "debug")
2127
.action((x, c) => c.copy(isDebugMode = (x == "true")))
2228
.text("enable debug mode"),
29+
opt[Double]('t', "temperature")
30+
.action((x, c) => c.copy(temperature = x))
31+
.text("temperature for LLM calls (default: 0.2)"),
32+
opt[Double]('p', "top_p")
33+
.action((x, c) => c.copy(top_p = x))
34+
.text("top_p for LLM nucleus sampling (default: 0.1)"),
2335
help("help").text("prints this usage text")
2436
)
2537
}

0 commit comments

Comments
 (0)