diff --git a/docs/genaisrc/genaiscript.d.ts b/docs/genaisrc/genaiscript.d.ts index 2868d9057b..34615cbec0 100644 --- a/docs/genaisrc/genaiscript.d.ts +++ b/docs/genaisrc/genaiscript.d.ts @@ -101,6 +101,8 @@ type PromptOutputProcessorHandler = ( | Promise | undefined | Promise + | void + | Promise type PromptTemplateResponseType = "json_object" | "json_schema" | undefined diff --git a/genaisrc/genaiscript.d.ts b/genaisrc/genaiscript.d.ts index 2868d9057b..34615cbec0 100644 --- a/genaisrc/genaiscript.d.ts +++ b/genaisrc/genaiscript.d.ts @@ -101,6 +101,8 @@ type PromptOutputProcessorHandler = ( | Promise | undefined | Promise + | void + | Promise type PromptTemplateResponseType = "json_object" | "json_schema" | undefined diff --git a/packages/core/src/genaisrc/genaiscript.d.ts b/packages/core/src/genaisrc/genaiscript.d.ts index 2868d9057b..34615cbec0 100644 --- a/packages/core/src/genaisrc/genaiscript.d.ts +++ b/packages/core/src/genaisrc/genaiscript.d.ts @@ -101,6 +101,8 @@ type PromptOutputProcessorHandler = ( | Promise | undefined | Promise + | void + | Promise type PromptTemplateResponseType = "json_object" | "json_schema" | undefined diff --git a/packages/core/src/trace.ts b/packages/core/src/trace.ts index a4f22ab07e..0e02a3c758 100644 --- a/packages/core/src/trace.ts +++ b/packages/core/src/trace.ts @@ -196,7 +196,7 @@ ${this.toResultIcon(success, "")}${title} error: serializeError(error), } this.errors.push(err) - this.renderError(err, { details: false }) + this.renderError(err, { details: true }) }) } @@ -226,7 +226,7 @@ ${this.toResultIcon(success, "")}${title} ) { const { message, error } = e const emsg = errorMessage(error) - const msg = message || emsg + const msg = [message, emsg].filter((m) => m).join(", ") this.disableChange(() => { this.item(msg) if (options.details && error?.stack) { diff --git a/packages/core/src/types/prompt_template.d.ts b/packages/core/src/types/prompt_template.d.ts index 70300854f0..d819529f1f 100644 --- a/packages/core/src/types/prompt_template.d.ts +++ b/packages/core/src/types/prompt_template.d.ts @@ -101,6 +101,8 @@ type PromptOutputProcessorHandler = ( | Promise | undefined | Promise + | void + | Promise type PromptTemplateResponseType = "json_object" | "json_schema" | undefined diff --git a/packages/sample/genaisrc/genaiscript.d.ts b/packages/sample/genaisrc/genaiscript.d.ts index 2868d9057b..34615cbec0 100644 --- a/packages/sample/genaisrc/genaiscript.d.ts +++ b/packages/sample/genaisrc/genaiscript.d.ts @@ -101,6 +101,8 @@ type PromptOutputProcessorHandler = ( | Promise | undefined | Promise + | void + | Promise type PromptTemplateResponseType = "json_object" | "json_schema" | undefined diff --git a/packages/sample/genaisrc/node/genaiscript.d.ts b/packages/sample/genaisrc/node/genaiscript.d.ts index 2868d9057b..34615cbec0 100644 --- a/packages/sample/genaisrc/node/genaiscript.d.ts +++ b/packages/sample/genaisrc/node/genaiscript.d.ts @@ -101,6 +101,8 @@ type PromptOutputProcessorHandler = ( | Promise | undefined | Promise + | void + | Promise type PromptTemplateResponseType = "json_object" | "json_schema" | undefined diff --git a/packages/sample/genaisrc/output.genai.js b/packages/sample/genaisrc/output.genai.js index 9185b03995..b7d081c012 100644 --- a/packages/sample/genaisrc/output.genai.js +++ b/packages/sample/genaisrc/output.genai.js @@ -1,12 +1,14 @@ script({ + model: "openai:gpt-3.5-turbo", title: "custom output", + files: "src/rag/markdown.md", tests: { files: "src/rag/markdown.md" }, system: [], }) const output = env.files[0].filename + ".txt" def("FILE", env.files) $`Summarize all the files. Respond as raw text.` -defOutputProcessor((o) => { +defOutputProcessor(async (o) => { console.log(`writing to ${output}`) return { files: { @@ -14,3 +16,9 @@ defOutputProcessor((o) => { }, } }) + +defOutputProcessor(o => { + const { text } = o + console.log(`doing something with text`) + console.log(text) +}) \ No newline at end of file diff --git a/packages/sample/genaisrc/python/genaiscript.d.ts b/packages/sample/genaisrc/python/genaiscript.d.ts index 2868d9057b..34615cbec0 100644 --- a/packages/sample/genaisrc/python/genaiscript.d.ts +++ b/packages/sample/genaisrc/python/genaiscript.d.ts @@ -101,6 +101,8 @@ type PromptOutputProcessorHandler = ( | Promise | undefined | Promise + | void + | Promise type PromptTemplateResponseType = "json_object" | "json_schema" | undefined diff --git a/packages/sample/genaisrc/style/genaiscript.d.ts b/packages/sample/genaisrc/style/genaiscript.d.ts index 2868d9057b..34615cbec0 100644 --- a/packages/sample/genaisrc/style/genaiscript.d.ts +++ b/packages/sample/genaisrc/style/genaiscript.d.ts @@ -101,6 +101,8 @@ type PromptOutputProcessorHandler = ( | Promise | undefined | Promise + | void + | Promise type PromptTemplateResponseType = "json_object" | "json_schema" | undefined diff --git a/packages/sample/src/aici/genaiscript.d.ts b/packages/sample/src/aici/genaiscript.d.ts index 2868d9057b..34615cbec0 100644 --- a/packages/sample/src/aici/genaiscript.d.ts +++ b/packages/sample/src/aici/genaiscript.d.ts @@ -101,6 +101,8 @@ type PromptOutputProcessorHandler = ( | Promise | undefined | Promise + | void + | Promise type PromptTemplateResponseType = "json_object" | "json_schema" | undefined diff --git a/packages/sample/src/errors/genaiscript.d.ts b/packages/sample/src/errors/genaiscript.d.ts index 2868d9057b..34615cbec0 100644 --- a/packages/sample/src/errors/genaiscript.d.ts +++ b/packages/sample/src/errors/genaiscript.d.ts @@ -101,6 +101,8 @@ type PromptOutputProcessorHandler = ( | Promise | undefined | Promise + | void + | Promise type PromptTemplateResponseType = "json_object" | "json_schema" | undefined diff --git a/packages/sample/src/makecode/genaiscript.d.ts b/packages/sample/src/makecode/genaiscript.d.ts index 2868d9057b..34615cbec0 100644 --- a/packages/sample/src/makecode/genaiscript.d.ts +++ b/packages/sample/src/makecode/genaiscript.d.ts @@ -101,6 +101,8 @@ type PromptOutputProcessorHandler = ( | Promise | undefined | Promise + | void + | Promise type PromptTemplateResponseType = "json_object" | "json_schema" | undefined diff --git a/packages/sample/src/tla/genaiscript.d.ts b/packages/sample/src/tla/genaiscript.d.ts index 2868d9057b..34615cbec0 100644 --- a/packages/sample/src/tla/genaiscript.d.ts +++ b/packages/sample/src/tla/genaiscript.d.ts @@ -101,6 +101,8 @@ type PromptOutputProcessorHandler = ( | Promise | undefined | Promise + | void + | Promise type PromptTemplateResponseType = "json_object" | "json_schema" | undefined diff --git a/packages/sample/src/vision/genaiscript.d.ts b/packages/sample/src/vision/genaiscript.d.ts index 2868d9057b..34615cbec0 100644 --- a/packages/sample/src/vision/genaiscript.d.ts +++ b/packages/sample/src/vision/genaiscript.d.ts @@ -101,6 +101,8 @@ type PromptOutputProcessorHandler = ( | Promise | undefined | Promise + | void + | Promise type PromptTemplateResponseType = "json_object" | "json_schema" | undefined diff --git a/slides/genaisrc/genaiscript.d.ts b/slides/genaisrc/genaiscript.d.ts index 2868d9057b..34615cbec0 100644 --- a/slides/genaisrc/genaiscript.d.ts +++ b/slides/genaisrc/genaiscript.d.ts @@ -101,6 +101,8 @@ type PromptOutputProcessorHandler = ( | Promise | undefined | Promise + | void + | Promise type PromptTemplateResponseType = "json_object" | "json_schema" | undefined