@promptbook/openai 0.61.0-11 → 0.61.0-13
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 +5 -4
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/execute-javascript.index.d.ts +1 -1
- package/esm/typings/src/_packages/utils.index.d.ts +1 -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 +1 -1
- package/esm/typings/src/config.d.ts +1 -1
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +4 -2
- package/esm/typings/src/errors/LimitReachedError.d.ts +7 -0
- package/esm/typings/src/execution/CommonExecutionToolsOptions.d.ts +1 -0
- package/esm/typings/src/execution/utils/addUsage.d.ts +57 -1
- 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/pdf/prepareKnowledgeFromPdf.d.ts +1 -0
- package/{umd/typings/src/llm-providers/utils → esm/typings/src/llm-providers/_common}/createLlmToolsFromEnv.d.ts +3 -2
- 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/{umd/typings/src/llm-providers → esm/typings/src/llm-providers/_common}/utils/cache/CacheItem.d.ts +4 -4
- package/{umd/typings/src/llm-providers → esm/typings/src/llm-providers/_common}/utils/cache/CacheLlmToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/{utils → _common/utils}/cache/cacheLlmTools.d.ts +3 -4
- package/esm/typings/src/llm-providers/{utils → _common/utils}/count-total-cost/LlmExecutionToolsWithTotalCost.d.ts +2 -2
- package/{umd/typings/src/llm-providers → esm/typings/src/llm-providers/_common}/utils/count-total-cost/countTotalCost.d.ts +2 -2
- package/esm/typings/src/llm-providers/_common/utils/count-total-cost/limitTotalCost.d.ts +32 -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/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -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/openai/OpenAiExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/openai/computeUsage.d.ts +2 -2
- package/esm/typings/src/personas/preparePersona.d.ts +6 -1
- package/esm/typings/src/prepare/preparePipeline.d.ts +2 -1
- package/esm/typings/src/prepare/unpreparePipeline.d.ts +1 -0
- package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +1 -0
- package/esm/typings/src/storage/_common/PromptbookStorage.test-type.d.ts +1 -1
- package/esm/typings/src/storage/files-storage/FilesStorage.d.ts +2 -0
- package/esm/typings/src/storage/files-storage/FilesStorageOptions.d.ts +3 -0
- package/esm/typings/src/storage/local-storage/getLocalStorage.d.ts +2 -1
- package/esm/typings/src/storage/local-storage/getSessionStorage.d.ts +2 -1
- package/esm/typings/src/storage/memory/MemoryStorage.d.ts +3 -0
- package/esm/typings/src/storage/utils/PrefixStorage.d.ts +3 -0
- package/esm/typings/src/storage/utils/makePromptbookStorageFromWebStorage.d.ts +0 -1
- package/esm/typings/src/types/ModelRequirements.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -1
- package/esm/typings/src/types/PipelineString.d.ts +1 -1
- package/esm/typings/src/types/execution-report/countWorkingDuration.d.ts +1 -1
- package/esm/typings/src/utils/deepClone.d.ts +9 -0
- package/esm/typings/src/utils/deepFreeze.d.ts +13 -0
- 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/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 +5 -1
- package/esm/typings/src/utils/organization/keepUnused.d.ts +16 -0
- package/esm/typings/src/utils/organization/really_any.d.ts +2 -0
- package/package.json +2 -2
- package/umd/index.umd.js +5 -4
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/src/_packages/execute-javascript.index.d.ts +1 -1
- package/umd/typings/src/_packages/utils.index.d.ts +1 -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 +1 -1
- package/umd/typings/src/config.d.ts +1 -1
- package/umd/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
- package/umd/typings/src/conversion/validation/validatePipeline.d.ts +4 -2
- package/umd/typings/src/errors/LimitReachedError.d.ts +7 -0
- package/umd/typings/src/execution/CommonExecutionToolsOptions.d.ts +1 -0
- package/umd/typings/src/execution/utils/addUsage.d.ts +57 -1
- 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/pdf/prepareKnowledgeFromPdf.d.ts +1 -0
- package/{esm/typings/src/llm-providers/utils → umd/typings/src/llm-providers/_common}/createLlmToolsFromEnv.d.ts +3 -2
- 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/{esm/typings/src/llm-providers → umd/typings/src/llm-providers/_common}/utils/cache/CacheItem.d.ts +4 -4
- package/{esm/typings/src/llm-providers → umd/typings/src/llm-providers/_common}/utils/cache/CacheLlmToolsOptions.d.ts +1 -1
- package/umd/typings/src/llm-providers/{utils → _common/utils}/cache/cacheLlmTools.d.ts +3 -4
- package/umd/typings/src/llm-providers/{utils → _common/utils}/count-total-cost/LlmExecutionToolsWithTotalCost.d.ts +2 -2
- package/{esm/typings/src/llm-providers → umd/typings/src/llm-providers/_common}/utils/count-total-cost/countTotalCost.d.ts +2 -2
- package/umd/typings/src/llm-providers/_common/utils/count-total-cost/limitTotalCost.d.ts +32 -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/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -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/openai/OpenAiExecutionTools.d.ts +1 -0
- package/umd/typings/src/llm-providers/openai/computeUsage.d.ts +2 -2
- package/umd/typings/src/personas/preparePersona.d.ts +6 -1
- package/umd/typings/src/prepare/preparePipeline.d.ts +2 -1
- package/umd/typings/src/prepare/unpreparePipeline.d.ts +1 -0
- package/umd/typings/src/storage/_common/PromptbookStorage.d.ts +1 -0
- package/umd/typings/src/storage/_common/PromptbookStorage.test-type.d.ts +1 -1
- package/umd/typings/src/storage/files-storage/FilesStorage.d.ts +2 -0
- package/umd/typings/src/storage/files-storage/FilesStorageOptions.d.ts +3 -0
- package/umd/typings/src/storage/local-storage/getLocalStorage.d.ts +2 -1
- package/umd/typings/src/storage/local-storage/getSessionStorage.d.ts +2 -1
- package/umd/typings/src/storage/memory/MemoryStorage.d.ts +3 -0
- package/umd/typings/src/storage/utils/PrefixStorage.d.ts +3 -0
- package/umd/typings/src/storage/utils/makePromptbookStorageFromWebStorage.d.ts +0 -1
- package/umd/typings/src/types/ModelRequirements.d.ts +1 -1
- package/umd/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -1
- package/umd/typings/src/types/PipelineString.d.ts +1 -1
- package/umd/typings/src/types/execution-report/countWorkingDuration.d.ts +1 -1
- package/umd/typings/src/utils/deepClone.d.ts +9 -0
- package/umd/typings/src/utils/deepFreeze.d.ts +13 -0
- 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/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 +5 -1
- package/umd/typings/src/utils/organization/keepUnused.d.ts +16 -0
- package/umd/typings/src/utils/organization/really_any.d.ts +2 -0
- package/esm/typings/src/execution/addPromptResultUsage.test.d.ts +0 -1
- package/esm/typings/src/knowledge/prepare-knowledge/_common/utils/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +0 -10
- package/esm/typings/src/utils/organization/notUsing.d.ts +0 -11
- package/umd/typings/src/execution/addPromptResultUsage.test.d.ts +0 -1
- package/umd/typings/src/knowledge/prepare-knowledge/_common/utils/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +0 -10
- package/umd/typings/src/utils/organization/notUsing.d.ts +0 -11
- /package/esm/typings/src/{utils/postprocessing → postprocessing/utils}/extractBlock.d.ts +0 -0
- /package/umd/typings/src/{utils/postprocessing → postprocessing/utils}/extractBlock.d.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LlmExecutionTools } from '
|
|
1
|
+
import type { LlmExecutionTools } from '../../../../execution/LlmExecutionTools';
|
|
2
2
|
import type { LlmExecutionToolsWithTotalCost } from './LlmExecutionToolsWithTotalCost';
|
|
3
3
|
/**
|
|
4
4
|
* Intercepts LLM tools and counts total usage of the tools
|
|
@@ -8,7 +8,7 @@ import type { LlmExecutionToolsWithTotalCost } from './LlmExecutionToolsWithTota
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function countTotalUsage(llmTools: LlmExecutionTools): LlmExecutionToolsWithTotalCost;
|
|
10
10
|
/**
|
|
11
|
-
* TODO:
|
|
11
|
+
* TODO: [🔼] !!! Export via `@promptbookcore/`
|
|
12
12
|
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
13
13
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
14
14
|
*/
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { LlmExecutionTools } from '../../../../execution/LlmExecutionTools';
|
|
2
|
+
import type { PromptResultUsage } from '../../../../execution/PromptResult';
|
|
3
|
+
import type { PromptbookStorage } from '../../../../storage/_common/PromptbookStorage';
|
|
4
|
+
import type { TODO } from '../../../../utils/organization/TODO';
|
|
5
|
+
import type { LlmExecutionToolsWithTotalCost } from './LlmExecutionToolsWithTotalCost';
|
|
6
|
+
/**
|
|
7
|
+
* Options for `limitTotalCost`
|
|
8
|
+
*/
|
|
9
|
+
type LimitTotalCostOptions = {
|
|
10
|
+
/**
|
|
11
|
+
* @@@
|
|
12
|
+
*
|
|
13
|
+
* @default ZERO_USAGE
|
|
14
|
+
*/
|
|
15
|
+
maxTotalCost: PromptResultUsage;
|
|
16
|
+
/**
|
|
17
|
+
* @@@
|
|
18
|
+
*
|
|
19
|
+
* @default MemoryStorage
|
|
20
|
+
*/
|
|
21
|
+
storage: PromptbookStorage<TODO>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @@@
|
|
25
|
+
*/
|
|
26
|
+
export declare function limitTotalCost(llmTools: LlmExecutionTools, options?: Partial<LimitTotalCostOptions>): LlmExecutionToolsWithTotalCost;
|
|
27
|
+
export {};
|
|
28
|
+
/**
|
|
29
|
+
* TODO: [🔼] !!! Export via `@promptbookcore/`
|
|
30
|
+
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
31
|
+
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
32
|
+
*/
|
|
@@ -45,4 +45,5 @@ export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools
|
|
|
45
45
|
* TODO: [🧠] Maybe handle errors via transformAnthropicError (like transformAzureError)
|
|
46
46
|
* TODO: Maybe Create some common util for callChatModel and callCompletionModel
|
|
47
47
|
* TODO: Maybe make custom OpenaiError
|
|
48
|
+
* TODO: [🧠][🈁] Maybe use `isDeterministic` from options
|
|
48
49
|
*/
|
|
@@ -15,7 +15,7 @@ export declare const ANTHROPIC_CLAUDE_MODELS: Array<AvailableModel & {
|
|
|
15
15
|
}>;
|
|
16
16
|
/**
|
|
17
17
|
* Note: [🤖] Add models of new variant
|
|
18
|
-
* TODO:
|
|
18
|
+
* TODO: [🧠] !!! Add embedding models OR Anthropic has only chat+completion models?
|
|
19
19
|
* TODO: [🧠] Some mechanism to propagate unsureness
|
|
20
20
|
* TODO: [🧠][👮♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
|
|
21
21
|
* TODO: [🕚] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
|
|
@@ -44,4 +44,5 @@ export declare class AzureOpenAiExecutionTools implements LlmExecutionTools {
|
|
|
44
44
|
/**
|
|
45
45
|
* TODO: Maybe Create some common util for callChatModel and callCompletionModel
|
|
46
46
|
* TODO: Maybe make custom AzureOpenaiError
|
|
47
|
+
* TODO: [🧠][🈁] Maybe use `isDeterministic` from options
|
|
47
48
|
*/
|
|
@@ -29,6 +29,6 @@ export declare class MockedEchoLlmExecutionTools implements LlmExecutionTools {
|
|
|
29
29
|
listModels(): Array<AvailableModel>;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
* TODO:
|
|
32
|
+
* TODO: [🧠][🈁] Maybe use `isDeterministic` from options
|
|
33
33
|
* TODO: Allow in spaceTrim: nesting with > ${block(prompt.request)}, same as replace params
|
|
34
34
|
*/
|
|
@@ -62,4 +62,5 @@ export declare class OpenAiExecutionTools implements LlmExecutionTools {
|
|
|
62
62
|
* TODO: [🧠][🧙♂️] Maybe there can be some wizzard for thoose who want to use just OpenAI
|
|
63
63
|
* TODO: Maybe Create some common util for callChatModel and callCompletionModel
|
|
64
64
|
* TODO: Maybe make custom OpenaiError
|
|
65
|
+
* TODO: [🧠][🈁] Maybe use `isDeterministic` from options
|
|
65
66
|
*/
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* @see https://openai.com/api/pricing/
|
|
5
5
|
* @see https://docs.anthropic.com/en/docs/models-overview
|
|
6
6
|
*
|
|
7
|
-
* @private within the
|
|
7
|
+
* @private within the repository, used only as internal helper for `OPENAI_MODELS` and `computeUsage`
|
|
8
8
|
*/
|
|
9
9
|
type string_model_price = `$${number}.${number} / ${number}M tokens`;
|
|
10
10
|
/**
|
|
11
11
|
* Function computeUsage will create price per one token based on the string value found on openai page
|
|
12
12
|
*
|
|
13
|
-
* @private within the
|
|
13
|
+
* @private within the repository, used only as internal helper for `OPENAI_MODELS`
|
|
14
14
|
*/
|
|
15
15
|
export declare function computeUsage(value: string_model_price): number;
|
|
16
16
|
export {};
|
|
@@ -5,6 +5,11 @@ import type { string_persona_description } from '../types/typeAliases';
|
|
|
5
5
|
* Prepares the persona for the pipeline
|
|
6
6
|
*
|
|
7
7
|
* @see https://github.com/webgptorg/promptbook/discussions/22
|
|
8
|
-
* @private within the package
|
|
9
8
|
*/
|
|
10
9
|
export declare function preparePersona(personaDescription: string_persona_description, options: PrepareOptions): Promise<PersonaPreparedJson['modelRequirements']>;
|
|
10
|
+
/**
|
|
11
|
+
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
12
|
+
* TODO: [🏢] !! Check validity of `modelName` in pipeline
|
|
13
|
+
* TODO: [🏢] !! Check validity of `systemMessage` in pipeline
|
|
14
|
+
* TODO: [🏢] !! Check validity of `temperature` in pipeline
|
|
15
|
+
*/
|
|
@@ -8,9 +8,10 @@ import type { PrepareOptions } from './PrepareOptions';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function preparePipeline(pipeline: PipelineJson, options: PrepareOptions): Promise<PipelineJson>;
|
|
10
10
|
/**
|
|
11
|
+
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
11
12
|
* TODO: Write tests for `preparePipeline`
|
|
12
13
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
13
14
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
14
|
-
* TODO:
|
|
15
|
+
* TODO: [🎐] !!!! Use here countTotalUsage
|
|
15
16
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
16
17
|
*/
|
|
@@ -24,5 +24,7 @@ export declare class FilesStorage<TItem> implements PromptbookStorage<TItem> {
|
|
|
24
24
|
removeItem(key: string): Promise<void>;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
+
* TODO: [🔼] !!! Export via `@promptbook/node`
|
|
27
28
|
* TODO: [🌗] Maybe some checkers, not all valid JSONs are desired and valid values
|
|
29
|
+
* Note: [🟢] This code should never be published outside of `@promptbook/node`
|
|
28
30
|
*/
|
|
@@ -4,5 +4,6 @@ import type { PromptbookStorage } from '../_common/PromptbookStorage';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare function getLocalStorage<TItem>(): PromptbookStorage<TItem>;
|
|
6
6
|
/**
|
|
7
|
-
* Export
|
|
7
|
+
* TODO: [🔼] !!! Export via `@promptbook/browser`
|
|
8
|
+
* Note: [🔵] This code should never be published outside of `@promptbook/browser`
|
|
8
9
|
*/
|
|
@@ -4,5 +4,6 @@ import type { PromptbookStorage } from '../_common/PromptbookStorage';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare function getSessionStorage<TItem>(): PromptbookStorage<TItem>;
|
|
6
6
|
/**
|
|
7
|
-
* Export
|
|
7
|
+
* TODO: [🔼] !!! Export via `@promptbook/browser`
|
|
8
|
+
* Note: [🔵] This code should never be published outside of `@promptbook/browser`
|
|
8
9
|
*/
|
|
@@ -6,7 +6,6 @@ import type { PromptbookStorage } from '../_common/PromptbookStorage';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function makePromptbookStorageFromWebStorage<TValue>(webStorage: Storage): PromptbookStorage<TValue>;
|
|
8
8
|
/**
|
|
9
|
-
* TODO: !!!! Export through `@promptbook/browser`
|
|
10
9
|
* TODO: [🧠] Should this be named `makePromptbookStorageFromWebStorage` vs `createPromptbookStorageFromWebStorage`
|
|
11
10
|
* TODO: [🌗] Maybe some checkers, not all valid JSONs are desired and valid values
|
|
12
11
|
*/
|
|
@@ -54,7 +54,7 @@ export type ModelRequirements = {
|
|
|
54
54
|
readonly maxTokens?: number;
|
|
55
55
|
};
|
|
56
56
|
/**
|
|
57
|
-
* TODO: [🈁] `seed` should maybe be somewhere else (not in `ModelRequirements`) (simmilar that `user` identification is not here)
|
|
57
|
+
* TODO: [🧠][🈁] `seed` should maybe be somewhere else (not in `ModelRequirements`) (simmilar that `user` identification is not here)
|
|
58
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
59
|
* [💱] Probbably keep using just `temperature` in Promptbook (not `top_k` and `top_p`)
|
|
60
60
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
@@ -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
|
/**
|
|
@@ -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';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { WritableDeep } from 'type-fest';
|
|
2
|
+
/**
|
|
3
|
+
* @@@
|
|
4
|
+
*/
|
|
5
|
+
export declare function deepClone<TObject>(objectValue: TObject): WritableDeep<TObject>;
|
|
6
|
+
/**
|
|
7
|
+
* TODO: [🔼] Export from `@promptbook/utils`
|
|
8
|
+
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
9
|
+
*/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReadonlyDeep } from 'type-fest';
|
|
2
|
+
/**
|
|
3
|
+
* @@@
|
|
4
|
+
*
|
|
5
|
+
* @returns The same object as the input, but deeply frozen
|
|
6
|
+
*
|
|
7
|
+
* Note: This function mutates the object
|
|
8
|
+
*/
|
|
9
|
+
export declare function deepFreeze<TObject>(objectValue: TObject): ReadonlyDeep<TObject>;
|
|
10
|
+
/**
|
|
11
|
+
* TODO: [🔼] Export from `@promptbook/utils`
|
|
12
|
+
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
13
|
+
*/
|
|
@@ -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;
|
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
* Returns the same value that is passed as argument.
|
|
3
3
|
* No side effects.
|
|
4
4
|
*
|
|
5
|
-
* Note: It can be usefull for
|
|
5
|
+
* Note: It can be usefull for:
|
|
6
|
+
*
|
|
7
|
+
* 1) Leveling indentation
|
|
8
|
+
* 2) Putting always-true or always-false conditions without getting eslint errors
|
|
6
9
|
*
|
|
7
10
|
* @param value any values
|
|
8
11
|
* @returns the same values
|
|
12
|
+
* @private within the repository
|
|
9
13
|
*/
|
|
10
14
|
export declare function just<T>(value?: T): T;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 for:
|
|
7
|
+
*
|
|
8
|
+
* 1) Suppressing eager optimization of unused imports
|
|
9
|
+
* 2) Suppressing eslint errors of unused variables in the tests
|
|
10
|
+
* 3) Keeping the type of the variable for type testing
|
|
11
|
+
*
|
|
12
|
+
* @param value any values
|
|
13
|
+
* @returns void
|
|
14
|
+
* @private within the repository
|
|
15
|
+
*/
|
|
16
|
+
export declare function keepUnused<TTypeToKeep1 = really_any, TTypeToKeep2 = really_any, TTypeToKeep3 = really_any>(...valuesToKeep: 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-13",
|
|
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-13"
|
|
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];
|
|
@@ -940,7 +940,7 @@
|
|
|
940
940
|
model: model,
|
|
941
941
|
max_tokens: modelRequirements.maxTokens,
|
|
942
942
|
// <- TODO: Make some global max cap for maxTokens
|
|
943
|
-
// <- TODO:
|
|
943
|
+
// <- TODO: !!!!!! Use here `systemMessage`, `temperature` and `seed`
|
|
944
944
|
};
|
|
945
945
|
if (expectFormat === 'JSON') {
|
|
946
946
|
modelSettings.response_format = {
|
|
@@ -1014,7 +1014,7 @@
|
|
|
1014
1014
|
model: model,
|
|
1015
1015
|
max_tokens: modelRequirements.maxTokens || 2000, // <- Note: 2000 is for lagacy reasons
|
|
1016
1016
|
// <- TODO: Make some global max cap for maxTokens
|
|
1017
|
-
// <- TODO:
|
|
1017
|
+
// <- TODO: !!!!!! Use here `systemMessage`, `temperature` and `seed`
|
|
1018
1018
|
};
|
|
1019
1019
|
rawRequest = __assign(__assign({}, modelSettings), { prompt: content, user: this.options.user });
|
|
1020
1020
|
start = getCurrentIsoDate();
|
|
@@ -1165,12 +1165,13 @@
|
|
|
1165
1165
|
* TODO: [🧠][🧙♂️] Maybe there can be some wizzard for thoose who want to use just OpenAI
|
|
1166
1166
|
* TODO: Maybe Create some common util for callChatModel and callCompletionModel
|
|
1167
1167
|
* TODO: Maybe make custom OpenaiError
|
|
1168
|
+
* TODO: [🧠][🈁] Maybe use `isDeterministic` from options
|
|
1168
1169
|
*/
|
|
1169
1170
|
|
|
1170
1171
|
/**
|
|
1171
1172
|
* The version of the Promptbook library
|
|
1172
1173
|
*/
|
|
1173
|
-
var PROMPTBOOK_VERSION = '0.61.0-
|
|
1174
|
+
var PROMPTBOOK_VERSION = '0.61.0-12';
|
|
1174
1175
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
1175
1176
|
|
|
1176
1177
|
exports.OPENAI_MODELS = OPENAI_MODELS;
|