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, { const topicJokesFeedback = withHumanFeedback(topicJokes, {
type: 'selectN', type: 'selectN',
annotations: false, annotations: false,
bail: false, abort: false,
editing: true, editing: true,
mechanism: HumanFeedbackMechanismCLI mechanism: HumanFeedbackMechanismCLI
}) })

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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