@promptbook/google 0.92.0-8 → 0.92.0
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 +1 -5
- package/esm/index.es.js +41 -30
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/browser.index.d.ts +2 -0
- package/esm/typings/src/_packages/core.index.d.ts +26 -14
- package/esm/typings/src/_packages/types.index.d.ts +6 -2
- package/esm/typings/src/collection/PipelineCollection.d.ts +0 -2
- package/esm/typings/src/collection/SimplePipelineCollection.d.ts +1 -1
- package/esm/typings/src/commands/FOREACH/ForeachJson.d.ts +6 -6
- package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +0 -2
- package/esm/typings/src/commands/FORMFACTOR/formfactorCommandParser.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 +36 -28
- package/esm/typings/src/config.d.ts +41 -11
- package/esm/typings/src/constants.d.ts +43 -2
- package/esm/typings/src/conversion/parsePipeline.d.ts +2 -2
- package/esm/typings/src/errors/0-BoilerplateError.d.ts +2 -2
- package/esm/typings/src/errors/CollectionError.d.ts +1 -1
- package/esm/typings/src/executables/$provideExecutablesForNode.d.ts +1 -1
- package/esm/typings/src/executables/apps/locateLibreoffice.d.ts +2 -1
- package/esm/typings/src/executables/apps/locatePandoc.d.ts +2 -1
- package/esm/typings/src/executables/locateApp.d.ts +2 -2
- package/esm/typings/src/executables/platforms/locateAppOnLinux.d.ts +2 -1
- package/esm/typings/src/executables/platforms/locateAppOnMacOs.d.ts +2 -1
- package/esm/typings/src/executables/platforms/locateAppOnWindows.d.ts +2 -1
- package/esm/typings/src/execution/AbstractTaskResult.d.ts +1 -1
- package/esm/typings/src/execution/CommonToolsOptions.d.ts +5 -1
- package/esm/typings/src/execution/ExecutionTask.d.ts +19 -1
- package/esm/typings/src/execution/LlmExecutionToolsConstructor.d.ts +2 -1
- package/esm/typings/src/execution/PipelineExecutorResult.d.ts +4 -2
- package/esm/typings/src/execution/PromptbookFetch.d.ts +1 -1
- package/esm/typings/src/execution/ScriptExecutionTools.d.ts +1 -1
- package/esm/typings/src/execution/createPipelineExecutor/$OngoingTaskResult.d.ts +12 -9
- package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +13 -10
- package/esm/typings/src/execution/createPipelineExecutor/20-executeTask.d.ts +12 -9
- package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +15 -3
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +21 -15
- package/esm/typings/src/execution/createPipelineExecutor/computeCosineSimilarity.d.ts +13 -0
- package/esm/typings/src/execution/createPipelineExecutor/filterJustOutputParameters.d.ts +7 -6
- package/esm/typings/src/execution/createPipelineExecutor/getContextForTask.d.ts +5 -1
- package/esm/typings/src/execution/createPipelineExecutor/getExamplesForTask.d.ts +1 -1
- package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTask.d.ts +12 -9
- package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTask.d.ts +18 -5
- package/esm/typings/src/execution/createPipelineExecutor/knowledgePiecesToString.d.ts +9 -0
- package/esm/typings/src/execution/execution-report/ExecutionReportJson.d.ts +1 -1
- package/esm/typings/src/execution/execution-report/ExecutionReportString.d.ts +1 -1
- package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +4 -4
- package/esm/typings/src/execution/utils/checkExpectations.d.ts +3 -3
- package/esm/typings/src/execution/utils/uncertainNumber.d.ts +3 -2
- package/esm/typings/src/execution/utils/usageToWorktime.d.ts +1 -1
- package/esm/typings/src/formats/_common/{FormatDefinition.d.ts → FormatParser.d.ts} +8 -6
- package/esm/typings/src/formats/_common/FormatSubvalueParser.d.ts +66 -0
- package/esm/typings/src/formats/csv/CsvFormatParser.d.ts +17 -0
- package/esm/typings/src/formats/csv/CsvSettings.d.ts +2 -2
- package/esm/typings/src/formats/csv/utils/csvParse.d.ts +12 -0
- package/esm/typings/src/formats/csv/utils/isValidCsvString.d.ts +1 -1
- package/esm/typings/src/formats/index.d.ts +2 -2
- package/esm/typings/src/formats/json/JsonFormatParser.d.ts +19 -0
- package/esm/typings/src/formats/json/utils/isValidJsonString.d.ts +1 -1
- package/esm/typings/src/formats/json/utils/jsonParse.d.ts +0 -3
- package/esm/typings/src/formats/text/{TextFormatDefinition.d.ts → TextFormatParser.d.ts} +7 -7
- package/esm/typings/src/formats/xml/XmlFormatParser.d.ts +19 -0
- package/esm/typings/src/formats/xml/utils/isValidXmlString.d.ts +1 -1
- package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +3 -2
- package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +16 -7
- package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +3 -1
- package/esm/typings/src/formfactors/_common/string_formfactor_name.d.ts +2 -1
- package/esm/typings/src/formfactors/chatbot/ChatbotFormfactorDefinition.d.ts +2 -2
- package/esm/typings/src/formfactors/completion/CompletionFormfactorDefinition.d.ts +29 -0
- package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +2 -1
- package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +2 -2
- package/esm/typings/src/formfactors/index.d.ts +33 -8
- package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +4 -2
- package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +3 -2
- package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +3 -2
- package/esm/typings/src/high-level-abstractions/index.d.ts +2 -2
- package/esm/typings/src/llm-providers/_common/register/$llmToolsMetadataRegister.d.ts +3 -3
- package/esm/typings/src/llm-providers/_common/register/$llmToolsRegister.d.ts +3 -3
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +4 -4
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +4 -3
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +18 -5
- package/esm/typings/src/llm-providers/_common/register/LlmToolsConfiguration.d.ts +11 -4
- package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +21 -42
- package/esm/typings/src/llm-providers/_common/register/LlmToolsOptions.d.ts +9 -2
- package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +13 -4
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +10 -5
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +11 -3
- package/esm/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +5 -5
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +6 -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 +5 -1
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +4 -4
- package/esm/typings/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +4 -0
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +2 -2
- package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +2 -2
- package/esm/typings/src/migrations/migratePipeline.d.ts +9 -0
- package/esm/typings/src/other/templates/getBookTemplates.d.ts +2 -2
- package/esm/typings/src/pipeline/PipelineInterface/PipelineInterface.d.ts +3 -3
- package/esm/typings/src/pipeline/PipelineInterface/constants.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineInterface/getPipelineInterface.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineInterface/isPipelineImplementingInterface.d.ts +5 -4
- package/esm/typings/src/pipeline/PipelineInterface/isPipelineInterfacesEqual.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineJson/CommonTaskJson.d.ts +10 -7
- package/esm/typings/src/pipeline/PipelineJson/ParameterJson.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineJson/PipelineJson.d.ts +3 -2
- package/esm/typings/src/pipeline/PipelineString.d.ts +3 -1
- package/esm/typings/src/pipeline/book-notation.d.ts +2 -2
- package/esm/typings/src/postprocessing/utils/extractBlock.d.ts +1 -1
- package/esm/typings/src/postprocessing/utils/extractJsonBlock.d.ts +2 -2
- package/esm/typings/src/prepare/prepareTasks.d.ts +8 -5
- package/esm/typings/src/remote-server/openapi.d.ts +1 -1
- package/esm/typings/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Response.d.ts +1 -1
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +1 -1
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +7 -6
- package/esm/typings/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +3 -3
- package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/Converter.d.ts +3 -1
- package/esm/typings/src/scrapers/_common/Scraper.d.ts +4 -3
- package/esm/typings/src/scrapers/_common/ScraperIntermediateSource.d.ts +4 -2
- package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.d.ts +2 -2
- package/esm/typings/src/scrapers/_common/register/$provideFilesystemForNode.d.ts +2 -1
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForBrowser.d.ts +6 -3
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +3 -5
- package/esm/typings/src/scrapers/_common/register/$scrapersMetadataRegister.d.ts +3 -3
- package/esm/typings/src/scrapers/_common/register/$scrapersRegister.d.ts +3 -2
- package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +8 -5
- package/esm/typings/src/scrapers/_common/register/ScraperConstructor.d.ts +2 -1
- package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +6 -5
- package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +3 -1
- package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +2 -1
- package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +4 -1
- package/esm/typings/src/scrapers/markitdown/MarkitdownScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +2 -1
- package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +3 -4
- package/esm/typings/src/scripting/javascript/JavascriptExecutionTools.d.ts +1 -1
- package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +5 -1
- package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +1 -1
- package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +1 -1
- package/esm/typings/src/storage/file-cache-storage/FileCacheStorage.d.ts +12 -5
- package/esm/typings/src/storage/file-cache-storage/FileCacheStorageOptions.d.ts +4 -2
- package/esm/typings/src/storage/file-cache-storage/utils/nameToSubfolderPath.d.ts +2 -1
- package/esm/typings/src/storage/local-storage/getIndexedDbStorage.d.ts +11 -0
- package/esm/typings/src/storage/local-storage/utils/IndexedDbStorageOptions.d.ts +14 -0
- package/esm/typings/src/storage/local-storage/utils/makePromptbookStorageFromIndexedDb.d.ts +8 -0
- package/esm/typings/src/storage/local-storage/utils/makePromptbookStorageFromWebStorage.d.ts +2 -1
- package/esm/typings/src/types/IntermediateFilesStrategy.d.ts +2 -1
- package/esm/typings/src/types/ModelRequirements.d.ts +2 -2
- package/esm/typings/src/types/ModelVariant.d.ts +5 -5
- package/esm/typings/src/types/typeAliases.d.ts +22 -19
- package/esm/typings/src/utils/$Register.d.ts +8 -7
- package/esm/typings/src/utils/editable/edit-pipeline-string/addPipelineCommand.d.ts +2 -2
- package/esm/typings/src/utils/editable/edit-pipeline-string/deflatePipeline.d.ts +4 -1
- package/esm/typings/src/utils/editable/utils/isFlatPipeline.d.ts +2 -1
- package/esm/typings/src/utils/editable/utils/stringifyPipelineJson.d.ts +1 -1
- package/esm/typings/src/utils/environment/$getGlobalScope.d.ts +2 -1
- package/esm/typings/src/utils/expectation-counters/index.d.ts +1 -1
- package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +2 -2
- package/esm/typings/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +1 -1
- package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +2 -2
- package/esm/typings/src/utils/normalization/nameToUriPart.d.ts +4 -4
- package/esm/typings/src/utils/normalization/nameToUriParts.d.ts +4 -4
- package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +3 -3
- package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +3 -3
- package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +4 -4
- package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +3 -3
- package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +3 -3
- package/esm/typings/src/utils/normalization/searchKeywords.d.ts +4 -1
- package/esm/typings/src/utils/normalization/titleToName.d.ts +4 -4
- package/esm/typings/src/utils/organization/TODO_USE.d.ts +1 -1
- package/esm/typings/src/utils/organization/empty_object.d.ts +2 -2
- package/esm/typings/src/utils/organization/just.d.ts +1 -1
- package/esm/typings/src/utils/organization/just_empty_object.d.ts +4 -4
- package/esm/typings/src/utils/organization/keepUnused.d.ts +1 -1
- package/esm/typings/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +7 -7
- package/esm/typings/src/utils/removeQuotes.d.ts +2 -2
- package/esm/typings/src/utils/serialization/clonePipeline.d.ts +4 -3
- package/esm/typings/src/utils/serialization/deepClone.d.ts +5 -1
- package/esm/typings/src/utils/trimCodeBlock.d.ts +1 -1
- package/esm/typings/src/utils/trimEndOfCodeBlock.d.ts +1 -1
- package/esm/typings/src/utils/unwrapResult.d.ts +2 -2
- package/esm/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +3 -3
- package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +5 -4
- package/esm/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +1 -1
- package/esm/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +1 -1
- package/esm/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.d.ts +1 -1
- package/esm/typings/src/utils/validators/url/isUrlOnPrivateNetwork.d.ts +1 -1
- package/esm/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +1 -1
- package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +1 -1
- package/esm/typings/src/version.d.ts +2 -1
- package/esm/typings/src/wizzard/wizzard.d.ts +1 -1
- package/package.json +14 -2
- package/umd/index.umd.js +41 -30
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +0 -31
- package/esm/typings/src/formats/csv/CsvFormatDefinition.d.ts +0 -17
- package/esm/typings/src/formats/json/JsonFormatDefinition.d.ts +0 -19
- package/esm/typings/src/formats/xml/XmlFormatDefinition.d.ts +0 -19
- /package/esm/typings/src/llm-providers/{multiple → _multiple}/MultipleLlmExecutionTools.d.ts +0 -0
- /package/esm/typings/src/llm-providers/{multiple → _multiple}/joinLlmExecutionTools.d.ts +0 -0
- /package/esm/typings/src/llm-providers/{multiple → _multiple}/playground/playground.d.ts +0 -0
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import type { string_parameter_name } from '../../types/typeAliases';
|
|
2
2
|
import type { string_parameter_value } from '../../types/typeAliases';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Options for mapping available parameters to expected parameters in a pipeline task.
|
|
5
5
|
*/
|
|
6
6
|
type MakeapAvailableToExpectedParametersOptions = {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* The set of expected parameter names (keys) for the task, all values are null.
|
|
9
9
|
*/
|
|
10
10
|
readonly expectedParameters: Readonly<Record<string_parameter_name, null>>;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* The set of available parameters (name-value pairs) to map to the expected parameters.
|
|
13
13
|
*/
|
|
14
14
|
readonly availableParameters: Readonly<Record<string_parameter_name, string_parameter_value>>;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
|
-
* Maps available parameters to expected parameters
|
|
17
|
+
* Maps available parameters to expected parameters for a pipeline task.
|
|
18
18
|
*
|
|
19
19
|
* The strategy is:
|
|
20
|
-
* 1)
|
|
21
|
-
* 2)
|
|
20
|
+
* 1) First, match parameters by name where both available and expected.
|
|
21
|
+
* 2) Then, if there are unmatched expected and available parameters, map them by order.
|
|
22
22
|
*
|
|
23
|
-
* @throws {PipelineExecutionError}
|
|
23
|
+
* @throws {PipelineExecutionError} If the number of unmatched expected and available parameters does not match, or mapping is ambiguous.
|
|
24
24
|
* @private within the repository used in `createPipelineExecutor`
|
|
25
25
|
*/
|
|
26
26
|
export declare function mapAvailableToExpectedParameters(options: MakeapAvailableToExpectedParametersOptions): Readonly<Record<string_parameter_name, string_parameter_value>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Removes quotes from a string
|
|
3
3
|
*
|
|
4
|
-
* Tip: This is very
|
|
4
|
+
* Tip: This is very useful for post-processing of the result of the LLM model
|
|
5
5
|
* Note: This function removes only the same quotes from the beginning and the end of the string
|
|
6
|
-
* Note: There are two
|
|
6
|
+
* Note: There are two similar functions:
|
|
7
7
|
* - `removeQuotes` which removes only bounding quotes
|
|
8
8
|
* - `unwrapResult` which removes whole introduce sentence
|
|
9
9
|
*
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Creates a deep clone of a PipelineJson object, copying all properties explicitly.
|
|
4
4
|
*
|
|
5
|
-
* Note: It is
|
|
5
|
+
* Note: It is useful for ensuring that modifications to the returned pipeline do not affect the original.
|
|
6
6
|
*
|
|
7
|
-
* @param pipeline
|
|
7
|
+
* @param pipeline The pipeline to clone.
|
|
8
|
+
* @returns A new PipelineJson object with the same properties as the input.
|
|
8
9
|
* @public exported from `@promptbook/utils`
|
|
9
10
|
*/
|
|
10
11
|
export declare function clonePipeline(pipeline: PipelineJson): PipelineJson;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { WritableDeep } from 'type-fest';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Creates a deep clone of the given object
|
|
4
4
|
*
|
|
5
|
+
* Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
|
|
6
|
+
*
|
|
7
|
+
* @param objectValue The object to clone.
|
|
8
|
+
* @returns A deep, writable clone of the input object.
|
|
5
9
|
* @public exported from `@promptbook/utils`
|
|
6
10
|
*/
|
|
7
11
|
export declare function deepClone<TObject>(objectValue: TObject): WritableDeep<TObject>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Function trimCodeBlock will trim starting and ending code block from the string if it is present.
|
|
3
3
|
*
|
|
4
|
-
* Note: This is
|
|
4
|
+
* Note: This is useful for post-processing of the result of the chat LLM model
|
|
5
5
|
* when the model wraps the result in the (markdown) code block.
|
|
6
6
|
*
|
|
7
7
|
* @public exported from `@promptbook/utils`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Function trimEndOfCodeBlock will remove ending code block from the string if it is present.
|
|
3
3
|
*
|
|
4
|
-
* Note: This is
|
|
4
|
+
* Note: This is useful for post-processing of the result of the completion LLM model
|
|
5
5
|
* if you want to start code block in the prompt but you don't want to end it in the result.
|
|
6
6
|
*
|
|
7
7
|
* @public exported from `@promptbook/utils`
|
|
@@ -20,9 +20,9 @@ type UnwrapResultOptions = {
|
|
|
20
20
|
/**
|
|
21
21
|
* Removes quotes and optional introduce text from a string
|
|
22
22
|
*
|
|
23
|
-
* Tip: This is very
|
|
23
|
+
* Tip: This is very useful for post-processing of the result of the LLM model
|
|
24
24
|
* Note: This function trims the text and removes whole introduce sentence if it is present
|
|
25
|
-
* Note: There are two
|
|
25
|
+
* Note: There are two similar functions:
|
|
26
26
|
* - `removeQuotes` which removes only bounding quotes
|
|
27
27
|
* - `unwrapResult` which removes whole introduce sentence
|
|
28
28
|
*
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { string_javascript_name } from '../../../types/typeAliases';
|
|
2
2
|
import type { really_unknown } from '../../organization/really_unknown';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Checks if the given value is a valid JavaScript identifier name.
|
|
5
5
|
*
|
|
6
|
-
* @param javascriptName
|
|
7
|
-
* @returns
|
|
6
|
+
* @param javascriptName The value to check for JavaScript identifier validity.
|
|
7
|
+
* @returns `true` if the value is a valid JavaScript name, false otherwise.
|
|
8
8
|
* @public exported from `@promptbook/utils`
|
|
9
9
|
*/
|
|
10
10
|
export declare function isValidJavascriptName(javascriptName: really_unknown): javascriptName is string_javascript_name;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { string_parameter_name } from '../../../types/typeAliases';
|
|
2
2
|
/**
|
|
3
|
-
* Function `validateParameterName` will
|
|
3
|
+
* Function `validateParameterName` will normalize and validate a parameter name for use in pipelines.
|
|
4
|
+
* It removes diacritics, emojis, and quotes, normalizes to camelCase, and checks for reserved names and invalid characters.
|
|
4
5
|
*
|
|
5
|
-
* @param parameterName
|
|
6
|
-
* @returns
|
|
7
|
-
* @throws {ParseError}
|
|
6
|
+
* @param parameterName The parameter name to validate and normalize.
|
|
7
|
+
* @returns The validated and normalized parameter name.
|
|
8
|
+
* @throws {ParseError} If the parameter name is empty, reserved, or contains invalid characters.
|
|
8
9
|
* @private within the repository
|
|
9
10
|
*/
|
|
10
11
|
export declare function validateParameterName(parameterName: string): string_parameter_name;
|
|
@@ -6,7 +6,7 @@ import type { really_unknown } from '../../organization/really_unknown';
|
|
|
6
6
|
*
|
|
7
7
|
* @see https://www.npmjs.com/package/promptbook?activeTab=versions
|
|
8
8
|
* Note: When you are using for example promptbook 2.0.0 and there already is promptbook 3.0.0 it don`t know about it.
|
|
9
|
-
* Note: There are two
|
|
9
|
+
* Note: There are two similar functions:
|
|
10
10
|
* - `isValidSemanticVersion` which tests any semantic version
|
|
11
11
|
* - `isValidPromptbookVersion` *(this one)* which tests just Promptbook versions
|
|
12
12
|
*
|
|
@@ -3,7 +3,7 @@ import type { really_unknown } from '../../organization/really_unknown';
|
|
|
3
3
|
/**
|
|
4
4
|
* Tests if given string is valid semantic version
|
|
5
5
|
*
|
|
6
|
-
* Note: There are two
|
|
6
|
+
* Note: There are two similar functions:
|
|
7
7
|
* - `isValidSemanticVersion` which tests any semantic version
|
|
8
8
|
* - `isValidPromptbookVersion` *(this one)* which tests just Promptbook versions
|
|
9
9
|
*
|
|
@@ -2,7 +2,7 @@ import type { string_hostname } from '../../../types/typeAliases';
|
|
|
2
2
|
/**
|
|
3
3
|
* Checks if an URL is reserved for private networks or localhost.
|
|
4
4
|
*
|
|
5
|
-
* Note: There are two
|
|
5
|
+
* Note: There are two similar functions:
|
|
6
6
|
* - `isUrlOnPrivateNetwork` which tests full URL
|
|
7
7
|
* - `isHostnameOnPrivateNetwork` *(this one)* which tests just hostname
|
|
8
8
|
*
|
|
@@ -2,7 +2,7 @@ import type { string_url } from '../../../types/typeAliases';
|
|
|
2
2
|
/**
|
|
3
3
|
* Checks if an IP address or hostname is reserved for private networks or localhost.
|
|
4
4
|
*
|
|
5
|
-
* Note: There are two
|
|
5
|
+
* Note: There are two similar functions:
|
|
6
6
|
* - `isUrlOnPrivateNetwork` *(this one)* which tests full URL
|
|
7
7
|
* - `isHostnameOnPrivateNetwork` which tests just hostname
|
|
8
8
|
*
|
|
@@ -3,7 +3,7 @@ import type { really_unknown } from '../../organization/really_unknown';
|
|
|
3
3
|
/**
|
|
4
4
|
* Tests if given string is valid pipeline URL URL.
|
|
5
5
|
*
|
|
6
|
-
* Note: There are two
|
|
6
|
+
* Note: There are two similar functions:
|
|
7
7
|
* - `isValidUrl` which tests any URL
|
|
8
8
|
* - `isValidPipelineUrl` *(this one)* which tests just pipeline URL
|
|
9
9
|
*
|
|
@@ -4,7 +4,7 @@ import type { really_unknown } from '../../organization/really_unknown';
|
|
|
4
4
|
* Tests if given string is valid URL.
|
|
5
5
|
*
|
|
6
6
|
* Note: Dataurl are considered perfectly valid.
|
|
7
|
-
* Note: There are two
|
|
7
|
+
* Note: There are two similar functions:
|
|
8
8
|
* - `isValidUrl` which tests any URL
|
|
9
9
|
* - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
|
|
10
10
|
*
|
|
@@ -14,7 +14,8 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
14
14
|
*/
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Represents the version string of the Promptbook engine.
|
|
18
|
+
* It follows semantic versioning (e.g., `0.92.0-35`).
|
|
18
19
|
*
|
|
19
20
|
* @generated
|
|
20
21
|
*/
|
|
@@ -24,7 +24,7 @@ declare class Wizzard {
|
|
|
24
24
|
* 2) As a URL https://promptbook.studio/hejny/write-cv.book fetched from the internet
|
|
25
25
|
* 3) As a string
|
|
26
26
|
*
|
|
27
|
-
* Note: This works
|
|
27
|
+
* Note: This works similar to the `ptbk run` command
|
|
28
28
|
*/
|
|
29
29
|
execute(book: string_pipeline_url | string_filename | PipelineString, inputParameters: InputParameters): Promise<{
|
|
30
30
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/google",
|
|
3
|
-
"version": "0.92.0
|
|
3
|
+
"version": "0.92.0",
|
|
4
4
|
"description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -47,11 +47,23 @@
|
|
|
47
47
|
"node": ">=16.0.0",
|
|
48
48
|
"npm": ">=8.0.0"
|
|
49
49
|
},
|
|
50
|
+
"cspell": {
|
|
51
|
+
"version": "0.2",
|
|
52
|
+
"language": "en",
|
|
53
|
+
"ignorePaths": [
|
|
54
|
+
"node_modules",
|
|
55
|
+
".next",
|
|
56
|
+
"coverage",
|
|
57
|
+
"dist",
|
|
58
|
+
".git"
|
|
59
|
+
],
|
|
60
|
+
"words": []
|
|
61
|
+
},
|
|
50
62
|
"main": "./umd/index.umd.js",
|
|
51
63
|
"module": "./esm/index.es.js",
|
|
52
64
|
"typings": "./esm/typings/src/_packages/google.index.d.ts",
|
|
53
65
|
"peerDependencies": {
|
|
54
|
-
"@promptbook/core": "0.92.0
|
|
66
|
+
"@promptbook/core": "0.92.0"
|
|
55
67
|
},
|
|
56
68
|
"dependencies": {
|
|
57
69
|
"@ai-sdk/google": "1.0.5",
|
package/umd/index.umd.js
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* @generated
|
|
24
24
|
* @see https://github.com/webgptorg/promptbook
|
|
25
25
|
*/
|
|
26
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.92.0
|
|
26
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0';
|
|
27
27
|
/**
|
|
28
28
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
29
29
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
super(message);
|
|
74
74
|
this.name = 'PipelineExecutionError';
|
|
75
75
|
// TODO: [🐙] DRY - Maybe $randomId
|
|
76
|
-
this.id = `error-${$randomToken(8 /* <- TODO: To global config + Use Base58 to avoid
|
|
76
|
+
this.id = `error-${$randomToken(8 /* <- TODO: To global config + Use Base58 to avoid similar char conflicts */)}`;
|
|
77
77
|
Object.setPrototypeOf(this, PipelineExecutionError.prototype);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -424,10 +424,10 @@
|
|
|
424
424
|
*/
|
|
425
425
|
|
|
426
426
|
/**
|
|
427
|
-
*
|
|
427
|
+
* Removes diacritic marks (accents) from characters in a string.
|
|
428
428
|
*
|
|
429
|
-
* @param input
|
|
430
|
-
* @returns
|
|
429
|
+
* @param input The string containing diacritics to be normalized.
|
|
430
|
+
* @returns The string with diacritics removed or normalized.
|
|
431
431
|
* @public exported from `@promptbook/utils`
|
|
432
432
|
*/
|
|
433
433
|
function removeDiacritics(input) {
|
|
@@ -573,14 +573,18 @@
|
|
|
573
573
|
/**
|
|
574
574
|
* Make UncertainNumber
|
|
575
575
|
*
|
|
576
|
-
* @param value
|
|
576
|
+
* @param value value of the uncertain number, if `NaN` or `undefined`, it will be set to 0 and `isUncertain=true`
|
|
577
|
+
* @param isUncertain if `true`, the value is uncertain, otherwise depends on the value
|
|
577
578
|
*
|
|
578
579
|
* @private utility for initializating UncertainNumber
|
|
579
580
|
*/
|
|
580
|
-
function uncertainNumber(value) {
|
|
581
|
+
function uncertainNumber(value, isUncertain) {
|
|
581
582
|
if (value === null || value === undefined || Number.isNaN(value)) {
|
|
582
583
|
return UNCERTAIN_ZERO_VALUE;
|
|
583
584
|
}
|
|
585
|
+
if (isUncertain === true) {
|
|
586
|
+
return { value, isUncertain };
|
|
587
|
+
}
|
|
584
588
|
return { value };
|
|
585
589
|
}
|
|
586
590
|
|
|
@@ -646,7 +650,7 @@
|
|
|
646
650
|
const SMALL_NUMBER = 0.001;
|
|
647
651
|
// <- TODO: [🧜♂️]
|
|
648
652
|
/**
|
|
649
|
-
*
|
|
653
|
+
* Default settings for parsing and generating CSV files in Promptbook.
|
|
650
654
|
*
|
|
651
655
|
* @public exported from `@promptbook/core`
|
|
652
656
|
*/
|
|
@@ -731,7 +735,7 @@
|
|
|
731
735
|
${block(message)}
|
|
732
736
|
|
|
733
737
|
Note: This error should not happen.
|
|
734
|
-
It's
|
|
738
|
+
It's probably a bug in the pipeline collection
|
|
735
739
|
|
|
736
740
|
Please report issue:
|
|
737
741
|
${block(getErrorReportUrl(new Error(message)).href)}
|
|
@@ -931,8 +935,12 @@
|
|
|
931
935
|
*/
|
|
932
936
|
|
|
933
937
|
/**
|
|
934
|
-
*
|
|
938
|
+
* Creates a deep clone of the given object
|
|
939
|
+
*
|
|
940
|
+
* Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
|
|
935
941
|
*
|
|
942
|
+
* @param objectValue The object to clone.
|
|
943
|
+
* @returns A deep, writable clone of the input object.
|
|
936
944
|
* @public exported from `@promptbook/utils`
|
|
937
945
|
*/
|
|
938
946
|
function deepClone(objectValue) {
|
|
@@ -994,13 +1002,13 @@
|
|
|
994
1002
|
*/
|
|
995
1003
|
const REPLACING_NONCE = 'ptbkauk42kV2dzao34faw7FudQUHYPtW';
|
|
996
1004
|
/**
|
|
997
|
-
*
|
|
1005
|
+
* Placeholder value indicating a parameter is missing its value.
|
|
998
1006
|
*
|
|
999
1007
|
* @private within the repository
|
|
1000
1008
|
*/
|
|
1001
1009
|
const RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
|
|
1002
1010
|
/**
|
|
1003
|
-
*
|
|
1011
|
+
* Placeholder value indicating a parameter is restricted and cannot be used directly.
|
|
1004
1012
|
*
|
|
1005
1013
|
* @private within the repository
|
|
1006
1014
|
*/
|
|
@@ -1238,12 +1246,14 @@
|
|
|
1238
1246
|
const { vercelProvider, availableModels, userId, additionalChatSettings = {} } = options;
|
|
1239
1247
|
if (!/Vercel/i.test(title)) {
|
|
1240
1248
|
title = `${title} (through Vercel)`;
|
|
1249
|
+
// <- TODO: [🧈] Maybe standartize the suffix
|
|
1241
1250
|
} /* not else */
|
|
1242
1251
|
if (description === undefined) {
|
|
1243
1252
|
description = `Implementation of ${title} through Vercel`;
|
|
1244
1253
|
} /* not else */
|
|
1245
1254
|
if (!/Vercel/i.test(description)) {
|
|
1246
1255
|
description = `${description} (through Vercel)`;
|
|
1256
|
+
// <- TODO: [🧈] Maybe standartize the suffix
|
|
1247
1257
|
} /* not else */
|
|
1248
1258
|
return {
|
|
1249
1259
|
title,
|
|
@@ -1371,7 +1381,7 @@
|
|
|
1371
1381
|
/**
|
|
1372
1382
|
* List of available Google models with descriptions
|
|
1373
1383
|
*
|
|
1374
|
-
* Note: Done at 2025-
|
|
1384
|
+
* Note: Done at 2025-05-06
|
|
1375
1385
|
*
|
|
1376
1386
|
* @see https://ai.google.dev/models/gemini
|
|
1377
1387
|
* @public exported from `@promptbook/google`
|
|
@@ -1385,8 +1395,8 @@
|
|
|
1385
1395
|
modelName: 'gemini-2.5-pro-preview-03-25',
|
|
1386
1396
|
modelDescription: 'Latest advanced multimodal model with exceptional reasoning, tool use, and instruction following. 1M token context window with improved vision capabilities for complex visual tasks.',
|
|
1387
1397
|
pricing: {
|
|
1388
|
-
prompt: computeUsage(`$
|
|
1389
|
-
output: computeUsage(`$
|
|
1398
|
+
prompt: computeUsage(`$8.00 / 1M tokens`),
|
|
1399
|
+
output: computeUsage(`$24.00 / 1M tokens`),
|
|
1390
1400
|
},
|
|
1391
1401
|
},
|
|
1392
1402
|
{
|
|
@@ -1425,8 +1435,8 @@
|
|
|
1425
1435
|
modelName: 'gemini-1.5-flash',
|
|
1426
1436
|
modelDescription: 'Efficient model balancing speed and quality for general-purpose applications. 1M token context window with good multimodal capabilities and quick response times.',
|
|
1427
1437
|
pricing: {
|
|
1428
|
-
prompt: computeUsage(`$0.
|
|
1429
|
-
output: computeUsage(`$
|
|
1438
|
+
prompt: computeUsage(`$0.25 / 1M tokens`),
|
|
1439
|
+
output: computeUsage(`$0.75 / 1M tokens`),
|
|
1430
1440
|
},
|
|
1431
1441
|
},
|
|
1432
1442
|
{
|
|
@@ -1493,8 +1503,8 @@
|
|
|
1493
1503
|
modelName: 'gemini-1.5-pro',
|
|
1494
1504
|
modelDescription: 'Flagship multimodal model with strong performance across text, code, vision, and audio tasks. 1M token context window with excellent reasoning capabilities.',
|
|
1495
1505
|
pricing: {
|
|
1496
|
-
prompt: computeUsage(`$
|
|
1497
|
-
output: computeUsage(`$
|
|
1506
|
+
prompt: computeUsage(`$6.00 / 1M tokens`),
|
|
1507
|
+
output: computeUsage(`$18.00 / 1M tokens`),
|
|
1498
1508
|
},
|
|
1499
1509
|
},
|
|
1500
1510
|
{
|
|
@@ -1591,7 +1601,8 @@
|
|
|
1591
1601
|
}
|
|
1592
1602
|
|
|
1593
1603
|
/**
|
|
1594
|
-
*
|
|
1604
|
+
* Safely retrieves the global scope object (window in browser, global in Node.js)
|
|
1605
|
+
* regardless of the JavaScript environment in which the code is running
|
|
1595
1606
|
*
|
|
1596
1607
|
* Note: `$` is used to indicate that this function is not a pure function - it access global scope
|
|
1597
1608
|
*
|
|
@@ -1602,10 +1613,10 @@
|
|
|
1602
1613
|
}
|
|
1603
1614
|
|
|
1604
1615
|
/**
|
|
1605
|
-
*
|
|
1616
|
+
* Normalizes a text string to SCREAMING_CASE (all uppercase with underscores).
|
|
1606
1617
|
*
|
|
1607
|
-
* @param text
|
|
1608
|
-
* @returns
|
|
1618
|
+
* @param text The text string to be converted to SCREAMING_CASE format.
|
|
1619
|
+
* @returns The normalized text in SCREAMING_CASE format.
|
|
1609
1620
|
* @example 'HELLO_WORLD'
|
|
1610
1621
|
* @example 'I_LOVE_PROMPTBOOK'
|
|
1611
1622
|
* @public exported from `@promptbook/utils`
|
|
@@ -1657,10 +1668,10 @@
|
|
|
1657
1668
|
*/
|
|
1658
1669
|
|
|
1659
1670
|
/**
|
|
1660
|
-
*
|
|
1671
|
+
* Normalizes a text string to snake_case format.
|
|
1661
1672
|
*
|
|
1662
|
-
* @param text
|
|
1663
|
-
* @returns
|
|
1673
|
+
* @param text The text string to be converted to snake_case format.
|
|
1674
|
+
* @returns The normalized text in snake_case format.
|
|
1664
1675
|
* @example 'hello_world'
|
|
1665
1676
|
* @example 'i_love_promptbook'
|
|
1666
1677
|
* @public exported from `@promptbook/utils`
|
|
@@ -1670,11 +1681,11 @@
|
|
|
1670
1681
|
}
|
|
1671
1682
|
|
|
1672
1683
|
/**
|
|
1673
|
-
*
|
|
1684
|
+
* Global registry for storing and managing registered entities of a given type.
|
|
1674
1685
|
*
|
|
1675
1686
|
* Note: `$` is used to indicate that this function is not a pure function - it accesses and adds variables in global scope.
|
|
1676
1687
|
*
|
|
1677
|
-
* @private internal utility, exported are only
|
|
1688
|
+
* @private internal utility, exported are only singleton instances of this class
|
|
1678
1689
|
*/
|
|
1679
1690
|
class $Register {
|
|
1680
1691
|
constructor(registerName) {
|
|
@@ -1718,10 +1729,10 @@
|
|
|
1718
1729
|
}
|
|
1719
1730
|
|
|
1720
1731
|
/**
|
|
1721
|
-
*
|
|
1732
|
+
* Register for LLM tools.
|
|
1722
1733
|
*
|
|
1723
1734
|
* Note: `$` is used to indicate that this interacts with the global scope
|
|
1724
|
-
* @singleton Only one instance of each register is created per build, but
|
|
1735
|
+
* @singleton Only one instance of each register is created per build, but there can be more instances across different builds or environments.
|
|
1725
1736
|
* @public exported from `@promptbook/core`
|
|
1726
1737
|
*/
|
|
1727
1738
|
const $llmToolsRegister = new $Register('llm_execution_tools_constructors');
|