@promptbook/remote-client
Advanced tools
Comparing version 0.24.0-0 to 0.24.0-1.0
@@ -1,2 +0,2 @@ | ||
import { string_name } from '.././types/typeAliases'; | ||
import { string_name, string_version } from '.././types/typeAliases'; | ||
import { PromptTemplateJson } from '../types/PromptTemplatePipelineJson/PromptTemplateJson'; | ||
@@ -19,2 +19,5 @@ import { PromptTemplateParameterJson } from '../types/PromptTemplatePipelineJson/PromptTemplateParameterJson'; | ||
readonly ptbkUrl: URL | null; | ||
readonly title: string | null; | ||
readonly ptbkVersion: string_version | null; | ||
readonly description: string | null; | ||
readonly parameters: Record<string_name, PromptTemplateParameterJson>; | ||
@@ -21,0 +24,0 @@ readonly promptTemplates: Array<PromptTemplateJson>; |
import { string_name } from '.././types/typeAliases'; | ||
import { CreatePtpExecutorSettings } from '../execution/createPtpExecutor'; | ||
import { ExecutionTools } from '../execution/ExecutionTools'; | ||
@@ -8,2 +9,6 @@ import { PtpExecutor } from '../execution/PtpExecutor'; | ||
import { PromptTemplatePipeline } from './PromptTemplatePipeline'; | ||
type PromptTemplatePipelineLibraryOptions = { | ||
readonly library: Record<string_name, PromptTemplatePipeline>; | ||
readonly settings: CreatePtpExecutorSettings; | ||
}; | ||
/** | ||
@@ -19,3 +24,3 @@ * Library of prompt template pipelines that groups together prompt template pipelines for an application. This is a very thin wrapper around the Array / Set of prompt template pipelines. | ||
export declare class PromptTemplatePipelineLibrary { | ||
readonly promptTemplatePipelines: Record<string_name, PromptTemplatePipeline>; | ||
readonly options: PromptTemplatePipelineLibraryOptions; | ||
/** | ||
@@ -30,3 +35,3 @@ * Constructs PromptTemplatePipeline from any sources | ||
*/ | ||
static fromSources(ptbkSources: Record<string_name, PromptTemplatePipelineJson | PromptTemplatePipelineString>): PromptTemplatePipelineLibrary; | ||
static fromSources(ptbkSources: Record<string_name, PromptTemplatePipelineJson | PromptTemplatePipelineString>, settings: CreatePtpExecutorSettings): PromptTemplatePipelineLibrary; | ||
private constructor(); | ||
@@ -46,2 +51,3 @@ /** | ||
} | ||
export {}; | ||
/** | ||
@@ -48,0 +54,0 @@ * TODO: !!! This should be renamed to Promptbook |
import { PromptTemplatePipeline } from '../classes/PromptTemplatePipeline'; | ||
import { ExecutionTools } from './ExecutionTools'; | ||
import { PtpExecutor } from './PtpExecutor'; | ||
export interface CreatePtpExecutorSettings { | ||
/** | ||
* When executor does not satisfy expectations it will be retried this amount of times | ||
* | ||
* !!!!!!! Make default in version 24.1.0 | ||
*/ | ||
readonly maxNaturalExecutionAttempts: number; | ||
} | ||
interface CreatePtpExecutorOptions { | ||
readonly ptp: PromptTemplatePipeline; | ||
readonly tools: ExecutionTools; | ||
readonly settings: CreatePtpExecutorSettings; | ||
} | ||
@@ -8,0 +17,0 @@ /** |
@@ -1,4 +0,5 @@ | ||
import { Promisable } from 'type-fest'; | ||
import { string_name } from '.././types/typeAliases'; | ||
import { TaskProgress } from '../types/TaskProgress'; | ||
import type { Promisable } from 'type-fest'; | ||
import type { string_name } from '.././types/typeAliases'; | ||
import type { TaskProgress } from '../types/TaskProgress'; | ||
import type { ExecutionReportJson } from '../types/execution-report/ExecutionReportJson'; | ||
/** | ||
@@ -15,3 +16,22 @@ * Executor is a simple async function that takes input parameters and returns result parameters _(along with all intermediate parameters and input parameters = it extends input object)_. | ||
export interface PtpExecutor { | ||
(inputParameters: Record<string_name, string>, onProgress: (taskProgress: TaskProgress) => Promisable<void>): Promise<Record<string_name, string>>; | ||
(inputParameters: Record<string_name, string>, onProgress: (taskProgress: TaskProgress) => Promisable<void>): Promise<{ | ||
/** | ||
* Whether the execution was successful | ||
*/ | ||
isSuccessful: boolean; | ||
/** | ||
* Errors that occured during the execution | ||
*/ | ||
errors: Array<Error>; | ||
/** | ||
* The report of the execution | ||
*/ | ||
executionReport: ExecutionReportJson; | ||
/** | ||
* Result parameters of the execution | ||
* | ||
* Note: If the execution was not successful, there are only some of the result parameters | ||
*/ | ||
outputParameters: Record<string_name, string>; | ||
}>; | ||
} | ||
@@ -18,0 +38,0 @@ /** |
import type { PromptResult } from '../../execution/PromptResult'; | ||
import { Prompt } from '../Prompt'; | ||
import type { Prompt } from '../Prompt'; | ||
import type { string_ptbk_url, string_version } from '../typeAliases'; | ||
/** | ||
@@ -13,8 +14,44 @@ * ExecutionReport is result of executing one promptbook | ||
*/ | ||
export type ExecutionReportJson = Array<{ | ||
prompt: Omit<Prompt, 'ptbkUrl' | 'parameters'>; | ||
result: PromptResult; | ||
}>; | ||
/** | ||
* TODO: [π§ ] What is the best shape of ExecutionReportJson | ||
*/ | ||
export type ExecutionReportJson = { | ||
/** | ||
* Unique identifier of the ptp from ptp which was executed | ||
*/ | ||
readonly ptbkUrl?: string_ptbk_url; | ||
/** | ||
* Title of from ptp which was executed | ||
*/ | ||
readonly title?: string; | ||
/** | ||
* Version from ptp which was executed | ||
*/ | ||
readonly ptbkUsedVersion: string_version; | ||
/** | ||
* Version from ptp which was requested by promptbook | ||
*/ | ||
readonly ptbkRequestedVersion?: string_version; | ||
/** | ||
* Description of the ptp which was executed | ||
*/ | ||
readonly description?: string; | ||
/** | ||
* Sequence of prompt templates in order which were executed | ||
*/ | ||
readonly promptExecutions: Array<{ | ||
/** | ||
* The prompt wich was executed | ||
*/ | ||
prompt: Omit<Prompt, 'ptbkUrl' | 'parameters'>; | ||
/** | ||
* Result of the prompt execution (if not failed during LLM execution) | ||
*/ | ||
result?: PromptResult; | ||
/** | ||
* The error which occured during LLM execution or during postprocessing or expectation checking | ||
* | ||
* Note: It makes sense to have both error and result defined, for example when the result not pass expectations | ||
*/ | ||
error?: { | ||
message: string; | ||
}; | ||
}>; | ||
}; |
@@ -1,3 +0,3 @@ | ||
import { string_name, string_prompt, string_ptbk_url_with_hashtemplate } from '.././types/typeAliases'; | ||
import { ModelRequirements } from './ModelRequirements'; | ||
import type { string_name, string_prompt, string_ptbk_url_with_hashtemplate, string_title } from '.././types/typeAliases'; | ||
import type { ModelRequirements } from './ModelRequirements'; | ||
/** | ||
@@ -10,2 +10,8 @@ * Prompt in a text along with model requirements, but without any execution or templating logic. | ||
/** | ||
* The title of the prompt | ||
* | ||
* Note: This has no effect on the model, it is just for the reporting | ||
*/ | ||
readonly title: string_title; | ||
/** | ||
* The text of the prompt | ||
@@ -12,0 +18,0 @@ * |
{ | ||
"name": "@promptbook/remote-client", | ||
"version": "0.24.0-0", | ||
"version": "0.24.0-1.0", | ||
"description": "Library to supercharge your use of large language models", | ||
@@ -40,3 +40,3 @@ "private": false, | ||
"peerDependencies": { | ||
"@promptbook/core": "0.24.0-0" | ||
"@promptbook/core": "0.24.0-1.0" | ||
}, | ||
@@ -43,0 +43,0 @@ "main": "./umd/index.umd.js", |
@@ -1,2 +0,2 @@ | ||
import { string_name } from '.././types/typeAliases'; | ||
import { string_name, string_version } from '.././types/typeAliases'; | ||
import { PromptTemplateJson } from '../types/PromptTemplatePipelineJson/PromptTemplateJson'; | ||
@@ -19,2 +19,5 @@ import { PromptTemplateParameterJson } from '../types/PromptTemplatePipelineJson/PromptTemplateParameterJson'; | ||
readonly ptbkUrl: URL | null; | ||
readonly title: string | null; | ||
readonly ptbkVersion: string_version | null; | ||
readonly description: string | null; | ||
readonly parameters: Record<string_name, PromptTemplateParameterJson>; | ||
@@ -21,0 +24,0 @@ readonly promptTemplates: Array<PromptTemplateJson>; |
import { string_name } from '.././types/typeAliases'; | ||
import { CreatePtpExecutorSettings } from '../execution/createPtpExecutor'; | ||
import { ExecutionTools } from '../execution/ExecutionTools'; | ||
@@ -8,2 +9,6 @@ import { PtpExecutor } from '../execution/PtpExecutor'; | ||
import { PromptTemplatePipeline } from './PromptTemplatePipeline'; | ||
type PromptTemplatePipelineLibraryOptions = { | ||
readonly library: Record<string_name, PromptTemplatePipeline>; | ||
readonly settings: CreatePtpExecutorSettings; | ||
}; | ||
/** | ||
@@ -19,3 +24,3 @@ * Library of prompt template pipelines that groups together prompt template pipelines for an application. This is a very thin wrapper around the Array / Set of prompt template pipelines. | ||
export declare class PromptTemplatePipelineLibrary { | ||
readonly promptTemplatePipelines: Record<string_name, PromptTemplatePipeline>; | ||
readonly options: PromptTemplatePipelineLibraryOptions; | ||
/** | ||
@@ -30,3 +35,3 @@ * Constructs PromptTemplatePipeline from any sources | ||
*/ | ||
static fromSources(ptbkSources: Record<string_name, PromptTemplatePipelineJson | PromptTemplatePipelineString>): PromptTemplatePipelineLibrary; | ||
static fromSources(ptbkSources: Record<string_name, PromptTemplatePipelineJson | PromptTemplatePipelineString>, settings: CreatePtpExecutorSettings): PromptTemplatePipelineLibrary; | ||
private constructor(); | ||
@@ -46,2 +51,3 @@ /** | ||
} | ||
export {}; | ||
/** | ||
@@ -48,0 +54,0 @@ * TODO: !!! This should be renamed to Promptbook |
import { PromptTemplatePipeline } from '../classes/PromptTemplatePipeline'; | ||
import { ExecutionTools } from './ExecutionTools'; | ||
import { PtpExecutor } from './PtpExecutor'; | ||
export interface CreatePtpExecutorSettings { | ||
/** | ||
* When executor does not satisfy expectations it will be retried this amount of times | ||
* | ||
* !!!!!!! Make default in version 24.1.0 | ||
*/ | ||
readonly maxNaturalExecutionAttempts: number; | ||
} | ||
interface CreatePtpExecutorOptions { | ||
readonly ptp: PromptTemplatePipeline; | ||
readonly tools: ExecutionTools; | ||
readonly settings: CreatePtpExecutorSettings; | ||
} | ||
@@ -8,0 +17,0 @@ /** |
@@ -1,4 +0,5 @@ | ||
import { Promisable } from 'type-fest'; | ||
import { string_name } from '.././types/typeAliases'; | ||
import { TaskProgress } from '../types/TaskProgress'; | ||
import type { Promisable } from 'type-fest'; | ||
import type { string_name } from '.././types/typeAliases'; | ||
import type { TaskProgress } from '../types/TaskProgress'; | ||
import type { ExecutionReportJson } from '../types/execution-report/ExecutionReportJson'; | ||
/** | ||
@@ -15,3 +16,22 @@ * Executor is a simple async function that takes input parameters and returns result parameters _(along with all intermediate parameters and input parameters = it extends input object)_. | ||
export interface PtpExecutor { | ||
(inputParameters: Record<string_name, string>, onProgress: (taskProgress: TaskProgress) => Promisable<void>): Promise<Record<string_name, string>>; | ||
(inputParameters: Record<string_name, string>, onProgress: (taskProgress: TaskProgress) => Promisable<void>): Promise<{ | ||
/** | ||
* Whether the execution was successful | ||
*/ | ||
isSuccessful: boolean; | ||
/** | ||
* Errors that occured during the execution | ||
*/ | ||
errors: Array<Error>; | ||
/** | ||
* The report of the execution | ||
*/ | ||
executionReport: ExecutionReportJson; | ||
/** | ||
* Result parameters of the execution | ||
* | ||
* Note: If the execution was not successful, there are only some of the result parameters | ||
*/ | ||
outputParameters: Record<string_name, string>; | ||
}>; | ||
} | ||
@@ -18,0 +38,0 @@ /** |
import type { PromptResult } from '../../execution/PromptResult'; | ||
import { Prompt } from '../Prompt'; | ||
import type { Prompt } from '../Prompt'; | ||
import type { string_ptbk_url, string_version } from '../typeAliases'; | ||
/** | ||
@@ -13,8 +14,44 @@ * ExecutionReport is result of executing one promptbook | ||
*/ | ||
export type ExecutionReportJson = Array<{ | ||
prompt: Omit<Prompt, 'ptbkUrl' | 'parameters'>; | ||
result: PromptResult; | ||
}>; | ||
/** | ||
* TODO: [π§ ] What is the best shape of ExecutionReportJson | ||
*/ | ||
export type ExecutionReportJson = { | ||
/** | ||
* Unique identifier of the ptp from ptp which was executed | ||
*/ | ||
readonly ptbkUrl?: string_ptbk_url; | ||
/** | ||
* Title of from ptp which was executed | ||
*/ | ||
readonly title?: string; | ||
/** | ||
* Version from ptp which was executed | ||
*/ | ||
readonly ptbkUsedVersion: string_version; | ||
/** | ||
* Version from ptp which was requested by promptbook | ||
*/ | ||
readonly ptbkRequestedVersion?: string_version; | ||
/** | ||
* Description of the ptp which was executed | ||
*/ | ||
readonly description?: string; | ||
/** | ||
* Sequence of prompt templates in order which were executed | ||
*/ | ||
readonly promptExecutions: Array<{ | ||
/** | ||
* The prompt wich was executed | ||
*/ | ||
prompt: Omit<Prompt, 'ptbkUrl' | 'parameters'>; | ||
/** | ||
* Result of the prompt execution (if not failed during LLM execution) | ||
*/ | ||
result?: PromptResult; | ||
/** | ||
* The error which occured during LLM execution or during postprocessing or expectation checking | ||
* | ||
* Note: It makes sense to have both error and result defined, for example when the result not pass expectations | ||
*/ | ||
error?: { | ||
message: string; | ||
}; | ||
}>; | ||
}; |
@@ -1,3 +0,3 @@ | ||
import { string_name, string_prompt, string_ptbk_url_with_hashtemplate } from '.././types/typeAliases'; | ||
import { ModelRequirements } from './ModelRequirements'; | ||
import type { string_name, string_prompt, string_ptbk_url_with_hashtemplate, string_title } from '.././types/typeAliases'; | ||
import type { ModelRequirements } from './ModelRequirements'; | ||
/** | ||
@@ -10,2 +10,8 @@ * Prompt in a text along with model requirements, but without any execution or templating logic. | ||
/** | ||
* The title of the prompt | ||
* | ||
* Note: This has no effect on the model, it is just for the reporting | ||
*/ | ||
readonly title: string_title; | ||
/** | ||
* The text of the prompt | ||
@@ -12,0 +18,0 @@ * |
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
325700
258
5046