Skip to content

Commit 9535b1d

Browse files
committed
fix: trim leading whitespace from arg descriptions
Trim the optional leading whitespace from descriptions when parsing arguments to prevent them from showing up in the chat completion function definitions produced by gptscript. Signed-off-by: Nick Hale <[email protected]>
1 parent cdd7016 commit 9535b1d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pkg/loader/loader_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func TestHelloWorld(t *testing.T) {
7777
"arguments": {
7878
"properties": {
7979
"input": {
80-
"description": " Any string",
80+
"description": "Any string",
8181
"type": "string"
8282
}
8383
},

pkg/parser/parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func addArg(line string, tool *types.Tool) error {
6060

6161
tool.Parameters.Arguments.Properties[key] = &openapi3.SchemaRef{
6262
Value: &openapi3.Schema{
63-
Description: value,
63+
Description: strings.TrimSpace(value),
6464
Type: "string",
6565
},
6666
}

0 commit comments

Comments
 (0)