Skip to content
Open
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 json-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,6 @@
"items": {
"type": "object",
"required": [
"role",
"content"
],
"properties": {
Expand All @@ -830,6 +829,7 @@
"user",
"assistant"
],
"default": "user",
"description": "The role of the message sender"
},
"content": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function prompt_with_missing_message_content_should_be_rejected(string $c

#[Test]
#[DataProvider('commandsProvider')]
public function prompt_with_missing_message_role_should_be_rejected(string $command): void
public function prompt_with_missing_message_role_defaults_to_user(string $command): void
{
// Create a config with a prompt that has a message with missing role
$configFile = $this->createTempFile(
Expand All @@ -139,7 +139,7 @@ public function prompt_with_missing_message_role_should_be_rejected(string $comm
description: "Prompt with message missing role"
messages:
- content: "This message is missing a role"
# Missing role
# Missing role defaults to "user"
YAML,
'.yaml',
);
Expand All @@ -150,8 +150,8 @@ public function prompt_with_missing_message_role_should_be_rejected(string $comm
command: $command,
);

// The implementation should reject a prompt with missing message role
$result->assertPromptCount(0);
$result->assertPromptCount(1);
$this->assertSame('user', $result->getResult()['prompts'][0]['messages'][0]['role'] ?? null);
}

#[Test]
Expand Down Expand Up @@ -221,7 +221,7 @@ public function template_without_messages_should_be_invalid(string $command): vo
type: template
description: "Template with no messages"
# Missing 'messages'

- id: extending-empty
description: "Prompt extending empty template"
extend:
Expand Down Expand Up @@ -259,7 +259,7 @@ public function prompt_with_invalid_extension_format_should_be_rejected(string $
messages:
- role: user
content: "Template content"

- id: invalid-extension
description: "Prompt with invalid extension format"
extend:
Expand Down Expand Up @@ -361,7 +361,7 @@ public function duplicated_prompt_ids_should_be_resolved(string $command): void
messages:
- role: user
content: "First prompt content"

- id: duplicate-id
description: "Second prompt with the same ID"
messages:
Expand Down Expand Up @@ -420,7 +420,7 @@ public function prompt_with_both_messages_and_extensions_should_be_valid(string
messages:
- role: user
content: "Template content with {{var}}."

- id: valid-combined
description: "Prompt with both messages and extensions"
extend:
Expand Down Expand Up @@ -469,7 +469,7 @@ public function circular_template_inheritance_should_be_detected(string $command
messages:
- role: user
content: "Template A content"

- id: template-b
type: template
extend:
Expand Down
Loading