@promptbook/openai 0.67.9 → 0.68.0-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/esm/index.es.js +4 -4
- package/esm/index.es.js.map +1 -1
- package/esm/typings/promptbook-collection/index.d.ts +7 -16
- package/esm/typings/src/_packages/core.index.d.ts +2 -2
- package/esm/typings/src/_packages/types.index.d.ts +20 -24
- package/esm/typings/src/_packages/utils.index.d.ts +2 -2
- package/esm/typings/src/commands/BLOCK/BlockTypes.d.ts +1 -1
- package/esm/typings/src/commands/BLOCK/blockCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/EXPECT/ExpectCommand.d.ts +14 -6
- package/esm/typings/src/commands/EXPECT/expectCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/FOREACH/ForeachCommand.d.ts +9 -0
- package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +14 -0
- package/esm/typings/src/commands/{EXPECT/ExpectFormatCommand.d.ts → FORMAT/FormatCommand.d.ts} +2 -2
- package/esm/typings/src/commands/FORMAT/formatCommand.test.d.ts +1 -0
- package/esm/typings/src/commands/FORMAT/formatCommandParser.d.ts +9 -0
- package/esm/typings/src/commands/JOKER/jokerCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/KNOWLEDGE/knowledgeCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/MODEL/modelCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/PARAMETER/parameterCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/PERSONA/personaCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/POSTPROCESS/postprocessCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/URL/urlCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/X_ACTION/actionCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/X_INSTRUMENT/instrumentCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +6 -4
- package/esm/typings/src/commands/_common/parseCommand.d.ts +1 -1
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +137 -30
- package/esm/typings/src/commands/index.d.ts +1 -1
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
- package/esm/typings/src/conversion/pipelineStringToJson.d.ts +1 -1
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +2 -2
- package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +2 -2
- package/esm/typings/src/conversion/utils/extractParameterNamesFromTemplate.d.ts +14 -0
- package/esm/typings/src/conversion/utils/extractParameterNamesFromTemplate.test.d.ts +1 -0
- package/esm/typings/src/conversion/utils/extractVariables.d.ts +1 -1
- package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -1
- package/esm/typings/src/errors/{ParsingError.d.ts → ParseError.d.ts} +5 -2
- package/esm/typings/src/errors/index.d.ts +2 -2
- package/esm/typings/src/execution/CommonExecutionToolsOptions.d.ts +5 -0
- package/esm/typings/src/execution/PromptResult.d.ts +2 -0
- package/esm/typings/src/execution/PromptResultUsage.d.ts +1 -1
- package/esm/typings/src/execution/createPipelineExecutor.d.ts +1 -1
- package/esm/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +1 -1
- package/esm/typings/src/postprocessing/utils/extractBlock.d.ts +2 -2
- package/esm/typings/src/postprocessing/utils/extractJsonBlock.d.ts +3 -3
- package/esm/typings/src/prepare/prepareTemplates.d.ts +3 -4
- package/esm/typings/src/prepare/unpreparePipeline.d.ts +1 -1
- package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +1 -1
- package/esm/typings/src/storage/utils/PrefixStorage.d.ts +1 -1
- package/esm/typings/src/types/ModelRequirements.d.ts +2 -0
- package/esm/typings/src/types/PipelineJson/DialogTemplateJson.d.ts +13 -0
- package/esm/typings/src/types/PipelineJson/Expectations.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/{PromptTemplateParameterJson.d.ts → ParameterJson.d.ts} +2 -2
- package/esm/typings/src/types/PipelineJson/PersonaJson.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +10 -5
- package/esm/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +20 -9
- package/esm/typings/src/types/PipelineJson/{ScriptJson.d.ts → ScriptTemplateJson.d.ts} +4 -4
- package/esm/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +3 -3
- package/esm/typings/src/types/PipelineJson/TemplateJson.d.ts +11 -0
- package/esm/typings/src/types/PipelineJson/{PromptTemplateJsonCommon.d.ts → TemplateJsonCommon.d.ts} +3 -4
- package/esm/typings/src/types/Prompt.d.ts +4 -2
- package/esm/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +1 -0
- package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +1 -1
- package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +2 -2
- package/esm/typings/src/utils/organization/___and___.d.ts +7 -0
- package/esm/typings/src/utils/organization/{___.d.ts → ___or___.d.ts} +1 -1
- package/esm/typings/src/utils/parseNumber.d.ts +1 -1
- package/esm/typings/src/utils/serialization/clonePipeline.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +4 -4
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/commands/EXPECT/ExpectAmountCommand.d.ts +0 -17
- package/esm/typings/src/conversion/utils/extractParameterNamesFromPromptTemplate.d.ts +0 -14
- package/esm/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +0 -27
- package/esm/typings/src/types/PipelineJson/PromptDialogJson.d.ts +0 -14
- /package/esm/typings/src/{conversion/utils/extractParameterNamesFromPromptTemplate.test.d.ts → commands/FOREACH/foreachCommand.test.d.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TemplateJson } from '../types/PipelineJson/TemplateJson';
|
|
3
3
|
import type { PrepareOptions } from './PrepareOptions';
|
|
4
|
-
type PrepareTemplateInput = Pick<PipelineJson, '
|
|
4
|
+
type PrepareTemplateInput = Pick<PipelineJson, 'templates' | 'parameters'> & {
|
|
5
5
|
/**
|
|
6
6
|
* @@@
|
|
7
7
|
*/
|
|
@@ -11,7 +11,7 @@ type PreparedTemplates = {
|
|
|
11
11
|
/**
|
|
12
12
|
* @@@ Sequence of prompt templates that are chained together to form a pipeline
|
|
13
13
|
*/
|
|
14
|
-
readonly
|
|
14
|
+
readonly templatesPrepared: Array<TemplateJson>;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
17
|
* @@@
|
|
@@ -28,5 +28,4 @@ export {};
|
|
|
28
28
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
29
29
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
30
30
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
31
|
-
* TODO: [🧠][🥜]
|
|
32
31
|
*/
|
|
@@ -8,5 +8,5 @@ export declare function unpreparePipeline(pipeline: PipelineJson): PipelineJson;
|
|
|
8
8
|
/**
|
|
9
9
|
* TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
|
|
10
10
|
* TODO: Write tests for `preparePipeline`
|
|
11
|
-
* TODO: [🍙] Make some
|
|
11
|
+
* TODO: [🍙] Make some standard order of json properties
|
|
12
12
|
*/
|
|
@@ -52,6 +52,8 @@ export type EmbeddingModelRequirements = CommonModelRequirements & {
|
|
|
52
52
|
* Common properties for all model requirements variants
|
|
53
53
|
*
|
|
54
54
|
* Note: [🚉] This is fully serializable as JSON
|
|
55
|
+
*
|
|
56
|
+
* @private just abstract the common properties of the model requirements
|
|
55
57
|
*/
|
|
56
58
|
export type CommonModelRequirements = {
|
|
57
59
|
/**
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TemplateJsonCommon } from './TemplateJsonCommon';
|
|
2
|
+
/**
|
|
3
|
+
* Template for prompt to user
|
|
4
|
+
*
|
|
5
|
+
* Note: [🚉] This is fully serializable as JSON
|
|
6
|
+
* @see https://github.com/webgptorg/promptbook/discussions/76
|
|
7
|
+
*/
|
|
8
|
+
export type DialogTemplateJson = TemplateJsonCommon & {
|
|
9
|
+
readonly blockType: 'DIALOG_TEMPLATE';
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* TODO: [🍙] Make some standard order of json properties
|
|
13
|
+
*/
|
|
@@ -36,5 +36,5 @@ export declare const EXPECTATION_UNITS: readonly ["CHARACTERS", "WORDS", "SENTEN
|
|
|
36
36
|
*/
|
|
37
37
|
export type ExpectationAmount = number_integer & (number_positive | 0);
|
|
38
38
|
/**
|
|
39
|
-
* TODO: [💝] Unite object for expecting amount and format - remove
|
|
39
|
+
* TODO: [💝] Unite object for expecting amount and format - remove format
|
|
40
40
|
*/
|
package/esm/typings/src/types/PipelineJson/{PromptTemplateParameterJson.d.ts → ParameterJson.d.ts}
RENAMED
|
@@ -6,7 +6,7 @@ import type { string_parameter_value } from '../typeAliases';
|
|
|
6
6
|
*
|
|
7
7
|
* Note: [🚉] This is fully serializable as JSON
|
|
8
8
|
*/
|
|
9
|
-
export type
|
|
9
|
+
export type ParameterJson = {
|
|
10
10
|
/**
|
|
11
11
|
* Name of the parameter
|
|
12
12
|
* - It must be unique across the pipeline
|
|
@@ -34,5 +34,5 @@ export type PromptTemplateParameterJson = {
|
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
36
36
|
* TODO: [♈] Probbably move expectations from templates to parameters
|
|
37
|
-
* TODO: [🍙] Make some
|
|
37
|
+
* TODO: [🍙] Make some standard order of json properties
|
|
38
38
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ModelRequirements } from '../ModelRequirements';
|
|
1
2
|
import type { string_file_path } from '../typeAliases';
|
|
2
3
|
import type { string_markdown_text } from '../typeAliases';
|
|
3
4
|
import type { string_pipeline_url } from '../typeAliases';
|
|
@@ -5,11 +6,11 @@ import type { string_semantic_version } from '../typeAliases';
|
|
|
5
6
|
import type { KnowledgePiecePreparedJson } from './KnowledgePieceJson';
|
|
6
7
|
import type { KnowledgeSourceJson } from './KnowledgeSourceJson';
|
|
7
8
|
import type { KnowledgeSourcePreparedJson } from './KnowledgeSourceJson';
|
|
9
|
+
import type { ParameterJson } from './ParameterJson';
|
|
8
10
|
import type { PersonaJson } from './PersonaJson';
|
|
9
11
|
import type { PersonaPreparedJson } from './PersonaJson';
|
|
10
12
|
import type { PreparationJson } from './PreparationJson';
|
|
11
|
-
import type {
|
|
12
|
-
import type { PromptTemplateParameterJson } from './PromptTemplateParameterJson';
|
|
13
|
+
import type { TemplateJson } from './TemplateJson';
|
|
13
14
|
/**
|
|
14
15
|
* Promptbook is the **core concept of this package**.
|
|
15
16
|
* It represents a series of prompt templates chained together to form a pipeline / one big prompt template with input and result parameters.
|
|
@@ -50,11 +51,15 @@ export type PipelineJson = {
|
|
|
50
51
|
/**
|
|
51
52
|
* Set of variables that are used across the pipeline
|
|
52
53
|
*/
|
|
53
|
-
readonly parameters: Array<
|
|
54
|
+
readonly parameters: Array<ParameterJson>;
|
|
55
|
+
/**
|
|
56
|
+
* Default model requirements for the model for all `templates`
|
|
57
|
+
*/
|
|
58
|
+
readonly defaultModelRequirements?: Partial<ModelRequirements>;
|
|
54
59
|
/**
|
|
55
60
|
* Sequence of prompt templates that are chained together to form a pipeline
|
|
56
61
|
*/
|
|
57
|
-
readonly
|
|
62
|
+
readonly templates: Array<TemplateJson>;
|
|
58
63
|
/**
|
|
59
64
|
* Set of information that are used as external knowledge in the pipeline
|
|
60
65
|
*
|
|
@@ -81,7 +86,7 @@ export type PipelineJson = {
|
|
|
81
86
|
readonly preparations: Array<PreparationJson>;
|
|
82
87
|
};
|
|
83
88
|
/**
|
|
84
|
-
* TODO: [🍙] Make some
|
|
89
|
+
* TODO: [🍙] Make some standard order of json properties
|
|
85
90
|
* TODO: [🧠] Maybe wrap all {parameterNames} in brackets for example { "resultingParameterName": "{foo}" }
|
|
86
91
|
* Note: [💼] There was a proposal for multiple types of promptbook objects 78816ff33e2705ee1a187aa2eb8affd976d4ea1a
|
|
87
92
|
* But then immediately reverted back to the single type
|
|
@@ -16,7 +16,7 @@ export type PreparationJson = {
|
|
|
16
16
|
readonly usage: PromptResultUsage;
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
|
-
* TODO: [🍙] Make some
|
|
19
|
+
* TODO: [🍙] Make some standard order of json properties
|
|
20
20
|
* TODO: Maybe put here used `modelName`
|
|
21
21
|
* TODO: [🍥] When using `date` it changes all samples .ptbk.json files each time so until some more elegant solution omit the time from prepared pipeline
|
|
22
22
|
*/
|
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type { ScriptJson } from './ScriptJson';
|
|
5
|
-
import type { SimpleTemplateJson } from './SimpleTemplateJson';
|
|
1
|
+
import type { ModelRequirements } from '../ModelRequirements';
|
|
2
|
+
import type { string_name } from '../typeAliases';
|
|
3
|
+
import type { TemplateJsonCommon } from './TemplateJsonCommon';
|
|
6
4
|
/**
|
|
7
|
-
*
|
|
5
|
+
* Template for prompt to LLM
|
|
8
6
|
*
|
|
9
7
|
* Note: [🚉] This is fully serializable as JSON
|
|
10
8
|
*/
|
|
11
|
-
export type PromptTemplateJson =
|
|
9
|
+
export type PromptTemplateJson = TemplateJsonCommon & {
|
|
10
|
+
readonly blockType: 'PROMPT_TEMPLATE';
|
|
11
|
+
/**
|
|
12
|
+
* Name of the persona who will be responding to this prompt
|
|
13
|
+
*/
|
|
14
|
+
readonly personaName?: string_name;
|
|
15
|
+
/**
|
|
16
|
+
* Requirements for the model
|
|
17
|
+
* - This is required only for blockType PROMPT_TEMPLATE
|
|
18
|
+
*/
|
|
19
|
+
readonly modelRequirements?: Partial<ModelRequirements>;
|
|
20
|
+
};
|
|
12
21
|
/**
|
|
13
|
-
* TODO: [
|
|
14
|
-
*
|
|
22
|
+
* TODO: [👙][🧠] Maybe add `knowledge`, `actions` and `instruments` to be available granularly for each template
|
|
23
|
+
* @see https://github.com/webgptorg/promptbook/discussions/79
|
|
24
|
+
* TODO: [💕][🧠] Just selecting gpt3 or gpt4 level of model
|
|
25
|
+
* TODO: [🍙] Make some standard order of json properties
|
|
15
26
|
*/
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { ScriptLanguage } from '../ScriptLanguage';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TemplateJsonCommon } from './TemplateJsonCommon';
|
|
3
3
|
/**
|
|
4
4
|
* Template for script execution
|
|
5
5
|
*
|
|
6
6
|
* Note: [🚉] This is fully serializable as JSON
|
|
7
7
|
* @see https://github.com/webgptorg/promptbook/discussions/77
|
|
8
8
|
*/
|
|
9
|
-
export type
|
|
10
|
-
readonly blockType: '
|
|
9
|
+
export type ScriptTemplateJson = TemplateJsonCommon & {
|
|
10
|
+
readonly blockType: 'SCRIPT_TEMPLATE';
|
|
11
11
|
/**
|
|
12
12
|
* Language of the script
|
|
13
13
|
* - This is required only for blockType SCRIPT
|
|
@@ -16,5 +16,5 @@ export type ScriptJson = PromptTemplateJsonCommon & {
|
|
|
16
16
|
readonly contentLanguage?: ScriptLanguage;
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
|
-
* TODO: [🍙] Make some
|
|
19
|
+
* TODO: [🍙] Make some standard order of json properties
|
|
20
20
|
*/
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TemplateJsonCommon } from './TemplateJsonCommon';
|
|
2
2
|
/**
|
|
3
3
|
* Template for simple concatenation of strings
|
|
4
4
|
*
|
|
5
5
|
* Note: [🚉] This is fully serializable as JSON
|
|
6
6
|
* @see https://github.com/webgptorg/promptbook/discussions/17
|
|
7
7
|
*/
|
|
8
|
-
export type SimpleTemplateJson =
|
|
8
|
+
export type SimpleTemplateJson = TemplateJsonCommon & {
|
|
9
9
|
readonly blockType: 'SIMPLE_TEMPLATE';
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
|
-
* TODO: [🍙] Make some
|
|
12
|
+
* TODO: [🍙] Make some standard order of json properties
|
|
13
13
|
*/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ___or___ } from '../../utils/organization/___or___';
|
|
2
|
+
import type { DialogTemplateJson } from './DialogTemplateJson';
|
|
3
|
+
import type { PromptTemplateJson } from './PromptTemplateJson';
|
|
4
|
+
import type { ScriptTemplateJson } from './ScriptTemplateJson';
|
|
5
|
+
import type { SimpleTemplateJson } from './SimpleTemplateJson';
|
|
6
|
+
/**
|
|
7
|
+
* Describes one (prompt) template in the promptbook
|
|
8
|
+
*
|
|
9
|
+
* Note: [🚉] This is fully serializable as JSON
|
|
10
|
+
*/
|
|
11
|
+
export type TemplateJson = PromptTemplateJson | SimpleTemplateJson | ScriptTemplateJson | DialogTemplateJson | ___or___ | ___or___;
|
package/esm/typings/src/types/PipelineJson/{PromptTemplateJsonCommon.d.ts → TemplateJsonCommon.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BlockType } from '../../commands/BLOCK/BlockTypes';
|
|
2
|
-
import type {
|
|
2
|
+
import type { FormatCommand } from '../../commands/FORMAT/FormatCommand';
|
|
3
3
|
import type { string_javascript } from '../typeAliases';
|
|
4
4
|
import type { string_markdown } from '../typeAliases';
|
|
5
5
|
import type { string_markdown_text } from '../typeAliases';
|
|
@@ -12,7 +12,7 @@ import type { Expectations } from './Expectations';
|
|
|
12
12
|
/**
|
|
13
13
|
* Common properties of all prompt templates
|
|
14
14
|
*/
|
|
15
|
-
export interface
|
|
15
|
+
export interface TemplateJsonCommon {
|
|
16
16
|
/**
|
|
17
17
|
* Name of the template
|
|
18
18
|
* - It must be unique across the pipeline
|
|
@@ -83,14 +83,13 @@ export interface PromptTemplateJsonCommon {
|
|
|
83
83
|
* @see https://github.com/webgptorg/promptbook/discussions/30
|
|
84
84
|
* @deprecated [💝]
|
|
85
85
|
*/
|
|
86
|
-
readonly
|
|
86
|
+
readonly format?: FormatCommand['format'];
|
|
87
87
|
/**
|
|
88
88
|
* Name of the parameter that is the result of the prompt template
|
|
89
89
|
*/
|
|
90
90
|
readonly resultingParameterName: string_name;
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
|
-
* TODO: [🧠][🥜]
|
|
94
93
|
* TODO: use one helper type> (string_prompt | string_javascript | string_markdown) & string_template
|
|
95
94
|
* TODO: [♈] Probbably move expectations from templates to parameters
|
|
96
95
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FormatCommand } from '../commands/FORMAT/FormatCommand';
|
|
2
2
|
import type { ChatModelRequirements } from './ModelRequirements';
|
|
3
3
|
import type { CompletionModelRequirements } from './ModelRequirements';
|
|
4
4
|
import type { EmbeddingModelRequirements } from './ModelRequirements';
|
|
@@ -54,6 +54,8 @@ export type EmbeddingPrompt = CommonPrompt & {
|
|
|
54
54
|
* Common properties for all prompt results
|
|
55
55
|
*
|
|
56
56
|
* Note: [🚉] This is fully serializable as JSON
|
|
57
|
+
*
|
|
58
|
+
* @private just abstract the common properties of the prompts
|
|
57
59
|
*/
|
|
58
60
|
export type CommonPrompt = {
|
|
59
61
|
/**
|
|
@@ -89,7 +91,7 @@ export type CommonPrompt = {
|
|
|
89
91
|
* Note: Expectations are performed after all postprocessing steps
|
|
90
92
|
* @deprecated [💝]
|
|
91
93
|
*/
|
|
92
|
-
readonly
|
|
94
|
+
readonly format?: FormatCommand['format'];
|
|
93
95
|
/**
|
|
94
96
|
* Unique identifier of the pipeline with specific template name as hash
|
|
95
97
|
*
|
|
@@ -10,5 +10,6 @@ export declare function addAutoGeneratedSection(content: string_markdown, option
|
|
|
10
10
|
readonly sectionContent: string_markdown;
|
|
11
11
|
}): string_markdown;
|
|
12
12
|
/**
|
|
13
|
+
* TODO: !!!!!! Somw way how to connect this with commands
|
|
13
14
|
* TODO: [🏛] This can be part of markdown builder
|
|
14
15
|
*/
|
|
@@ -27,7 +27,7 @@ export type CodeBlock = {
|
|
|
27
27
|
*
|
|
28
28
|
* @param markdown any valid markdown
|
|
29
29
|
* @returns code blocks with language and content
|
|
30
|
-
* @throws {
|
|
30
|
+
* @throws {ParseError} if block is not closed properly
|
|
31
31
|
* @public exported from `@promptbook/markdown-utils`
|
|
32
32
|
*/
|
|
33
33
|
export declare function extractAllBlocksFromMarkdown(markdown: string_markdown): Array<CodeBlock>;
|
|
@@ -3,7 +3,7 @@ import type { CodeBlock } from './extractAllBlocksFromMarkdown';
|
|
|
3
3
|
/**
|
|
4
4
|
* Extracts exactly ONE code block from markdown.
|
|
5
5
|
*
|
|
6
|
-
* - When there are multiple or no code blocks the function throws a `
|
|
6
|
+
* - When there are multiple or no code blocks the function throws a `ParseError`
|
|
7
7
|
*
|
|
8
8
|
* Note: There are multiple simmilar function:
|
|
9
9
|
* - `extractBlock` just extracts the content of the code block which is also used as build-in function for postprocessing
|
|
@@ -14,7 +14,7 @@ import type { CodeBlock } from './extractAllBlocksFromMarkdown';
|
|
|
14
14
|
* @param markdown any valid markdown
|
|
15
15
|
* @returns code block with language and content
|
|
16
16
|
* @public exported from `@promptbook/markdown-utils`
|
|
17
|
-
* @throws {
|
|
17
|
+
* @throws {ParseError} if there is not exactly one code block in the markdown
|
|
18
18
|
*/
|
|
19
19
|
export declare function extractOneBlockFromMarkdown(markdown: string_markdown): CodeBlock;
|
|
20
20
|
/***
|
|
@@ -9,5 +9,5 @@ import type { PipelineJson } from '../../types/PipelineJson/PipelineJson';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function clonePipeline(pipeline: PipelineJson): PipelineJson;
|
|
11
11
|
/**
|
|
12
|
-
* TODO: [🍙] Make some
|
|
12
|
+
* TODO: [🍙] Make some standard order of json properties
|
|
13
13
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/openai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.68.0-1",
|
|
4
4
|
"description": "Supercharge your use of large language models",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"module": "./esm/index.es.js",
|
|
48
48
|
"typings": "./esm/typings/src/_packages/openai.index.d.ts",
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@promptbook/core": "0.
|
|
50
|
+
"@promptbook/core": "0.68.0-1"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"colors": "1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
/**
|
|
15
15
|
* The version of the Promptbook library
|
|
16
16
|
*/
|
|
17
|
-
var PROMPTBOOK_VERSION = '0.
|
|
17
|
+
var PROMPTBOOK_VERSION = '0.68.0-0';
|
|
18
18
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
19
19
|
|
|
20
20
|
/*! *****************************************************************************
|
|
@@ -1361,14 +1361,14 @@
|
|
|
1361
1361
|
*/
|
|
1362
1362
|
OpenAiExecutionTools.prototype.callChatModel = function (prompt) {
|
|
1363
1363
|
return __awaiter(this, void 0, void 0, function () {
|
|
1364
|
-
var content, parameters, modelRequirements,
|
|
1364
|
+
var content, parameters, modelRequirements, format, client, modelName, modelSettings, rawPromptContent, rawRequest, start, complete, rawResponse, resultContent, usage;
|
|
1365
1365
|
return __generator(this, function (_a) {
|
|
1366
1366
|
switch (_a.label) {
|
|
1367
1367
|
case 0:
|
|
1368
1368
|
if (this.options.isVerbose) {
|
|
1369
1369
|
console.info('💬 OpenAI callChatModel call', { prompt: prompt });
|
|
1370
1370
|
}
|
|
1371
|
-
content = prompt.content, parameters = prompt.parameters, modelRequirements = prompt.modelRequirements,
|
|
1371
|
+
content = prompt.content, parameters = prompt.parameters, modelRequirements = prompt.modelRequirements, format = prompt.format;
|
|
1372
1372
|
return [4 /*yield*/, this.getClient()];
|
|
1373
1373
|
case 1:
|
|
1374
1374
|
client = _a.sent();
|
|
@@ -1385,7 +1385,7 @@
|
|
|
1385
1385
|
// <- TODO: [🈁] Use `seed` here AND/OR use is `isDeterministic` for entire execution tools
|
|
1386
1386
|
// <- Note: [🧆]
|
|
1387
1387
|
};
|
|
1388
|
-
if (
|
|
1388
|
+
if (format === 'JSON') {
|
|
1389
1389
|
modelSettings.response_format = {
|
|
1390
1390
|
type: 'json_object',
|
|
1391
1391
|
};
|