memory: add temperature support to agent defs, update reflect prompt
Thread temperature parameter from agent def header through the API
call chain. Agents can now specify {"temperature": 1.2} in their
JSON header to override the default 0.6.
Also includes Kent's reflect agent prompt iterations.
This commit is contained in:
parent
e88df06cd4
commit
f086815eaa
7 changed files with 97 additions and 136 deletions
|
|
@ -70,12 +70,24 @@ impl ApiClient {
|
|||
ui_tx: &UiSender,
|
||||
target: StreamTarget,
|
||||
reasoning_effort: &str,
|
||||
) -> Result<(Message, Option<Usage>)> {
|
||||
self.chat_completion_stream_temp(messages, tools, ui_tx, target, reasoning_effort, None).await
|
||||
}
|
||||
|
||||
pub async fn chat_completion_stream_temp(
|
||||
&self,
|
||||
messages: &[Message],
|
||||
tools: Option<&[ToolDef]>,
|
||||
ui_tx: &UiSender,
|
||||
target: StreamTarget,
|
||||
reasoning_effort: &str,
|
||||
temperature: Option<f32>,
|
||||
) -> Result<(Message, Option<Usage>)> {
|
||||
match &self.backend {
|
||||
Backend::OpenAi { base_url } => {
|
||||
openai::stream(
|
||||
&self.client, base_url, &self.api_key, &self.model,
|
||||
messages, tools, ui_tx, target, reasoning_effort,
|
||||
messages, tools, ui_tx, target, reasoning_effort, temperature,
|
||||
).await
|
||||
}
|
||||
Backend::Anthropic => {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ pub async fn stream(
|
|||
ui_tx: &UiSender,
|
||||
target: StreamTarget,
|
||||
reasoning_effort: &str,
|
||||
temperature: Option<f32>,
|
||||
) -> Result<(Message, Option<Usage>)> {
|
||||
let request = ChatRequest {
|
||||
model: model.to_string(),
|
||||
|
|
@ -28,7 +29,7 @@ pub async fn stream(
|
|||
tool_choice: tools.map(|_| "auto".to_string()),
|
||||
tools: tools.map(|t| t.to_vec()),
|
||||
max_tokens: Some(16384),
|
||||
temperature: Some(0.6),
|
||||
temperature: Some(temperature.unwrap_or(0.6)),
|
||||
stream: Some(true),
|
||||
reasoning: if reasoning_effort != "none" && reasoning_effort != "default" {
|
||||
Some(ReasoningConfig {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue