@promptbook/utils
Advanced tools
Comparing version 0.72.0-14 to 0.72.0-15
@@ -10,10 +10,11 @@ import { PROMPTBOOK_VERSION } from '../version'; | ||
import { CLAIM } from '../config'; | ||
import { MAX_PARALLEL_COUNT } from '../config'; | ||
import { MAX_EXECUTION_ATTEMPTS } from '../config'; | ||
import { MAX_FILENAME_LENGTH } from '../config'; | ||
import { MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH } from '../config'; | ||
import { MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL } from '../config'; | ||
import { EXECUTIONS_CACHE_DIRNAME } from '../config'; | ||
import { SCRAPE_CACHE_DIRNAME } from '../config'; | ||
import { PIPELINE_COLLECTION_BASE_FILENAME } from '../config'; | ||
import { DEFAULT_INTERMEDIATE_FILES_STRATEGY } from '../config'; | ||
import { DEFAULT_MAX_PARALLEL_COUNT } from '../config'; | ||
import { DEFAULT_MAX_EXECUTION_ATTEMPTS } from '../config'; | ||
import { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH } from '../config'; | ||
import { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL } from '../config'; | ||
import { DEFAULT_EXECUTIONS_CACHE_DIRNAME } from '../config'; | ||
import { DEFAULT_SCRAPE_CACHE_DIRNAME } from '../config'; | ||
import { DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME } from '../config'; | ||
import { RESERVED_PARAMETER_NAMES } from '../config'; | ||
@@ -23,4 +24,4 @@ import { DEFAULT_REMOTE_URL } from '../config'; | ||
import { DEFAULT_CSV_SETTINGS } from '../config'; | ||
import { IS_VERBOSE } from '../config'; | ||
import { IS_AUTO_INSTALLED } from '../config'; | ||
import { DEFAULT_IS_VERBOSE } from '../config'; | ||
import { DEFAULT_IS_AUTO_INSTALLED } from '../config'; | ||
import { pipelineJsonToString } from '../conversion/pipelineJsonToString'; | ||
@@ -71,2 +72,3 @@ import { pipelineStringToJson } from '../conversion/pipelineStringToJson'; | ||
import { joinLlmExecutionTools } from '../llm-providers/multiple/joinLlmExecutionTools'; | ||
import { MultipleLlmExecutionTools } from '../llm-providers/multiple/MultipleLlmExecutionTools'; | ||
import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration'; | ||
@@ -104,10 +106,11 @@ import { _OpenAiAssistantMetadataRegistration } from '../llm-providers/openai/register-configuration'; | ||
export { CLAIM }; | ||
export { MAX_PARALLEL_COUNT }; | ||
export { MAX_EXECUTION_ATTEMPTS }; | ||
export { MAX_FILENAME_LENGTH }; | ||
export { MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH }; | ||
export { MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL }; | ||
export { EXECUTIONS_CACHE_DIRNAME }; | ||
export { SCRAPE_CACHE_DIRNAME }; | ||
export { PIPELINE_COLLECTION_BASE_FILENAME }; | ||
export { DEFAULT_INTERMEDIATE_FILES_STRATEGY }; | ||
export { DEFAULT_MAX_PARALLEL_COUNT }; | ||
export { DEFAULT_MAX_EXECUTION_ATTEMPTS }; | ||
export { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH }; | ||
export { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL }; | ||
export { DEFAULT_EXECUTIONS_CACHE_DIRNAME }; | ||
export { DEFAULT_SCRAPE_CACHE_DIRNAME }; | ||
export { DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME }; | ||
export { RESERVED_PARAMETER_NAMES }; | ||
@@ -117,4 +120,4 @@ export { DEFAULT_REMOTE_URL }; | ||
export { DEFAULT_CSV_SETTINGS }; | ||
export { IS_VERBOSE }; | ||
export { IS_AUTO_INSTALLED }; | ||
export { DEFAULT_IS_VERBOSE }; | ||
export { DEFAULT_IS_AUTO_INSTALLED }; | ||
export { pipelineJsonToString }; | ||
@@ -165,2 +168,3 @@ export { pipelineStringToJson }; | ||
export { joinLlmExecutionTools }; | ||
export { MultipleLlmExecutionTools }; | ||
export { _OpenAiMetadataRegistration }; | ||
@@ -167,0 +171,0 @@ export { _OpenAiAssistantMetadataRegistration }; |
@@ -6,2 +6,3 @@ import { PROMPTBOOK_VERSION } from '../version'; | ||
import { $provideLlmToolsFromEnv } from '../llm-providers/_common/register/$provideLlmToolsFromEnv'; | ||
import { $provideExecutablesForNode } from '../scrapers/_common/register/$provideExecutablesForNode'; | ||
import { $provideFilesystemForNode } from '../scrapers/_common/register/$provideFilesystemForNode'; | ||
@@ -17,2 +18,3 @@ import { $provideScrapersForNode } from '../scrapers/_common/register/$provideScrapersForNode'; | ||
export { $provideLlmToolsFromEnv }; | ||
export { $provideExecutablesForNode }; | ||
export { $provideFilesystemForNode }; | ||
@@ -19,0 +21,0 @@ export { $provideScrapersForNode }; |
@@ -20,4 +20,4 @@ import type { PipelineCollection } from '../collection/PipelineCollection'; | ||
import type { CreatePipelineExecutorOptions } from '../execution/createPipelineExecutor/00-CreatePipelineExecutorOptions'; | ||
import type { CreatePipelineExecutorSettings } from '../execution/createPipelineExecutor/00-CreatePipelineExecutorSettings'; | ||
import type { EmbeddingVector } from '../execution/EmbeddingVector'; | ||
import type { Executables } from '../execution/Executables'; | ||
import type { ExecutionTools } from '../execution/ExecutionTools'; | ||
@@ -53,3 +53,2 @@ import type { FilesystemTools } from '../execution/FilesystemTools'; | ||
import type { LangtailExecutionToolsOptions } from '../llm-providers/langtail/LangtailExecutionToolsOptions'; | ||
import type { MultipleLlmExecutionTools } from '../llm-providers/multiple/MultipleLlmExecutionTools'; | ||
import type { OpenAiAssistantExecutionToolsOptions } from '../llm-providers/openai/OpenAiAssistantExecutionToolsOptions'; | ||
@@ -87,2 +86,3 @@ import type { OpenAiExecutionToolsOptions } from '../llm-providers/openai/OpenAiExecutionToolsOptions'; | ||
import type { ExecutionReportStringOptions } from '../types/execution-report/ExecutionReportStringOptions'; | ||
import type { IntermediateFilesStrategy } from '../types/IntermediateFilesStrategy'; | ||
import type { ModelRequirements } from '../types/ModelRequirements'; | ||
@@ -231,4 +231,4 @@ import type { CompletionModelRequirements } from '../types/ModelRequirements'; | ||
import type { Registration } from '../utils/$Register'; | ||
import type { IExecCommandOptions } from '../utils/execCommand/IExecCommandOptions'; | ||
import type { IExecCommandOptionsAdvanced } from '../utils/execCommand/IExecCommandOptions'; | ||
import type { ExecCommandOptions } from '../utils/execCommand/ExecCommandOptions'; | ||
import type { ExecCommandOptionsAdvanced } from '../utils/execCommand/ExecCommandOptions'; | ||
import type { FromtoItems } from '../utils/FromtoItems'; | ||
@@ -238,3 +238,3 @@ import type { CodeBlock } from '../utils/markdown/extractAllBlocksFromMarkdown'; | ||
import type { string_keyword } from '../utils/normalization/IKeywords'; | ||
import type { IKeywords } from '../utils/normalization/IKeywords'; | ||
import type { Keywords } from '../utils/normalization/IKeywords'; | ||
import type { string_kebab_case } from '../utils/normalization/normalize-to-kebab-case'; | ||
@@ -268,4 +268,4 @@ import type { string_camelCase } from '../utils/normalization/normalizeTo_camelCase'; | ||
export type { CreatePipelineExecutorOptions }; | ||
export type { CreatePipelineExecutorSettings }; | ||
export type { EmbeddingVector }; | ||
export type { Executables }; | ||
export type { ExecutionTools }; | ||
@@ -301,3 +301,2 @@ export type { FilesystemTools }; | ||
export type { LangtailExecutionToolsOptions }; | ||
export type { MultipleLlmExecutionTools }; | ||
export type { OpenAiAssistantExecutionToolsOptions }; | ||
@@ -335,2 +334,3 @@ export type { OpenAiExecutionToolsOptions }; | ||
export type { ExecutionReportStringOptions }; | ||
export type { IntermediateFilesStrategy }; | ||
export type { ModelRequirements }; | ||
@@ -479,4 +479,4 @@ export type { CompletionModelRequirements }; | ||
export type { Registration }; | ||
export type { IExecCommandOptions }; | ||
export type { IExecCommandOptionsAdvanced }; | ||
export type { ExecCommandOptions }; | ||
export type { ExecCommandOptionsAdvanced }; | ||
export type { FromtoItems }; | ||
@@ -486,3 +486,3 @@ export type { CodeBlock }; | ||
export type { string_keyword }; | ||
export type { IKeywords }; | ||
export type { Keywords }; | ||
export type { string_kebab_case }; | ||
@@ -489,0 +489,0 @@ export type { string_camelCase }; |
@@ -27,3 +27,3 @@ import { PROMPTBOOK_VERSION } from '../version'; | ||
import type { string_keyword } from '../utils/normalization/IKeywords'; | ||
import type { IKeywords } from '../utils/normalization/IKeywords'; | ||
import type { Keywords } from '../utils/normalization/IKeywords'; | ||
import { isValidKeyword } from '../utils/normalization/isValidKeyword'; | ||
@@ -99,3 +99,3 @@ import { nameToUriPart } from '../utils/normalization/nameToUriPart'; | ||
export type { string_keyword }; | ||
export type { IKeywords }; | ||
export type { Keywords }; | ||
export { isValidKeyword }; | ||
@@ -102,0 +102,0 @@ export { nameToUriPart }; |
@@ -10,5 +10,5 @@ import type { PipelineJson } from '../types/PipelineJson/PipelineJson'; | ||
*/ | ||
export declare function collectionToJson(collection: PipelineCollection): Promise<Array<PipelineJson>>; | ||
export declare function collectionToJson(collection: PipelineCollection): Promise<ReadonlyArray<PipelineJson>>; | ||
/** | ||
* TODO: [๐ง ] Maybe clear `sourceFile` or clear when exposing through API or remote server | ||
*/ |
@@ -13,2 +13,2 @@ import type { PipelineJson } from '../../types/PipelineJson/PipelineJson'; | ||
*/ | ||
export declare function createCollectionFromJson(...promptbooks: Array<PipelineJson>): PipelineCollection; | ||
export declare function createCollectionFromJson(...promptbooks: ReadonlyArray<PipelineJson>): PipelineCollection; |
@@ -23,2 +23,2 @@ import type { PipelineJson } from '../../types/PipelineJson/PipelineJson'; | ||
*/ | ||
export declare function createCollectionFromPromise(promptbookSourcesPromiseOrFactory: Promise<Array<PipelineJson>> | (() => Promise<Array<PipelineJson>>)): PipelineCollection; | ||
export declare function createCollectionFromPromise(promptbookSourcesPromiseOrFactory: Promise<ReadonlyArray<PipelineJson>> | (() => Promise<ReadonlyArray<PipelineJson>>)): PipelineCollection; |
@@ -14,3 +14,3 @@ import type { Promisable } from 'type-fest'; | ||
*/ | ||
listPipelines(): Promisable<Array<string_pipeline_url>>; | ||
listPipelines(): Promisable<ReadonlyArray<string_pipeline_url>>; | ||
/** | ||
@@ -17,0 +17,0 @@ * Gets pipeline by its URL |
@@ -22,7 +22,7 @@ import type { PipelineJson } from '../types/PipelineJson/PipelineJson'; | ||
*/ | ||
constructor(...pipelines: Array<PipelineJson>); | ||
constructor(...pipelines: ReadonlyArray<PipelineJson>); | ||
/** | ||
* Gets all pipelines in the collection | ||
*/ | ||
listPipelines(): Array<string_pipeline_url>; | ||
listPipelines(): ReadonlyArray<string_pipeline_url>; | ||
/** | ||
@@ -29,0 +29,0 @@ * Gets pipeline by its URL |
@@ -43,7 +43,7 @@ import type { WritableDeep } from 'type-fest'; | ||
*/ | ||
readonly aliasNames?: Array<string_name & string_SCREAMING_CASE>; | ||
readonly aliasNames?: ReadonlyArray<string_name & string_SCREAMING_CASE>; | ||
/** | ||
* @@@ | ||
*/ | ||
readonly deprecatedNames?: Array<string_name & string_SCREAMING_CASE>; | ||
readonly deprecatedNames?: ReadonlyArray<string_name & string_SCREAMING_CASE>; | ||
/** | ||
@@ -60,3 +60,3 @@ * @@@ | ||
*/ | ||
readonly examples: Array<string_markdown_text>; | ||
readonly examples: ReadonlyArray<string_markdown_text>; | ||
/** | ||
@@ -100,3 +100,3 @@ * @throws {ParseError} if the parsing fails | ||
*/ | ||
takeFromPipelineJson(pipelineJson: PipelineJson): Array<TCommand>; | ||
takeFromPipelineJson(pipelineJson: PipelineJson): ReadonlyArray<TCommand>; | ||
}; | ||
@@ -126,3 +126,3 @@ /** | ||
*/ | ||
takeFromTemplateJson($templateJson: $TemplateJson): Array<TCommand>; | ||
takeFromTemplateJson($templateJson: $TemplateJson): ReadonlyArray<TCommand>; | ||
}; | ||
@@ -129,0 +129,0 @@ /** |
import type { CsvSettings } from './formats/csv/CsvSettings'; | ||
import type { IntermediateFilesStrategy } from './types/IntermediateFilesStrategy'; | ||
/** | ||
@@ -15,3 +16,3 @@ * Warning message for the generated sections and files files | ||
*/ | ||
export declare const CLAIM = "Supercharge LLM models with Promptbook"; | ||
export declare const CLAIM = "Build responsible, controlled and transparent applications on top of LLM models!"; | ||
/** | ||
@@ -54,20 +55,26 @@ * Warning message for the generated sections and files files | ||
/** | ||
* The maximum number of (LLM) tasks running in parallel | ||
* The maximum length of the (generated) filename | ||
* | ||
* @public exported from `@promptbook/core` | ||
*/ | ||
export declare const MAX_PARALLEL_COUNT = 5; | ||
export declare const MAX_FILENAME_LENGTH = 30; | ||
/** | ||
* The maximum number of attempts to execute LLM task before giving up | ||
* Strategy for caching the intermediate results for knowledge sources | ||
* | ||
* @public exported from `@promptbook/core` | ||
*/ | ||
export declare const MAX_EXECUTION_ATTEMPTS = 3; | ||
export declare const DEFAULT_INTERMEDIATE_FILES_STRATEGY: IntermediateFilesStrategy; | ||
/** | ||
* The maximum length of the (generated) filename | ||
* The maximum number of (LLM) tasks running in parallel | ||
* | ||
* @public exported from `@promptbook/core` | ||
*/ | ||
export declare const MAX_FILENAME_LENGTH = 30; | ||
export declare const DEFAULT_MAX_PARALLEL_COUNT = 5; | ||
/** | ||
* The maximum number of attempts to execute LLM task before giving up | ||
* | ||
* @public exported from `@promptbook/core` | ||
*/ | ||
export declare const DEFAULT_MAX_EXECUTION_ATTEMPTS = 3; | ||
/** | ||
* @@@ | ||
@@ -78,3 +85,3 @@ * TODO: [๐][main] !!! Use | ||
*/ | ||
export declare const MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH = 3; | ||
export declare const DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH = 3; | ||
/** | ||
@@ -86,3 +93,3 @@ * @@@ | ||
*/ | ||
export declare const MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL = 200; | ||
export declare const DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL = 200; | ||
/** | ||
@@ -95,3 +102,3 @@ * Where to store the cache of executions for promptbook CLI | ||
*/ | ||
export declare const EXECUTIONS_CACHE_DIRNAME = "/.promptbook/executions-cache"; | ||
export declare const DEFAULT_EXECUTIONS_CACHE_DIRNAME = "/.promptbook/executions-cache"; | ||
/** | ||
@@ -104,3 +111,3 @@ * Where to store the scrape cache | ||
*/ | ||
export declare const SCRAPE_CACHE_DIRNAME = "/.promptbook/scrape-cache"; | ||
export declare const DEFAULT_SCRAPE_CACHE_DIRNAME = "/.promptbook/scrape-cache"; | ||
/** | ||
@@ -111,3 +118,3 @@ * The name of the builded pipeline collection made by CLI `ptbk make` and for lookup in `createCollectionFromDirectory` | ||
*/ | ||
export declare const PIPELINE_COLLECTION_BASE_FILENAME = "index"; | ||
export declare const DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME = "index"; | ||
/** | ||
@@ -169,3 +176,3 @@ * Nonce which is used for replacing things in strings | ||
*/ | ||
export declare const IS_VERBOSE = false; | ||
export declare const DEFAULT_IS_VERBOSE = false; | ||
/** | ||
@@ -176,3 +183,3 @@ * @@@ | ||
*/ | ||
export declare const IS_AUTO_INSTALLED = false; | ||
export declare const DEFAULT_IS_AUTO_INSTALLED = false; | ||
/** | ||
@@ -179,0 +186,0 @@ * @@@ |
@@ -11,3 +11,4 @@ import type { PipelineExecutorResult } from './PipelineExecutorResult'; | ||
/** | ||
* TODO: [๐] This function should be removed OR changed OR be completely rewritten | ||
* TODO: [๐ง ] Can this return type be better typed than void | ||
*/ |
@@ -0,8 +1,9 @@ | ||
import type { CsvSettings } from '../../formats/csv/CsvSettings'; | ||
import type { PrepareAndScrapeOptions } from '../../prepare/PrepareAndScrapeOptions'; | ||
import type { PipelineJson } from '../../types/PipelineJson/PipelineJson'; | ||
import type { ExecutionTools } from '../ExecutionTools'; | ||
import type { CreatePipelineExecutorSettings } from './00-CreatePipelineExecutorSettings'; | ||
/** | ||
* Options for `createPipelineExecutor` | ||
*/ | ||
export type CreatePipelineExecutorOptions = { | ||
export type CreatePipelineExecutorOptions = PrepareAndScrapeOptions & { | ||
/** | ||
@@ -17,8 +18,30 @@ * The pipeline to be executed | ||
/** | ||
* Optional settings for the pipeline executor | ||
* When executor does not satisfy expectations it will be retried this amount of times | ||
* | ||
* @default MAX_EXECUTION_ATTEMPTS | ||
*/ | ||
readonly settings?: Partial<CreatePipelineExecutorSettings>; | ||
readonly maxExecutionAttempts?: number; | ||
/** | ||
* Settings for CSV format | ||
* | ||
* @default DEFAULT_CSV_SETTINGS | ||
*/ | ||
readonly csvSettings?: CsvSettings; | ||
/** | ||
* If you pass fully prepared pipeline, this does not matter | ||
* | ||
* Otherwise: | ||
* If false or not set, warning is shown when pipeline is not prepared | ||
* If true, warning is suppressed | ||
* | ||
* @default false | ||
*/ | ||
readonly isNotPreparedWarningSupressed?: boolean; | ||
}; | ||
/** | ||
* TODO: !!!!!! Unite `CreatePipelineExecutorOptions` and `CreatePipelineExecutorSettings` OR describe the difference | ||
*/ | ||
* TODO: [๐ง][๐ง ] Move `csvSettings` to some better place | ||
* 1) either to some dependency in `ExecutionTools` | ||
* 2) or make here container for multiple formats | ||
* 3) or make the setting more universal and which just sets things like `delimiter` and `quote` without specifying the format | ||
* TODO: [๐คนโโ๏ธ] More granular setting for limits of execution + better waiting for queue | ||
*/ |
@@ -5,5 +5,4 @@ import type { Promisable, ReadonlyDeep } from 'type-fest'; | ||
import type { Parameters } from '../../types/typeAliases'; | ||
import type { ExecutionTools } from '../ExecutionTools'; | ||
import type { PipelineExecutorResult } from '../PipelineExecutorResult'; | ||
import type { CreatePipelineExecutorSettings } from './00-CreatePipelineExecutorSettings'; | ||
import type { CreatePipelineExecutorOptions } from './00-CreatePipelineExecutorOptions'; | ||
/** | ||
@@ -14,3 +13,3 @@ * @@@ | ||
*/ | ||
type ExecutePipelineOptions = { | ||
type ExecutePipelineOptions = CreatePipelineExecutorOptions & { | ||
/** | ||
@@ -23,6 +22,2 @@ * @@@ | ||
*/ | ||
readonly tools: ExecutionTools; | ||
/** | ||
* @@@ | ||
*/ | ||
onProgress?(taskProgress: TaskProgress): Promisable<void>; | ||
@@ -45,6 +40,2 @@ /** | ||
readonly pipelineIdentification: string; | ||
/** | ||
* Settings for the pipeline executor | ||
*/ | ||
readonly settings: CreatePipelineExecutorSettings; | ||
}; | ||
@@ -51,0 +42,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import { Promisable, ReadonlyDeep } from 'type-fest'; | ||
import type { Promisable, ReadonlyDeep, WritableDeep } from 'type-fest'; | ||
import type { ExecutionReportJson } from '../../types/execution-report/ExecutionReportJson'; | ||
@@ -7,4 +7,3 @@ import type { PipelineJson } from '../../types/PipelineJson/PipelineJson'; | ||
import type { Parameters } from '../../types/typeAliases'; | ||
import type { ExecutionTools } from '../ExecutionTools'; | ||
import type { CreatePipelineExecutorSettings } from './00-CreatePipelineExecutorSettings'; | ||
import type { CreatePipelineExecutorOptions } from './00-CreatePipelineExecutorOptions'; | ||
/** | ||
@@ -15,3 +14,3 @@ * @@@ | ||
*/ | ||
type executeSingleTemplateOptions = { | ||
type executeSingleTemplateOptions = CreatePipelineExecutorOptions & { | ||
/** | ||
@@ -32,15 +31,7 @@ * @@@ | ||
*/ | ||
readonly tools: ExecutionTools; | ||
/** | ||
* @@@ | ||
*/ | ||
readonly onProgress: (taskProgress: TaskProgress) => Promisable<void>; | ||
/** | ||
* Settings for the pipeline executor | ||
*/ | ||
readonly settings: CreatePipelineExecutorSettings; | ||
/** | ||
* @@@ | ||
*/ | ||
readonly $executionReport: ExecutionReportJson; | ||
readonly $executionReport: WritableDeep<ExecutionReportJson>; | ||
/** | ||
@@ -47,0 +38,0 @@ * @@@ |
@@ -1,2 +0,2 @@ | ||
import type { ReadonlyDeep } from 'type-fest'; | ||
import type { ReadonlyDeep, WritableDeep } from 'type-fest'; | ||
import type { ExecutionReportJson } from '../../types/execution-report/ExecutionReportJson'; | ||
@@ -8,4 +8,3 @@ import type { PipelineJson } from '../../types/PipelineJson/PipelineJson'; | ||
import type { TODO_string } from '../../utils/organization/TODO_string'; | ||
import type { ExecutionTools } from '../ExecutionTools'; | ||
import type { CreatePipelineExecutorSettings } from './00-CreatePipelineExecutorSettings'; | ||
import type { CreatePipelineExecutorOptions } from './00-CreatePipelineExecutorOptions'; | ||
/** | ||
@@ -16,7 +15,7 @@ * @@@ | ||
*/ | ||
export type ExecuteAttemptsOptions = { | ||
export type ExecuteAttemptsOptions = Omit<CreatePipelineExecutorOptions, 'pipeline'> & { | ||
/** | ||
* @@@ | ||
*/ | ||
readonly jokerParameterNames: Readonly<Array<string_parameter_name>>; | ||
readonly jokerParameterNames: Readonly<ReadonlyArray<string_parameter_name>>; | ||
/** | ||
@@ -28,2 +27,6 @@ * @@@ | ||
* @@@ | ||
* | ||
* Note: [๐] There are two distinct variabiles | ||
* 1) `maxExecutionAttempts` - the amount of attempts LLM model | ||
* 2) `maxAttempts` - the amount of attempts for any template - LLM, SCRIPT, DIALOG, etc. | ||
*/ | ||
@@ -50,14 +53,6 @@ readonly maxAttempts: number; | ||
*/ | ||
readonly tools: ExecutionTools; | ||
readonly $executionReport: WritableDeep<ExecutionReportJson>; | ||
/** | ||
* Settings for the pipeline executor | ||
*/ | ||
readonly settings: CreatePipelineExecutorSettings; | ||
/** | ||
* @@@ | ||
*/ | ||
readonly $executionReport: ExecutionReportJson; | ||
/** | ||
* @@@ | ||
*/ | ||
readonly pipelineIdentification: string; | ||
@@ -64,0 +59,0 @@ }; |
/** | ||
* Represents a vector in an latent space of the embedding model | ||
*/ | ||
export type EmbeddingVector = Array<number>; | ||
export type EmbeddingVector = ReadonlyArray<number>; | ||
/** | ||
@@ -6,0 +6,0 @@ * TODO: Figure out how to use NPM package xyzt |
import type { Scraper } from '../scrapers/_common/Scraper'; | ||
import type { Arrayable } from '../types/Arrayable'; | ||
import type { Executables } from './Executables'; | ||
import type { FilesystemTools } from './FilesystemTools'; | ||
@@ -32,2 +33,10 @@ import type { LlmExecutionTools } from './LlmExecutionTools'; | ||
* | ||
* Tip: Use `$provideExecutablesForNode` | ||
* | ||
* @default [] - If not provided, no external knowledge extraction will be possible | ||
*/ | ||
readonly executables?: Executables; | ||
/** | ||
* Scrapers for extracting knowledge from external sources | ||
* | ||
* Tip: Use `$provideScrapersForNode` OR `$provideScrapersForBrowser` to use all available scrapers | ||
@@ -55,4 +64,1 @@ * | ||
}; | ||
/** | ||
* TODO: !!!!!! Move here also the executables and make $provideXxxxForNode | ||
*/ |
@@ -40,3 +40,3 @@ import type { Promisable } from 'type-fest'; | ||
*/ | ||
listModels(): Promisable<Array<AvailableModel>>; | ||
listModels(): Promisable<ReadonlyArray<AvailableModel>>; | ||
/** | ||
@@ -43,0 +43,0 @@ * Calls a chat model |
@@ -30,7 +30,7 @@ import { ReadonlyDeep } from 'type-fest'; | ||
*/ | ||
readonly errors: ReadonlyDeep<Array<ErrorJson>>; | ||
readonly errors: ReadonlyDeep<ReadonlyArray<ErrorJson>>; | ||
/** | ||
* Warnings that occured during the execution, details are aviable in `executionReport` | ||
*/ | ||
readonly warnings: ReadonlyDeep<Array<ErrorJson>>; | ||
readonly warnings: ReadonlyDeep<ReadonlyArray<ErrorJson>>; | ||
/** | ||
@@ -37,0 +37,0 @@ * The report of the execution with all details |
import type { AutomaticTranslator } from './AutomaticTranslator'; | ||
import type { TranslatorOptions } from './TranslatorOptions'; | ||
interface LindatAutomaticTranslatorOptions extends TranslatorOptions { | ||
apiUrl?: URL; | ||
} | ||
/** | ||
* @@@ | ||
*/ | ||
type LindatAutomaticTranslatorOptions = TranslatorOptions & { | ||
/** | ||
* @@@ | ||
*/ | ||
readonly apiUrl?: URL; | ||
}; | ||
/** | ||
* @@@ | ||
* | ||
* @private still in development [๐ณ] | ||
@@ -8,0 +16,0 @@ */ |
@@ -9,2 +9,2 @@ import type { PromptResultUsage } from '../PromptResultUsage'; | ||
*/ | ||
export declare function addUsage(...usageItems: Array<PromptResultUsage>): PromptResultUsage; | ||
export declare function addUsage(...usageItems: ReadonlyArray<PromptResultUsage>): PromptResultUsage; |
@@ -19,3 +19,3 @@ import type { Promisable } from 'type-fest'; | ||
*/ | ||
export declare function forEachAsync<TItem>(array: Array<TItem>, options: ForEachAsyncOptions, callbackfunction: (value: TItem, index: number, array: Array<TItem>) => Promisable<void>): Promise<void>; | ||
export declare function forEachAsync<TItem>(array: ReadonlyArray<TItem>, options: ForEachAsyncOptions, callbackfunction: (value: TItem, index: number, array: ReadonlyArray<TItem>) => Promisable<void>): Promise<void>; | ||
export {}; |
@@ -24,3 +24,3 @@ import type { string_mime_type } from '../../types/typeAliases'; | ||
*/ | ||
readonly aliases?: Array<string_name & string_SCREAMING_CASE>; | ||
readonly aliases?: ReadonlyArray<string_name & string_SCREAMING_CASE>; | ||
/** | ||
@@ -62,3 +62,3 @@ * The mime type of the format (if any) | ||
*/ | ||
readonly subvalueDefinitions: Array<FormatSubvalueDefinition<TValue, TSettings>>; | ||
readonly subvalueDefinitions: ReadonlyArray<FormatSubvalueDefinition<TValue, TSettings>>; | ||
}; | ||
@@ -65,0 +65,0 @@ /** |
import type { Promisable } from 'type-fest'; | ||
import type { Parameters } from '../../types/typeAliases'; | ||
import type { string_name } from '../../types/typeAliases'; | ||
import type { string_parameter_name } from '../../types/typeAliases'; | ||
import type { string_name } from '../../types/typeAliases'; | ||
import type { string_SCREAMING_CASE } from '../../utils/normalization/normalizeTo_SCREAMING_CASE'; | ||
@@ -20,3 +20,3 @@ import type { empty_object } from '../../utils/organization/empty_object'; | ||
*/ | ||
readonly aliases?: Array<string_name & string_SCREAMING_CASE>; | ||
readonly aliases?: ReadonlyArray<string_name & string_SCREAMING_CASE>; | ||
/** | ||
@@ -23,0 +23,0 @@ * Maps values |
@@ -1,2 +0,2 @@ | ||
import type { PrepareAndScrapeOptions } from '../../../prepare/PrepareAndScrapeOptions'; | ||
import type { CacheLlmToolsOptions } from '../utils/cache/CacheLlmToolsOptions'; | ||
import type { LlmExecutionToolsWithTotalUsage } from '../utils/count-total-usage/LlmExecutionToolsWithTotalUsage'; | ||
@@ -8,3 +8,3 @@ /** | ||
*/ | ||
export declare function $provideLlmToolsForCli(options?: Pick<PrepareAndScrapeOptions, 'isCacheCleaned'>): LlmExecutionToolsWithTotalUsage; | ||
export declare function $provideLlmToolsForCli(options?: Pick<CacheLlmToolsOptions, 'isCacheReloaded'>): LlmExecutionToolsWithTotalUsage; | ||
/** | ||
@@ -11,0 +11,0 @@ * Note: [๐ก] Code in this file should never be published outside of `@promptbook/cli` |
@@ -9,3 +9,3 @@ import type { string_title } from '../../../types/typeAliases'; | ||
*/ | ||
export type LlmToolsConfiguration = Array<Registered & { | ||
export type LlmToolsConfiguration = ReadonlyArray<Registered & { | ||
/** | ||
@@ -12,0 +12,0 @@ * @@@ |
import type { PromptbookStorage } from '../../../../storage/_common/PromptbookStorage'; | ||
import type { CacheItem } from './CacheItem'; | ||
/** | ||
* @@@ | ||
*/ | ||
export type CacheLlmToolsOptions = { | ||
@@ -15,3 +18,3 @@ /** | ||
*/ | ||
isReloaded?: boolean; | ||
isCacheReloaded?: boolean; | ||
}; |
@@ -11,3 +11,3 @@ import type { AvailableModel } from '../../execution/AvailableModel'; | ||
*/ | ||
export declare const ANTHROPIC_CLAUDE_MODELS: Array<AvailableModel & { | ||
export declare const ANTHROPIC_CLAUDE_MODELS: ReadonlyArray<AvailableModel & { | ||
pricing?: { | ||
@@ -14,0 +14,0 @@ readonly prompt: number_usd; |
@@ -38,3 +38,3 @@ import Anthropic from '@anthropic-ai/sdk'; | ||
*/ | ||
listModels(): Array<AvailableModel>; | ||
listModels(): ReadonlyArray<AvailableModel>; | ||
/** | ||
@@ -41,0 +41,0 @@ * Calls Anthropic Claude API to use a chat model. |
@@ -38,3 +38,3 @@ import { OpenAIClient } from '@azure/openai'; | ||
*/ | ||
listModels(): Promise<Array<AvailableModel>>; | ||
listModels(): Promise<ReadonlyArray<AvailableModel>>; | ||
/** | ||
@@ -41,0 +41,0 @@ * Calls OpenAI API to use a chat model. |
@@ -12,5 +12,5 @@ import type { Expectations } from '../../types/PipelineJson/Expectations'; | ||
*/ | ||
export declare function $fakeTextToExpectations(expectations: Expectations, postprocessingFunctionNames?: Array<string_postprocessing_function_name>): Promise<string>; | ||
export declare function $fakeTextToExpectations(expectations: Expectations, postprocessingFunctionNames?: ReadonlyArray<string_postprocessing_function_name>): Promise<string>; | ||
/** | ||
* TODO: [๐] Unite object for expecting amount and format - use here also a format | ||
*/ |
@@ -27,3 +27,3 @@ import type { AvailableModel } from '../../execution/AvailableModel'; | ||
*/ | ||
listModels(): Array<AvailableModel>; | ||
listModels(): ReadonlyArray<AvailableModel>; | ||
/** | ||
@@ -30,0 +30,0 @@ * Mocks chat model |
@@ -28,3 +28,3 @@ import type { AvailableModel } from '../../execution/AvailableModel'; | ||
*/ | ||
listModels(): Array<AvailableModel>; | ||
listModels(): ReadonlyArray<AvailableModel>; | ||
/** | ||
@@ -31,0 +31,0 @@ * Fakes chat model |
@@ -18,5 +18,5 @@ import type { LlmExecutionTools } from '../../execution/LlmExecutionTools'; | ||
*/ | ||
export declare function joinLlmExecutionTools(...llmExecutionTools: Array<LlmExecutionTools>): MultipleLlmExecutionTools; | ||
export declare function joinLlmExecutionTools(...llmExecutionTools: ReadonlyArray<LlmExecutionTools>): MultipleLlmExecutionTools; | ||
/** | ||
* TODO: [๐ทโโ๏ธ] @@@ Manual about construction of llmTools | ||
*/ |
@@ -18,4 +18,3 @@ import type { AvailableModel } from '../../execution/AvailableModel'; | ||
* Note: Internal utility of `joinLlmExecutionTools` but exposed type | ||
* @public exported from `@promptbook/types` | ||
* TODO: !!!!!! Export as runtime class not just type | ||
* @public exported from `@promptbook/core` | ||
*/ | ||
@@ -26,7 +25,7 @@ export declare class MultipleLlmExecutionTools implements LlmExecutionTools { | ||
*/ | ||
readonly llmExecutionTools: Array<LlmExecutionTools>; | ||
readonly llmExecutionTools: ReadonlyArray<LlmExecutionTools>; | ||
/** | ||
* Gets array of execution tools in order of priority | ||
*/ | ||
constructor(...llmExecutionTools: Array<LlmExecutionTools>); | ||
constructor(...llmExecutionTools: ReadonlyArray<LlmExecutionTools>); | ||
get title(): string_title & string_markdown_text; | ||
@@ -42,3 +41,3 @@ get description(): string_markdown; | ||
*/ | ||
listModels(): Promise<Array<AvailableModel>>; | ||
listModels(): Promise<ReadonlyArray<AvailableModel>>; | ||
/** | ||
@@ -45,0 +44,0 @@ * Calls the best available chat model |
@@ -12,3 +12,3 @@ import type { AvailableModel } from '../../execution/AvailableModel'; | ||
*/ | ||
export declare const OPENAI_MODELS: Array<AvailableModel & { | ||
export declare const OPENAI_MODELS: ReadonlyArray<AvailableModel & { | ||
pricing?: { | ||
@@ -15,0 +15,0 @@ readonly prompt: number_usd; |
@@ -48,3 +48,3 @@ import OpenAI from 'openai'; | ||
*/ | ||
listModels(): Array<AvailableModel>; | ||
listModels(): ReadonlyArray<AvailableModel>; | ||
/** | ||
@@ -51,0 +51,0 @@ * Calls OpenAI API to use a chat model. |
@@ -7,10 +7,10 @@ import type { AvailableModel } from '../../../execution/AvailableModel'; | ||
*/ | ||
export interface PromptbookServer_ListModels_Response { | ||
export type PromptbookServer_ListModels_Response = { | ||
/** | ||
* Available models that can be used | ||
*/ | ||
readonly models: Array<AvailableModel>; | ||
} | ||
readonly models: ReadonlyArray<AvailableModel>; | ||
}; | ||
/** | ||
* TODO: [๐] Listing models (and checking configuration) probbably should go through REST API not Socket.io | ||
*/ |
@@ -7,3 +7,3 @@ import type { PromptResult } from '../../../execution/PromptResult'; | ||
*/ | ||
export interface PromptbookServer_Prompt_Response { | ||
export type PromptbookServer_Prompt_Response = { | ||
/** | ||
@@ -13,2 +13,2 @@ * The result of the prompt | ||
readonly promptResult: PromptResult; | ||
} | ||
}; |
@@ -34,3 +34,3 @@ import type { AvailableModel } from '../../execution/AvailableModel'; | ||
*/ | ||
listModels(): Promise<Array<AvailableModel>>; | ||
listModels(): Promise<ReadonlyArray<AvailableModel>>; | ||
/** | ||
@@ -37,0 +37,0 @@ * Creates a connection to the remote proxy server. |
@@ -0,1 +1,2 @@ | ||
import type { IntermediateFilesStrategy } from '../types/IntermediateFilesStrategy'; | ||
import type { string_dirname } from '../types/typeAliases'; | ||
@@ -24,8 +25,7 @@ /** | ||
/** | ||
* If true, the cache is cleaned after the scraping | ||
* Strategy for caching the intermediate results for knowledge source | ||
* | ||
* | ||
* @default false // <- TODO: !!!!!! Change to `cacheStrategy`/`intermediateFiles`, Put to global config, change to `true` and explicitly set to `false` in all playgrounds | ||
* @default DEFAULT_INTERMEDIATE_FILES_STRATEGY | ||
*/ | ||
readonly isCacheCleaned?: boolean; | ||
readonly intermediateFilesStrategy?: IntermediateFilesStrategy; | ||
/** | ||
@@ -38,21 +38,2 @@ * Maximum number of tasks running in parallel | ||
/** | ||
* Path to the external programs executables | ||
* | ||
* TODO: !!!!!! Transform to scrapers and make them Classy | ||
*/ | ||
readonly externalProgramsPaths?: { | ||
/** | ||
* Path to the `pandoc` executable | ||
* | ||
* @example 'C:/Users/me/AppData/Local/Pandoc/pandoc.exe' | ||
*/ | ||
readonly pandocPath?: string; | ||
/** | ||
* Path to the LibreOffice executable | ||
* | ||
* @example 'C:/Program Files/LibreOffice/program/swriter.exe' | ||
*/ | ||
readonly libreOfficePath?: string; | ||
}; | ||
/** | ||
* If true, the missing software is automatically installed | ||
@@ -59,0 +40,0 @@ */ |
@@ -15,3 +15,3 @@ import type { ExecutionTools } from '../execution/ExecutionTools'; | ||
*/ | ||
readonly templatesPrepared: Array<TemplateJson>; | ||
readonly templatesPrepared: ReadonlyArray<TemplateJson>; | ||
}; | ||
@@ -18,0 +18,0 @@ /** |
@@ -11,3 +11,3 @@ import type { PrepareAndScrapeOptions } from '../../prepare/PrepareAndScrapeOptions'; | ||
*/ | ||
export declare function prepareKnowledgePieces(knowledgeSources: Array<KnowledgeSourceJson>, tools: Pick<ExecutionTools, 'llm' | 'fs' | 'scrapers'>, options: PrepareAndScrapeOptions): Promise<Array<Omit<KnowledgePiecePreparedJson, 'preparationIds'>>>; | ||
export declare function prepareKnowledgePieces(knowledgeSources: ReadonlyArray<KnowledgeSourceJson>, tools: Pick<ExecutionTools, 'llm' | 'fs' | 'scrapers'>, options: PrepareAndScrapeOptions): Promise<ReadonlyArray<Omit<KnowledgePiecePreparedJson, 'preparationIds'>>>; | ||
/** | ||
@@ -14,0 +14,0 @@ * TODO: [๐ง] In future one preparation can take data from previous preparation and save tokens and time |
@@ -5,3 +5,3 @@ import type { ExecutionTools } from '../../../execution/ExecutionTools'; | ||
/** | ||
* @@@!!!!!! | ||
* @@@ | ||
* | ||
@@ -13,2 +13,2 @@ * 1) @@@ | ||
*/ | ||
export declare function $provideScrapersForBrowser(tools: Pick<ExecutionTools, 'llm'>, options?: PrepareAndScrapeOptions): Promise<Array<Scraper>>; | ||
export declare function $provideScrapersForBrowser(tools: Pick<ExecutionTools, 'llm'>, options?: PrepareAndScrapeOptions): Promise<ReadonlyArray<Scraper>>; |
@@ -5,3 +5,3 @@ import type { ExecutionTools } from '../../../execution/ExecutionTools'; | ||
/** | ||
* !!!!!! | ||
* @@@ | ||
* | ||
@@ -13,5 +13,5 @@ * 1) @@@ | ||
*/ | ||
export declare function $provideScrapersForNode(tools: Pick<ExecutionTools, 'fs' | 'llm'>, options?: PrepareAndScrapeOptions): Promise<Array<Scraper>>; | ||
export declare function $provideScrapersForNode(tools: Pick<ExecutionTools, 'fs' | 'llm' | 'executables'>, options?: PrepareAndScrapeOptions): Promise<ReadonlyArray<Scraper>>; | ||
/** | ||
* Note: [๐ข] Code in this file should never be never released in packages that could be imported into browser environment | ||
*/ |
@@ -0,1 +1,2 @@ | ||
import type { Executables } from '../../../execution/Executables'; | ||
import type { string_mime_type } from '../../../types/typeAliases'; | ||
@@ -5,3 +6,2 @@ import type { string_promptbook_documentation_url } from '../../../types/typeAliases'; | ||
import type { Registered } from '../../../utils/$Register'; | ||
import type { TODO_any } from '../../../utils/organization/TODO_any'; | ||
/** | ||
@@ -37,3 +37,3 @@ * @@@ | ||
*/ | ||
readonly requiredExecutables: TODO_any; | ||
readonly requiredExecutables: ReadonlyArray<Capitalize<keyof Executables extends `${infer N}Path` ? N : never>>; | ||
/** | ||
@@ -40,0 +40,0 @@ * Link to documentation |
@@ -20,3 +20,3 @@ import type { Promisable } from 'type-fest'; | ||
*/ | ||
scrape(source: ScraperSourceHandler): Promisable<Array<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>> | null>; | ||
scrape(source: ScraperSourceHandler): Promisable<ReadonlyArray<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>> | null>; | ||
}; | ||
@@ -64,5 +64,1 @@ /** | ||
*/ | ||
/** | ||
* TODO: !!!!!! Test that this is catched | ||
* Note: [โซ] Code in this file should never be published in any package | ||
*/ |
@@ -16,3 +16,3 @@ import type { PrepareAndScrapeOptions } from '../../../prepare/PrepareAndScrapeOptions'; | ||
*/ | ||
type GetScraperIntermediateSourceHandler = Required<Pick<PrepareAndScrapeOptions, 'rootDirname' | 'cacheDirname' | 'isCacheCleaned' | 'isVerbose'>> & { | ||
type GetScraperIntermediateSourceHandler = Required<Pick<PrepareAndScrapeOptions, 'rootDirname' | 'cacheDirname' | 'intermediateFilesStrategy' | 'isVerbose'>> & { | ||
readonly extension: string_file_extension; | ||
@@ -32,5 +32,5 @@ }; | ||
* 1) Need to store more than serialized JSONs | ||
* 2) Need to switch between a `rootDirname` and `cacheDirname` <- TODO: !!!! | ||
* 2) Need to switch between a `rootDirname` and `cacheDirname` <- TODO: [๐ก] | ||
* TODO: [๐ฑโ๐][๐ง ] Make some smart crop | ||
* Note: [๐ข] Code in this file should never be never released in packages that could be imported into browser environment | ||
*/ |
@@ -16,3 +16,3 @@ import type { ExecutionTools } from '../../execution/ExecutionTools'; | ||
isAvilableInBrowser: false; | ||
requiredExecutables: string[]; | ||
requiredExecutables: ("Pandoc" | "LibreOffice")[]; | ||
}>; | ||
@@ -19,0 +19,0 @@ /** |
@@ -10,3 +10,3 @@ import type { KnowledgePiecePreparedJson } from '../../types/PipelineJson/KnowledgePieceJson'; | ||
/** | ||
* Scraper for .docx files | ||
* Scraper for old document files (like .doc and .rtf) | ||
* | ||
@@ -27,3 +27,3 @@ * @see `documentationUrl` for more details | ||
private readonly documentScraper; | ||
constructor(tools: Pick<ExecutionTools, 'fs' | 'llm'>, options: PrepareAndScrapeOptions); | ||
constructor(tools: Pick<ExecutionTools, 'fs' | 'llm' | 'executables'>, options: PrepareAndScrapeOptions); | ||
/** | ||
@@ -38,3 +38,3 @@ * Convert the `.doc` or `.rtf` to `.doc` file and returns intermediate source | ||
*/ | ||
scrape(source: ScraperSourceHandler): Promise<Array<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>> | null>; | ||
scrape(source: ScraperSourceHandler): Promise<ReadonlyArray<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>> | null>; | ||
} | ||
@@ -41,0 +41,0 @@ /** |
@@ -14,3 +14,3 @@ import type { Registration } from '../../utils/$Register'; | ||
isAvilableInBrowser: false; | ||
requiredExecutables: string[]; | ||
requiredExecutables: ("Pandoc" | "LibreOffice")[]; | ||
}>; | ||
@@ -17,0 +17,0 @@ /** |
@@ -16,3 +16,3 @@ import type { ExecutionTools } from '../../execution/ExecutionTools'; | ||
isAvilableInBrowser: false; | ||
requiredExecutables: string[]; | ||
requiredExecutables: "Pandoc"[]; | ||
}>; | ||
@@ -19,0 +19,0 @@ /** |
@@ -26,3 +26,3 @@ import type { KnowledgePiecePreparedJson } from '../../types/PipelineJson/KnowledgePieceJson'; | ||
private readonly markdownScraper; | ||
constructor(tools: Pick<ExecutionTools, 'fs' | 'llm'>, options: PrepareAndScrapeOptions); | ||
constructor(tools: Pick<ExecutionTools, 'fs' | 'llm' | 'executables'>, options: PrepareAndScrapeOptions); | ||
/** | ||
@@ -37,3 +37,3 @@ * Convert the `.docx` or `.odt` to `.md` file and returns intermediate source | ||
*/ | ||
scrape(source: ScraperSourceHandler): Promise<Array<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>> | null>; | ||
scrape(source: ScraperSourceHandler): Promise<ReadonlyArray<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>> | null>; | ||
} | ||
@@ -40,0 +40,0 @@ /** |
@@ -14,3 +14,3 @@ import type { Registration } from '../../utils/$Register'; | ||
isAvilableInBrowser: false; | ||
requiredExecutables: string[]; | ||
requiredExecutables: "Pandoc"[]; | ||
}>; | ||
@@ -17,0 +17,0 @@ /** |
@@ -16,3 +16,3 @@ import type { ExecutionTools } from '../../execution/ExecutionTools'; | ||
isAvilableInBrowser: true; | ||
requiredExecutables: string[]; | ||
requiredExecutables: never[]; | ||
}>; | ||
@@ -19,0 +19,0 @@ /** |
@@ -24,3 +24,3 @@ import type { KnowledgePiecePreparedJson } from '../../types/PipelineJson/KnowledgePieceJson'; | ||
*/ | ||
scrape(source: ScraperSourceHandler): Promise<Array<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>> | null>; | ||
scrape(source: ScraperSourceHandler): Promise<ReadonlyArray<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>> | null>; | ||
} | ||
@@ -27,0 +27,0 @@ /** |
@@ -14,3 +14,3 @@ import type { Registration } from '../../utils/$Register'; | ||
isAvilableInBrowser: true; | ||
requiredExecutables: string[]; | ||
requiredExecutables: never[]; | ||
}>; | ||
@@ -17,0 +17,0 @@ /** |
@@ -16,3 +16,3 @@ import type { ExecutionTools } from '../../execution/ExecutionTools'; | ||
isAvilableInBrowser: true; | ||
requiredExecutables: string[]; | ||
requiredExecutables: never[]; | ||
}>; | ||
@@ -19,0 +19,0 @@ /** |
@@ -10,3 +10,3 @@ import type { KnowledgePiecePreparedJson } from '../../types/PipelineJson/KnowledgePieceJson'; | ||
/** | ||
* Scraper for .docx files | ||
* Scraper for .pdf files | ||
* | ||
@@ -35,3 +35,3 @@ * @see `documentationUrl` for more details | ||
*/ | ||
scrape(source: ScraperSourceHandler): Promise<Array<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>> | null>; | ||
scrape(source: ScraperSourceHandler): Promise<ReadonlyArray<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>> | null>; | ||
} | ||
@@ -38,0 +38,0 @@ /** |
@@ -14,3 +14,3 @@ import type { Registration } from '../../utils/$Register'; | ||
isAvilableInBrowser: true; | ||
requiredExecutables: string[]; | ||
requiredExecutables: never[]; | ||
}>; | ||
@@ -17,0 +17,0 @@ /** |
@@ -16,3 +16,3 @@ import type { ExecutionTools } from '../../execution/ExecutionTools'; | ||
isAvilableInBrowser: false; | ||
requiredExecutables: string[]; | ||
requiredExecutables: never[]; | ||
}>; | ||
@@ -19,0 +19,0 @@ /** |
@@ -14,3 +14,3 @@ import type { Registration } from '../../utils/$Register'; | ||
isAvilableInBrowser: false; | ||
requiredExecutables: string[]; | ||
requiredExecutables: never[]; | ||
}>; | ||
@@ -17,0 +17,0 @@ /** |
@@ -11,3 +11,3 @@ import type { KnowledgePiecePreparedJson } from '../../types/PipelineJson/KnowledgePieceJson'; | ||
/** | ||
* Scraper for .docx files | ||
* Scraper for websites | ||
* | ||
@@ -28,2 +28,6 @@ * @see `documentationUrl` for more details | ||
private readonly markdownScraper; | ||
/** | ||
* Showdown converter is used internally | ||
*/ | ||
private readonly showdownConverter; | ||
constructor(tools: Pick<ExecutionTools, 'fs' | 'llm'>, options: PrepareAndScrapeOptions); | ||
@@ -41,6 +45,5 @@ /** | ||
*/ | ||
scrape(source: ScraperSourceHandler): Promise<Array<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>> | null>; | ||
scrape(source: ScraperSourceHandler): Promise<ReadonlyArray<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>> | null>; | ||
} | ||
/** | ||
* TODO: !!!!!! Put into separate package | ||
* TODO: [๐ฃ] Scraped website in .md can act as cache item - there is no need to run conversion each time | ||
@@ -47,0 +50,0 @@ * TODO: [๐ช] Do it in parallel 11:11 |
@@ -10,5 +10,5 @@ import type { really_any } from '../../../utils/organization/really_any'; | ||
*/ | ||
export declare function preserve(func: (...params: Array<really_any>) => unknown): void; | ||
export declare function preserve(func: (...params: ReadonlyArray<really_any>) => unknown): void; | ||
/** | ||
* TODO: !! [1] This maybe does memory leak | ||
*/ |
@@ -7,2 +7,2 @@ import type { string_name } from '../../../types/typeAliases'; | ||
*/ | ||
export declare function nameToSubfolderPath(name: string_name): Array<string>; | ||
export declare function nameToSubfolderPath(name: string_name): ReadonlyArray<string>; |
@@ -10,2 +10,2 @@ /** | ||
*/ | ||
export type Arrayable<TItem> = TItem | Array<TItem> | undefined; | ||
export type Arrayable<TItem> = TItem | ReadonlyArray<TItem> | undefined; |
@@ -40,3 +40,3 @@ import type { string_markdown_text } from '../typeAliases'; | ||
*/ | ||
readonly promptExecutions: Array<ExecutionPromptReportJson>; | ||
readonly promptExecutions: ReadonlyArray<ExecutionPromptReportJson>; | ||
}; |
@@ -34,3 +34,3 @@ import type { EmbeddingVector } from '../../execution/EmbeddingVector'; | ||
*/ | ||
readonly sources: Array<{ | ||
readonly sources: ReadonlyArray<{ | ||
/** | ||
@@ -52,7 +52,7 @@ * Identifier of the source | ||
*/ | ||
readonly keywords: Array<string_keyword>; | ||
readonly keywords: ReadonlyArray<string_keyword>; | ||
/** | ||
* List of models embeddings that are associated with the knowledge piece | ||
*/ | ||
readonly index: Array<{ | ||
readonly index: ReadonlyArray<{ | ||
/** | ||
@@ -70,3 +70,3 @@ * Model name which generated the embedding | ||
*/ | ||
readonly preparationIds: Array<number_id>; | ||
readonly preparationIds: ReadonlyArray<number_id>; | ||
}; | ||
@@ -73,0 +73,0 @@ /** |
@@ -40,3 +40,3 @@ import type { number_id } from '../typeAliases'; | ||
*/ | ||
readonly preparationIds: Array<number_id>; | ||
readonly preparationIds: ReadonlyArray<number_id>; | ||
}; | ||
@@ -43,0 +43,0 @@ /** |
@@ -41,3 +41,3 @@ import type { ChatModelRequirements } from '../ModelRequirements'; | ||
*/ | ||
readonly preparationIds: Array<number_id>; | ||
readonly preparationIds: ReadonlyArray<number_id>; | ||
}; | ||
@@ -44,0 +44,0 @@ /** |
@@ -16,3 +16,3 @@ import type { ForeachJson } from '../../commands/FOREACH/ForeachJson'; | ||
*/ | ||
export interface TemplateJsonCommon { | ||
export type TemplateJsonCommon = { | ||
/** | ||
@@ -97,3 +97,3 @@ * Name of the template | ||
readonly resultingParameterName: string_name; | ||
} | ||
}; | ||
/** | ||
@@ -100,0 +100,0 @@ * TODO: use one helper type> (string_prompt | string_javascript | string_markdown) & string_template |
@@ -80,3 +80,3 @@ import type { FormatCommand } from '../commands/FORMAT/FormatCommand'; | ||
*/ | ||
readonly postprocessingFunctionNames?: Array<string_postprocessing_function_name>; | ||
readonly postprocessingFunctionNames?: ReadonlyArray<string_postprocessing_function_name>; | ||
/** | ||
@@ -83,0 +83,0 @@ * Expectations for the answer |
@@ -37,4 +37,4 @@ import { type IDestroyable } from 'destroyable'; | ||
constructor(registerName: string_name); | ||
list(): Array<TRegistered>; | ||
list(): ReadonlyArray<TRegistered>; | ||
register(registered: TRegistered): Registration; | ||
} |
@@ -11,2 +11,2 @@ import type { Arrayable } from '../types/Arrayable'; | ||
*/ | ||
export declare function arrayableToArray<TItem>(input?: Arrayable<TItem>): Array<TItem>; | ||
export declare function arrayableToArray<TItem>(input?: Arrayable<TItem>): ReadonlyArray<TItem>; |
@@ -11,3 +11,3 @@ import type { string_char_emoji } from '../types/typeAliasEmoji'; | ||
*/ | ||
export declare const EMOJIS_IN_CATEGORIES: Record<string, Array<string_char_emoji>>; | ||
export declare const EMOJIS_IN_CATEGORIES: Record<string, ReadonlyArray<string_char_emoji>>; | ||
/** | ||
@@ -14,0 +14,0 @@ * |
@@ -1,2 +0,2 @@ | ||
import type { IExecCommandOptions } from './IExecCommandOptions'; | ||
import type { ExecCommandOptions } from './ExecCommandOptions'; | ||
/** | ||
@@ -11,5 +11,5 @@ * Run one command in a shell | ||
*/ | ||
export declare function $execCommand(options: IExecCommandOptions): Promise<string>; | ||
export declare function $execCommand(options: ExecCommandOptions): Promise<string>; | ||
/** | ||
* Note: [๐ข] Code in this file should never be never released in packages that could be imported into browser environment | ||
*/ |
@@ -1,3 +0,3 @@ | ||
import type { IExecCommandOptions } from './IExecCommandOptions'; | ||
import type { IExecCommandOptionsAdvanced } from './IExecCommandOptions'; | ||
import type { ExecCommandOptions } from './ExecCommandOptions'; | ||
import type { ExecCommandOptionsAdvanced } from './ExecCommandOptions'; | ||
/** | ||
@@ -8,4 +8,4 @@ * Normalize options for `execCommand` and `execCommands` | ||
*/ | ||
export declare function execCommandNormalizeOptions(options: IExecCommandOptions): Pick<IExecCommandOptionsAdvanced, 'command' | 'args' | 'cwd' | 'crashOnError' | 'timeout'> & { | ||
export declare function execCommandNormalizeOptions(options: ExecCommandOptions): Pick<ExecCommandOptionsAdvanced, 'command' | 'args' | 'cwd' | 'crashOnError' | 'timeout'> & { | ||
humanReadableCommand: string; | ||
}; |
@@ -7,3 +7,3 @@ import type { ExpectationAmount } from '../../types/PipelineJson/Expectations'; | ||
*/ | ||
export declare function splitIntoSentences(text: string): Array<string>; | ||
export declare function splitIntoSentences(text: string): ReadonlyArray<string>; | ||
/** | ||
@@ -10,0 +10,0 @@ * Counts number of sentences in the text |
/** | ||
* Represents items which are compared to each other | ||
*/ | ||
export type FromtoItems = Array<{ | ||
export type FromtoItems = ReadonlyArray<{ | ||
/** | ||
@@ -6,0 +6,0 @@ * The title of the item |
@@ -33,5 +33,5 @@ import type { string_markdown } from '../../types/typeAliases'; | ||
*/ | ||
export declare function extractAllBlocksFromMarkdown(markdown: string_markdown): Array<CodeBlock>; | ||
export declare function extractAllBlocksFromMarkdown(markdown: string_markdown): ReadonlyArray<CodeBlock>; | ||
/** | ||
* TODO: Maybe name for `blockNotation` instead of '```' and '>' | ||
*/ |
@@ -8,3 +8,3 @@ import type { string_markdown } from '../../types/typeAliases'; | ||
*/ | ||
export declare function splitMarkdownIntoSections(markdown: string_markdown): Array<string_markdown_section>; | ||
export declare function splitMarkdownIntoSections(markdown: string_markdown): ReadonlyArray<string_markdown_section>; | ||
/** | ||
@@ -11,0 +11,0 @@ * TODO: [๐] This can be part of markdown builder |
@@ -5,3 +5,3 @@ /** | ||
* Keyword is string without diacritics in lowercase [a-z1-9] | ||
* Words are splitted between multiple keywords @see IKeywords | ||
* Words are splitted between multiple keywords @see Keywords | ||
* | ||
@@ -19,5 +19,5 @@ * For example `"keyword"` | ||
*/ | ||
export type IKeywords = Set<string_keyword>; | ||
export type Keywords = Set<string_keyword>; | ||
/** | ||
* TODO: [๐ฎ] Keywords with weight | ||
*/ |
import type { really_unknown } from '../organization/really_unknown'; | ||
import type { IKeywords } from './IKeywords'; | ||
import type { Keywords } from './IKeywords'; | ||
/** | ||
@@ -12,3 +12,3 @@ * Parses keywords from any object and recursively walks through | ||
*/ | ||
export declare function parseKeywords(input: really_unknown): IKeywords; | ||
export declare function parseKeywords(input: really_unknown): Keywords; | ||
/** | ||
@@ -15,0 +15,0 @@ * Note: Not using spread in input param because of keeping second parameter for options |
@@ -1,2 +0,2 @@ | ||
import type { IKeywords } from './IKeywords'; | ||
import type { Keywords } from './IKeywords'; | ||
/** | ||
@@ -9,2 +9,2 @@ * Parses keywords from a string | ||
*/ | ||
export declare function parseKeywordsFromString(input: string): IKeywords; | ||
export declare function parseKeywordsFromString(input: string): Keywords; |
@@ -1,2 +0,2 @@ | ||
import type { IKeywords } from './IKeywords'; | ||
import type { Keywords } from './IKeywords'; | ||
/** | ||
@@ -10,2 +10,2 @@ * @@@ | ||
*/ | ||
export declare function searchKeywords(haystack: IKeywords, needle: IKeywords): boolean; | ||
export declare function searchKeywords(haystack: Keywords, needle: Keywords): boolean; |
@@ -16,2 +16,2 @@ import type { really_any } from './really_any'; | ||
*/ | ||
export declare function keepUnused<TTypeToKeep1 = really_any, TTypeToKeep2 = really_any, TTypeToKeep3 = really_any>(...valuesToKeep: Array<really_any>): void; | ||
export declare function keepUnused<TTypeToKeep1 = really_any, TTypeToKeep2 = really_any, TTypeToKeep3 = really_any>(...valuesToKeep: ReadonlyArray<really_any>): void; |
@@ -12,2 +12,2 @@ import type { really_any } from './really_any'; | ||
*/ | ||
export declare function TODO_USE(...value: Array<really_any>): void; | ||
export declare function TODO_USE(...value: ReadonlyArray<really_any>): void; |
@@ -6,5 +6,5 @@ import type { number_seed } from '../../types/typeAliases'; | ||
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic | ||
* Warning: This function is not cryptographically secure (it uses Math.random internally) | ||
* Warning: This function is NOT cryptographically secure (it uses Math.random internally) | ||
* @public exported from `@promptbook/utils` | ||
*/ | ||
export declare function $randomSeed(): number_seed; |
@@ -7,2 +7,2 @@ /** | ||
*/ | ||
export declare function intersection<TItem>(...sets: Array<Set<TItem>>): Set<TItem>; | ||
export declare function intersection<TItem>(...sets: ReadonlyArray<Set<TItem>>): Set<TItem>; |
@@ -7,2 +7,2 @@ /** | ||
*/ | ||
export declare function union<TItem>(...sets: Array<Set<TItem>>): Set<TItem>; | ||
export declare function union<TItem>(...sets: ReadonlyArray<Set<TItem>>): Set<TItem>; |
/** | ||
* Additional options for `unwrapResult` | ||
*/ | ||
interface UnwrapResultOptions { | ||
type UnwrapResultOptions = { | ||
/** | ||
* If true, the text is trimmed before processing | ||
*/ | ||
isTrimmed?: boolean; | ||
readonly isTrimmed?: boolean; | ||
/** | ||
@@ -18,4 +18,4 @@ * If true, the introduce sentence is removed | ||
*/ | ||
isIntroduceSentenceRemoved?: boolean; | ||
} | ||
readonly isIntroduceSentenceRemoved?: boolean; | ||
}; | ||
/** | ||
@@ -22,0 +22,0 @@ * Removes quotes and optional introduce text from a string |
{ | ||
"name": "@promptbook/utils", | ||
"version": "0.72.0-14", | ||
"version": "0.72.0-15", | ||
"description": "Supercharge your use of large language models", | ||
@@ -14,2 +14,3 @@ "private": false, | ||
], | ||
"todo-0": "TODO: [โ๏ธ] Make better list of keywords", | ||
"keywords": [ | ||
@@ -55,4 +56,4 @@ "ai", | ||
"dependencies": { | ||
"spacetrim": "0.11.39" | ||
"spacetrim": "0.11.59" | ||
} | ||
} |
@@ -5,3 +5,3 @@ <!-- โ ๏ธ WARNING: This code has been generated so that any manual changes will be overwritten --> | ||
Supercharge your use of large language models | ||
Build responsible, controlled and transparent applications on top of LLM models! | ||
@@ -8,0 +8,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
795753
572
15289
58
8
+ Addedspacetrim@0.11.59(transitive)
- Removedspacetrim@0.11.39(transitive)
Updatedspacetrim@0.11.59