@promptbook/openai 0.70.0-1 → 0.71.0-7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -59
- package/esm/index.es.js +89 -10
- package/esm/index.es.js.map +1 -1
- package/esm/typings/promptbook-collection/index.d.ts +0 -3
- package/esm/typings/src/_packages/browser.index.d.ts +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +37 -11
- package/esm/typings/src/_packages/node.index.d.ts +6 -2
- package/esm/typings/src/_packages/types.index.d.ts +40 -20
- package/esm/typings/src/_packages/utils.index.d.ts +4 -4
- package/esm/typings/src/cli/cli-commands/about.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/hello.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/make.d.ts +2 -2
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +1 -1
- package/esm/typings/src/cli/main.d.ts +1 -1
- package/esm/typings/src/cli/promptbookCli.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +8 -5
- package/esm/typings/src/collection/constructors/createCollectionFromUrl.d.ts +1 -1
- package/esm/typings/src/commands/EXPECT/expectCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/FOREACH/ForeachCommand.d.ts +3 -7
- package/esm/typings/src/commands/FOREACH/ForeachJson.d.ts +27 -0
- package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +2 -3
- package/esm/typings/src/commands/FORMAT/formatCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/JOKER/jokerCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/KNOWLEDGE/knowledgeCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/KNOWLEDGE/utils/sourceContentToName.d.ts +11 -0
- package/esm/typings/src/commands/KNOWLEDGE/utils/sourceContentToName.test.d.ts +4 -0
- package/esm/typings/src/commands/MODEL/modelCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/PARAMETER/parameterCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/PERSONA/personaCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/POSTPROCESS/postprocessCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/TEMPLATE/templateCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/URL/urlCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/X_ACTION/actionCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/X_INSTRUMENT/instrumentCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +4 -4
- package/esm/typings/src/config.d.ts +26 -3
- package/esm/typings/src/conversion/pipelineStringToJson.d.ts +2 -15
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +1 -1
- package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +3 -0
- package/esm/typings/src/conversion/utils/extractParameterNamesFromTemplate.d.ts +2 -1
- package/esm/typings/src/conversion/validation/_importPipeline.d.ts +1 -1
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +10 -5
- package/esm/typings/src/{knowledge/dialogs → dialogs}/callback/CallbackInterfaceTools.d.ts +2 -2
- package/esm/typings/src/{knowledge/dialogs → dialogs}/callback/CallbackInterfaceToolsOptions.d.ts +2 -2
- package/esm/typings/src/{knowledge/dialogs → dialogs}/simple-prompt/SimplePromptInterfaceTools.d.ts +4 -4
- package/esm/typings/src/errors/AbstractFormatError.d.ts +11 -0
- package/esm/typings/src/errors/KnowledgeScrapeError.d.ts +9 -0
- package/esm/typings/src/errors/MissingToolsError.d.ts +9 -0
- package/esm/typings/src/execution/ExecutionTools.d.ts +3 -3
- package/esm/typings/src/execution/PipelineExecutor.d.ts +1 -0
- package/esm/typings/src/execution/PipelineExecutorResult.d.ts +9 -8
- package/esm/typings/src/execution/createPipelineExecutor/$OngoingTemplateResult.d.ts +45 -0
- package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +23 -0
- package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorSettings.d.ts +29 -0
- package/esm/typings/src/execution/createPipelineExecutor/00-createPipelineExecutor.d.ts +13 -0
- package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +58 -0
- package/esm/typings/src/execution/createPipelineExecutor/20-executeTemplate.d.ts +65 -0
- package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +15 -0
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +74 -0
- package/esm/typings/src/execution/createPipelineExecutor/filterJustOutputParameters.d.ts +34 -0
- package/esm/typings/src/execution/createPipelineExecutor/getContextForTemplate.d.ts +10 -0
- package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTemplate.d.ts +27 -0
- package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTemplate.d.ts +30 -0
- package/esm/typings/src/execution/createPipelineExecutor/getSamplesForTemplate.d.ts +10 -0
- package/esm/typings/src/execution/embeddingVectorToString.d.ts +1 -1
- package/esm/typings/src/execution/utils/checkExpectations.d.ts +2 -0
- package/esm/typings/src/execution/utils/forEachAsync.d.ts +1 -0
- package/esm/typings/src/execution/utils/usageToHuman.d.ts +3 -4
- package/esm/typings/src/formats/_common/FormatDefinition.d.ts +14 -15
- package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +31 -0
- package/esm/typings/src/formats/csv/{ListFormatDefinition.d.ts → CsvFormatDefinition.d.ts} +6 -3
- package/esm/typings/src/formats/csv/CsvFormatError.d.ts +10 -0
- package/esm/typings/src/formats/csv/CsvSettings.d.ts +13 -0
- package/esm/typings/src/formats/index.d.ts +1 -1
- package/esm/typings/src/formats/json/JsonFormatDefinition.d.ts +4 -3
- package/esm/typings/src/formats/text/TextFormatDefinition.d.ts +19 -0
- package/esm/typings/src/formats/xml/XmlFormatDefinition.d.ts +4 -3
- package/esm/typings/src/llm-providers/_common/createLlmToolsFromConfigurationFromEnv.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/getLlmToolsForCli.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +2 -1
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/createAnthropicClaudeExecutionTools.d.ts +2 -2
- package/esm/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +3 -2
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +8 -1
- package/esm/typings/src/llm-providers/azure-openai/playground/playground.d.ts +1 -0
- package/esm/typings/src/llm-providers/langtail/playground/playground.d.ts +3 -0
- package/esm/typings/src/llm-providers/multiple/playground/playground.d.ts +3 -0
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +2 -1
- package/esm/typings/src/llm-providers/openai/playground/playground.d.ts +2 -1
- package/esm/typings/src/llm-providers/remote/playground/playground.d.ts +3 -0
- package/esm/typings/src/personas/preparePersona.d.ts +3 -3
- package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +67 -0
- package/esm/typings/src/prepare/isPipelinePrepared.d.ts +1 -1
- package/esm/typings/src/prepare/preparePipeline.d.ts +2 -2
- package/esm/typings/src/prepare/prepareTemplates.d.ts +3 -3
- package/esm/typings/src/scrapers/_common/Converter.d.ts +28 -0
- package/esm/typings/src/scrapers/_common/Scraper.d.ts +71 -0
- package/esm/typings/src/scrapers/_common/ScraperIntermediateSource.d.ts +11 -0
- package/esm/typings/src/{knowledge/prepare-knowledge → scrapers}/_common/prepareKnowledgePieces.d.ts +4 -4
- package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +33 -0
- package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.test.d.ts +4 -0
- package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +10 -0
- package/esm/typings/src/scrapers/document/documentScraper.d.ts +37 -0
- package/esm/typings/src/scrapers/document/documentScraper.test.d.ts +4 -0
- package/esm/typings/src/scrapers/document/playground/document-scraper-playground.d.ts +5 -0
- package/esm/typings/src/scrapers/document-legacy/legacyDocumentScraper.d.ts +37 -0
- package/esm/typings/src/scrapers/document-legacy/legacyDocumentScraper.test.d.ts +4 -0
- package/esm/typings/src/scrapers/document-legacy/playground/legacy-document-scraper-playground.d.ts +5 -0
- package/esm/typings/src/scrapers/index.d.ts +7 -0
- package/esm/typings/src/scrapers/markdown/markdownScraper.d.ts +29 -0
- package/esm/typings/src/scrapers/markdown/playground/markdown-scraper-playground.d.ts +5 -0
- package/esm/typings/src/scrapers/pdf/pdfScraper.d.ts +35 -0
- package/esm/typings/src/scrapers/pdf/playground/pdf-scraper-playground.d.ts +5 -0
- package/esm/typings/src/scrapers/website/playground/website-scraper-playground.d.ts +5 -0
- package/esm/typings/src/scrapers/website/utils/markdownConverter.d.ts +12 -0
- package/esm/typings/src/scrapers/website/websiteScraper.d.ts +43 -0
- package/esm/typings/src/storage/{files-storage/FilesStorage.d.ts → file-cache-storage/FileCacheStorage.d.ts} +4 -4
- package/esm/typings/src/storage/file-cache-storage/FileCacheStorageOptions.d.ts +10 -0
- package/esm/typings/src/storage/{files-storage → file-cache-storage}/utils/nameToSubfolderPath.d.ts +1 -1
- package/esm/typings/src/storage/local-storage/getLocalStorage.d.ts +1 -1
- package/esm/typings/src/storage/local-storage/getSessionStorage.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +9 -2
- package/esm/typings/src/types/PipelineJson/ParameterJson.d.ts +1 -0
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +3 -3
- package/esm/typings/src/types/PipelineJson/TemplateJsonCommon.d.ts +5 -0
- package/esm/typings/src/types/execution-report/executionReportJsonToString.d.ts +2 -1
- package/esm/typings/src/types/typeAliases.d.ts +9 -12
- package/esm/typings/src/utils/execCommand/$execCommand.d.ts +14 -0
- package/esm/typings/src/utils/execCommand/$execCommands.d.ts +17 -0
- package/esm/typings/src/utils/execCommand/IExecCommandOptions.d.ts +23 -0
- package/esm/typings/src/utils/execCommand/execCommandNormalizeOptions.d.ts +10 -0
- package/esm/typings/src/utils/expectation-counters/index.d.ts +3 -0
- package/esm/typings/src/utils/files/$isDirectoryExisting.d.ts +3 -3
- package/esm/typings/src/utils/files/$isFileExisting.d.ts +3 -3
- package/esm/typings/src/utils/files/$listAllFiles.d.ts +4 -4
- package/esm/typings/src/utils/files/extensionToMimeType.d.ts +8 -0
- package/esm/typings/src/utils/files/getFileExtension.d.ts +8 -0
- package/esm/typings/src/utils/files/getFileExtension.test.d.ts +1 -0
- package/esm/typings/src/utils/organization/{f.d.ts → empty_object.d.ts} +5 -1
- package/esm/typings/src/utils/organization/just_empty_object.d.ts +12 -0
- package/esm/typings/src/utils/{extractParameterNames.d.ts → parameters/extractParameterNames.d.ts} +2 -2
- package/esm/typings/src/utils/parameters/extractParameterNames.test.d.ts +1 -0
- package/esm/typings/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +27 -0
- package/esm/typings/src/utils/parameters/mapAvailableToExpectedParameters.test.d.ts +1 -0
- package/esm/typings/src/utils/{replaceParameters.d.ts → parameters/replaceParameters.d.ts} +2 -2
- package/esm/typings/src/utils/parameters/replaceParameters.test.d.ts +1 -0
- package/esm/typings/src/utils/serialization/checkSerializableAsJson.d.ts +1 -1
- package/esm/typings/src/utils/serialization/isSerializableAsJson.d.ts +1 -1
- package/esm/typings/src/utils/validators/filePath/isValidFilePath.d.ts +2 -2
- package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +10 -0
- package/esm/typings/src/utils/validators/parameterName/validateParameterName.test.d.ts +1 -0
- package/package.json +17 -13
- package/umd/index.umd.js +89 -10
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/execution/createPipelineExecutor.d.ts +0 -72
- package/esm/typings/src/formats/list/ListFormatDefinition.d.ts +0 -16
- package/esm/typings/src/knowledge/prepare-knowledge/_common/Scraper.d.ts +0 -37
- package/esm/typings/src/knowledge/prepare-knowledge/markdown/playground/markdown-knowledge-playground.d.ts +0 -2
- package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +0 -14
- package/esm/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +0 -15
- package/esm/typings/src/prepare/PrepareOptions.d.ts +0 -22
- package/esm/typings/src/storage/files-storage/FilesStorageOptions.d.ts +0 -10
- /package/esm/typings/src/{knowledge/dialogs → dialogs}/user-interface-execution-tools.test.d.ts +0 -0
- /package/esm/typings/src/{knowledge/prepare-knowledge → scrapers}/_common/prepareKnowledgePieces.test.d.ts +0 -0
- /package/esm/typings/src/{knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.test.d.ts → scrapers/markdown/markdownScraper.test.d.ts} +0 -0
- /package/esm/typings/src/{execution/utils/usageToHuman.test.d.ts → scrapers/website/utils/markdownConverter.test.d.ts} +0 -0
- /package/esm/typings/src/{knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.test.d.ts → scrapers/website/websiteScraper.test.d.ts} +0 -0
- /package/esm/typings/src/storage/{files-storage → file-cache-storage}/utils/nameToSubfolderPath.test.d.ts +0 -0
- /package/esm/typings/src/{personas/preparePersona.test.d.ts → utils/execCommand/execCommand.test.d.ts} +0 -0
- /package/esm/typings/src/utils/{extractParameterNames.test.d.ts → execCommand/execCommandNormalizeOptions.test.d.ts} +0 -0
- /package/esm/typings/src/utils/{replaceParameters.test.d.ts → files/extensionToMimeType.test.d.ts} +0 -0
|
@@ -11,11 +11,18 @@ import type { string_name } from '../typeAliases';
|
|
|
11
11
|
*/
|
|
12
12
|
export type KnowledgeSourceJson = {
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Unique identifier of the knowledge source
|
|
15
15
|
*/
|
|
16
16
|
readonly name: string_name;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Source of one knowledge
|
|
19
|
+
*
|
|
20
|
+
* It can be a link, a relative path to file or direct text or combination of those
|
|
21
|
+
*
|
|
22
|
+
* For example `"https://pavolhejny.com/"`
|
|
23
|
+
* For example `"./pavol-hejny-cv.pdf"`
|
|
24
|
+
* For example `"Pavol Hejný has web https://pavolhejny.com/"`
|
|
25
|
+
* For example `"Pavol Hejný is web developer and creator of Promptbook and Collboard"`
|
|
19
26
|
*/
|
|
20
27
|
readonly sourceContent: string_knowledge_source_content;
|
|
21
28
|
};
|
|
@@ -33,6 +33,7 @@ export type ParameterJson = {
|
|
|
33
33
|
readonly sampleValues?: Array<string_parameter_value>;
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
36
|
+
* TODO: [🧠] Should be here registered subparameters from foreach or not?
|
|
36
37
|
* TODO: [♈] Probbably move expectations from templates to parameters
|
|
37
38
|
* TODO: [🍙] Make some standard order of json properties
|
|
38
39
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ModelRequirements } from '../ModelRequirements';
|
|
2
|
-
import type {
|
|
2
|
+
import type { string_filename } from '../typeAliases';
|
|
3
3
|
import type { string_markdown_text } from '../typeAliases';
|
|
4
4
|
import type { string_pipeline_url } from '../typeAliases';
|
|
5
5
|
import type { string_semantic_version } from '../typeAliases';
|
|
@@ -33,7 +33,7 @@ export type PipelineJson = {
|
|
|
33
33
|
/**
|
|
34
34
|
* Internal helper for tracking the source `.ptbk.md` file of the pipeline
|
|
35
35
|
*/
|
|
36
|
-
readonly sourceFile?:
|
|
36
|
+
readonly sourceFile?: string_filename;
|
|
37
37
|
/**
|
|
38
38
|
* Title of the promptbook
|
|
39
39
|
* -It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
@@ -42,7 +42,7 @@ export type PipelineJson = {
|
|
|
42
42
|
/**
|
|
43
43
|
* Version of the .ptbk.json file
|
|
44
44
|
*/
|
|
45
|
-
readonly promptbookVersion
|
|
45
|
+
readonly promptbookVersion?: string_semantic_version;
|
|
46
46
|
/**
|
|
47
47
|
* Description of the promptbook
|
|
48
48
|
* It can use multiple paragraphs of simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ForeachJson } from '../../commands/FOREACH/ForeachJson';
|
|
1
2
|
import type { FormatCommand } from '../../commands/FORMAT/FormatCommand';
|
|
2
3
|
import type { TemplateType } from '../../commands/TEMPLATE/TemplateTypes';
|
|
3
4
|
import type { string_javascript } from '../typeAliases';
|
|
@@ -42,6 +43,10 @@ export interface TemplateJsonCommon {
|
|
|
42
43
|
* @see https://github.com/webgptorg/promptbook/discussions/66
|
|
43
44
|
*/
|
|
44
45
|
readonly jokerParameterNames?: Array<string_parameter_name>;
|
|
46
|
+
/**
|
|
47
|
+
* @@@
|
|
48
|
+
*/
|
|
49
|
+
readonly foreach?: ForeachJson;
|
|
45
50
|
/**
|
|
46
51
|
* Type of the execution
|
|
47
52
|
* This determines if the template is send to LLM, user or some scripting evaluation
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReadonlyDeep } from 'type-fest';
|
|
1
2
|
import type { ExecutionReportJson } from './ExecutionReportJson';
|
|
2
3
|
import type { ExecutionReportString } from './ExecutionReportString';
|
|
3
4
|
import type { ExecutionReportStringOptions } from './ExecutionReportStringOptions';
|
|
@@ -6,7 +7,7 @@ import type { ExecutionReportStringOptions } from './ExecutionReportStringOption
|
|
|
6
7
|
*
|
|
7
8
|
* @public exported from `@promptbook/core`
|
|
8
9
|
*/
|
|
9
|
-
export declare function executionReportJsonToString(executionReportJson: ExecutionReportJson
|
|
10
|
+
export declare function executionReportJsonToString(executionReportJson: ReadonlyDeep<ExecutionReportJson>, options?: Partial<ExecutionReportStringOptions>): ExecutionReportString;
|
|
10
11
|
/**
|
|
11
12
|
* TODO: Add mermaid chart for every report
|
|
12
13
|
* TODO: [🧠] Allow to filter out some parts of the report by options
|
|
@@ -156,7 +156,7 @@ export type string_knowledge_source_content = string_knowledge_source_link | str
|
|
|
156
156
|
*
|
|
157
157
|
* @@@ string_knowledge_source vs string_knowledge_source_link
|
|
158
158
|
*/
|
|
159
|
-
export type string_knowledge_source_link = string_url |
|
|
159
|
+
export type string_knowledge_source_link = string_url | string_filename;
|
|
160
160
|
/**
|
|
161
161
|
* Semantic helper
|
|
162
162
|
*
|
|
@@ -386,6 +386,7 @@ export type string_emails = string;
|
|
|
386
386
|
* - `isValidUuid to check validity
|
|
387
387
|
*
|
|
388
388
|
* For example `"5a0a153d-7be9-4018-9eda-e0e2e2b89bd9"`
|
|
389
|
+
* TODO: [🥬] Make some system for hashes and ids of promptbook
|
|
389
390
|
*/
|
|
390
391
|
export type string_uuid = string & {
|
|
391
392
|
readonly _type: 'uuid';
|
|
@@ -423,37 +424,33 @@ export type string_file_extension = string;
|
|
|
423
424
|
*
|
|
424
425
|
* For example `"C:/Users/me/work/collboard/modules-sdk/src/colldev/commands/develop/ColldevDevelop.tsx"`
|
|
425
426
|
*/
|
|
426
|
-
export type
|
|
427
|
+
export type string_absolute_filename = string;
|
|
427
428
|
/**
|
|
428
429
|
* Semantic helper
|
|
429
430
|
*
|
|
430
431
|
* For example `"./src/colldev/commands/develop/ColldevDevelop.tsx"`
|
|
431
432
|
*/
|
|
432
|
-
export type
|
|
433
|
+
export type string_relative_filename = string;
|
|
433
434
|
/**
|
|
434
435
|
* Semantic helper
|
|
435
436
|
*/
|
|
436
|
-
export type
|
|
437
|
+
export type string_filename = string_absolute_filename | string_relative_filename;
|
|
437
438
|
/**
|
|
438
439
|
* Semantic helper
|
|
439
440
|
*
|
|
440
441
|
* For example `"C:/Users/me/work/collboard/modules-sdk/src/colldev/commands/develop/ColldevDevelop.tsx"`
|
|
441
442
|
*/
|
|
442
|
-
export type
|
|
443
|
+
export type string_absolute_dirname = string;
|
|
443
444
|
/**
|
|
444
445
|
* Semantic helper
|
|
445
446
|
*
|
|
446
447
|
* For example `"./src/colldev/commands/develop/ColldevDevelop.tsx"`
|
|
447
448
|
*/
|
|
448
|
-
export type
|
|
449
|
+
export type string_relative_dirname = string;
|
|
449
450
|
/**
|
|
450
451
|
* Semantic helper
|
|
451
452
|
*/
|
|
452
|
-
export type
|
|
453
|
-
/**
|
|
454
|
-
* Semantic helper
|
|
455
|
-
*/
|
|
456
|
-
export type string_filename = string;
|
|
453
|
+
export type string_dirname = string_absolute_dirname | string_relative_dirname;
|
|
457
454
|
/**
|
|
458
455
|
* Semantic helper
|
|
459
456
|
*
|
|
@@ -592,7 +589,7 @@ export type number_megabytes = number_positive;
|
|
|
592
589
|
export type number_gigabytes = number_positive;
|
|
593
590
|
export type number_terabytes = number_positive;
|
|
594
591
|
/**.
|
|
595
|
-
* TODO: !!! Change "For example" to @example
|
|
592
|
+
* TODO: [main] !!! Change "For example" to @example
|
|
596
593
|
* TODO: !! Change to branded types
|
|
597
594
|
* TODO: Delete type aliases that are not exported or used internally
|
|
598
595
|
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IExecCommandOptions } from './IExecCommandOptions';
|
|
2
|
+
/**
|
|
3
|
+
* Run one command in a shell
|
|
4
|
+
*
|
|
5
|
+
* Note: There are 2 similar functions in the codebase:
|
|
6
|
+
* - `$execCommand` which runs a single command
|
|
7
|
+
* - `$execCommands` which runs multiple commands
|
|
8
|
+
*
|
|
9
|
+
* @public exported from `@promptbook/node`
|
|
10
|
+
*/
|
|
11
|
+
export declare function $execCommand(options: IExecCommandOptions): Promise<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Note: [🟢 <- TODO: [🦖] !!!!!! Split scrapers into packages and enable] Code in this file should never be published outside of `@promptbook/node` and `@promptbook/cli`
|
|
14
|
+
*/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run multiple commands in a shell in sequence
|
|
3
|
+
*
|
|
4
|
+
* Note: There are 2 similar functions in the codebase:
|
|
5
|
+
* - `$execCommand` which runs a single command
|
|
6
|
+
* - `$execCommands` which runs multiple commands
|
|
7
|
+
*
|
|
8
|
+
* @public exported from `@promptbook/node`
|
|
9
|
+
*/
|
|
10
|
+
export declare function $execCommands({ commands, cwd, crashOnError, }: {
|
|
11
|
+
readonly commands: string[];
|
|
12
|
+
readonly cwd: string;
|
|
13
|
+
readonly crashOnError?: boolean;
|
|
14
|
+
}): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Note: [🟢 <- TODO: [🦖] !!!!!! Split scrapers into packages and enable] Code in this file should never be published outside of `@promptbook/node` and `@promptbook/cli`
|
|
17
|
+
*/
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Use sth from type-fest or move this to type helpers
|
|
3
|
+
*/
|
|
4
|
+
type RequiredAndOptional<TBase, TRequired extends keyof TBase, TOptional extends keyof TBase> = Pick<TBase, TRequired> & Partial<Pick<TBase, TOptional>>;
|
|
5
|
+
/**
|
|
6
|
+
* Simple options for `execCommand`
|
|
7
|
+
*
|
|
8
|
+
* TODO: !!!!!! Rename - remove I prefix
|
|
9
|
+
*/
|
|
10
|
+
export type IExecCommandOptions = string | RequiredAndOptional<IExecCommandOptionsAdvanced, 'command', 'args' | 'cwd' | 'crashOnError' | 'timeout'>;
|
|
11
|
+
/**
|
|
12
|
+
* Advanced options for `execCommand`
|
|
13
|
+
*
|
|
14
|
+
* TODO: !!!!!! Rename - remove I prefix
|
|
15
|
+
*/
|
|
16
|
+
export type IExecCommandOptionsAdvanced = {
|
|
17
|
+
readonly command: string;
|
|
18
|
+
readonly args: string[];
|
|
19
|
+
readonly cwd: string;
|
|
20
|
+
readonly crashOnError: boolean;
|
|
21
|
+
readonly timeout: number;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IExecCommandOptions } from './IExecCommandOptions';
|
|
2
|
+
import type { IExecCommandOptionsAdvanced } from './IExecCommandOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Normalize options for `execCommand` and `execCommands`
|
|
5
|
+
*
|
|
6
|
+
* @private internal utility of `execCommand` and `execCommands`
|
|
7
|
+
*/
|
|
8
|
+
export declare function execCommandNormalizeOptions(options: IExecCommandOptions): Pick<IExecCommandOptionsAdvanced, 'command' | 'args' | 'cwd' | 'crashOnError' | 'timeout'> & {
|
|
9
|
+
humanReadableCommand: string;
|
|
10
|
+
};
|
|
@@ -6,3 +6,6 @@ import type { ExpectationUnit } from '../../types/PipelineJson/Expectations';
|
|
|
6
6
|
* @public exported from `@promptbook/utils`
|
|
7
7
|
*/
|
|
8
8
|
export declare const CountUtils: Record<ExpectationUnit, (text: string) => ExpectationAmount>;
|
|
9
|
+
/**
|
|
10
|
+
* TODO: [🧠][🤠] This should be probbably as part of `TextFormatDefinition`
|
|
11
|
+
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { string_dirname } from '../../types/typeAliases';
|
|
2
2
|
/**
|
|
3
3
|
* Checks if the directory exists
|
|
4
4
|
*
|
|
@@ -6,9 +6,9 @@ import type { string_folder_path } from '../../types/typeAliases';
|
|
|
6
6
|
*
|
|
7
7
|
* @private within the repository
|
|
8
8
|
*/
|
|
9
|
-
export declare function $isDirectoryExisting(directoryPath:
|
|
9
|
+
export declare function $isDirectoryExisting(directoryPath: string_dirname): Promise<boolean>;
|
|
10
10
|
/**
|
|
11
|
-
* Note: [🟢]
|
|
11
|
+
* Note: [🟢 <- TODO: [🦖] !!!!!! Split scrapers into packages and enable] Code in this file should never be published outside of `@promptbook/node` and `@promptbook/cli`
|
|
12
12
|
* TODO: [🐠] This can be a validator - with variants that return true/false and variants that throw errors with meaningless messages
|
|
13
13
|
* TODO: [🧠][📂] "directory" vs "folder"
|
|
14
14
|
* TODO: [🖇] What about symlinks?
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { string_filename } from '../../types/typeAliases';
|
|
2
2
|
/**
|
|
3
3
|
* Checks if the file exists
|
|
4
4
|
*
|
|
@@ -6,9 +6,9 @@ import type { string_file_path } from '../../types/typeAliases';
|
|
|
6
6
|
*
|
|
7
7
|
* @private within the repository
|
|
8
8
|
*/
|
|
9
|
-
export declare function $isFileExisting(
|
|
9
|
+
export declare function $isFileExisting(filename: string_filename): Promise<boolean>;
|
|
10
10
|
/**
|
|
11
|
-
* Note: [🟢]
|
|
11
|
+
* Note: [🟢 <- TODO: [🦖] !!!!!! Split scrapers into packages and enable] Code in this file should never be published outside of `@promptbook/node` and `@promptbook/cli`
|
|
12
12
|
* TODO: [🐠] This can be a validator - with variants that return true/false and variants that throw errors with meaningless messages
|
|
13
13
|
* TODO: [🖇] What about symlinks?
|
|
14
14
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { string_dirname } from '../../types/typeAliases';
|
|
2
|
+
import type { string_filename } from '../../types/typeAliases';
|
|
3
3
|
/**
|
|
4
4
|
* Reads all files in the directory
|
|
5
5
|
*
|
|
@@ -10,8 +10,8 @@ import type { string_folder_path } from '../../types/typeAliases';
|
|
|
10
10
|
* @returns List of all files in the directory
|
|
11
11
|
* @private internal function of `createCollectionFromDirectory`
|
|
12
12
|
*/
|
|
13
|
-
export declare function $listAllFiles(path:
|
|
13
|
+
export declare function $listAllFiles(path: string_dirname, isRecursive: boolean): Promise<Array<string_filename>>;
|
|
14
14
|
/**
|
|
15
|
-
* Note: [🟢]
|
|
15
|
+
* Note: [🟢 <- TODO: [🦖] !!!!!! Split scrapers into packages and enable] Code in this file should never be published outside of `@promptbook/node` and `@promptbook/cli`
|
|
16
16
|
* TODO: [🖇] What about symlinks?
|
|
17
17
|
*/
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { string_file_extension } from '../../types/typeAliases';
|
|
2
|
+
import type { string_mime_type } from '../../types/typeAliases';
|
|
3
|
+
/**
|
|
4
|
+
* Convert file extension to mime type
|
|
5
|
+
*
|
|
6
|
+
* @private within the repository
|
|
7
|
+
*/
|
|
8
|
+
export declare function extensionToMimeType(value: string_file_extension): string_mime_type;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { string_filename } from '../../types/typeAliases';
|
|
2
|
+
import type { string_mime_type } from '../../types/typeAliases';
|
|
3
|
+
/**
|
|
4
|
+
* Get the file extension from a file name
|
|
5
|
+
*
|
|
6
|
+
* @private within the repository
|
|
7
|
+
*/
|
|
8
|
+
export declare function getFileExtension(value: string_filename): string_mime_type | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Organizational helper to better mark the place where to really use empty object `{}`
|
|
3
3
|
*
|
|
4
|
+
* Note: There are 2 similar types>
|
|
5
|
+
* - `empty_object` @@@
|
|
6
|
+
* - `just_empty_object` @@@
|
|
7
|
+
*
|
|
4
8
|
* @private within the repository
|
|
5
9
|
*/
|
|
6
|
-
export type
|
|
10
|
+
export type empty_object = {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Organizational helper to better @@@@
|
|
3
|
+
*
|
|
4
|
+
* Note: There are 2 similar types>
|
|
5
|
+
* - `empty_object` @@@
|
|
6
|
+
* - `just_empty_object` @@@
|
|
7
|
+
*
|
|
8
|
+
* Note: In most cases, you should use `empty_object`
|
|
9
|
+
*
|
|
10
|
+
* @private within the repository
|
|
11
|
+
*/
|
|
12
|
+
export type just_empty_object = Record<string, never>;
|
package/esm/typings/src/utils/{extractParameterNames.d.ts → parameters/extractParameterNames.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { string_parameter_name } from '
|
|
2
|
-
import type { string_template } from '
|
|
1
|
+
import type { string_parameter_name } from '../../types/typeAliases';
|
|
2
|
+
import type { string_template } from '../../types/typeAliases';
|
|
3
3
|
/**
|
|
4
4
|
* Parses the template and returns the list of all parameter names
|
|
5
5
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { string_parameter_name } from '../../types/typeAliases';
|
|
2
|
+
import type { string_parameter_value } from '../../types/typeAliases';
|
|
3
|
+
/**
|
|
4
|
+
* @@@
|
|
5
|
+
*/
|
|
6
|
+
type MakeapAvailableToExpectedParametersOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* @@@
|
|
9
|
+
*/
|
|
10
|
+
readonly expectedParameters: Readonly<Record<string_parameter_name, null>>;
|
|
11
|
+
/**
|
|
12
|
+
* @@@
|
|
13
|
+
*/
|
|
14
|
+
readonly availableParameters: Readonly<Record<string_parameter_name, string_parameter_value>>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Maps available parameters to expected parameters
|
|
18
|
+
*
|
|
19
|
+
* The strategy is:
|
|
20
|
+
* 1) @@@
|
|
21
|
+
* 2) @@@
|
|
22
|
+
*
|
|
23
|
+
* @throws {PipelineExecutionError} @@@
|
|
24
|
+
* @private within the repository used in `createPipelineExecutor`
|
|
25
|
+
*/
|
|
26
|
+
export declare function mapAvailableToExpectedParameters(options: MakeapAvailableToExpectedParametersOptions): Readonly<Record<string_parameter_name, string_parameter_value>>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Parameters } from '
|
|
2
|
-
import type { string_template } from '
|
|
1
|
+
import type { Parameters } from '../../types/typeAliases';
|
|
2
|
+
import type { string_template } from '../../types/typeAliases';
|
|
3
3
|
/**
|
|
4
4
|
* Replaces parameters in template with values from parameters object
|
|
5
5
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -22,6 +22,6 @@ import type { string_name } from '../../types/typeAliases';
|
|
|
22
22
|
export declare function checkSerializableAsJson(name: string_name, value: unknown): void;
|
|
23
23
|
/**
|
|
24
24
|
* TODO: [🧠][🛣] More elegant way to tracking than passing `name`
|
|
25
|
-
* TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
|
|
25
|
+
* TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
|
|
26
26
|
* Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
|
|
27
27
|
*/
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
*/
|
|
20
20
|
export declare function isSerializableAsJson(value: unknown): boolean;
|
|
21
21
|
/**
|
|
22
|
-
* TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
|
|
22
|
+
* TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
|
|
23
23
|
* TODO: [🧠][💺] Can be done this on type-level?
|
|
24
24
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { string_filename } from '../../../types/typeAliases';
|
|
2
2
|
import type { really_unknown } from '../../organization/really_unknown';
|
|
3
3
|
/**
|
|
4
4
|
* Tests if given string is valid URL.
|
|
@@ -6,4 +6,4 @@ import type { really_unknown } from '../../organization/really_unknown';
|
|
|
6
6
|
* Note: This does not check if the file exists only if the path is valid
|
|
7
7
|
* @public exported from `@promptbook/utils`
|
|
8
8
|
*/
|
|
9
|
-
export declare function isValidFilePath(
|
|
9
|
+
export declare function isValidFilePath(filename: really_unknown): filename is string_filename;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { string_parameter_name } from '../../../types/typeAliases';
|
|
2
|
+
/**
|
|
3
|
+
* Function `validateParameterName` will @@@
|
|
4
|
+
*
|
|
5
|
+
* @param parameterName @@@
|
|
6
|
+
* @returns @@@
|
|
7
|
+
* @throws {ParseError} @@@
|
|
8
|
+
* @private within the repository
|
|
9
|
+
*/
|
|
10
|
+
export declare function validateParameterName(parameterName: string): string_parameter_name;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/openai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.71.0-7",
|
|
4
4
|
"description": "Supercharge your use of large language models",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -12,21 +12,25 @@
|
|
|
12
12
|
"Pavol Hejný <me@pavolhejny.com> (https://www.pavolhejny.com/)"
|
|
13
13
|
],
|
|
14
14
|
"keywords": [
|
|
15
|
-
"autogpt",
|
|
16
|
-
"openai",
|
|
17
|
-
"gpt-3",
|
|
18
|
-
"gpt-4",
|
|
19
|
-
"chatgpt",
|
|
20
15
|
"ai",
|
|
16
|
+
"llm",
|
|
17
|
+
"prompt",
|
|
18
|
+
"template",
|
|
19
|
+
"language-model",
|
|
20
|
+
"chatgpt",
|
|
21
|
+
"autogpt",
|
|
21
22
|
"machine-learning",
|
|
22
23
|
"natural-language-processing",
|
|
23
24
|
"nlp",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
25
|
+
"openai",
|
|
26
|
+
"gpt-3",
|
|
27
|
+
"gpt-4",
|
|
28
|
+
"gpt-4o",
|
|
29
|
+
"gpt-4o-mini",
|
|
30
|
+
"o1",
|
|
31
|
+
"o1-mini",
|
|
32
|
+
"o1-preview",
|
|
33
|
+
"anthropic"
|
|
30
34
|
],
|
|
31
35
|
"license": "CC-BY-4.0",
|
|
32
36
|
"bugs": {
|
|
@@ -47,7 +51,7 @@
|
|
|
47
51
|
"module": "./esm/index.es.js",
|
|
48
52
|
"typings": "./esm/typings/src/_packages/openai.index.d.ts",
|
|
49
53
|
"peerDependencies": {
|
|
50
|
-
"@promptbook/core": "0.
|
|
54
|
+
"@promptbook/core": "0.71.0-7"
|
|
51
55
|
},
|
|
52
56
|
"dependencies": {
|
|
53
57
|
"colors": "1.4.0",
|