-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
81d3b48
commit a8e1b85
Showing
18 changed files
with
424 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package runner | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/gptscript-ai/gptscript/pkg/engine" | ||
) | ||
|
||
func (r *Runner) handleInput(callCtx engine.Context, monitor Monitor, env []string, input string) (string, error) { | ||
inputToolRefs, err := callCtx.Tool.GetInputFilterTools(*callCtx.Program) | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
for _, inputToolRef := range inputToolRefs { | ||
res, err := r.subCall(callCtx.Ctx, callCtx, monitor, env, inputToolRef.ToolID, input, "", engine.InputToolCategory) | ||
if err != nil { | ||
return "", err | ||
} | ||
if res.Result == nil { | ||
return "", fmt.Errorf("invalid state: input tool [%s] can not result in a chat continuation", inputToolRef.Reference) | ||
} | ||
input = *res.Result | ||
} | ||
|
||
return input, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
`{ | ||
"role": "assistant", | ||
"content": [ | ||
{ | ||
"text": "TEST RESULT CALL: 1" | ||
} | ||
], | ||
"usage": {} | ||
}` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
`{ | ||
"model": "gpt-4o", | ||
"internalSystemPrompt": false, | ||
"messages": [ | ||
{ | ||
"role": "system", | ||
"content": [ | ||
{ | ||
"text": "\nTool body" | ||
} | ||
], | ||
"usage": {} | ||
}, | ||
{ | ||
"role": "user", | ||
"content": [ | ||
{ | ||
"text": "No, You're stupid!\n ha ha ha\n" | ||
} | ||
], | ||
"usage": {} | ||
} | ||
] | ||
}` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
`{ | ||
"role": "assistant", | ||
"content": [ | ||
{ | ||
"text": "TEST RESULT CALL: 2" | ||
} | ||
], | ||
"usage": {} | ||
}` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
`{ | ||
"model": "gpt-4o", | ||
"internalSystemPrompt": false, | ||
"messages": [ | ||
{ | ||
"role": "system", | ||
"content": [ | ||
{ | ||
"text": "\nTool body" | ||
} | ||
], | ||
"usage": {} | ||
}, | ||
{ | ||
"role": "user", | ||
"content": [ | ||
{ | ||
"text": "No, You're stupid!\n ha ha ha\n" | ||
} | ||
], | ||
"usage": {} | ||
}, | ||
{ | ||
"role": "assistant", | ||
"content": [ | ||
{ | ||
"text": "TEST RESULT CALL: 1" | ||
} | ||
], | ||
"usage": {} | ||
}, | ||
{ | ||
"role": "user", | ||
"content": [ | ||
{ | ||
"text": "No, You're ugly!\n ha ha ha\n" | ||
} | ||
], | ||
"usage": {} | ||
} | ||
] | ||
}` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
`{ | ||
"done": false, | ||
"content": "TEST RESULT CALL: 1", | ||
"toolID": "testdata/TestInput/test.gpt:", | ||
"state": { | ||
"continuation": { | ||
"state": { | ||
"input": "No, You're stupid!\n ha ha ha\n", | ||
"completion": { | ||
"model": "gpt-4o", | ||
"internalSystemPrompt": false, | ||
"messages": [ | ||
{ | ||
"role": "system", | ||
"content": [ | ||
{ | ||
"text": "\nTool body" | ||
} | ||
], | ||
"usage": {} | ||
}, | ||
{ | ||
"role": "user", | ||
"content": [ | ||
{ | ||
"text": "No, You're stupid!\n ha ha ha\n" | ||
} | ||
], | ||
"usage": {} | ||
}, | ||
{ | ||
"role": "assistant", | ||
"content": [ | ||
{ | ||
"text": "TEST RESULT CALL: 1" | ||
} | ||
], | ||
"usage": {} | ||
} | ||
] | ||
} | ||
}, | ||
"result": "TEST RESULT CALL: 1" | ||
}, | ||
"continuationToolID": "testdata/TestInput/test.gpt:" | ||
} | ||
}` |
Oops, something went wrong.