Skip to content

Commit 7008513

Browse files
Merge pull request #260 from ibuildthecloud/skipnode
bug: replace - with _ in tool names sent to LLM
2 parents 9d41471 + b4ac9c8 commit 7008513

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

pkg/tests/testdata/TestExport/call1.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
{
2424
"function": {
2525
"toolID": "testdata/TestExport/parent.gpt:11",
26-
"name": "parent-local",
26+
"name": "parent_local",
2727
"parameters": {
2828
"properties": {
2929
"defaultPromptParameter": {

pkg/tests/testdata/TestExport/call3.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
{
2424
"function": {
2525
"toolID": "testdata/TestExport/parent.gpt:11",
26-
"name": "parent-local",
26+
"name": "parent_local",
2727
"parameters": {
2828
"properties": {
2929
"defaultPromptParameter": {

pkg/types/toolname.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99
)
1010

1111
var (
12-
validToolName = regexp.MustCompile("^[a-zA-Z0-9_-]{1,64}$")
13-
invalidChars = regexp.MustCompile("[^a-zA-Z0-9_-]+")
12+
validToolName = regexp.MustCompile("^[a-zA-Z0-9_]{1,64}$")
13+
invalidChars = regexp.MustCompile("[^a-zA-Z0-9_]+")
1414
)
1515

1616
func ToolNormalizer(tool string) string {

pkg/types/toolname_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package types
2+
3+
import (
4+
"testing"
5+
6+
"github.com/hexops/autogold/v2"
7+
)
8+
9+
func TestToolNormalizer(t *testing.T) {
10+
autogold.Expect("bob_tool").Equal(t, ToolNormalizer("bob-tool"))
11+
}

0 commit comments

Comments
 (0)