-
Notifications
You must be signed in to change notification settings - Fork 285
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 c98b7ed
Showing
15 changed files
with
308 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,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:" | ||
} | ||
}` |
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,23 @@ | ||
input filter: taunt | ||
context: exporter | ||
chat: true | ||
|
||
Tool body | ||
|
||
--- | ||
name: taunt | ||
args: foo: this is useless | ||
#!/bin/bash | ||
|
||
echo "No, ${GPTSCRIPT_INPUT}!" | ||
|
||
--- | ||
name: exporter | ||
share input filters: taunt2 | ||
|
||
--- | ||
name: taunt2 | ||
args: foo: this is useless | ||
|
||
#!/bin/bash | ||
echo "${GPTSCRIPT_INPUT} ha ha ha" |
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
Oops, something went wrong.