chore: fix example code and simplify code

Philipp Burckhardt 2023-06-14 23:31:13 -04:00 zatwierdzone przez Travis Fischer
rodzic 07138c9ca7
commit ff5a878cc9
4 zmienionych plików z 6 dodań i 9 usunięć

Wyświetl plik

@ -23,7 +23,7 @@ async function main() {
const topicJokesFeedback = withHumanFeedback(topicJokes, {
type: 'selectN',
annotations: false,
bail: false,
abort: false,
editing: true,
mechanism: HumanFeedbackMechanismCLI
})

Wyświetl plik

@ -23,7 +23,7 @@ async function main() {
const topicJokesFeedback = withHumanFeedback(topicJokes, {
type: 'selectN',
annotations: false,
bail: false,
abort: false,
editing: true,
mechanism: HumanFeedbackMechanismSlack
})

Wyświetl plik

@ -23,7 +23,7 @@ async function main() {
const topicJokesFeedback = withHumanFeedback(topicJokes, {
type: 'selectN',
annotations: false,
bail: false,
abort: false,
editing: true,
mechanism: HumanFeedbackMechanismTwilio
})

Wyświetl plik

@ -263,10 +263,7 @@ export function withHumanFeedback<TInput, TOutput, V extends HumanFeedbackType>(
) {
task = task.clone()
// Default options defined at the instance level
const instanceDefaults = task.agentic.humanFeedbackDefaults
// Use Object.assign to merge the options, instance defaults, and hard-coded defaults
// Use Object.assign to merge the options, instance defaults, and hard-coded defaults:
const finalOptions: HumanFeedbackOptions<V, TOutput> = Object.assign(
{
type: 'confirm',
@ -275,8 +272,8 @@ export function withHumanFeedback<TInput, TOutput, V extends HumanFeedbackType>(
annotations: false,
mechanism: HumanFeedbackMechanismCLI
},
// Defaults from the instance:
instanceDefaults,
// Default options from the instance:
task.agentic.humanFeedbackDefaults,
// User-provided options (override instance defaults):
options
)