Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion PSAI.psd1
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
29 changes: 28 additions & 1 deletion Public/ConvertTo-OAIMessage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
4 changes: 3 additions & 1 deletion Public/New-Agent.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading