From 3b2de8b4a3e64047b646b254caeabe4cb010d79d Mon Sep 17 00:00:00 2001 From: dfinke Date: Mon, 12 Jan 2026 21:56:16 -0500 Subject: [PATCH 1/3] Enhance system message for New-Agent to improve response clarity and adherence to conversation style --- Public/New-Agent.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Public/New-Agent.ps1 b/Public/New-Agent.ps1 index f2218eb..b3d242c 100644 --- a/Public/New-Agent.ps1 +++ b/Public/New-Agent.ps1 @@ -211,7 +211,9 @@ function New-Agent { LLM = $LLM } - $script:messages += @(New-ChatRequestSystemMessage "You are a helpful agent. If you are configured with tools, you can use them to assist the user. They are also considered skills") + $script:messages += @( + New-ChatRequestSystemMessage "You are a helpful agent. Answer every request concisely and follow the style established earlier in the conversation. If you are configured with tools, you can use them to assist the user. They are also considered skills." + ) if ($Instructions) { # $agent['Instructions'] = $Instructions From cfee679814688f9b9101d1581d1318e0faa31918 Mon Sep 17 00:00:00 2001 From: dfinke Date: Mon, 12 Jan 2026 21:56:23 -0500 Subject: [PATCH 2/3] Enhance ConvertTo-OAIMessage function to improve message conversion and remove unnecessary fields --- Public/ConvertTo-OAIMessage.ps1 | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/Public/ConvertTo-OAIMessage.ps1 b/Public/ConvertTo-OAIMessage.ps1 index 631999a..8ac2fc2 100644 --- a/Public/ConvertTo-OAIMessage.ps1 +++ b/Public/ConvertTo-OAIMessage.ps1 @@ -23,6 +23,33 @@ function ConvertTo-OAIMessage { ) Process { - $Message | ConvertTo-Json -Depth 5 | ConvertFrom-Json -AsHashtable -Depth 5 + $converted = $Message | ConvertTo-Json -Depth 10 | ConvertFrom-Json -AsHashtable -Depth 10 + + foreach ($key in @('refusal', 'annotations')) { + if ($converted.ContainsKey($key)) { + $converted.Remove($key) + } + } + + if ($converted.ContainsKey('content') -and $converted['content'] -is [array]) { + foreach ($part in $converted['content']) { + if ($part -is [hashtable]) { + foreach ($k in @('refusal', 'annotations')) { + if ($part.ContainsKey($k)) { + $part.Remove($k) + } + } + if ($part.ContainsKey('text') -and $part['text'] -is [hashtable]) { + foreach ($k in @('refusal', 'annotations')) { + if ($part['text'].ContainsKey($k)) { + $part['text'].Remove($k) + } + } + } + } + } + } + + $converted } } From 958b3d36b6c6ae7d42e650563ea35946078f894e Mon Sep 17 00:00:00 2001 From: dfinke Date: Mon, 12 Jan 2026 21:56:31 -0500 Subject: [PATCH 3/3] Update module version to 0.5.3 and enhance changelog with recent changes --- PSAI.psd1 | 2 +- changelog.md | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/PSAI.psd1 b/PSAI.psd1 index 13ef293..379dcac 100644 --- a/PSAI.psd1 +++ b/PSAI.psd1 @@ -1,6 +1,6 @@ @{ RootModule = 'PSAI.psm1' - ModuleVersion = '0.5.2' + ModuleVersion = '0.5.3' GUID = '68662d19-a8f1-484f-b1b7-3bf0e8a436df' Author = 'Douglas Finke' CompanyName = 'Doug Finke' diff --git a/changelog.md b/changelog.md index 9ff443c..bd4d15c 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,9 @@ +## v0.5.3 + +- Fixed assistant messages to not include `refusal` or `annotations` properties when converting for API input +- Updated system prompt in New-Agent to keep responses concise and pattern-aligned without domain-specific rules +- Simplified ConvertTo-OAIMessage function for better maintainability + ## v0.5.2 - Added `/rewind` slash command to InteractiveCLI for rewinding the conversation to before the last user message