UNPKG

@promptbook/azure-openai

Version:

Promptbook: Run AI apps in plain human language across multiple models and platforms

104 lines (103 loc) 4.2 kB
import type { ForeachJson } from '../../commands/FOREACH/ForeachJson'; import type { FormatCommand } from '../../commands/FORMAT/FormatCommand'; import type { SectionType } from '../../types/SectionType'; import type { string_javascript } from '../../types/typeAliases'; import type { string_markdown } from '../../types/typeAliases'; import type { string_markdown_text } from '../../types/typeAliases'; import type { string_name } from '../../types/typeAliases'; import type { string_parameter_name } from '../../types/typeAliases'; import type { string_postprocessing_function_name } from '../../types/typeAliases'; import type { string_prompt } from '../../types/typeAliases'; import type { string_template } from '../../types/typeAliases'; import type { Expectations } from './Expectations'; /** * Common properties of all tasks */ export type CommonTaskJson = { /** * Name of the task * - It must be unique across the pipeline * - It should start uppercase and can contain letters and numbers * - The pipelineUrl together with hash and name are used to identify the task in the pipeline */ readonly name: string_name; /** * Title of the task * It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure */ readonly title: string; /** * Description of the task * It can use multiple paragraphs of simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure */ readonly description?: string_markdown_text; /** * List of parameter names that are used in the task and must be defined before the task is executed * * Note: Joker is one of the dependent parameters */ readonly dependentParameterNames: Array<string_parameter_name>; /** * List of parameter names that act as jokers. * If a joker parameter meets the expectations, its value is used instead of executing the task. * * @see https://github.com/webgptorg/promptbook/discussions/66 */ readonly jokerParameterNames?: Array<string_parameter_name>; /** * Configuration for the FOREACH command, if used. * Allows iterating over a list parameter. */ readonly foreach?: ForeachJson; /** * Type of the execution * This determines if the task is send to LLM, user or some scripting evaluation */ readonly taskType: SectionType; /** * Raw content of the task with {placeholders} for parameters before any preparation. * * @see preparedContent */ readonly content: (string_prompt | string_javascript | string_markdown) & string_template; /** * Content of the task after preparation, with {placeholders} for parameters. * This is the content used during execution. * * @see content * * @default "{content}" */ readonly preparedContent?: (string_prompt | string_javascript | string_markdown) & string_template; /** * List of postprocessing steps that are executed after the task * * @see https://github.com/webgptorg/promptbook/discussions/31 */ readonly postprocessingFunctionNames?: Array<string_postprocessing_function_name>; /** * Expect this amount of each unit in the answer * * For example 5 words, 3 sentences, 2 paragraphs, ... * * Note: Expectations are performed after all postprocessing steps * @see https://github.com/webgptorg/promptbook/discussions/30 */ readonly expectations?: Expectations; /** * Expect this format of the answer * * Note: Expectations are performed after all postprocessing steps * @see https://github.com/webgptorg/promptbook/discussions/30 * @deprecated [💝] */ readonly format?: FormatCommand['format']; /** * Name of the parameter that is the result of the task */ readonly resultingParameterName: string_name; }; /** * TODO: use one helper type> (string_prompt | string_javascript | string_markdown) & string_template * TODO: [♈] Probably move expectations from tasks to parameters */