New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More β†’
Socket
Sign inDemoInstall
Socket

@promptbook/remote-client

Package Overview
Dependencies
Maintainers
0
Versions
559
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@promptbook/remote-client - npm Package Compare versions

Comparing version 0.61.0-15 to 0.61.0-16

esm/typings/src/config.test.d.ts

2

esm/index.es.js

@@ -217,3 +217,3 @@ import { io } from 'socket.io-client';

*/
var PROMPTBOOK_VERSION = '0.61.0-14';
var PROMPTBOOK_VERSION = '0.61.0-15';
// TODO: !!!! List here all the versions and annotate + put into script

@@ -220,0 +220,0 @@

@@ -12,7 +12,5 @@ declare const _default: ({

promptTemplates: {
blockType: string;
name: string;
title: string;
dependentParameterNames: string[];
blockType: string;
personaName: null;
modelRequirements: {

@@ -23,2 +21,3 @@ modelVariant: string;

content: string;
dependentParameterNames: string[];
resultingParameterName: string;

@@ -96,6 +95,10 @@ }[];

promptTemplates: {
blockType: string;
name: string;
title: string;
dependentParameterNames: string[];
blockType: string;
modelRequirements: {
modelVariant: string;
modelName: string;
};
content: string;
expectations: {

@@ -107,8 +110,3 @@ words: {

};
personaName: null;
modelRequirements: {
modelVariant: string;
modelName: string;
};
content: string;
dependentParameterNames: string[];
resultingParameterName: string;

@@ -186,8 +184,5 @@ }[];

promptTemplates: {
blockType: string;
name: string;
title: string;
dependentParameterNames: string[];
blockType: string;
expectFormat: string;
personaName: null;
modelRequirements: {

@@ -198,2 +193,4 @@ modelVariant: string;

content: string;
expectFormat: string;
dependentParameterNames: string[];
resultingParameterName: string;

@@ -200,0 +197,0 @@ }[];

@@ -12,2 +12,3 @@ import { collectionToJson } from '../collection/collectionToJson';

import { prettifyPipelineString } from '../conversion/prettify/prettifyPipelineString';
import { stringifyPipelineJson } from '../conversion/utils/stringifyPipelineJson';
import { validatePipeline } from '../conversion/validation/validatePipeline';

@@ -45,3 +46,3 @@ import { CollectionError } from '../errors/CollectionError';

export { SimplePromptInterfaceTools };
export { pipelineJsonToString, pipelineStringToJson, pipelineStringToJsonSync, validatePipeline };
export { pipelineJsonToString, pipelineStringToJson, pipelineStringToJsonSync, stringifyPipelineJson, validatePipeline, };
export { preparePipeline, unpreparePipeline };

@@ -48,0 +49,0 @@ export { createPipelineExecutor, joinLlmExecutionTools };

@@ -15,3 +15,2 @@ import type { PipelineCollection } from '../collection/PipelineCollection';

import type { ModelVariant } from '../types/ModelVariant';
import type { Parameters } from '../types/Parameters';
import type { ExpectationAmount, ExpectationUnit, Expectations } from '../types/PipelineJson/Expectations';

@@ -36,3 +35,3 @@ import { EXPECTATION_UNITS } from '../types/PipelineJson/Expectations';

import type { string_char_emoji } from '../types/typeAliasEmoji';
import type { client_id, number_model_temperature, number_seed, string_char, string_chat_prompt, string_completion_prompt, string_data_url, string_domain, string_email, string_emails, string_file_absolute_path, string_file_extension, string_file_path, string_file_relative_path, string_filename, string_folder_absolute_path, string_folder_path, string_folder_relative_path, string_host, string_hostname, string_href, string_html, string_javascript, string_javascript_name, string_license, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_parameter_name, string_parameter_value, string_person_fullname, string_pipeline_url, string_pipeline_url_with_hashtemplate, string_prompt, string_script, string_semantic_version, string_sha256, string_system_message, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_uri, string_uri_part, string_url, string_url_image, string_uuid } from '../types/typeAliases';
import type { Parameters, ReservedParameters, client_id, number_model_temperature, number_seed, string_char, string_chat_prompt, string_completion_prompt, string_data_url, string_domain, string_email, string_emails, string_file_absolute_path, string_file_extension, string_file_path, string_file_relative_path, string_filename, string_folder_absolute_path, string_folder_path, string_folder_relative_path, string_host, string_hostname, string_href, string_html, string_javascript, string_javascript_name, string_license, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_parameter_name, string_parameter_value, string_person_fullname, string_pipeline_url, string_pipeline_url_with_hashtemplate, string_prompt, string_promptbook_documentation_url, string_reserved_parameter_name, string_script, string_semantic_version, string_sha256, string_system_message, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_uri, string_uri_part, string_url, string_url_image, string_uuid } from '../types/typeAliases';
import type { FromtoItems } from '../utils/FromtoItems';

@@ -42,5 +41,5 @@ import { PROMPTBOOK_VERSION, string_promptbook_version } from '../version';

export { EXPECTATION_UNITS };
export type { AvailableModel, BlockType, CommonExecutionToolsOptions, EmbeddingVector, ExecutionReportJson, ExecutionTools, ExpectationAmount, ExpectationUnit, Expectations, FromtoItems, KnowledgePiecePreparedJson, KnowledgeSourceJson, KnowledgeSourcePreparedJson, LlmExecutionTools, LlmTemplateJson, ModelRequirements, ModelVariant, Parameters, PersonaJson, PersonaPreparedJson, PipelineCollection, PipelineExecutor, PipelineJson, PipelineString, PreparationJson, Prompt, ChatPromptResult as PromptChatResult, CommonPromptResult as PromptCommonResult, CompletionPromptResult as PromptCompletionResult, PromptDialogJson, EmbeddingPromptResult as PromptEmbeddingResult, PromptResult, PromptResultUsage, PromptResultUsageCounts, PromptTemplateJson, PromptTemplateParameterJson, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptJson, ScriptLanguage, SimpleTemplateJson, TaskProgress, UncertainNumber, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, client_id, number_model_temperature, number_seed, string_char, string_char_emoji, string_chat_prompt, string_completion_prompt, string_data_url, string_domain, string_email, string_emails, string_file_absolute_path, string_file_extension, string_file_path, string_file_relative_path, string_filename, string_folder_absolute_path, string_folder_path, string_folder_relative_path, string_host, string_hostname, string_href, string_html, string_javascript, string_javascript_name, string_license, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_parameter_name, string_parameter_value, string_person_fullname, string_pipeline_url, string_pipeline_url_with_hashtemplate, string_prompt, string_promptbook_version, string_script, string_semantic_version, string_sha256, string_system_message, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_uri, string_uri_part, string_url, string_url_image, string_uuid, };
export type { AvailableModel, BlockType, CommonExecutionToolsOptions, EmbeddingVector, ExecutionReportJson, ExecutionTools, ExpectationAmount, ExpectationUnit, Expectations, FromtoItems, KnowledgePiecePreparedJson, KnowledgeSourceJson, KnowledgeSourcePreparedJson, LlmExecutionTools, LlmTemplateJson, ModelRequirements, ModelVariant, Parameters, PersonaJson, PersonaPreparedJson, PipelineCollection, PipelineExecutor, PipelineJson, PipelineString, PreparationJson, Prompt, ChatPromptResult as PromptChatResult, CommonPromptResult as PromptCommonResult, CompletionPromptResult as PromptCompletionResult, PromptDialogJson, EmbeddingPromptResult as PromptEmbeddingResult, PromptResult, PromptResultUsage, PromptResultUsageCounts, PromptTemplateJson, PromptTemplateParameterJson, ReservedParameters, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptJson, ScriptLanguage, SimpleTemplateJson, TaskProgress, UncertainNumber, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, client_id, number_model_temperature, number_seed, string_char, string_char_emoji, string_chat_prompt, string_completion_prompt, string_data_url, string_domain, string_email, string_emails, string_file_absolute_path, string_file_extension, string_file_path, string_file_relative_path, string_filename, string_folder_absolute_path, string_folder_path, string_folder_relative_path, string_host, string_hostname, string_href, string_html, string_javascript, string_javascript_name, string_license, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_parameter_name, string_parameter_value, string_person_fullname, string_pipeline_url, string_pipeline_url_with_hashtemplate, string_prompt, string_promptbook_documentation_url, string_promptbook_version, string_reserved_parameter_name, string_script, string_semantic_version, string_sha256, string_system_message, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_uri, string_uri_part, string_url, string_url_image, string_uuid, };
/**
* TODO: Delete type aliases (from ../types/typeAliases) that are not exported here
*/

@@ -8,3 +8,2 @@ import { spaceTrim } from 'spacetrim';

import { forEachAsync } from '../execution/utils/forEachAsync';
import { replaceParameters } from '../execution/utils/replaceParameters';
import { isValidJsonString } from '../formats/json/utils/isValidJsonString';

@@ -42,2 +41,3 @@ import { extractBlock } from '../postprocessing/utils/extractBlock';

import { removeQuotes } from '../utils/removeQuotes';
import { replaceParameters } from '../utils/replaceParameters';
import { difference } from '../utils/sets/difference';

@@ -60,5 +60,6 @@ import { intersection } from '../utils/sets/intersection';

export { forEachAsync, PROMPTBOOK_VERSION };
export { extractParameters, extractVariables, replaceParameters, spaceTrim };
export { $currentDate, $randomSeed, extractBlock, // <- [🌻] + maybe export through `@promptbook/markdown-utils`
extractParameters, extractVariables, isHostnameOnPrivateNetwork, isUrlOnPrivateNetwork, isValidFilePath, isValidJavascriptName, isValidJsonString, isValidPipelineUrl, isValidPromptbookVersion, isValidSemanticVersion, isValidUrl, isValidUuid, parseNumber, // <- [🌻]
removeEmojis, removeQuotes, replaceParameters, spaceTrim, trimCodeBlock, trimEndOfCodeBlock, unwrapResult, };
isHostnameOnPrivateNetwork, isUrlOnPrivateNetwork, isValidFilePath, isValidJavascriptName, isValidJsonString, isValidPipelineUrl, isValidPromptbookVersion, isValidSemanticVersion, isValidUrl, isValidUuid, parseNumber, // <- [🌻]
removeEmojis, removeQuotes, trimCodeBlock, trimEndOfCodeBlock, unwrapResult, };
export { countCharacters, countLines, countPages, countParagraphs, countSentences, CountUtils, countWords };

@@ -65,0 +66,0 @@ export { splitIntoSentences };

import type { WritableDeep } from 'type-fest';
import type { PromptTemplateJson } from '../../../types/PipelineJson/PromptTemplateJson';
import type { PipelineJson } from '../../../types/PipelineJson/PipelineJson';
import type { string_markdown_text } from '../../../types/typeAliases';
import type { string_name } from '../../../types/typeAliases';
import type { string_promptbook_documentation_url } from '../../../types/typeAliases';
import type { string_SCREAMING_CASE } from '../../../utils/normalization/normalizeTo_SCREAMING_CASE';

@@ -15,3 +17,3 @@ import type { CommandUsagePlace } from './CommandUsagePlaces';

readonly description: string_markdown_text;
readonly discussionUrl: `https://github.com/webgptorg/promptbook/discussions/${number | '@@'}`;
readonly documentationUrl: string_promptbook_documentation_url;
readonly examples: Array<string_markdown_text>;

@@ -22,3 +24,6 @@ /**

parse(input: CommandParserInput): TCommand;
applyToPipelineJson?(pipelineJson: WritableDeep<PipelineJson>, personaCommand: TCommand): void;
/**
* @@@ Mutated by the command
*/
applyToPipelineJson?(command: TCommand, subjects: ApplyToPipelineJsonSubjects): void;
};

@@ -33,5 +38,25 @@ export type CommandParserInput = {

/**
* @@@ Mutated by the command
*/
export type ApplyToPipelineJsonSubjects = {
/**
* @@@ Mutated by the command
*/
readonly pipelineJson: WritableDeep<PipelineJson>;
/**
* @@@
*
* @@@ Mutated by the command
*
* When used in
* - `PIPELINE_HEAD` it is `null`
* - `PIPELINE_TEMPLATE` it is the prompt template
*/
readonly templateJson: null | Partial<WritableDeep<PromptTemplateJson>>;
};
/**
* TODO: @@@ Annotate all
* TODO: [🍧][♓️] Add order here
* TODO: [🧠] Maybe put flag if it is for whole `.ptbk.md` file of just one section
* TODO: [🍧] CommandParser should have applyToPipelineJson method
* TODO: [🍧] All commands must implement `applyToPipelineJson` method
* which will apply parsed command to the pipeline JSON

@@ -38,0 +63,0 @@ * it will be called from `pipelineStringToJsonSync`

@@ -1,3 +0,2 @@

import type { string_file_relative_path } from '../../types/typeAliases';
import type { string_url } from '../../types/typeAliases';
import type { string_knowledge_source } from '../../types/typeAliases';
/**

@@ -11,3 +10,3 @@ * Parsed KNOWLEDGE command

readonly type: 'KNOWLEDGE';
readonly source: string_url | string_file_relative_path;
readonly source: string_knowledge_source;
};

@@ -14,2 +14,6 @@ /**

/**
* The maximum number of attempts to execute LLM task before giving up
*/
export declare const MAX_EXECUTION_ATTEMPTS = 3;
/**
* The maximum length of the (generated) filename

@@ -19,2 +23,16 @@ */

/**
* @@@
* TODO: [🐝] !!! Use
*/
export declare const MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH = 3;
/**
* @@@
* TODO: [🐝] !!! Use
*/
export declare const MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL = 200;
/**
* Where to store the cache of executions for promptbook CLI
*/
export declare const EXECUTIONS_CACHE_DIRNAME = "/.promptbook/executions-cache";
/**
* The name of the builded pipeline collection made by CLI `ptbk make` and for lookup in `createCollectionFromDirectory`

@@ -26,6 +44,13 @@ */

*/
export declare const RESERVED_PARAMETER_NAMES: readonly string[];
export declare const RESERVED_PARAMETER_NAMES: readonly ["context", "currentDate"];
/**
* @@@
*/
export declare const DEBUG_ALLOW_PAYED_TESTING: boolean;
/**
* Nonce which is used for replacing things in strings
*/
export declare const REPLACING_NONCE = "u$k42k%!V2zo34w7Fu#@QUHYPW";
/**
* TODO: [πŸ”Ό] Export all to core
*/
import type { PromptTemplateJson } from '../../types/PipelineJson/PromptTemplateJson';
import type { string_name } from '../../types/typeAliases';
import type { string_parameter_name } from '../../types/typeAliases';
/**

@@ -10,5 +10,5 @@ * Parses the prompt template and returns the set of all used parameters

*/
export declare function extractParametersFromPromptTemplate(promptTemplate: Pick<PromptTemplateJson, 'title' | 'description' | 'blockType' | 'content'>): Set<string_name>;
export declare function extractParametersFromPromptTemplate(promptTemplate: Pick<PromptTemplateJson, 'title' | 'description' | 'blockType' | 'content' | 'jokerParameterNames'>): Set<string_parameter_name>;
/**
* TODO: [πŸ”£] If script require contentLanguage
*/

@@ -10,5 +10,5 @@ import type { string_json } from '../../types/typeAliases';

/**
* TODO: !!!! Not Working propperly @see https://promptbook.studio/samples/mixed-knowledge.ptbk.md
* TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
* TODO: [πŸ”Ό] Export alongside pipelineStringToJson
* TODO: [🧠] Maybe more elegant solution than replacing via regex
*/

@@ -31,4 +31,7 @@ import type { PipelineJson } from '../../types/PipelineJson/PipelineJson';

* TODO: [🧠][🐣] !!!! Validate that knowledge is valid (non-void)
* TODO: [🧠][🐣] !!!! Validate that persona can be used only with CHAT variant
* TODO: !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
* TODO: !!!! Validate that reserved parameter is not used as joker
* TODO: [🧠] !!! Validationg not only logic itself but imports around - files and websites and rerefenced pipelines exists
* TODO: [πŸ› ] Actions, instruments (and maybe knowledge) => Functions and tools
*/

@@ -8,5 +8,17 @@ import type { PipelineJson } from '../types/PipelineJson/PipelineJson';

*
* @default 3
* @default MAX_EXECUTION_ATTEMPTS
*/
readonly maxExecutionAttempts: number;
readonly maxExecutionAttempts?: number;
/**
* Maximum number of tasks running in parallel
*
* @default MAX_PARALLEL_COUNT
*/
readonly maxParallelCount?: number;
/**
* If true, the preparation logs additional information
*
* @default false
*/
readonly isVerbose?: boolean;
};

@@ -39,3 +51,4 @@ /**

/**
* TODO: [πŸͺ‚] Pass maxParallelCount here
* TODO: Use isVerbose here (not only pass to `preparePipeline`)
* TODO: [πŸͺ‚] Use maxParallelCount here (not only pass to `preparePipeline`)
* TODO: [β™ˆ] Probbably move expectations from templates to parameters

@@ -42,0 +55,0 @@ * TODO: [🧠] When not meet expectations in PROMPT_DIALOG, make some way to tell the user

import type { Promisable } from 'type-fest';
import { PipelineExecutionError } from '../errors/PipelineExecutionError';
import type { TaskProgress } from '../types/TaskProgress';
import type { ExecutionReportJson } from '../types/execution-report/ExecutionReportJson';
import type { string_parameter_name } from '../types/typeAliases';
import type { string_parameter_value } from '../types/typeAliases';
import type { Parameters } from '../types/typeAliases';
import type { PromptResultUsage } from './PromptResultUsage';

@@ -16,3 +16,3 @@ /**

export type PipelineExecutor = {
(inputParameters: Record<string_parameter_name, string_parameter_value>, onProgress?: (taskProgress: TaskProgress) => Promisable<void>): Promise<{
(inputParameters: Parameters, onProgress?: (taskProgress: TaskProgress) => Promisable<void>): Promise<{
/**

@@ -29,3 +29,3 @@ * Whether the execution was successful, details are aviable in `executionReport`

*/
readonly errors: Array<Error>;
readonly errors: Array<PipelineExecutionError | Error>;
/**

@@ -40,3 +40,3 @@ * The report of the execution with all details

*/
readonly outputParameters: Record<string_parameter_name, string_parameter_value>;
readonly outputParameters: Parameters;
}>;

@@ -43,0 +43,0 @@ };

@@ -13,11 +13,11 @@ import type { KebabCase } from 'type-fest';

*/
price: UncertainNumber;
readonly price: UncertainNumber;
/**
* Number of whatever used in the input aka. `prompt_tokens`
*/
input: PromptResultUsageCounts;
readonly input: PromptResultUsageCounts;
/**
* Number of tokens used in the output aka. `completion_tokens`
*/
output: PromptResultUsageCounts;
readonly output: PromptResultUsageCounts;
};

@@ -24,0 +24,0 @@ /**

import type { ScriptLanguage } from '../types/ScriptLanguage';
import type { string_parameter_name } from '../types/typeAliases';
import type { string_parameter_value } from '../types/typeAliases';
import type { Parameters } from '../types/typeAliases';
import type { string_script } from '../types/typeAliases';

@@ -26,3 +25,3 @@ /**

*/
readonly parameters: Record<string_parameter_name, string_parameter_value>;
readonly parameters: Parameters;
/**

@@ -29,0 +28,0 @@ * The content of the script to execute

@@ -68,3 +68,3 @@ import type { string_mime_type } from '../../types/typeAliases';

* TODO: [πŸ“][🧠] llm Provider Bindings
* TODO: [πŸ“]Export via some package
* TODO: [πŸ“][πŸ”Ό] Export via some package
*/

@@ -11,3 +11,3 @@ import type { PrepareOptions } from '../../../prepare/PrepareOptions';

/**
* TODO: [πŸ”Ό] !!! Export via `@promptbook/core`
* TODO: [🐝][πŸ”Ό] !!! Export via `@promptbook/core`
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time

@@ -14,0 +14,0 @@ * Put `knowledgePieces` into `PrepareKnowledgeOptions`

@@ -9,5 +9,5 @@ import type { PrepareOptions } from '../../../prepare/PrepareOptions';

/**
* TODO: [πŸ”Ό] !!! Export via `@promptbook/markdown`
* TODO: [🐝][πŸ”Ό] !!! Export via `@promptbook/markdown`
* TODO: [πŸͺ‚] Do it in parallel 11:11
* Note: No need to aggregate usage here, it is done by intercepting the llmTools
*/

@@ -9,3 +9,3 @@ import type { PrepareOptions } from '../../../prepare/PrepareOptions';

/**
* TODO: [πŸ”Ό] !!! Export via `@promptbook/pdf`
* TODO: [🐝][πŸ”Ό] !!! Export via `@promptbook/pdf`
* TODO: [🧺] In future, content can be alse File or Blob BUT for now for wider compatibility its only base64

@@ -12,0 +12,0 @@ * @see https://stackoverflow.com/questions/14653349/node-js-cant-create-blobs

@@ -29,3 +29,3 @@ import type { AvailableModel } from '../../execution/LlmExecutionTools';

*/
callChatModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<ChatPromptResult>;
callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<ChatPromptResult>;
/**

@@ -32,0 +32,0 @@ * Get the model that should be used as default

@@ -30,7 +30,7 @@ import type { AvailableModel } from '../../execution/LlmExecutionTools';

*/
callChatModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<ChatPromptResult>;
callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<ChatPromptResult>;
/**
* Calls Azure OpenAI API to use a complete model.
*/
callCompletionModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<CompletionPromptResult>;
callCompletionModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<CompletionPromptResult>;
/**

@@ -37,0 +37,0 @@ * Changes Azure error (which is not propper Error but object) to propper Error

@@ -21,7 +21,7 @@ import type { CommonExecutionToolsOptions } from '../../execution/CommonExecutionToolsOptions';

*/
callChatModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<ChatPromptResult>;
callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<ChatPromptResult>;
/**
* Mocks completion model
*/
callCompletionModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<CompletionPromptResult>;
callCompletionModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<CompletionPromptResult>;
/**

@@ -28,0 +28,0 @@ * List all available mocked-models that can be used

@@ -22,11 +22,11 @@ import type { CommonExecutionToolsOptions } from '../../execution/CommonExecutionToolsOptions';

*/
callChatModel(prompt: Pick<Prompt, 'content' | 'modelRequirements' | 'expectations' | 'postprocessing'>): Promise<ChatPromptResult & CompletionPromptResult>;
callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements' | 'expectations' | 'postprocessing'>): Promise<ChatPromptResult & CompletionPromptResult>;
/**
* Fakes completion model
*/
callCompletionModel(prompt: Pick<Prompt, 'content' | 'modelRequirements' | 'expectations' | 'postprocessing'>): Promise<CompletionPromptResult>;
callCompletionModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements' | 'expectations' | 'postprocessing'>): Promise<CompletionPromptResult>;
/**
* Fakes embedding model
*/
callEmbeddingModel(prompt: Pick<Prompt, 'content' | 'modelRequirements' | 'expectations' | 'postprocessing'>): Promise<EmbeddingPromptResult>;
callEmbeddingModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements' | 'expectations' | 'postprocessing'>): Promise<EmbeddingPromptResult>;
/**

@@ -33,0 +33,0 @@ * List all available fake-models that can be used

@@ -31,11 +31,11 @@ import type { AvailableModel } from '../../execution/LlmExecutionTools';

*/
callChatModel(prompt: Pick<Prompt, 'content' | 'modelRequirements' | 'expectFormat'>): Promise<ChatPromptResult>;
callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements' | 'expectFormat'>): Promise<ChatPromptResult>;
/**
* Calls OpenAI API to use a complete model.
*/
callCompletionModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<CompletionPromptResult>;
callCompletionModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<CompletionPromptResult>;
/**
* Calls OpenAI API to use a embedding model
*/
callEmbeddingModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<EmbeddingPromptResult>;
callEmbeddingModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<EmbeddingPromptResult>;
/**

@@ -42,0 +42,0 @@ * Get the model that should be used as default

@@ -11,2 +11,3 @@ import type { PipelineJson } from '../types/PipelineJson/PipelineJson';

/**
* TODO: !!!!! Index the samples and maybe templates
* TODO: [πŸ”Ό] !!! Export via `@promptbook/core`

@@ -13,0 +14,0 @@ * TODO: Write tests for `preparePipeline`

@@ -12,3 +12,3 @@ import type { ModelRequirements } from '../ModelRequirements';

*/
readonly personaName: string_name | null;
readonly personaName?: string_name;
/**

@@ -21,2 +21,3 @@ * Requirements for the model

/**
* TODO: [🧠][πŸ₯œ]
* TODO: [πŸ‘™][🧠] Maybe add `knowledge`, `actions` and `instruments` to be available granularly for each template

@@ -23,0 +24,0 @@ * @see https://github.com/webgptorg/promptbook/discussions/79

@@ -82,2 +82,3 @@ import type { string_file_path } from '../typeAliases';

/**
* TODO: [🧠] Maybe wrap all {parameterNames} in brackets for example { "resultingParameterName": "{foo}" }
* Note: There was a proposal for multiple types of promptbook objects 78816ff33e2705ee1a187aa2eb8affd976d4ea1a

@@ -84,0 +85,0 @@ * But then immediately reverted back to the single type

@@ -10,1 +10,4 @@ import type { PromptTemplateJsonCommon } from './PromptTemplateJsonCommon';

}
/**
* TODO: [🧠][πŸ₯œ]
*/

@@ -10,1 +10,5 @@ import type { ___ } from '../../utils/organization/___';

export type PromptTemplateJson = LlmTemplateJson | SimpleTemplateJson | ScriptJson | PromptDialogJson | ___ | ___ | ___ | ___;
/**
* TODO: [🧠][πŸ₯œ] What is propper name for this - "Template", "Prompt template",...
* TODO: [🧠][πŸ₯œ] Reduce confusion of `PromptTemplateJson` vs (`LlmTemplateJson` which is 'PROMPT_TEMPLATE')
*/

@@ -8,2 +8,3 @@ import type { BlockType } from '../../commands/BLOCK/BlockTypes';

import type { string_name } from '../typeAliases';
import type { string_parameter_name } from '../typeAliases';
import type { string_prompt } from '../typeAliases';

@@ -38,3 +39,3 @@ import type { string_template } from '../typeAliases';

*/
readonly dependentParameterNames: Array<string_name>;
readonly dependentParameterNames: Array<string_parameter_name>;
/**

@@ -45,3 +46,3 @@ * If theese parameters meet the expectations requirements, they are used instead of executing this prompt template

*/
readonly jokers?: Array<string>;
readonly jokerParameterNames?: Array<string_parameter_name>;
/**

@@ -61,3 +62,3 @@ * Type of the execution

*/
readonly postprocessing?: Array<string_javascript_name>;
readonly postprocessingFunctionNames?: Array<string_javascript_name>;
/**

@@ -86,4 +87,5 @@ * Expect this amount of each unit in the answer

/**
* TODO: [🧠][πŸ₯œ]
* TODO: use one helper type> (string_prompt | string_javascript | string_markdown) & string_template
* TODO: [β™ˆ] Probbably move expectations from templates to parameters
*/

@@ -8,6 +8,6 @@ import type { ExpectFormatCommand } from '../commands/EXPECT/ExpectFormatCommand';

import type { Expectations } from './PipelineJson/Expectations';
import type { string_parameter_name } from './typeAliases';
import type { string_parameter_value } from './typeAliases';
import type { Parameters } from './typeAliases';
import type { string_pipeline_url_with_hashtemplate } from './typeAliases';
import type { string_prompt } from './typeAliases';
import type { string_template } from './typeAliases';
import type { string_title } from './typeAliases';

@@ -67,8 +67,7 @@ /**

/**
* The text of the prompt
* The text of the prompt with placeholders for parameters
*
* Note: This is not a template, this is exactly the text that will be sent to the model
* @example "What is the capital of France?"
* @example "What is the capital of {country}?"
*/
readonly content: string_prompt;
readonly content: string_prompt & string_template;
/**

@@ -103,7 +102,5 @@ * Requirements for the model

/**
* Parameters used in the prompt
*
* Note: This is redundant (same information is in pipelineUrl+content) but useful for logging and debugging
* Parameters used in the `content`
*/
readonly parameters: Record<string_parameter_name, string_parameter_value>;
readonly parameters: Parameters;
};

@@ -110,0 +107,0 @@ /**

@@ -0,1 +1,2 @@

import { RESERVED_PARAMETER_NAMES } from '../config';
/**

@@ -20,3 +21,3 @@ * Semantic helper

*
* For example `"A cat wearing a {ITEM}"`
* For example `"A cat wearing a {item}"`
*/

@@ -89,6 +90,6 @@ export type string_template = string;

*/
export type string_parameter_name = string;
export type string_parameter_name = string_name;
/**
* Semantic helper
* Unique identifier of anything
* Unique identifier of parameter
*

@@ -99,3 +100,25 @@ * For example `"DevConf 2024"`

/**
* Parameters of the pipeline
*
* There are three types of parameters:
* - **INPUT PARAMETERs** are required to execute the pipeline.
* - **Intermediate parameters** are used internally in the pipeline.
* - **OUTPUT PARAMETERs** are not used internally in the pipeline, but are returned as the result of the pipeline execution.
*
* @see https://ptbk.io/parameters
*/
export type Parameters = Exclude<Record<string_parameter_name, string_parameter_value>, ReservedParameters>;
/**
* Semantic helper
* Unique identifier of reserved parameter
*
* For example `"context"`
*/
export type string_reserved_parameter_name = typeof RESERVED_PARAMETER_NAMES[number];
/**
* @@@
*/
export type ReservedParameters = Record<string_reserved_parameter_name, string_parameter_value>;
/**
* Semantic helper
* Title of anything

@@ -121,5 +144,18 @@ *

* For example `"Pavol HejnΓ½ is web developer and creator of Promptbook and Collboard"`
*
* @@@ string_knowledge_source vs string_knowledge_source_link
*/
export type string_knowledge_source = string_url | string_file_path | string;
export type string_knowledge_source = string_knowledge_source_link | string_markdown;
/**
* One link to knowledge source
*
* It can be a link or relative path
*
* For example `"https://pavolhejny.com/"`
* For example `"./pavol-hejny-cv.pdf"`
*
* @@@ string_knowledge_source vs string_knowledge_source_link
*/
export type string_knowledge_source_link = string_url | string_file_path;
/**
* Semantic helper

@@ -168,2 +204,6 @@ *

/**
* @@@
*/
export type string_promptbook_documentation_url = `https://github.com/webgptorg/promptbook/discussions/${number | '@@'}`;
/**
* Semantic helper

@@ -170,0 +210,0 @@ *

@@ -7,8 +7,17 @@ import type { ReadonlyDeep } from 'type-fest';

*
* Note: This function mutates the object
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
*/
export declare function deepFreeze<TObject>(objectValue: TObject): ReadonlyDeep<TObject>;
/**
* @@@
* @@@
*
* @returns The same object as the input, but deeply frozen
*
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
*/
export declare function deepFreezeWithSameType<TObject>(objectValue: TObject): TObject;
/**
* TODO: [πŸ”Ό] Export from `@promptbook/utils`
* TODO: [🧠] Is there a way how to meaningfully test this utility
*/

@@ -1,2 +0,2 @@

import type { string_name } from '../types/typeAliases';
import type { string_parameter_name } from '../types/typeAliases';
import type { string_template } from '../types/typeAliases';

@@ -9,2 +9,2 @@ /**

*/
export declare function extractParameters(template: string_template): Set<string_name>;
export declare function extractParameters(template: string_template): Set<string_parameter_name>;

@@ -7,1 +7,4 @@ /**

export declare function difference<TItem>(a: Set<TItem>, b: Set<TItem>, isEqual?: (a: TItem, b: TItem) => boolean): Set<TItem>;
/**
* TODO: [🧠][πŸ’―] Maybe also implement symmetricDifference
*/
{
"name": "@promptbook/remote-client",
"version": "0.61.0-15",
"version": "0.61.0-16",
"description": "Supercharge your use of large language models",

@@ -50,3 +50,3 @@ "private": false,

"peerDependencies": {
"@promptbook/core": "0.61.0-15"
"@promptbook/core": "0.61.0-16"
},

@@ -53,0 +53,0 @@ "main": "./umd/index.umd.js",

@@ -221,3 +221,3 @@ (function (global, factory) {

*/
var PROMPTBOOK_VERSION = '0.61.0-14';
var PROMPTBOOK_VERSION = '0.61.0-15';
// TODO: !!!! List here all the versions and annotate + put into script

@@ -224,0 +224,0 @@

@@ -12,7 +12,5 @@ declare const _default: ({

promptTemplates: {
blockType: string;
name: string;
title: string;
dependentParameterNames: string[];
blockType: string;
personaName: null;
modelRequirements: {

@@ -23,2 +21,3 @@ modelVariant: string;

content: string;
dependentParameterNames: string[];
resultingParameterName: string;

@@ -96,6 +95,10 @@ }[];

promptTemplates: {
blockType: string;
name: string;
title: string;
dependentParameterNames: string[];
blockType: string;
modelRequirements: {
modelVariant: string;
modelName: string;
};
content: string;
expectations: {

@@ -107,8 +110,3 @@ words: {

};
personaName: null;
modelRequirements: {
modelVariant: string;
modelName: string;
};
content: string;
dependentParameterNames: string[];
resultingParameterName: string;

@@ -186,8 +184,5 @@ }[];

promptTemplates: {
blockType: string;
name: string;
title: string;
dependentParameterNames: string[];
blockType: string;
expectFormat: string;
personaName: null;
modelRequirements: {

@@ -198,2 +193,4 @@ modelVariant: string;

content: string;
expectFormat: string;
dependentParameterNames: string[];
resultingParameterName: string;

@@ -200,0 +197,0 @@ }[];

@@ -12,2 +12,3 @@ import { collectionToJson } from '../collection/collectionToJson';

import { prettifyPipelineString } from '../conversion/prettify/prettifyPipelineString';
import { stringifyPipelineJson } from '../conversion/utils/stringifyPipelineJson';
import { validatePipeline } from '../conversion/validation/validatePipeline';

@@ -45,3 +46,3 @@ import { CollectionError } from '../errors/CollectionError';

export { SimplePromptInterfaceTools };
export { pipelineJsonToString, pipelineStringToJson, pipelineStringToJsonSync, validatePipeline };
export { pipelineJsonToString, pipelineStringToJson, pipelineStringToJsonSync, stringifyPipelineJson, validatePipeline, };
export { preparePipeline, unpreparePipeline };

@@ -48,0 +49,0 @@ export { createPipelineExecutor, joinLlmExecutionTools };

@@ -15,3 +15,2 @@ import type { PipelineCollection } from '../collection/PipelineCollection';

import type { ModelVariant } from '../types/ModelVariant';
import type { Parameters } from '../types/Parameters';
import type { ExpectationAmount, ExpectationUnit, Expectations } from '../types/PipelineJson/Expectations';

@@ -36,3 +35,3 @@ import { EXPECTATION_UNITS } from '../types/PipelineJson/Expectations';

import type { string_char_emoji } from '../types/typeAliasEmoji';
import type { client_id, number_model_temperature, number_seed, string_char, string_chat_prompt, string_completion_prompt, string_data_url, string_domain, string_email, string_emails, string_file_absolute_path, string_file_extension, string_file_path, string_file_relative_path, string_filename, string_folder_absolute_path, string_folder_path, string_folder_relative_path, string_host, string_hostname, string_href, string_html, string_javascript, string_javascript_name, string_license, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_parameter_name, string_parameter_value, string_person_fullname, string_pipeline_url, string_pipeline_url_with_hashtemplate, string_prompt, string_script, string_semantic_version, string_sha256, string_system_message, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_uri, string_uri_part, string_url, string_url_image, string_uuid } from '../types/typeAliases';
import type { Parameters, ReservedParameters, client_id, number_model_temperature, number_seed, string_char, string_chat_prompt, string_completion_prompt, string_data_url, string_domain, string_email, string_emails, string_file_absolute_path, string_file_extension, string_file_path, string_file_relative_path, string_filename, string_folder_absolute_path, string_folder_path, string_folder_relative_path, string_host, string_hostname, string_href, string_html, string_javascript, string_javascript_name, string_license, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_parameter_name, string_parameter_value, string_person_fullname, string_pipeline_url, string_pipeline_url_with_hashtemplate, string_prompt, string_promptbook_documentation_url, string_reserved_parameter_name, string_script, string_semantic_version, string_sha256, string_system_message, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_uri, string_uri_part, string_url, string_url_image, string_uuid } from '../types/typeAliases';
import type { FromtoItems } from '../utils/FromtoItems';

@@ -42,5 +41,5 @@ import { PROMPTBOOK_VERSION, string_promptbook_version } from '../version';

export { EXPECTATION_UNITS };
export type { AvailableModel, BlockType, CommonExecutionToolsOptions, EmbeddingVector, ExecutionReportJson, ExecutionTools, ExpectationAmount, ExpectationUnit, Expectations, FromtoItems, KnowledgePiecePreparedJson, KnowledgeSourceJson, KnowledgeSourcePreparedJson, LlmExecutionTools, LlmTemplateJson, ModelRequirements, ModelVariant, Parameters, PersonaJson, PersonaPreparedJson, PipelineCollection, PipelineExecutor, PipelineJson, PipelineString, PreparationJson, Prompt, ChatPromptResult as PromptChatResult, CommonPromptResult as PromptCommonResult, CompletionPromptResult as PromptCompletionResult, PromptDialogJson, EmbeddingPromptResult as PromptEmbeddingResult, PromptResult, PromptResultUsage, PromptResultUsageCounts, PromptTemplateJson, PromptTemplateParameterJson, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptJson, ScriptLanguage, SimpleTemplateJson, TaskProgress, UncertainNumber, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, client_id, number_model_temperature, number_seed, string_char, string_char_emoji, string_chat_prompt, string_completion_prompt, string_data_url, string_domain, string_email, string_emails, string_file_absolute_path, string_file_extension, string_file_path, string_file_relative_path, string_filename, string_folder_absolute_path, string_folder_path, string_folder_relative_path, string_host, string_hostname, string_href, string_html, string_javascript, string_javascript_name, string_license, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_parameter_name, string_parameter_value, string_person_fullname, string_pipeline_url, string_pipeline_url_with_hashtemplate, string_prompt, string_promptbook_version, string_script, string_semantic_version, string_sha256, string_system_message, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_uri, string_uri_part, string_url, string_url_image, string_uuid, };
export type { AvailableModel, BlockType, CommonExecutionToolsOptions, EmbeddingVector, ExecutionReportJson, ExecutionTools, ExpectationAmount, ExpectationUnit, Expectations, FromtoItems, KnowledgePiecePreparedJson, KnowledgeSourceJson, KnowledgeSourcePreparedJson, LlmExecutionTools, LlmTemplateJson, ModelRequirements, ModelVariant, Parameters, PersonaJson, PersonaPreparedJson, PipelineCollection, PipelineExecutor, PipelineJson, PipelineString, PreparationJson, Prompt, ChatPromptResult as PromptChatResult, CommonPromptResult as PromptCommonResult, CompletionPromptResult as PromptCompletionResult, PromptDialogJson, EmbeddingPromptResult as PromptEmbeddingResult, PromptResult, PromptResultUsage, PromptResultUsageCounts, PromptTemplateJson, PromptTemplateParameterJson, ReservedParameters, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptJson, ScriptLanguage, SimpleTemplateJson, TaskProgress, UncertainNumber, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, client_id, number_model_temperature, number_seed, string_char, string_char_emoji, string_chat_prompt, string_completion_prompt, string_data_url, string_domain, string_email, string_emails, string_file_absolute_path, string_file_extension, string_file_path, string_file_relative_path, string_filename, string_folder_absolute_path, string_folder_path, string_folder_relative_path, string_host, string_hostname, string_href, string_html, string_javascript, string_javascript_name, string_license, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_parameter_name, string_parameter_value, string_person_fullname, string_pipeline_url, string_pipeline_url_with_hashtemplate, string_prompt, string_promptbook_documentation_url, string_promptbook_version, string_reserved_parameter_name, string_script, string_semantic_version, string_sha256, string_system_message, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_uri, string_uri_part, string_url, string_url_image, string_uuid, };
/**
* TODO: Delete type aliases (from ../types/typeAliases) that are not exported here
*/

@@ -8,3 +8,2 @@ import { spaceTrim } from 'spacetrim';

import { forEachAsync } from '../execution/utils/forEachAsync';
import { replaceParameters } from '../execution/utils/replaceParameters';
import { isValidJsonString } from '../formats/json/utils/isValidJsonString';

@@ -42,2 +41,3 @@ import { extractBlock } from '../postprocessing/utils/extractBlock';

import { removeQuotes } from '../utils/removeQuotes';
import { replaceParameters } from '../utils/replaceParameters';
import { difference } from '../utils/sets/difference';

@@ -60,5 +60,6 @@ import { intersection } from '../utils/sets/intersection';

export { forEachAsync, PROMPTBOOK_VERSION };
export { extractParameters, extractVariables, replaceParameters, spaceTrim };
export { $currentDate, $randomSeed, extractBlock, // <- [🌻] + maybe export through `@promptbook/markdown-utils`
extractParameters, extractVariables, isHostnameOnPrivateNetwork, isUrlOnPrivateNetwork, isValidFilePath, isValidJavascriptName, isValidJsonString, isValidPipelineUrl, isValidPromptbookVersion, isValidSemanticVersion, isValidUrl, isValidUuid, parseNumber, // <- [🌻]
removeEmojis, removeQuotes, replaceParameters, spaceTrim, trimCodeBlock, trimEndOfCodeBlock, unwrapResult, };
isHostnameOnPrivateNetwork, isUrlOnPrivateNetwork, isValidFilePath, isValidJavascriptName, isValidJsonString, isValidPipelineUrl, isValidPromptbookVersion, isValidSemanticVersion, isValidUrl, isValidUuid, parseNumber, // <- [🌻]
removeEmojis, removeQuotes, trimCodeBlock, trimEndOfCodeBlock, unwrapResult, };
export { countCharacters, countLines, countPages, countParagraphs, countSentences, CountUtils, countWords };

@@ -65,0 +66,0 @@ export { splitIntoSentences };

import type { WritableDeep } from 'type-fest';
import type { PromptTemplateJson } from '../../../types/PipelineJson/PromptTemplateJson';
import type { PipelineJson } from '../../../types/PipelineJson/PipelineJson';
import type { string_markdown_text } from '../../../types/typeAliases';
import type { string_name } from '../../../types/typeAliases';
import type { string_promptbook_documentation_url } from '../../../types/typeAliases';
import type { string_SCREAMING_CASE } from '../../../utils/normalization/normalizeTo_SCREAMING_CASE';

@@ -15,3 +17,3 @@ import type { CommandUsagePlace } from './CommandUsagePlaces';

readonly description: string_markdown_text;
readonly discussionUrl: `https://github.com/webgptorg/promptbook/discussions/${number | '@@'}`;
readonly documentationUrl: string_promptbook_documentation_url;
readonly examples: Array<string_markdown_text>;

@@ -22,3 +24,6 @@ /**

parse(input: CommandParserInput): TCommand;
applyToPipelineJson?(pipelineJson: WritableDeep<PipelineJson>, personaCommand: TCommand): void;
/**
* @@@ Mutated by the command
*/
applyToPipelineJson?(command: TCommand, subjects: ApplyToPipelineJsonSubjects): void;
};

@@ -33,5 +38,25 @@ export type CommandParserInput = {

/**
* @@@ Mutated by the command
*/
export type ApplyToPipelineJsonSubjects = {
/**
* @@@ Mutated by the command
*/
readonly pipelineJson: WritableDeep<PipelineJson>;
/**
* @@@
*
* @@@ Mutated by the command
*
* When used in
* - `PIPELINE_HEAD` it is `null`
* - `PIPELINE_TEMPLATE` it is the prompt template
*/
readonly templateJson: null | Partial<WritableDeep<PromptTemplateJson>>;
};
/**
* TODO: @@@ Annotate all
* TODO: [🍧][♓️] Add order here
* TODO: [🧠] Maybe put flag if it is for whole `.ptbk.md` file of just one section
* TODO: [🍧] CommandParser should have applyToPipelineJson method
* TODO: [🍧] All commands must implement `applyToPipelineJson` method
* which will apply parsed command to the pipeline JSON

@@ -38,0 +63,0 @@ * it will be called from `pipelineStringToJsonSync`

@@ -1,3 +0,2 @@

import type { string_file_relative_path } from '../../types/typeAliases';
import type { string_url } from '../../types/typeAliases';
import type { string_knowledge_source } from '../../types/typeAliases';
/**

@@ -11,3 +10,3 @@ * Parsed KNOWLEDGE command

readonly type: 'KNOWLEDGE';
readonly source: string_url | string_file_relative_path;
readonly source: string_knowledge_source;
};

@@ -14,2 +14,6 @@ /**

/**
* The maximum number of attempts to execute LLM task before giving up
*/
export declare const MAX_EXECUTION_ATTEMPTS = 3;
/**
* The maximum length of the (generated) filename

@@ -19,2 +23,16 @@ */

/**
* @@@
* TODO: [🐝] !!! Use
*/
export declare const MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH = 3;
/**
* @@@
* TODO: [🐝] !!! Use
*/
export declare const MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL = 200;
/**
* Where to store the cache of executions for promptbook CLI
*/
export declare const EXECUTIONS_CACHE_DIRNAME = "/.promptbook/executions-cache";
/**
* The name of the builded pipeline collection made by CLI `ptbk make` and for lookup in `createCollectionFromDirectory`

@@ -26,6 +44,13 @@ */

*/
export declare const RESERVED_PARAMETER_NAMES: readonly string[];
export declare const RESERVED_PARAMETER_NAMES: readonly ["context", "currentDate"];
/**
* @@@
*/
export declare const DEBUG_ALLOW_PAYED_TESTING: boolean;
/**
* Nonce which is used for replacing things in strings
*/
export declare const REPLACING_NONCE = "u$k42k%!V2zo34w7Fu#@QUHYPW";
/**
* TODO: [πŸ”Ό] Export all to core
*/
import type { PromptTemplateJson } from '../../types/PipelineJson/PromptTemplateJson';
import type { string_name } from '../../types/typeAliases';
import type { string_parameter_name } from '../../types/typeAliases';
/**

@@ -10,5 +10,5 @@ * Parses the prompt template and returns the set of all used parameters

*/
export declare function extractParametersFromPromptTemplate(promptTemplate: Pick<PromptTemplateJson, 'title' | 'description' | 'blockType' | 'content'>): Set<string_name>;
export declare function extractParametersFromPromptTemplate(promptTemplate: Pick<PromptTemplateJson, 'title' | 'description' | 'blockType' | 'content' | 'jokerParameterNames'>): Set<string_parameter_name>;
/**
* TODO: [πŸ”£] If script require contentLanguage
*/

@@ -10,5 +10,5 @@ import type { string_json } from '../../types/typeAliases';

/**
* TODO: !!!! Not Working propperly @see https://promptbook.studio/samples/mixed-knowledge.ptbk.md
* TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
* TODO: [πŸ”Ό] Export alongside pipelineStringToJson
* TODO: [🧠] Maybe more elegant solution than replacing via regex
*/

@@ -31,4 +31,7 @@ import type { PipelineJson } from '../../types/PipelineJson/PipelineJson';

* TODO: [🧠][🐣] !!!! Validate that knowledge is valid (non-void)
* TODO: [🧠][🐣] !!!! Validate that persona can be used only with CHAT variant
* TODO: !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
* TODO: !!!! Validate that reserved parameter is not used as joker
* TODO: [🧠] !!! Validationg not only logic itself but imports around - files and websites and rerefenced pipelines exists
* TODO: [πŸ› ] Actions, instruments (and maybe knowledge) => Functions and tools
*/

@@ -8,5 +8,17 @@ import type { PipelineJson } from '../types/PipelineJson/PipelineJson';

*
* @default 3
* @default MAX_EXECUTION_ATTEMPTS
*/
readonly maxExecutionAttempts: number;
readonly maxExecutionAttempts?: number;
/**
* Maximum number of tasks running in parallel
*
* @default MAX_PARALLEL_COUNT
*/
readonly maxParallelCount?: number;
/**
* If true, the preparation logs additional information
*
* @default false
*/
readonly isVerbose?: boolean;
};

@@ -39,3 +51,4 @@ /**

/**
* TODO: [πŸͺ‚] Pass maxParallelCount here
* TODO: Use isVerbose here (not only pass to `preparePipeline`)
* TODO: [πŸͺ‚] Use maxParallelCount here (not only pass to `preparePipeline`)
* TODO: [β™ˆ] Probbably move expectations from templates to parameters

@@ -42,0 +55,0 @@ * TODO: [🧠] When not meet expectations in PROMPT_DIALOG, make some way to tell the user

import type { Promisable } from 'type-fest';
import { PipelineExecutionError } from '../errors/PipelineExecutionError';
import type { TaskProgress } from '../types/TaskProgress';
import type { ExecutionReportJson } from '../types/execution-report/ExecutionReportJson';
import type { string_parameter_name } from '../types/typeAliases';
import type { string_parameter_value } from '../types/typeAliases';
import type { Parameters } from '../types/typeAliases';
import type { PromptResultUsage } from './PromptResultUsage';

@@ -16,3 +16,3 @@ /**

export type PipelineExecutor = {
(inputParameters: Record<string_parameter_name, string_parameter_value>, onProgress?: (taskProgress: TaskProgress) => Promisable<void>): Promise<{
(inputParameters: Parameters, onProgress?: (taskProgress: TaskProgress) => Promisable<void>): Promise<{
/**

@@ -29,3 +29,3 @@ * Whether the execution was successful, details are aviable in `executionReport`

*/
readonly errors: Array<Error>;
readonly errors: Array<PipelineExecutionError | Error>;
/**

@@ -40,3 +40,3 @@ * The report of the execution with all details

*/
readonly outputParameters: Record<string_parameter_name, string_parameter_value>;
readonly outputParameters: Parameters;
}>;

@@ -43,0 +43,0 @@ };

@@ -13,11 +13,11 @@ import type { KebabCase } from 'type-fest';

*/
price: UncertainNumber;
readonly price: UncertainNumber;
/**
* Number of whatever used in the input aka. `prompt_tokens`
*/
input: PromptResultUsageCounts;
readonly input: PromptResultUsageCounts;
/**
* Number of tokens used in the output aka. `completion_tokens`
*/
output: PromptResultUsageCounts;
readonly output: PromptResultUsageCounts;
};

@@ -24,0 +24,0 @@ /**

import type { ScriptLanguage } from '../types/ScriptLanguage';
import type { string_parameter_name } from '../types/typeAliases';
import type { string_parameter_value } from '../types/typeAliases';
import type { Parameters } from '../types/typeAliases';
import type { string_script } from '../types/typeAliases';

@@ -26,3 +25,3 @@ /**

*/
readonly parameters: Record<string_parameter_name, string_parameter_value>;
readonly parameters: Parameters;
/**

@@ -29,0 +28,0 @@ * The content of the script to execute

@@ -68,3 +68,3 @@ import type { string_mime_type } from '../../types/typeAliases';

* TODO: [πŸ“][🧠] llm Provider Bindings
* TODO: [πŸ“]Export via some package
* TODO: [πŸ“][πŸ”Ό] Export via some package
*/

@@ -11,3 +11,3 @@ import type { PrepareOptions } from '../../../prepare/PrepareOptions';

/**
* TODO: [πŸ”Ό] !!! Export via `@promptbook/core`
* TODO: [🐝][πŸ”Ό] !!! Export via `@promptbook/core`
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time

@@ -14,0 +14,0 @@ * Put `knowledgePieces` into `PrepareKnowledgeOptions`

@@ -9,5 +9,5 @@ import type { PrepareOptions } from '../../../prepare/PrepareOptions';

/**
* TODO: [πŸ”Ό] !!! Export via `@promptbook/markdown`
* TODO: [🐝][πŸ”Ό] !!! Export via `@promptbook/markdown`
* TODO: [πŸͺ‚] Do it in parallel 11:11
* Note: No need to aggregate usage here, it is done by intercepting the llmTools
*/

@@ -9,3 +9,3 @@ import type { PrepareOptions } from '../../../prepare/PrepareOptions';

/**
* TODO: [πŸ”Ό] !!! Export via `@promptbook/pdf`
* TODO: [🐝][πŸ”Ό] !!! Export via `@promptbook/pdf`
* TODO: [🧺] In future, content can be alse File or Blob BUT for now for wider compatibility its only base64

@@ -12,0 +12,0 @@ * @see https://stackoverflow.com/questions/14653349/node-js-cant-create-blobs

@@ -29,3 +29,3 @@ import type { AvailableModel } from '../../execution/LlmExecutionTools';

*/
callChatModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<ChatPromptResult>;
callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<ChatPromptResult>;
/**

@@ -32,0 +32,0 @@ * Get the model that should be used as default

@@ -30,7 +30,7 @@ import type { AvailableModel } from '../../execution/LlmExecutionTools';

*/
callChatModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<ChatPromptResult>;
callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<ChatPromptResult>;
/**
* Calls Azure OpenAI API to use a complete model.
*/
callCompletionModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<CompletionPromptResult>;
callCompletionModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<CompletionPromptResult>;
/**

@@ -37,0 +37,0 @@ * Changes Azure error (which is not propper Error but object) to propper Error

@@ -21,7 +21,7 @@ import type { CommonExecutionToolsOptions } from '../../execution/CommonExecutionToolsOptions';

*/
callChatModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<ChatPromptResult>;
callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<ChatPromptResult>;
/**
* Mocks completion model
*/
callCompletionModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<CompletionPromptResult>;
callCompletionModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<CompletionPromptResult>;
/**

@@ -28,0 +28,0 @@ * List all available mocked-models that can be used

@@ -22,11 +22,11 @@ import type { CommonExecutionToolsOptions } from '../../execution/CommonExecutionToolsOptions';

*/
callChatModel(prompt: Pick<Prompt, 'content' | 'modelRequirements' | 'expectations' | 'postprocessing'>): Promise<ChatPromptResult & CompletionPromptResult>;
callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements' | 'expectations' | 'postprocessing'>): Promise<ChatPromptResult & CompletionPromptResult>;
/**
* Fakes completion model
*/
callCompletionModel(prompt: Pick<Prompt, 'content' | 'modelRequirements' | 'expectations' | 'postprocessing'>): Promise<CompletionPromptResult>;
callCompletionModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements' | 'expectations' | 'postprocessing'>): Promise<CompletionPromptResult>;
/**
* Fakes embedding model
*/
callEmbeddingModel(prompt: Pick<Prompt, 'content' | 'modelRequirements' | 'expectations' | 'postprocessing'>): Promise<EmbeddingPromptResult>;
callEmbeddingModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements' | 'expectations' | 'postprocessing'>): Promise<EmbeddingPromptResult>;
/**

@@ -33,0 +33,0 @@ * List all available fake-models that can be used

@@ -31,11 +31,11 @@ import type { AvailableModel } from '../../execution/LlmExecutionTools';

*/
callChatModel(prompt: Pick<Prompt, 'content' | 'modelRequirements' | 'expectFormat'>): Promise<ChatPromptResult>;
callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements' | 'expectFormat'>): Promise<ChatPromptResult>;
/**
* Calls OpenAI API to use a complete model.
*/
callCompletionModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<CompletionPromptResult>;
callCompletionModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<CompletionPromptResult>;
/**
* Calls OpenAI API to use a embedding model
*/
callEmbeddingModel(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<EmbeddingPromptResult>;
callEmbeddingModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements'>): Promise<EmbeddingPromptResult>;
/**

@@ -42,0 +42,0 @@ * Get the model that should be used as default

@@ -11,2 +11,3 @@ import type { PipelineJson } from '../types/PipelineJson/PipelineJson';

/**
* TODO: !!!!! Index the samples and maybe templates
* TODO: [πŸ”Ό] !!! Export via `@promptbook/core`

@@ -13,0 +14,0 @@ * TODO: Write tests for `preparePipeline`

@@ -12,3 +12,3 @@ import type { ModelRequirements } from '../ModelRequirements';

*/
readonly personaName: string_name | null;
readonly personaName?: string_name;
/**

@@ -21,2 +21,3 @@ * Requirements for the model

/**
* TODO: [🧠][πŸ₯œ]
* TODO: [πŸ‘™][🧠] Maybe add `knowledge`, `actions` and `instruments` to be available granularly for each template

@@ -23,0 +24,0 @@ * @see https://github.com/webgptorg/promptbook/discussions/79

@@ -82,2 +82,3 @@ import type { string_file_path } from '../typeAliases';

/**
* TODO: [🧠] Maybe wrap all {parameterNames} in brackets for example { "resultingParameterName": "{foo}" }
* Note: There was a proposal for multiple types of promptbook objects 78816ff33e2705ee1a187aa2eb8affd976d4ea1a

@@ -84,0 +85,0 @@ * But then immediately reverted back to the single type

@@ -10,1 +10,4 @@ import type { PromptTemplateJsonCommon } from './PromptTemplateJsonCommon';

}
/**
* TODO: [🧠][πŸ₯œ]
*/

@@ -10,1 +10,5 @@ import type { ___ } from '../../utils/organization/___';

export type PromptTemplateJson = LlmTemplateJson | SimpleTemplateJson | ScriptJson | PromptDialogJson | ___ | ___ | ___ | ___;
/**
* TODO: [🧠][πŸ₯œ] What is propper name for this - "Template", "Prompt template",...
* TODO: [🧠][πŸ₯œ] Reduce confusion of `PromptTemplateJson` vs (`LlmTemplateJson` which is 'PROMPT_TEMPLATE')
*/

@@ -8,2 +8,3 @@ import type { BlockType } from '../../commands/BLOCK/BlockTypes';

import type { string_name } from '../typeAliases';
import type { string_parameter_name } from '../typeAliases';
import type { string_prompt } from '../typeAliases';

@@ -38,3 +39,3 @@ import type { string_template } from '../typeAliases';

*/
readonly dependentParameterNames: Array<string_name>;
readonly dependentParameterNames: Array<string_parameter_name>;
/**

@@ -45,3 +46,3 @@ * If theese parameters meet the expectations requirements, they are used instead of executing this prompt template

*/
readonly jokers?: Array<string>;
readonly jokerParameterNames?: Array<string_parameter_name>;
/**

@@ -61,3 +62,3 @@ * Type of the execution

*/
readonly postprocessing?: Array<string_javascript_name>;
readonly postprocessingFunctionNames?: Array<string_javascript_name>;
/**

@@ -86,4 +87,5 @@ * Expect this amount of each unit in the answer

/**
* TODO: [🧠][πŸ₯œ]
* TODO: use one helper type> (string_prompt | string_javascript | string_markdown) & string_template
* TODO: [β™ˆ] Probbably move expectations from templates to parameters
*/

@@ -8,6 +8,6 @@ import type { ExpectFormatCommand } from '../commands/EXPECT/ExpectFormatCommand';

import type { Expectations } from './PipelineJson/Expectations';
import type { string_parameter_name } from './typeAliases';
import type { string_parameter_value } from './typeAliases';
import type { Parameters } from './typeAliases';
import type { string_pipeline_url_with_hashtemplate } from './typeAliases';
import type { string_prompt } from './typeAliases';
import type { string_template } from './typeAliases';
import type { string_title } from './typeAliases';

@@ -67,8 +67,7 @@ /**

/**
* The text of the prompt
* The text of the prompt with placeholders for parameters
*
* Note: This is not a template, this is exactly the text that will be sent to the model
* @example "What is the capital of France?"
* @example "What is the capital of {country}?"
*/
readonly content: string_prompt;
readonly content: string_prompt & string_template;
/**

@@ -103,7 +102,5 @@ * Requirements for the model

/**
* Parameters used in the prompt
*
* Note: This is redundant (same information is in pipelineUrl+content) but useful for logging and debugging
* Parameters used in the `content`
*/
readonly parameters: Record<string_parameter_name, string_parameter_value>;
readonly parameters: Parameters;
};

@@ -110,0 +107,0 @@ /**

@@ -0,1 +1,2 @@

import { RESERVED_PARAMETER_NAMES } from '../config';
/**

@@ -20,3 +21,3 @@ * Semantic helper

*
* For example `"A cat wearing a {ITEM}"`
* For example `"A cat wearing a {item}"`
*/

@@ -89,6 +90,6 @@ export type string_template = string;

*/
export type string_parameter_name = string;
export type string_parameter_name = string_name;
/**
* Semantic helper
* Unique identifier of anything
* Unique identifier of parameter
*

@@ -99,3 +100,25 @@ * For example `"DevConf 2024"`

/**
* Parameters of the pipeline
*
* There are three types of parameters:
* - **INPUT PARAMETERs** are required to execute the pipeline.
* - **Intermediate parameters** are used internally in the pipeline.
* - **OUTPUT PARAMETERs** are not used internally in the pipeline, but are returned as the result of the pipeline execution.
*
* @see https://ptbk.io/parameters
*/
export type Parameters = Exclude<Record<string_parameter_name, string_parameter_value>, ReservedParameters>;
/**
* Semantic helper
* Unique identifier of reserved parameter
*
* For example `"context"`
*/
export type string_reserved_parameter_name = typeof RESERVED_PARAMETER_NAMES[number];
/**
* @@@
*/
export type ReservedParameters = Record<string_reserved_parameter_name, string_parameter_value>;
/**
* Semantic helper
* Title of anything

@@ -121,5 +144,18 @@ *

* For example `"Pavol HejnΓ½ is web developer and creator of Promptbook and Collboard"`
*
* @@@ string_knowledge_source vs string_knowledge_source_link
*/
export type string_knowledge_source = string_url | string_file_path | string;
export type string_knowledge_source = string_knowledge_source_link | string_markdown;
/**
* One link to knowledge source
*
* It can be a link or relative path
*
* For example `"https://pavolhejny.com/"`
* For example `"./pavol-hejny-cv.pdf"`
*
* @@@ string_knowledge_source vs string_knowledge_source_link
*/
export type string_knowledge_source_link = string_url | string_file_path;
/**
* Semantic helper

@@ -168,2 +204,6 @@ *

/**
* @@@
*/
export type string_promptbook_documentation_url = `https://github.com/webgptorg/promptbook/discussions/${number | '@@'}`;
/**
* Semantic helper

@@ -170,0 +210,0 @@ *

@@ -7,8 +7,17 @@ import type { ReadonlyDeep } from 'type-fest';

*
* Note: This function mutates the object
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
*/
export declare function deepFreeze<TObject>(objectValue: TObject): ReadonlyDeep<TObject>;
/**
* @@@
* @@@
*
* @returns The same object as the input, but deeply frozen
*
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
*/
export declare function deepFreezeWithSameType<TObject>(objectValue: TObject): TObject;
/**
* TODO: [πŸ”Ό] Export from `@promptbook/utils`
* TODO: [🧠] Is there a way how to meaningfully test this utility
*/

@@ -1,2 +0,2 @@

import type { string_name } from '../types/typeAliases';
import type { string_parameter_name } from '../types/typeAliases';
import type { string_template } from '../types/typeAliases';

@@ -9,2 +9,2 @@ /**

*/
export declare function extractParameters(template: string_template): Set<string_name>;
export declare function extractParameters(template: string_template): Set<string_parameter_name>;

@@ -7,1 +7,4 @@ /**

export declare function difference<TItem>(a: Set<TItem>, b: Set<TItem>, isEqual?: (a: TItem, b: TItem) => boolean): Set<TItem>;
/**
* TODO: [🧠][πŸ’―] Maybe also implement symmetricDifference
*/
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc