@promptbook/openai 0.61.0-10 → 0.61.0-12
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/esm/index.es.js +9 -2
- package/esm/index.es.js.map +1 -1
- package/esm/typings/promptbook-collection/index.d.ts +83 -2
- package/esm/typings/src/_packages/core.index.d.ts +2 -2
- package/esm/typings/src/_packages/types.index.d.ts +2 -2
- package/esm/typings/src/_packages/utils.index.d.ts +3 -1
- package/esm/typings/src/cli/cli-commands/hello.d.ts +3 -0
- package/esm/typings/src/cli/cli-commands/make.d.ts +3 -0
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +3 -0
- package/esm/typings/src/cli/promptbookCli.d.ts +1 -0
- package/esm/typings/src/collection/PipelineCollection.d.ts +1 -1
- package/esm/typings/src/collection/SimplePipelineCollection.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -0
- package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -0
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +4 -1
- package/esm/typings/src/config.d.ts +4 -0
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
- package/esm/typings/src/conversion/pipelineStringToJson.d.ts +1 -0
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +2 -0
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +6 -0
- package/esm/typings/src/errors/EnvironmentMismatchError.d.ts +7 -0
- package/{umd/typings/src/errors/VersionMismatch.d.ts → esm/typings/src/errors/VersionMismatchError.d.ts} +1 -1
- package/esm/typings/src/execution/CommonExecutionToolsOptions.d.ts +1 -0
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +3 -1
- package/esm/typings/src/execution/PipelineExecutor.d.ts +4 -3
- package/esm/typings/src/execution/PromptResult.d.ts +12 -0
- package/esm/typings/src/execution/ScriptExecutionTools.d.ts +4 -2
- package/esm/typings/src/execution/createPipelineExecutor.d.ts +2 -0
- package/esm/typings/src/formats/csv/ListFormatDefinition.d.ts +1 -0
- package/esm/typings/src/formats/json/JsonFormatDefinition.d.ts +1 -0
- package/esm/typings/src/formats/list/ListFormatDefinition.d.ts +1 -0
- package/esm/typings/src/formats/xml/XmlFormatDefinition.d.ts +1 -0
- package/esm/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +3 -0
- package/esm/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +1 -1
- package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +1 -0
- package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.test.d.ts +3 -0
- package/esm/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +1 -0
- package/esm/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +22 -0
- package/esm/typings/src/llm-providers/_common/getLlmToolsForCli.d.ts +10 -0
- package/esm/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +10 -0
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +29 -0
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +10 -0
- package/esm/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +16 -0
- package/esm/typings/src/llm-providers/_common/utils/count-total-cost/LlmExecutionToolsWithTotalCost.d.ts +11 -0
- package/esm/typings/src/llm-providers/_common/utils/count-total-cost/countTotalCost.d.ts +14 -0
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +3 -0
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/azure-openai/playground/playground.d.ts +3 -0
- package/esm/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +3 -0
- package/esm/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +3 -1
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/openai/computeUsage.d.ts +2 -2
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -0
- package/esm/typings/src/llm-providers/openai/playground/playground.d.ts +3 -0
- package/esm/typings/src/personas/preparePersona.d.ts +4 -2
- package/esm/typings/src/prepare/preparePipeline.d.ts +3 -1
- package/esm/typings/src/prepare/unpreparePipeline.d.ts +1 -0
- package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +25 -0
- package/esm/typings/src/storage/_common/PromptbookStorage.test-type.d.ts +5 -0
- package/esm/typings/src/storage/files-storage/FilesStorage.d.ts +30 -0
- package/esm/typings/src/storage/files-storage/FilesStorageOptions.d.ts +13 -0
- package/esm/typings/src/storage/files-storage/utils/nameToSubfolderPath.d.ts +7 -0
- package/esm/typings/src/storage/files-storage/utils/nameToSubfolderPath.test.d.ts +1 -0
- package/esm/typings/src/storage/local-storage/getLocalStorage.d.ts +9 -0
- package/esm/typings/src/storage/local-storage/getSessionStorage.d.ts +9 -0
- package/esm/typings/src/storage/memory/MemoryStorage.d.ts +34 -0
- package/esm/typings/src/storage/utils/PrefixStorage.d.ts +26 -0
- package/esm/typings/src/storage/utils/makePromptbookStorageFromWebStorage.d.ts +11 -0
- package/esm/typings/src/types/ModelRequirements.d.ts +21 -1
- package/esm/typings/src/types/Parameters.d.ts +0 -1
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -2
- package/esm/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -5
- package/esm/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +1 -0
- package/esm/typings/src/types/PipelineJson/PromptTemplateParameterJson.d.ts +11 -2
- package/esm/typings/src/types/PipelineString.d.ts +1 -1
- package/esm/typings/src/types/Prompt.d.ts +5 -2
- package/esm/typings/src/types/execution-report/countWorkingDuration.d.ts +1 -1
- package/esm/typings/src/types/typeAliases.d.ts +35 -1
- package/esm/typings/src/utils/emojis.d.ts +2 -2
- package/esm/typings/src/utils/formatNumber.d.ts +1 -1
- package/esm/typings/src/utils/isRunningInWhatever.d.ts +3 -0
- package/esm/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +1 -1
- package/esm/typings/src/utils/markdown/createMarkdownChart.d.ts +1 -1
- package/esm/typings/src/utils/markdown/createMarkdownTable.d.ts +1 -1
- package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown-real.test.d.ts +1 -0
- package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +7 -0
- package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +1 -1
- package/esm/typings/src/utils/organization/TODO.d.ts +2 -0
- package/esm/typings/src/utils/organization/TODO_USE.d.ts +1 -0
- package/esm/typings/src/utils/organization/___.d.ts +2 -0
- package/esm/typings/src/utils/organization/just.d.ts +1 -0
- package/esm/typings/src/utils/organization/keepImported.d.ts +12 -0
- package/esm/typings/src/utils/organization/notUsing.d.ts +12 -0
- package/esm/typings/src/utils/organization/really_any.d.ts +2 -0
- package/esm/typings/src/utils/random/randomSeed.d.ts +7 -0
- package/esm/typings/src/version.d.ts +3 -0
- package/package.json +2 -2
- package/umd/index.umd.js +9 -2
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/promptbook-collection/index.d.ts +83 -2
- package/umd/typings/src/_packages/core.index.d.ts +2 -2
- package/umd/typings/src/_packages/types.index.d.ts +2 -2
- package/umd/typings/src/_packages/utils.index.d.ts +3 -1
- package/umd/typings/src/cli/cli-commands/hello.d.ts +3 -0
- package/umd/typings/src/cli/cli-commands/make.d.ts +3 -0
- package/umd/typings/src/cli/cli-commands/prettify.d.ts +3 -0
- package/umd/typings/src/cli/promptbookCli.d.ts +1 -0
- package/umd/typings/src/collection/PipelineCollection.d.ts +1 -1
- package/umd/typings/src/collection/SimplePipelineCollection.d.ts +1 -1
- package/umd/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -0
- package/umd/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -0
- package/umd/typings/src/commands/_common/types/CommandParser.d.ts +4 -1
- package/umd/typings/src/config.d.ts +4 -0
- package/umd/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
- package/umd/typings/src/conversion/pipelineStringToJson.d.ts +1 -0
- package/umd/typings/src/conversion/pipelineStringToJsonSync.d.ts +2 -0
- package/umd/typings/src/conversion/validation/validatePipeline.d.ts +6 -0
- package/umd/typings/src/errors/EnvironmentMismatchError.d.ts +7 -0
- package/{esm/typings/src/errors/VersionMismatch.d.ts → umd/typings/src/errors/VersionMismatchError.d.ts} +1 -1
- package/umd/typings/src/execution/CommonExecutionToolsOptions.d.ts +1 -0
- package/umd/typings/src/execution/LlmExecutionTools.d.ts +3 -1
- package/umd/typings/src/execution/PipelineExecutor.d.ts +4 -3
- package/umd/typings/src/execution/PromptResult.d.ts +12 -0
- package/umd/typings/src/execution/ScriptExecutionTools.d.ts +4 -2
- package/umd/typings/src/execution/createPipelineExecutor.d.ts +2 -0
- package/umd/typings/src/formats/csv/ListFormatDefinition.d.ts +1 -0
- package/umd/typings/src/formats/json/JsonFormatDefinition.d.ts +1 -0
- package/umd/typings/src/formats/list/ListFormatDefinition.d.ts +1 -0
- package/umd/typings/src/formats/xml/XmlFormatDefinition.d.ts +1 -0
- package/umd/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +3 -0
- package/umd/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +1 -1
- package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +1 -0
- package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.test.d.ts +3 -0
- package/umd/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +1 -0
- package/umd/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +22 -0
- package/umd/typings/src/llm-providers/_common/getLlmToolsForCli.d.ts +10 -0
- package/umd/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +10 -0
- package/umd/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +29 -0
- package/umd/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +10 -0
- package/umd/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +16 -0
- package/umd/typings/src/llm-providers/_common/utils/count-total-cost/LlmExecutionToolsWithTotalCost.d.ts +11 -0
- package/umd/typings/src/llm-providers/_common/utils/count-total-cost/countTotalCost.d.ts +14 -0
- package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -0
- package/umd/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/umd/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +3 -0
- package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -0
- package/umd/typings/src/llm-providers/azure-openai/playground/playground.d.ts +3 -0
- package/umd/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +3 -0
- package/umd/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +1 -1
- package/umd/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +1 -1
- package/umd/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +1 -1
- package/umd/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +3 -1
- package/umd/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +1 -0
- package/umd/typings/src/llm-providers/openai/computeUsage.d.ts +2 -2
- package/umd/typings/src/llm-providers/openai/openai-models.d.ts +1 -0
- package/umd/typings/src/llm-providers/openai/playground/playground.d.ts +3 -0
- package/umd/typings/src/personas/preparePersona.d.ts +4 -2
- package/umd/typings/src/prepare/preparePipeline.d.ts +3 -1
- package/umd/typings/src/prepare/unpreparePipeline.d.ts +1 -0
- package/umd/typings/src/storage/_common/PromptbookStorage.d.ts +25 -0
- package/umd/typings/src/storage/_common/PromptbookStorage.test-type.d.ts +5 -0
- package/umd/typings/src/storage/files-storage/FilesStorage.d.ts +30 -0
- package/umd/typings/src/storage/files-storage/FilesStorageOptions.d.ts +13 -0
- package/umd/typings/src/storage/files-storage/utils/nameToSubfolderPath.d.ts +7 -0
- package/umd/typings/src/storage/files-storage/utils/nameToSubfolderPath.test.d.ts +1 -0
- package/umd/typings/src/storage/local-storage/getLocalStorage.d.ts +9 -0
- package/umd/typings/src/storage/local-storage/getSessionStorage.d.ts +9 -0
- package/umd/typings/src/storage/memory/MemoryStorage.d.ts +34 -0
- package/umd/typings/src/storage/utils/PrefixStorage.d.ts +26 -0
- package/umd/typings/src/storage/utils/makePromptbookStorageFromWebStorage.d.ts +11 -0
- package/umd/typings/src/types/ModelRequirements.d.ts +21 -1
- package/umd/typings/src/types/Parameters.d.ts +0 -1
- package/umd/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -2
- package/umd/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -5
- package/umd/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +1 -0
- package/umd/typings/src/types/PipelineJson/PromptTemplateParameterJson.d.ts +11 -2
- package/umd/typings/src/types/PipelineString.d.ts +1 -1
- package/umd/typings/src/types/Prompt.d.ts +5 -2
- package/umd/typings/src/types/execution-report/countWorkingDuration.d.ts +1 -1
- package/umd/typings/src/types/typeAliases.d.ts +35 -1
- package/umd/typings/src/utils/emojis.d.ts +2 -2
- package/umd/typings/src/utils/formatNumber.d.ts +1 -1
- package/umd/typings/src/utils/isRunningInWhatever.d.ts +3 -0
- package/umd/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +1 -1
- package/umd/typings/src/utils/markdown/createMarkdownChart.d.ts +1 -1
- package/umd/typings/src/utils/markdown/createMarkdownTable.d.ts +1 -1
- package/umd/typings/src/utils/markdown/extractAllBlocksFromMarkdown-real.test.d.ts +1 -0
- package/umd/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +7 -0
- package/umd/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +1 -1
- package/umd/typings/src/utils/organization/TODO.d.ts +2 -0
- package/umd/typings/src/utils/organization/TODO_USE.d.ts +1 -0
- package/umd/typings/src/utils/organization/___.d.ts +2 -0
- package/umd/typings/src/utils/organization/just.d.ts +1 -0
- package/umd/typings/src/utils/organization/keepImported.d.ts +12 -0
- package/umd/typings/src/utils/organization/notUsing.d.ts +12 -0
- package/umd/typings/src/utils/organization/really_any.d.ts +2 -0
- package/umd/typings/src/utils/random/randomSeed.d.ts +7 -0
- package/umd/typings/src/version.d.ts +3 -0
- package/esm/typings/src/collection/constructors/justTestFsImport.d.ts +0 -7
- package/esm/typings/src/knowledge/prepare-knowledge/_common/utils/getLlmToolsForTests.d.ts +0 -7
- package/umd/typings/src/collection/constructors/justTestFsImport.d.ts +0 -7
- package/umd/typings/src/knowledge/prepare-knowledge/_common/utils/getLlmToolsForTests.d.ts +0 -7
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PromptbookStorage } from '../_common/PromptbookStorage';
|
|
2
|
+
/**
|
|
3
|
+
* @@@
|
|
4
|
+
*
|
|
5
|
+
* @private for `getLocalStorage` and `getSessionStorage`
|
|
6
|
+
*/
|
|
7
|
+
export declare function makePromptbookStorageFromWebStorage<TValue>(webStorage: Storage): PromptbookStorage<TValue>;
|
|
8
|
+
/**
|
|
9
|
+
* TODO: [🧠] Should this be named `makePromptbookStorageFromWebStorage` vs `createPromptbookStorageFromWebStorage`
|
|
10
|
+
* TODO: [🌗] Maybe some checkers, not all valid JSONs are desired and valid values
|
|
11
|
+
*/
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import type { number_model_temperature } from './typeAliases';
|
|
2
|
+
import type { number_seed } from './typeAliases';
|
|
1
3
|
import type { string_model_name } from './typeAliases';
|
|
4
|
+
import type { string_system_message } from './typeAliases';
|
|
2
5
|
export declare const MODEL_VARIANTS: readonly ["COMPLETION", "CHAT", "EMBEDDING"];
|
|
3
6
|
/**
|
|
4
7
|
* Model variant describes the very general type of the model
|
|
@@ -31,13 +34,30 @@ export type ModelRequirements = {
|
|
|
31
34
|
* @example 'gpt-4', 'gpt-4-32k-0314', 'gpt-3.5-turbo-instruct',...
|
|
32
35
|
*/
|
|
33
36
|
readonly modelName?: string_model_name;
|
|
37
|
+
/**
|
|
38
|
+
* System message to be used in the model
|
|
39
|
+
*/
|
|
40
|
+
readonly systemMessage?: string_system_message;
|
|
41
|
+
/**
|
|
42
|
+
* The temperature of the model
|
|
43
|
+
*
|
|
44
|
+
* Note: [💱] Promptbook is using just `temperature` (not `top_k` and `top_p`)
|
|
45
|
+
*/
|
|
46
|
+
readonly temperature?: number_model_temperature;
|
|
47
|
+
/**
|
|
48
|
+
* Seed for the model
|
|
49
|
+
*/
|
|
50
|
+
readonly seed?: number_seed;
|
|
34
51
|
/**
|
|
35
52
|
* Maximum number of tokens that can be generated by the model
|
|
36
53
|
*/
|
|
37
54
|
readonly maxTokens?: number;
|
|
38
55
|
};
|
|
39
56
|
/**
|
|
40
|
-
* TODO:
|
|
57
|
+
* TODO: [🧠][🈁] `seed` should maybe be somewhere else (not in `ModelRequirements`) (simmilar that `user` identification is not here)
|
|
58
|
+
* TODO: [🧠][💱] Add more model options: `stop_token`, `logit_bias`, `logprobs` (`top_logprobs`), `top_k`, `top_p`, `presence_penalty`, `frequency_penalty`, `bestOf`, `logitBias`, `logitBiasType`,...
|
|
59
|
+
* [💱] Probbably keep using just `temperature` in Promptbook (not `top_k` and `top_p`)
|
|
60
|
+
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
41
61
|
* TODO: Maybe figure out better word than "variant"
|
|
42
62
|
* TODO: Add here more requirement options like max context size, max tokens, etc.
|
|
43
63
|
* TODO: [💕][🧠] Just selecting gpt3 or gpt4 level of model
|
|
@@ -14,7 +14,7 @@ import type { PromptTemplateParameterJson } from './PromptTemplateParameterJson'
|
|
|
14
14
|
* Promptbook is the **core concept of this package**.
|
|
15
15
|
* It represents a series of prompt templates chained together to form a pipeline / one big prompt template with input and result parameters.
|
|
16
16
|
*
|
|
17
|
-
* @see
|
|
17
|
+
* @see @@@ https://github.com/webgptorg/promptbook#promptbook
|
|
18
18
|
*/
|
|
19
19
|
export type PipelineJson = {
|
|
20
20
|
/**
|
|
@@ -79,7 +79,6 @@ export type PipelineJson = {
|
|
|
79
79
|
readonly preparations: Array<PreparationJson>;
|
|
80
80
|
};
|
|
81
81
|
/**
|
|
82
|
-
* TODO: !!!!! Implement new commands
|
|
83
82
|
* Note: There was a proposal for multiple types of promptbook objects 78816ff33e2705ee1a187aa2eb8affd976d4ea1a
|
|
84
83
|
* But then immediately reverted back to the single type
|
|
85
84
|
* With knowledge as part of the promptbook and collection just as a collection of promptbooks
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import type { PromptResultUsage } from '../../execution/PromptResult';
|
|
2
2
|
import type { string_promptbook_version } from '../../version';
|
|
3
3
|
import type { number_id } from '../typeAliases';
|
|
4
|
-
import type { string_date_iso8601 } from '../typeAliases';
|
|
5
4
|
export type PreparationJson = {
|
|
6
5
|
/**
|
|
7
6
|
* Incremental ID of the preparation
|
|
8
7
|
*/
|
|
9
8
|
readonly id: number_id;
|
|
10
|
-
/**
|
|
11
|
-
* Date and time of the preparation
|
|
12
|
-
*/
|
|
13
|
-
readonly date: string_date_iso8601;
|
|
14
9
|
/**
|
|
15
10
|
* Version of the promptbook used for the preparation
|
|
16
11
|
*/
|
|
@@ -22,4 +17,5 @@ export type PreparationJson = {
|
|
|
22
17
|
};
|
|
23
18
|
/**
|
|
24
19
|
* TODO: Maybe put here used `modelName`
|
|
20
|
+
* 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
|
|
25
21
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { string_markdown_text } from '../typeAliases';
|
|
2
|
-
import type {
|
|
2
|
+
import type { string_parameter_name } from '../typeAliases';
|
|
3
|
+
import type { string_parameter_value } from '../typeAliases';
|
|
3
4
|
/**
|
|
4
5
|
* Describes one parameter of the promptbook
|
|
5
6
|
*/
|
|
@@ -9,7 +10,7 @@ export type PromptTemplateParameterJson = {
|
|
|
9
10
|
* - It must be unique across the pipeline
|
|
10
11
|
* - It should start lowercase and contain letters and numbers
|
|
11
12
|
*/
|
|
12
|
-
readonly name:
|
|
13
|
+
readonly name: string_parameter_name;
|
|
13
14
|
/**
|
|
14
15
|
* The parameter is input of the pipeline
|
|
15
16
|
*/
|
|
@@ -23,4 +24,12 @@ export type PromptTemplateParameterJson = {
|
|
|
23
24
|
* - It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
24
25
|
*/
|
|
25
26
|
readonly description?: string_markdown_text;
|
|
27
|
+
/**
|
|
28
|
+
* Sample values of the parameter
|
|
29
|
+
* Note: This values won't be actually used as some default values, but they are just for better understanding of the parameter
|
|
30
|
+
*/
|
|
31
|
+
readonly sampleValues?: Array<string_parameter_value>;
|
|
26
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* TODO: [♈] Probbably move expectations from templates to parameters
|
|
35
|
+
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Promptbook is the **core concept of this package**.
|
|
3
3
|
* It represents a series of prompt templates chained together to form a pipeline / one big prompt template with input and result parameters.
|
|
4
4
|
*
|
|
5
|
-
* @see
|
|
5
|
+
* @see @@@ https://github.com/webgptorg/promptbook#promptbook
|
|
6
6
|
*/
|
|
7
7
|
export type PipelineString = string & {
|
|
8
8
|
readonly _type: 'Promptbook';
|
|
@@ -2,13 +2,15 @@ import type { ExpectFormatCommand } from '../commands/EXPECT/ExpectFormatCommand
|
|
|
2
2
|
import type { PostprocessingFunction } from '../scripting/javascript/JavascriptExecutionToolsOptions';
|
|
3
3
|
import type { ModelRequirements } from './ModelRequirements';
|
|
4
4
|
import type { Expectations } from './PipelineJson/Expectations';
|
|
5
|
-
import type {
|
|
5
|
+
import type { string_parameter_name } from './typeAliases';
|
|
6
|
+
import type { string_parameter_value } from './typeAliases';
|
|
6
7
|
import type { string_pipeline_url_with_hashtemplate } from './typeAliases';
|
|
7
8
|
import type { string_prompt } from './typeAliases';
|
|
8
9
|
import type { string_title } from './typeAliases';
|
|
9
10
|
/**
|
|
10
11
|
* Prompt in a text along with model requirements, but without any execution or templating logic.
|
|
11
12
|
*
|
|
13
|
+
* Note: [🛫] This is NOT fully serializable as JSON, it contains functions which are not serializable
|
|
12
14
|
* @see https://github.com/webgptorg/promptbook#prompt
|
|
13
15
|
*/
|
|
14
16
|
export type Prompt = {
|
|
@@ -58,8 +60,9 @@ export type Prompt = {
|
|
|
58
60
|
*
|
|
59
61
|
* Note: This is redundant (same information is in pipelineUrl+content) but useful for logging and debugging
|
|
60
62
|
*/
|
|
61
|
-
readonly parameters: Record<
|
|
63
|
+
readonly parameters: Record<string_parameter_name, string_parameter_value>;
|
|
62
64
|
};
|
|
63
65
|
/**
|
|
64
66
|
* TODO: [✔] Check ModelRequirements in runtime
|
|
67
|
+
* TODO: [🏳] Add options for translation - maybe create `TranslationPrompt`
|
|
65
68
|
*/
|
|
@@ -32,6 +32,12 @@ export type string_text_prompt = string_prompt;
|
|
|
32
32
|
* For example `"How many hats does the cat wear?"`
|
|
33
33
|
*/
|
|
34
34
|
export type string_chat_prompt = string_text_prompt;
|
|
35
|
+
/**
|
|
36
|
+
* Semantic helper
|
|
37
|
+
*
|
|
38
|
+
* For example `"You are an AI assistant. You are here to help me with my work."`
|
|
39
|
+
*/
|
|
40
|
+
export type string_system_message = string_text_prompt;
|
|
35
41
|
/**
|
|
36
42
|
* Semantic helper
|
|
37
43
|
*
|
|
@@ -73,6 +79,20 @@ export type string_char = string;
|
|
|
73
79
|
* For example `"ainautes"`
|
|
74
80
|
*/
|
|
75
81
|
export type string_name = string;
|
|
82
|
+
/**
|
|
83
|
+
* Semantic helper
|
|
84
|
+
* Unique identifier of anything
|
|
85
|
+
*
|
|
86
|
+
* For example `"eventName"`
|
|
87
|
+
*/
|
|
88
|
+
export type string_parameter_name = string;
|
|
89
|
+
/**
|
|
90
|
+
* Semantic helper
|
|
91
|
+
* Unique identifier of anything
|
|
92
|
+
*
|
|
93
|
+
* For example `"DevConf 2024"`
|
|
94
|
+
*/
|
|
95
|
+
export type string_parameter_value = string;
|
|
76
96
|
/**
|
|
77
97
|
* Semantic helper
|
|
78
98
|
* Title of anything
|
|
@@ -462,9 +482,22 @@ export type number_negative = number;
|
|
|
462
482
|
export type number_integer = number;
|
|
463
483
|
/**
|
|
464
484
|
* Semantic helper;
|
|
465
|
-
* Percentage from 0 to 1 (100%)
|
|
485
|
+
* Percentage from 0 to 1 (100%) (and bellow and above)
|
|
466
486
|
*/
|
|
467
487
|
export type number_percent = number;
|
|
488
|
+
/**
|
|
489
|
+
* Semantic helper;
|
|
490
|
+
* Model temperature
|
|
491
|
+
*/
|
|
492
|
+
export type number_model_temperature = number_percent;
|
|
493
|
+
/**
|
|
494
|
+
* Semantic helper;
|
|
495
|
+
* Seed for random generator
|
|
496
|
+
*
|
|
497
|
+
* Percentage from 0 to 1 (100%)
|
|
498
|
+
* TODO: Is seed (in OpenAI) number from 0 to 1?
|
|
499
|
+
*/
|
|
500
|
+
export type number_seed = number_percent;
|
|
468
501
|
/**
|
|
469
502
|
* Likeness of the wallpaper
|
|
470
503
|
*
|
|
@@ -491,4 +524,5 @@ export type number_terabytes = number_positive;
|
|
|
491
524
|
* TODO: !!! Change "For example" to @example
|
|
492
525
|
* TODO: !! Cleanup
|
|
493
526
|
* TODO: !! Change to branded types
|
|
527
|
+
* TODO: [📂] Export all this file through `@promptbook/types`
|
|
494
528
|
*/
|
|
@@ -5,7 +5,7 @@ import type { string_char_emoji } from '../types/typeAliasEmoji';
|
|
|
5
5
|
*
|
|
6
6
|
* @see https://getemoji.com/
|
|
7
7
|
*
|
|
8
|
-
* @private within the
|
|
8
|
+
* @private within the repository
|
|
9
9
|
* @deprecated Use /\p{Extended_Pictographic}/ instead
|
|
10
10
|
*/
|
|
11
11
|
export declare const EMOJIS_IN_CATEGORIES: Record<string, Array<string_char_emoji>>;
|
|
@@ -13,7 +13,7 @@ export declare const EMOJIS_IN_CATEGORIES: Record<string, Array<string_char_emoj
|
|
|
13
13
|
*
|
|
14
14
|
* All possible emoji chars like "🍆", "🍡", "🍤"...
|
|
15
15
|
*
|
|
16
|
-
* @private within the
|
|
16
|
+
* @private within the repository
|
|
17
17
|
* @deprecated Use /\p{Extended_Pictographic}/ instead
|
|
18
18
|
*/
|
|
19
19
|
export declare const EMOJIS: Set<string_char_emoji>;
|
|
@@ -3,7 +3,7 @@ import type { string_name } from '../../types/typeAliases';
|
|
|
3
3
|
/**
|
|
4
4
|
* Add or modify an auto-generated section in a markdown file
|
|
5
5
|
*
|
|
6
|
-
* @private within the
|
|
6
|
+
* @private within the repository
|
|
7
7
|
*/
|
|
8
8
|
export declare function addAutoGeneratedSection(content: string_markdown, options: {
|
|
9
9
|
readonly sectionName: string_name;
|
|
@@ -28,7 +28,7 @@ type CreateMarkdownChartOptions = {
|
|
|
28
28
|
/**
|
|
29
29
|
* Function createMarkdownChart will draw a chart in markdown from ⬛+🟦 tiles
|
|
30
30
|
*
|
|
31
|
-
* @private within the
|
|
31
|
+
* @private within the repository
|
|
32
32
|
*/
|
|
33
33
|
export declare function createMarkdownChart(options: CreateMarkdownChartOptions): string_markdown;
|
|
34
34
|
export {};
|
|
@@ -3,6 +3,6 @@ import type { string_markdown_text } from '../../types/typeAliases';
|
|
|
3
3
|
/**
|
|
4
4
|
* Create a markdown table from a 2D array of strings
|
|
5
5
|
*
|
|
6
|
-
* @private within the
|
|
6
|
+
* @private within the repository
|
|
7
7
|
*/
|
|
8
8
|
export declare function createMarkdownTable(table: Array<Array<string_markdown_text>>): string_markdown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,6 +3,10 @@ import type { string_markdown } from '../../types/typeAliases';
|
|
|
3
3
|
* Single code block inside markdown.
|
|
4
4
|
*/
|
|
5
5
|
export type CodeBlock = {
|
|
6
|
+
/**
|
|
7
|
+
* Which notation was used to open the code block
|
|
8
|
+
*/
|
|
9
|
+
readonly blockNotation: '```' | '>';
|
|
6
10
|
/**
|
|
7
11
|
* Language of the code block OR null if the language is not specified in opening ```
|
|
8
12
|
*/
|
|
@@ -25,3 +29,6 @@ export type CodeBlock = {
|
|
|
25
29
|
*
|
|
26
30
|
*/
|
|
27
31
|
export declare function extractAllBlocksFromMarkdown(markdown: string_markdown): Array<CodeBlock>;
|
|
32
|
+
/**
|
|
33
|
+
* TODO: Maybe name for `blockNotation` instead of '```' and '>'
|
|
34
|
+
*/
|
|
@@ -15,5 +15,5 @@ import type { CodeBlock } from './extractAllBlocksFromMarkdown';
|
|
|
15
15
|
*/
|
|
16
16
|
export declare function extractOneBlockFromMarkdown(markdown: string_markdown): CodeBlock;
|
|
17
17
|
/***
|
|
18
|
-
* TODO: [🍓][🌻]
|
|
18
|
+
* TODO: [🍓][🌻] Decide of this is internal util, external util OR validator/postprocessor
|
|
19
19
|
*/
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { really_any } from './really_any';
|
|
2
|
+
/**
|
|
3
|
+
* Just says that the variable is not used but should be kept
|
|
4
|
+
* No side effects.
|
|
5
|
+
*
|
|
6
|
+
* Note: It can be usefull suppressing eager optimization of unused imports
|
|
7
|
+
*
|
|
8
|
+
* @param value any values
|
|
9
|
+
* @returns void
|
|
10
|
+
* @private within the repository
|
|
11
|
+
*/
|
|
12
|
+
export declare function keepImported(...value: Array<really_any>): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { really_any } from './really_any';
|
|
2
|
+
/**
|
|
3
|
+
* Just says that the variable is not used
|
|
4
|
+
* No side effects.
|
|
5
|
+
*
|
|
6
|
+
* Note: It can be usefull suppressing eslint errors of unused variables in the tests
|
|
7
|
+
*
|
|
8
|
+
* @param value any values
|
|
9
|
+
* @returns void
|
|
10
|
+
* @private within the repository
|
|
11
|
+
*/
|
|
12
|
+
export declare function notUsing(...value: Array<really_any>): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/openai",
|
|
3
|
-
"version": "0.61.0-
|
|
3
|
+
"version": "0.61.0-12",
|
|
4
4
|
"description": "Supercharge your use of large language models",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
}
|
|
50
50
|
],
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@promptbook/core": "0.61.0-
|
|
52
|
+
"@promptbook/core": "0.61.0-12"
|
|
53
53
|
},
|
|
54
54
|
"main": "./umd/index.umd.js",
|
|
55
55
|
"module": "./esm/index.es.js",
|
package/umd/index.umd.js
CHANGED
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
/**
|
|
111
111
|
* Function computeUsage will create price per one token based on the string value found on openai page
|
|
112
112
|
*
|
|
113
|
-
* @private within the
|
|
113
|
+
* @private within the repository, used only as internal helper for `OPENAI_MODELS`
|
|
114
114
|
*/
|
|
115
115
|
function computeUsage(value) {
|
|
116
116
|
var _a = __read(value.split(' / '), 2), price = _a[0], tokens = _a[1];
|
|
@@ -464,6 +464,7 @@
|
|
|
464
464
|
* @see /other/playground/playground.ts
|
|
465
465
|
* TODO: [🍓] Make better
|
|
466
466
|
* TODO: Change model titles to human eg: "gpt-4-turbo-2024-04-09" -> "GPT-4 Turbo (2024-04-09)"
|
|
467
|
+
* TODO: [🚸] Not all models are compatible with JSON mode, add this information here and use it
|
|
467
468
|
*/
|
|
468
469
|
|
|
469
470
|
/**
|
|
@@ -939,6 +940,7 @@
|
|
|
939
940
|
model: model,
|
|
940
941
|
max_tokens: modelRequirements.maxTokens,
|
|
941
942
|
// <- TODO: Make some global max cap for maxTokens
|
|
943
|
+
// <- TODO: !!!!! Use here `systemMessage`, `temperature` and `seed`
|
|
942
944
|
};
|
|
943
945
|
if (expectFormat === 'JSON') {
|
|
944
946
|
modelSettings.response_format = {
|
|
@@ -1012,6 +1014,7 @@
|
|
|
1012
1014
|
model: model,
|
|
1013
1015
|
max_tokens: modelRequirements.maxTokens || 2000, // <- Note: 2000 is for lagacy reasons
|
|
1014
1016
|
// <- TODO: Make some global max cap for maxTokens
|
|
1017
|
+
// <- TODO: !!!!! Use here `systemMessage`, `temperature` and `seed`
|
|
1015
1018
|
};
|
|
1016
1019
|
rawRequest = __assign(__assign({}, modelSettings), { prompt: content, user: this.options.user });
|
|
1017
1020
|
start = getCurrentIsoDate();
|
|
@@ -1162,13 +1165,17 @@
|
|
|
1162
1165
|
* TODO: [🧠][🧙♂️] Maybe there can be some wizzard for thoose who want to use just OpenAI
|
|
1163
1166
|
* TODO: Maybe Create some common util for callChatModel and callCompletionModel
|
|
1164
1167
|
* TODO: Maybe make custom OpenaiError
|
|
1168
|
+
* TODO: [🧠][🈁] Maybe use `isDeterministic` from options
|
|
1165
1169
|
*/
|
|
1166
1170
|
|
|
1167
1171
|
/**
|
|
1168
1172
|
* The version of the Promptbook library
|
|
1169
1173
|
*/
|
|
1170
|
-
var PROMPTBOOK_VERSION = '0.61.0-
|
|
1174
|
+
var PROMPTBOOK_VERSION = '0.61.0-11';
|
|
1171
1175
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
1176
|
+
/**
|
|
1177
|
+
* TODO: [🔼] !!! Export via `@promptbook/code`
|
|
1178
|
+
*/
|
|
1172
1179
|
|
|
1173
1180
|
exports.OPENAI_MODELS = OPENAI_MODELS;
|
|
1174
1181
|
exports.OpenAiExecutionTools = OpenAiExecutionTools;
|