@promptbook/openai 0.61.0-1 → 0.61.0-11
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 +4 -1
- package/esm/index.es.js.map +1 -1
- package/esm/typings/promptbook-collection/index.d.ts +196 -23
- package/esm/typings/src/_packages/core.index.d.ts +5 -1
- package/esm/typings/src/_packages/types.index.d.ts +6 -4
- package/esm/typings/src/_packages/utils.index.d.ts +4 -3
- package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createCollectionFromUrl.d.ts +2 -2
- package/esm/typings/src/commands/MODEL/ModelCommand.d.ts +1 -1
- package/esm/typings/src/commands/PERSONA/PersonaCommand.d.ts +4 -2
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +15 -12
- package/esm/typings/src/config.d.ts +8 -0
- package/esm/typings/src/conversion/pipelineStringToJson.d.ts +9 -5
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +5 -3
- package/esm/typings/src/conversion/prettify/PrettifyOptions.d.ts +2 -2
- package/esm/typings/src/conversion/utils/renameParameter.d.ts +3 -3
- package/esm/typings/src/conversion/validation/_importPipeline.d.ts +2 -2
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +4 -0
- package/esm/typings/src/errors/EnvironmentMismatchError.d.ts +7 -0
- package/esm/typings/src/errors/VersionMismatchError.d.ts +8 -0
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +3 -1
- package/esm/typings/src/execution/PipelineExecutor.d.ts +8 -7
- package/esm/typings/src/execution/PromptResult.d.ts +17 -5
- package/esm/typings/src/execution/ScriptExecutionTools.d.ts +6 -4
- package/esm/typings/src/execution/UserInterfaceTools.d.ts +5 -5
- package/esm/typings/src/execution/createPipelineExecutor.d.ts +4 -1
- package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +2 -2
- package/esm/typings/src/execution/utils/forEachAsync.d.ts +1 -1
- package/esm/typings/src/formats/csv/ListFormatDefinition.d.ts +1 -1
- package/esm/typings/src/formats/json/JsonFormatDefinition.d.ts +1 -1
- package/esm/typings/src/formats/list/ListFormatDefinition.d.ts +1 -1
- package/esm/typings/src/knowledge/dialogs/callback/CallbackInterfaceToolsOptions.d.ts +1 -1
- package/esm/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +18 -0
- package/esm/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.test.d.ts +1 -0
- package/esm/typings/src/knowledge/prepare-knowledge/_common/utils/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +10 -0
- package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +8 -23
- 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 +7 -14
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +2 -2
- package/esm/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +3 -0
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +5 -5
- package/esm/typings/src/llm-providers/azure-openai/playground/playground.d.ts +3 -0
- 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/OpenAiExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +3 -2
- package/esm/typings/src/llm-providers/openai/playground/playground.d.ts +3 -0
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/utils/cache/CacheItem.d.ts +29 -0
- package/esm/typings/src/llm-providers/utils/cache/CacheLlmToolsOptions.d.ts +10 -0
- package/esm/typings/src/llm-providers/utils/cache/cacheLlmTools.d.ts +17 -0
- package/esm/typings/src/llm-providers/utils/count-total-cost/LlmExecutionToolsWithTotalCost.d.ts +11 -0
- package/esm/typings/src/llm-providers/utils/count-total-cost/countTotalCost.d.ts +14 -0
- package/esm/typings/src/llm-providers/utils/createLlmToolsFromEnv.d.ts +21 -0
- package/esm/typings/src/personas/preparePersona.d.ts +10 -0
- package/esm/typings/src/personas/preparePersona.test.d.ts +1 -0
- package/esm/typings/src/prepare/PrepareOptions.d.ts +22 -0
- package/esm/typings/src/prepare/preparePipeline.d.ts +16 -0
- package/esm/typings/src/prepare/unpreparePipeline.d.ts +8 -0
- package/esm/typings/src/scripting/javascript/JavascriptExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +1 -1
- package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +24 -0
- package/esm/typings/src/storage/_common/PromptbookStorage.test-type.d.ts +5 -0
- package/esm/typings/src/storage/files-storage/FilesStorage.d.ts +28 -0
- package/esm/typings/src/storage/files-storage/FilesStorageOptions.d.ts +10 -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 +8 -0
- package/esm/typings/src/storage/local-storage/getSessionStorage.d.ts +8 -0
- package/esm/typings/src/storage/memory/MemoryStorage.d.ts +31 -0
- package/esm/typings/src/storage/utils/PrefixStorage.d.ts +23 -0
- package/esm/typings/src/storage/utils/makePromptbookStorageFromWebStorage.d.ts +12 -0
- package/esm/typings/src/types/ModelRequirements.d.ts +22 -1
- package/esm/typings/src/types/PipelineJson/Expectations.d.ts +6 -2
- package/esm/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +67 -0
- package/esm/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +24 -0
- package/esm/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +8 -1
- package/esm/typings/src/types/PipelineJson/PersonaJson.d.ts +40 -0
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +27 -3
- package/esm/typings/src/types/PipelineJson/PreparationJson.d.ts +21 -0
- package/esm/typings/src/types/PipelineJson/PromptDialogJson.d.ts +2 -0
- package/esm/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +8 -1
- package/esm/typings/src/types/PipelineJson/PromptTemplateParameterJson.d.ts +11 -2
- package/esm/typings/src/types/PipelineJson/ScriptJson.d.ts +2 -0
- package/esm/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +2 -0
- package/esm/typings/src/types/Prompt.d.ts +5 -2
- package/esm/typings/src/types/execution-report/ExecutionReportJson.d.ts +4 -4
- package/esm/typings/src/types/execution-report/ExecutionReportStringOptions.d.ts +3 -3
- package/esm/typings/src/types/typeAliases.d.ts +62 -14
- package/esm/typings/src/utils/FromtoItems.d.ts +3 -3
- package/esm/typings/src/utils/currentDate.d.ts +7 -0
- package/esm/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +2 -2
- package/esm/typings/src/utils/markdown/createMarkdownChart.d.ts +6 -9
- package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown-real.test.d.ts +1 -0
- package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +9 -2
- package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +1 -1
- package/esm/typings/src/utils/markdown/parseMarkdownSection.d.ts +3 -3
- package/esm/typings/src/utils/organization/TODO.d.ts +4 -0
- package/esm/typings/src/utils/organization/TODO_USE.d.ts +11 -0
- package/esm/typings/src/utils/organization/___.d.ts +4 -0
- package/esm/typings/src/utils/organization/notUsing.d.ts +11 -0
- package/esm/typings/src/utils/organization/really_any.d.ts +4 -0
- package/esm/typings/src/utils/random/randomSeed.d.ts +7 -0
- package/package.json +2 -2
- package/umd/index.umd.js +4 -1
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/promptbook-collection/index.d.ts +196 -23
- package/umd/typings/src/_packages/core.index.d.ts +5 -1
- package/umd/typings/src/_packages/types.index.d.ts +6 -4
- package/umd/typings/src/_packages/utils.index.d.ts +4 -3
- package/umd/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -1
- package/umd/typings/src/collection/constructors/createCollectionFromUrl.d.ts +2 -2
- package/umd/typings/src/commands/MODEL/ModelCommand.d.ts +1 -1
- package/umd/typings/src/commands/PERSONA/PersonaCommand.d.ts +4 -2
- package/umd/typings/src/commands/_common/types/CommandParser.d.ts +15 -12
- package/umd/typings/src/config.d.ts +8 -0
- package/umd/typings/src/conversion/pipelineStringToJson.d.ts +9 -5
- package/umd/typings/src/conversion/pipelineStringToJsonSync.d.ts +5 -3
- package/umd/typings/src/conversion/prettify/PrettifyOptions.d.ts +2 -2
- package/umd/typings/src/conversion/utils/renameParameter.d.ts +3 -3
- package/umd/typings/src/conversion/validation/_importPipeline.d.ts +2 -2
- package/umd/typings/src/conversion/validation/validatePipeline.d.ts +4 -0
- package/umd/typings/src/errors/EnvironmentMismatchError.d.ts +7 -0
- package/umd/typings/src/errors/VersionMismatchError.d.ts +8 -0
- package/umd/typings/src/execution/LlmExecutionTools.d.ts +3 -1
- package/umd/typings/src/execution/PipelineExecutor.d.ts +8 -7
- package/umd/typings/src/execution/PromptResult.d.ts +17 -5
- package/umd/typings/src/execution/ScriptExecutionTools.d.ts +6 -4
- package/umd/typings/src/execution/UserInterfaceTools.d.ts +5 -5
- package/umd/typings/src/execution/createPipelineExecutor.d.ts +4 -1
- package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +2 -2
- package/umd/typings/src/execution/utils/forEachAsync.d.ts +1 -1
- package/umd/typings/src/formats/csv/ListFormatDefinition.d.ts +1 -1
- package/umd/typings/src/formats/json/JsonFormatDefinition.d.ts +1 -1
- package/umd/typings/src/formats/list/ListFormatDefinition.d.ts +1 -1
- package/umd/typings/src/knowledge/dialogs/callback/CallbackInterfaceToolsOptions.d.ts +1 -1
- package/umd/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +18 -0
- package/umd/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.test.d.ts +1 -0
- package/umd/typings/src/knowledge/prepare-knowledge/_common/utils/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +10 -0
- package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +8 -23
- 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 +7 -14
- package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +1 -1
- package/umd/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +2 -2
- package/umd/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +3 -0
- package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +5 -5
- package/umd/typings/src/llm-providers/azure-openai/playground/playground.d.ts +3 -0
- 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/OpenAiExecutionToolsOptions.d.ts +1 -1
- package/umd/typings/src/llm-providers/openai/openai-models.d.ts +3 -2
- package/umd/typings/src/llm-providers/openai/playground/playground.d.ts +3 -0
- package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionToolsOptions.d.ts +1 -1
- package/umd/typings/src/llm-providers/utils/cache/CacheItem.d.ts +29 -0
- package/umd/typings/src/llm-providers/utils/cache/CacheLlmToolsOptions.d.ts +10 -0
- package/umd/typings/src/llm-providers/utils/cache/cacheLlmTools.d.ts +17 -0
- package/umd/typings/src/llm-providers/utils/count-total-cost/LlmExecutionToolsWithTotalCost.d.ts +11 -0
- package/umd/typings/src/llm-providers/utils/count-total-cost/countTotalCost.d.ts +14 -0
- package/umd/typings/src/llm-providers/utils/createLlmToolsFromEnv.d.ts +21 -0
- package/umd/typings/src/personas/preparePersona.d.ts +10 -0
- package/umd/typings/src/personas/preparePersona.test.d.ts +1 -0
- package/umd/typings/src/prepare/PrepareOptions.d.ts +22 -0
- package/umd/typings/src/prepare/preparePipeline.d.ts +16 -0
- package/umd/typings/src/prepare/unpreparePipeline.d.ts +8 -0
- package/umd/typings/src/scripting/javascript/JavascriptExecutionToolsOptions.d.ts +1 -1
- package/umd/typings/src/scripting/javascript/utils/preserve.d.ts +1 -1
- package/umd/typings/src/storage/_common/PromptbookStorage.d.ts +24 -0
- package/umd/typings/src/storage/_common/PromptbookStorage.test-type.d.ts +5 -0
- package/umd/typings/src/storage/files-storage/FilesStorage.d.ts +28 -0
- package/umd/typings/src/storage/files-storage/FilesStorageOptions.d.ts +10 -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 +8 -0
- package/umd/typings/src/storage/local-storage/getSessionStorage.d.ts +8 -0
- package/umd/typings/src/storage/memory/MemoryStorage.d.ts +31 -0
- package/umd/typings/src/storage/utils/PrefixStorage.d.ts +23 -0
- package/umd/typings/src/storage/utils/makePromptbookStorageFromWebStorage.d.ts +12 -0
- package/umd/typings/src/types/ModelRequirements.d.ts +22 -1
- package/umd/typings/src/types/PipelineJson/Expectations.d.ts +6 -2
- package/umd/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +67 -0
- package/umd/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +24 -0
- package/umd/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +8 -1
- package/umd/typings/src/types/PipelineJson/PersonaJson.d.ts +40 -0
- package/umd/typings/src/types/PipelineJson/PipelineJson.d.ts +27 -3
- package/umd/typings/src/types/PipelineJson/PreparationJson.d.ts +21 -0
- package/umd/typings/src/types/PipelineJson/PromptDialogJson.d.ts +2 -0
- package/umd/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +1 -1
- package/umd/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +8 -1
- package/umd/typings/src/types/PipelineJson/PromptTemplateParameterJson.d.ts +11 -2
- package/umd/typings/src/types/PipelineJson/ScriptJson.d.ts +2 -0
- package/umd/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +2 -0
- package/umd/typings/src/types/Prompt.d.ts +5 -2
- package/umd/typings/src/types/execution-report/ExecutionReportJson.d.ts +4 -4
- package/umd/typings/src/types/execution-report/ExecutionReportStringOptions.d.ts +3 -3
- package/umd/typings/src/types/typeAliases.d.ts +62 -14
- package/umd/typings/src/utils/FromtoItems.d.ts +3 -3
- package/umd/typings/src/utils/currentDate.d.ts +7 -0
- package/umd/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +2 -2
- package/umd/typings/src/utils/markdown/createMarkdownChart.d.ts +6 -9
- package/umd/typings/src/utils/markdown/extractAllBlocksFromMarkdown-real.test.d.ts +1 -0
- package/umd/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +9 -2
- package/umd/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +1 -1
- package/umd/typings/src/utils/markdown/parseMarkdownSection.d.ts +3 -3
- package/umd/typings/src/utils/organization/TODO.d.ts +4 -0
- package/umd/typings/src/utils/organization/TODO_USE.d.ts +11 -0
- package/umd/typings/src/utils/organization/___.d.ts +4 -0
- package/umd/typings/src/utils/organization/notUsing.d.ts +11 -0
- package/umd/typings/src/utils/organization/really_any.d.ts +4 -0
- package/umd/typings/src/utils/random/randomSeed.d.ts +7 -0
- package/esm/typings/src/collection/constructors/justTestFsImport.d.ts +0 -7
- package/esm/typings/src/personas/personaToModelRequirements.d.ts +0 -6
- package/esm/typings/src/types/PipelineJson/KnowledgeJson.d.ts +0 -6
- package/esm/typings/src/types/PipelineJson/MaterialKnowledgePieceJson.d.ts +0 -28
- package/umd/typings/src/collection/constructors/justTestFsImport.d.ts +0 -7
- package/umd/typings/src/personas/personaToModelRequirements.d.ts +0 -6
- package/umd/typings/src/types/PipelineJson/KnowledgeJson.d.ts +0 -6
- package/umd/typings/src/types/PipelineJson/MaterialKnowledgePieceJson.d.ts +0 -28
- /package/esm/typings/src/_packages/{markdown-utils.d.ts → markdown-utils.index.d.ts} +0 -0
- /package/esm/typings/src/utils/{just.d.ts → organization/just.d.ts} +0 -0
- /package/umd/typings/src/_packages/{markdown-utils.d.ts → markdown-utils.index.d.ts} +0 -0
- /package/umd/typings/src/utils/{just.d.ts → organization/just.d.ts} +0 -0
|
@@ -10,8 +10,8 @@ import type { number_usd } from '../../types/typeAliases';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare const OPENAI_MODELS: Array<AvailableModel & {
|
|
12
12
|
pricing?: {
|
|
13
|
-
prompt: number_usd;
|
|
14
|
-
output: number_usd;
|
|
13
|
+
readonly prompt: number_usd;
|
|
14
|
+
readonly output: number_usd;
|
|
15
15
|
};
|
|
16
16
|
}>;
|
|
17
17
|
/**
|
|
@@ -24,4 +24,5 @@ export declare const OPENAI_MODELS: Array<AvailableModel & {
|
|
|
24
24
|
* @see /other/playground/playground.ts
|
|
25
25
|
* TODO: [🍓] Make better
|
|
26
26
|
* TODO: Change model titles to human eg: "gpt-4-turbo-2024-04-09" -> "GPT-4 Turbo (2024-04-09)"
|
|
27
|
+
* TODO: [🚸] Not all models are compatible with JSON mode, add this information here and use it
|
|
27
28
|
*/
|
|
@@ -2,7 +2,7 @@ import type { CommonExecutionToolsOptions } from '../../execution/CommonExecutio
|
|
|
2
2
|
import type { client_id } from '../../types/typeAliases';
|
|
3
3
|
import type { string_uri } from '../../types/typeAliases';
|
|
4
4
|
/**
|
|
5
|
-
* Options for RemoteLlmExecutionTools
|
|
5
|
+
* Options for `RemoteLlmExecutionTools`
|
|
6
6
|
*/
|
|
7
7
|
export type RemoteLlmExecutionToolsOptions = CommonExecutionToolsOptions & {
|
|
8
8
|
/**
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { PromptResult } from '../../../execution/PromptResult';
|
|
2
|
+
import type { Prompt } from '../../../types/Prompt';
|
|
3
|
+
import type { string_date_iso8601 } from '../../../types/typeAliases';
|
|
4
|
+
import type { string_promptbook_version } from '../../../version';
|
|
5
|
+
/**
|
|
6
|
+
* @@@
|
|
7
|
+
*/
|
|
8
|
+
export type CacheItem = {
|
|
9
|
+
/**
|
|
10
|
+
* @@@
|
|
11
|
+
*/
|
|
12
|
+
date: string_date_iso8601;
|
|
13
|
+
/**
|
|
14
|
+
* @@@
|
|
15
|
+
*/
|
|
16
|
+
promptbookVersion: string_promptbook_version;
|
|
17
|
+
/**
|
|
18
|
+
* @@@
|
|
19
|
+
*/
|
|
20
|
+
prompt: Prompt;
|
|
21
|
+
/**
|
|
22
|
+
* @@@
|
|
23
|
+
*/
|
|
24
|
+
promptResult: PromptResult;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* TODO: [🧠] Should be this exported alongsite `cacheLlmTools` through `@promptbook/utils` OR through `@promptbook/types`
|
|
28
|
+
* TODO: [🛫] `prompt` is NOT fully serializable as JSON, it contains functions which are not serializable, fix it
|
|
29
|
+
*/
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PromptbookStorage } from '../../../storage/_common/PromptbookStorage';
|
|
2
|
+
import type { CacheItem } from './CacheItem';
|
|
3
|
+
export type CacheLlmToolsOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* Total cost of the execution
|
|
6
|
+
*
|
|
7
|
+
* @default MemoryStorage
|
|
8
|
+
*/
|
|
9
|
+
storage: PromptbookStorage<CacheItem>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { LlmExecutionTools } from '../../../execution/LlmExecutionTools';
|
|
2
|
+
import type { CacheLlmToolsOptions } from './CacheLlmToolsOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Intercepts LLM tools and counts total usage of the tools
|
|
5
|
+
*
|
|
6
|
+
* @param llmTools LLM tools to be intercepted with usage counting
|
|
7
|
+
* @returns LLM tools with same functionality with added total cost counting
|
|
8
|
+
*/
|
|
9
|
+
export declare function cacheLlmTools(llmTools: LlmExecutionTools, options?: Partial<CacheLlmToolsOptions>): LlmExecutionTools;
|
|
10
|
+
/**
|
|
11
|
+
* TODO: !!!!! Export this util
|
|
12
|
+
* TODO: !!!!! Use this for tests in promptbook project itself
|
|
13
|
+
* TODO: !!!! write discussion about this and storages
|
|
14
|
+
* write how to combine multiple interceptors
|
|
15
|
+
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
16
|
+
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
17
|
+
*/
|
package/umd/typings/src/llm-providers/utils/count-total-cost/LlmExecutionToolsWithTotalCost.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LlmExecutionTools } from '../../../execution/LlmExecutionTools';
|
|
2
|
+
import type { PromptResultUsage } from '../../../execution/PromptResult';
|
|
3
|
+
/**
|
|
4
|
+
* LLM tools with option to get total cost of the execution
|
|
5
|
+
*/
|
|
6
|
+
export type LlmExecutionToolsWithTotalCost = LlmExecutionTools & {
|
|
7
|
+
/**
|
|
8
|
+
* Total cost of the execution
|
|
9
|
+
*/
|
|
10
|
+
totalUsage: PromptResultUsage;
|
|
11
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LlmExecutionTools } from '../../../execution/LlmExecutionTools';
|
|
2
|
+
import type { LlmExecutionToolsWithTotalCost } from './LlmExecutionToolsWithTotalCost';
|
|
3
|
+
/**
|
|
4
|
+
* Intercepts LLM tools and counts total usage of the tools
|
|
5
|
+
*
|
|
6
|
+
* @param llmTools LLM tools to be intercepted with usage counting
|
|
7
|
+
* @returns LLM tools with same functionality with added total cost counting
|
|
8
|
+
*/
|
|
9
|
+
export declare function countTotalUsage(llmTools: LlmExecutionTools): LlmExecutionToolsWithTotalCost;
|
|
10
|
+
/**
|
|
11
|
+
* TODO: !!!!! Export this utils
|
|
12
|
+
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
13
|
+
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
14
|
+
*/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
2
|
+
/**
|
|
3
|
+
* @@@
|
|
4
|
+
*
|
|
5
|
+
* Note: This function is not cached, every call creates new instance of LlmExecutionTools
|
|
6
|
+
*
|
|
7
|
+
* It looks for environment variables:
|
|
8
|
+
* - `process.env.OPENAI_API_KEY`
|
|
9
|
+
* - `process.env.ANTHROPIC_CLAUDE_API_KEY`
|
|
10
|
+
*
|
|
11
|
+
* @returns @@@
|
|
12
|
+
*/
|
|
13
|
+
export declare function createLlmToolsFromEnv(): LlmExecutionTools;
|
|
14
|
+
/**
|
|
15
|
+
* TODO: !!!!! Export this util
|
|
16
|
+
* TODO: !!!! write discussion about this - wizzard
|
|
17
|
+
* TODO: Add Azure
|
|
18
|
+
* TODO: [🧠] Which name is better `createLlmToolsFromEnv` or `createLlmToolsFromEnvironment`?
|
|
19
|
+
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
20
|
+
* TODO: [🧠] Maybe pass env as argument
|
|
21
|
+
*/
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PrepareOptions } from '../prepare/PrepareOptions';
|
|
2
|
+
import type { PersonaPreparedJson } from '../types/PipelineJson/PersonaJson';
|
|
3
|
+
import type { string_persona_description } from '../types/typeAliases';
|
|
4
|
+
/**
|
|
5
|
+
* Prepares the persona for the pipeline
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/webgptorg/promptbook/discussions/22
|
|
8
|
+
* @private within the package
|
|
9
|
+
*/
|
|
10
|
+
export declare function preparePersona(personaDescription: string_persona_description, options: PrepareOptions): Promise<PersonaPreparedJson['modelRequirements']>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { LlmExecutionTools } from '../execution/LlmExecutionTools';
|
|
2
|
+
/**
|
|
3
|
+
* Options for preparation of the pipeline
|
|
4
|
+
*/
|
|
5
|
+
export type PrepareOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* LLM tools
|
|
8
|
+
*/
|
|
9
|
+
readonly llmTools: LlmExecutionTools;
|
|
10
|
+
/**
|
|
11
|
+
* Maximum number of tasks running in parallel
|
|
12
|
+
*
|
|
13
|
+
* @default MAX_PARALLEL_COUNT
|
|
14
|
+
*/
|
|
15
|
+
readonly maxParallelCount?: number;
|
|
16
|
+
/**
|
|
17
|
+
* If true, the preparation logs additional information
|
|
18
|
+
*
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
readonly isVerbose?: boolean;
|
|
22
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
|
|
2
|
+
import type { PrepareOptions } from './PrepareOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Prepare pipeline from string (markdown) format to JSON format
|
|
5
|
+
*
|
|
6
|
+
* Note: This function does not validate logic of the pipeline
|
|
7
|
+
* Note: This function acts as part of compilation process
|
|
8
|
+
*/
|
|
9
|
+
export declare function preparePipeline(pipeline: PipelineJson, options: PrepareOptions): Promise<PipelineJson>;
|
|
10
|
+
/**
|
|
11
|
+
* TODO: Write tests for `preparePipeline`
|
|
12
|
+
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
13
|
+
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
14
|
+
* TODO: !!!!! Use here countTotalUsage
|
|
15
|
+
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
16
|
+
*/
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
|
|
2
|
+
/**
|
|
3
|
+
* Unprepare just strips the preparation data of the pipeline
|
|
4
|
+
*/
|
|
5
|
+
export declare function unpreparePipeline(pipeline: PipelineJson): PipelineJson;
|
|
6
|
+
/**
|
|
7
|
+
* TODO: Write tests for `preparePipeline`
|
|
8
|
+
*/
|
|
@@ -2,7 +2,7 @@ import type { Promisable } from 'type-fest';
|
|
|
2
2
|
import type { CommonExecutionToolsOptions } from '../../execution/CommonExecutionToolsOptions';
|
|
3
3
|
import type { string_javascript_name } from '../../types/typeAliases';
|
|
4
4
|
/**
|
|
5
|
-
* Options for
|
|
5
|
+
* Options for `JavascriptExecutionTools`
|
|
6
6
|
*/
|
|
7
7
|
export type JavascriptExecutionToolsOptions = CommonExecutionToolsOptions & {
|
|
8
8
|
/**
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Promisable } from 'type-fest';
|
|
2
|
+
/**
|
|
3
|
+
* Storage of objects with asynchronous API
|
|
4
|
+
*
|
|
5
|
+
* Note: Naming `PromptbookStorage` not `Storage` to avoid name collision with global `Storage` interface.
|
|
6
|
+
* Note: This is simmilar to Web Storage API interface but everything is asynchronous and can store JSON objects.
|
|
7
|
+
*/
|
|
8
|
+
export type PromptbookStorage<TItem> = {
|
|
9
|
+
/**
|
|
10
|
+
* Returns the current value associated with the given key, or null if the given key does not exist in the list associated with the object
|
|
11
|
+
*/
|
|
12
|
+
getItem(key: string): Promisable<TItem | null>;
|
|
13
|
+
/**
|
|
14
|
+
* Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously
|
|
15
|
+
*/
|
|
16
|
+
setItem(key: string, value: TItem): Promisable<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Removes the key/value pair with the given key from the list associated with the object, if a key/value pair with the given key exists
|
|
19
|
+
*/
|
|
20
|
+
removeItem(key: string): Promisable<void>;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* TODO: [🧠][🛫] Constrain `TItem` to JSON-serializable objects only
|
|
24
|
+
*/
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { PromptbookStorage } from '../_common/PromptbookStorage';
|
|
2
|
+
import type { FilesStorageOptions } from './FilesStorageOptions';
|
|
3
|
+
/**
|
|
4
|
+
* @@@
|
|
5
|
+
*/
|
|
6
|
+
export declare class FilesStorage<TItem> implements PromptbookStorage<TItem> {
|
|
7
|
+
private readonly options;
|
|
8
|
+
constructor(options: FilesStorageOptions);
|
|
9
|
+
/**
|
|
10
|
+
* @@@
|
|
11
|
+
*/
|
|
12
|
+
private getFilenameForKey;
|
|
13
|
+
/**
|
|
14
|
+
* @@@ Returns the current value associated with the given key, or null if the given key does not exist in the list associated with the object.
|
|
15
|
+
*/
|
|
16
|
+
getItem(key: string): Promise<TItem | null>;
|
|
17
|
+
/**
|
|
18
|
+
* @@@ Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
|
|
19
|
+
*/
|
|
20
|
+
setItem(key: string, value: TItem): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* @@@ Removes the key/value pair with the given key from the list associated with the object, if a key/value pair with the given key exists.
|
|
23
|
+
*/
|
|
24
|
+
removeItem(key: string): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* TODO: [🌗] Maybe some checkers, not all valid JSONs are desired and valid values
|
|
28
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PromptbookStorage } from '../_common/PromptbookStorage';
|
|
2
|
+
/**
|
|
3
|
+
* Gets wrapper around `localStorage` object which can be used as `PromptbookStorage`
|
|
4
|
+
*/
|
|
5
|
+
export declare function getLocalStorage<TItem>(): PromptbookStorage<TItem>;
|
|
6
|
+
/**
|
|
7
|
+
* Export through `@promptbook/browser`
|
|
8
|
+
*/
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PromptbookStorage } from '../_common/PromptbookStorage';
|
|
2
|
+
/**
|
|
3
|
+
* Gets wrapper around `sessionStorage` object which can be used as `PromptbookStorage`
|
|
4
|
+
*/
|
|
5
|
+
export declare function getSessionStorage<TItem>(): PromptbookStorage<TItem>;
|
|
6
|
+
/**
|
|
7
|
+
* Export through `@promptbook/browser`
|
|
8
|
+
*/
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { PromptbookStorage } from '../_common/PromptbookStorage';
|
|
2
|
+
/**
|
|
3
|
+
* Stores
|
|
4
|
+
*/
|
|
5
|
+
export declare class MemoryStorage<TItem> implements PromptbookStorage<TItem> {
|
|
6
|
+
private storage;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the number of key/value pairs currently present in the list associated with the object.
|
|
9
|
+
*/
|
|
10
|
+
get length(): number;
|
|
11
|
+
/**
|
|
12
|
+
* Empties the list associated with the object of all key/value pairs, if there are any.
|
|
13
|
+
*/
|
|
14
|
+
clear(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Returns the current value associated with the given key, or null if the given key does not exist in the list associated with the object.
|
|
17
|
+
*/
|
|
18
|
+
getItem(key: string): TItem | null;
|
|
19
|
+
/**
|
|
20
|
+
* Returns the name of the nth key in the list, or null if n is greater than or equal to the number of key/value pairs in the object.
|
|
21
|
+
*/
|
|
22
|
+
key(index: number): string | null;
|
|
23
|
+
/**
|
|
24
|
+
* Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
|
|
25
|
+
*/
|
|
26
|
+
setItem(key: string, value: TItem): void;
|
|
27
|
+
/**
|
|
28
|
+
* Removes the key/value pair with the given key from the list associated with the object, if a key/value pair with the given key exists.
|
|
29
|
+
*/
|
|
30
|
+
removeItem(key: string): void;
|
|
31
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Promisable } from 'type-fest';
|
|
2
|
+
import type { PromptbookStorage } from '../_common/PromptbookStorage';
|
|
3
|
+
/**
|
|
4
|
+
* This class behaves like LocalStorage but separates keys by prefix
|
|
5
|
+
*/
|
|
6
|
+
export declare class PrefixStorage<TItem> implements PromptbookStorage<TItem> {
|
|
7
|
+
private baseStorage;
|
|
8
|
+
private keyPrefix;
|
|
9
|
+
private separator;
|
|
10
|
+
constructor(baseStorage: PromptbookStorage<TItem>, keyPrefix: string, separator?: string);
|
|
11
|
+
/**
|
|
12
|
+
* Returns the current value associated with the given key, or null if the given key does not exist in the list associated with the object.
|
|
13
|
+
*/
|
|
14
|
+
getItem(key: string): Promisable<TItem | null>;
|
|
15
|
+
/**
|
|
16
|
+
* Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
|
|
17
|
+
*/
|
|
18
|
+
setItem(key: string, value: TItem): Promisable<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Removes the key/value pair with the given key from the list associated with the object, if a key/value pair with the given key exists.
|
|
21
|
+
*/
|
|
22
|
+
removeItem(key: string): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
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: !!!! Export through `@promptbook/browser`
|
|
10
|
+
* TODO: [🧠] Should this be named `makePromptbookStorageFromWebStorage` vs `createPromptbookStorageFromWebStorage`
|
|
11
|
+
* TODO: [🌗] Maybe some checkers, not all valid JSONs are desired and valid values
|
|
12
|
+
*/
|
|
@@ -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,31 @@ 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
|
/**
|
|
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
|
|
40
61
|
* TODO: Maybe figure out better word than "variant"
|
|
41
62
|
* TODO: Add here more requirement options like max context size, max tokens, etc.
|
|
42
|
-
* TODO: [
|
|
63
|
+
* TODO: [💕][🧠] Just selecting gpt3 or gpt4 level of model
|
|
43
64
|
*/
|
|
@@ -6,21 +6,25 @@ import type { number_positive } from '../typeAliases';
|
|
|
6
6
|
* For example 5 words, 3 sentences, 2 paragraphs, ...
|
|
7
7
|
*
|
|
8
8
|
* Note: Expectations are performed after all postprocessing steps
|
|
9
|
+
* @see https://github.com/webgptorg/promptbook/discussions/30
|
|
9
10
|
*/
|
|
10
11
|
export type Expectations = Partial<Record<Lowercase<ExpectationUnit>, {
|
|
11
|
-
min?: ExpectationAmount;
|
|
12
|
-
max?: ExpectationAmount;
|
|
12
|
+
readonly min?: ExpectationAmount;
|
|
13
|
+
readonly max?: ExpectationAmount;
|
|
13
14
|
}>>;
|
|
14
15
|
/**
|
|
15
16
|
* Units of text measurement
|
|
17
|
+
* @see https://github.com/webgptorg/promptbook/discussions/30
|
|
16
18
|
*/
|
|
17
19
|
export declare const EXPECTATION_UNITS: readonly ["CHARACTERS", "WORDS", "SENTENCES", "LINES", "PARAGRAPHS", "PAGES"];
|
|
18
20
|
/**
|
|
19
21
|
* Unit of text measurement
|
|
22
|
+
* @see https://github.com/webgptorg/promptbook/discussions/30
|
|
20
23
|
*/
|
|
21
24
|
export type ExpectationUnit = typeof EXPECTATION_UNITS[number];
|
|
22
25
|
/**
|
|
23
26
|
* Amount of text measurement
|
|
27
|
+
* @see https://github.com/webgptorg/promptbook/discussions/30
|
|
24
28
|
*/
|
|
25
29
|
export type ExpectationAmount = number_integer & (number_positive | 0);
|
|
26
30
|
/**
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { EmbeddingVector } from '../../execution/EmbeddingVector';
|
|
2
|
+
import type { string_keyword } from '../../utils/normalization/IKeywords';
|
|
3
|
+
import type { number_id } from '../typeAliases';
|
|
4
|
+
import type { number_linecol_number } from '../typeAliases';
|
|
5
|
+
import type { string_markdown } from '../typeAliases';
|
|
6
|
+
import type { string_markdown_text } from '../typeAliases';
|
|
7
|
+
import type { string_model_name } from '../typeAliases';
|
|
8
|
+
import type { string_name } from '../typeAliases';
|
|
9
|
+
/**
|
|
10
|
+
* Defines one piece of knowledge in the pipeline
|
|
11
|
+
*
|
|
12
|
+
* Note: Knowledge piece is by definition prepared
|
|
13
|
+
*
|
|
14
|
+
* @see https://github.com/webgptorg/promptbook/discussions/41
|
|
15
|
+
*/
|
|
16
|
+
export type KnowledgePiecePreparedJson = {
|
|
17
|
+
/**
|
|
18
|
+
* Unique name of the knowledge piece based on the title
|
|
19
|
+
*/
|
|
20
|
+
readonly name?: string_name;
|
|
21
|
+
/**
|
|
22
|
+
* Short title for the information
|
|
23
|
+
*/
|
|
24
|
+
readonly title?: string_markdown_text;
|
|
25
|
+
/**
|
|
26
|
+
* The information in markdown format
|
|
27
|
+
*/
|
|
28
|
+
readonly content?: string_markdown;
|
|
29
|
+
/**
|
|
30
|
+
* List of sources where the information comes from
|
|
31
|
+
*/
|
|
32
|
+
readonly sources: Array<{
|
|
33
|
+
/**
|
|
34
|
+
* Identifier of the source
|
|
35
|
+
*/
|
|
36
|
+
readonly name: string_name;
|
|
37
|
+
/**
|
|
38
|
+
* Line number
|
|
39
|
+
*/
|
|
40
|
+
readonly line?: number_linecol_number;
|
|
41
|
+
/**
|
|
42
|
+
* Column number
|
|
43
|
+
*/
|
|
44
|
+
readonly column?: number_linecol_number;
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* List of keywords that are associated with the knowledge piece
|
|
48
|
+
*/
|
|
49
|
+
readonly keywords: Array<string_keyword>;
|
|
50
|
+
/**
|
|
51
|
+
* List of models embeddings that are associated with the knowledge piece
|
|
52
|
+
*/
|
|
53
|
+
readonly index: Array<{
|
|
54
|
+
/**
|
|
55
|
+
* Model name which generated the embedding
|
|
56
|
+
*/
|
|
57
|
+
readonly modelName: string_model_name;
|
|
58
|
+
/**
|
|
59
|
+
* Embedding vector of the knowledge piece
|
|
60
|
+
*/
|
|
61
|
+
readonly position: EmbeddingVector;
|
|
62
|
+
}>;
|
|
63
|
+
/**
|
|
64
|
+
* List of preparation ids that were used to prepare this knowledge piece
|
|
65
|
+
*/
|
|
66
|
+
readonly preparationIds: Array<number_id>;
|
|
67
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { number_id } from '../typeAliases';
|
|
2
|
+
import type { string_knowledge_source } from '../typeAliases';
|
|
3
|
+
import type { string_name } from '../typeAliases';
|
|
4
|
+
/**
|
|
5
|
+
* Defines one source of knowledge in the pipeline
|
|
6
|
+
* For example, a source of information, a fact, a quote, a definition, website, etc.
|
|
7
|
+
*
|
|
8
|
+
* @see https://github.com/webgptorg/promptbook/discussions/41
|
|
9
|
+
*/
|
|
10
|
+
export type KnowledgeSourceJson = {
|
|
11
|
+
readonly name: string_name;
|
|
12
|
+
readonly source: string_knowledge_source;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Defines one source of knowledge in the pipeline after it has been prepared
|
|
16
|
+
*
|
|
17
|
+
* @see https://github.com/webgptorg/promptbook/discussions/41
|
|
18
|
+
*/
|
|
19
|
+
export type KnowledgeSourcePreparedJson = KnowledgeSourceJson & {
|
|
20
|
+
/**
|
|
21
|
+
* List of preparation ids that were used to prepare this knowledge source to knowledge pieces
|
|
22
|
+
*/
|
|
23
|
+
readonly preparationIds: Array<number_id>;
|
|
24
|
+
};
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import type { ModelRequirements } from '../ModelRequirements';
|
|
2
|
+
import type { string_name } from '../typeAliases';
|
|
2
3
|
import type { PromptTemplateJsonCommon } from './PromptTemplateJsonCommon';
|
|
3
4
|
/**
|
|
4
5
|
* Template for prompt to LLM
|
|
5
6
|
*/
|
|
6
7
|
export type LlmTemplateJson = PromptTemplateJsonCommon & {
|
|
7
8
|
readonly blockType: 'PROMPT_TEMPLATE';
|
|
9
|
+
/**
|
|
10
|
+
* Name of the persona who will be responding to this prompt
|
|
11
|
+
*/
|
|
12
|
+
readonly personaName: string_name | null;
|
|
8
13
|
/**
|
|
9
14
|
* Requirements for the model
|
|
10
15
|
* - This is required only for blockType PROMPT_TEMPLATE
|
|
@@ -12,5 +17,7 @@ export type LlmTemplateJson = PromptTemplateJsonCommon & {
|
|
|
12
17
|
readonly modelRequirements: ModelRequirements;
|
|
13
18
|
};
|
|
14
19
|
/**
|
|
15
|
-
* TODO: [👙][🧠]
|
|
20
|
+
* TODO: [👙][🧠] Maybe add `knowledge`, `actions` and `instruments` to be available granularly for each template
|
|
21
|
+
* @see https://github.com/webgptorg/promptbook/discussions/79
|
|
22
|
+
* TODO: [💕][🧠] Just selecting gpt3 or gpt4 level of model
|
|
16
23
|
*/
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ModelRequirements } from '../ModelRequirements';
|
|
2
|
+
import type { number_id } from '../typeAliases';
|
|
3
|
+
import type { string_name } from '../typeAliases';
|
|
4
|
+
import type { string_persona_description } from '../typeAliases';
|
|
5
|
+
/**
|
|
6
|
+
* Defines a persona in the pipeline
|
|
7
|
+
*
|
|
8
|
+
* @see https://github.com/webgptorg/promptbook/discussions/22
|
|
9
|
+
*/
|
|
10
|
+
export type PersonaJson = {
|
|
11
|
+
/**
|
|
12
|
+
* Name of the template
|
|
13
|
+
* - It must be unique across the pipeline
|
|
14
|
+
* - It should start uppercase and can contain letters and numbers
|
|
15
|
+
*/
|
|
16
|
+
readonly name: string_name;
|
|
17
|
+
/**
|
|
18
|
+
* Description of persona
|
|
19
|
+
*/
|
|
20
|
+
readonly description: string_persona_description;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Defines a persona in the pipeline after it has been prepared
|
|
24
|
+
*
|
|
25
|
+
* @see https://github.com/webgptorg/promptbook/discussions/22
|
|
26
|
+
*/
|
|
27
|
+
export type PersonaPreparedJson = PersonaJson & {
|
|
28
|
+
/**
|
|
29
|
+
* Model requirements for the persona
|
|
30
|
+
*
|
|
31
|
+
* Note: The model must be CHAT variant to be usable through persona
|
|
32
|
+
*/
|
|
33
|
+
readonly modelRequirements: ModelRequirements & {
|
|
34
|
+
readonly modelVariant: 'CHAT';
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* List of preparation ids that were used to prepare this persona
|
|
38
|
+
*/
|
|
39
|
+
readonly preparationIds: Array<number_id>;
|
|
40
|
+
};
|