@promptbook/types
Advanced tools
Comparing version 0.23.2 to 0.24.0-0
@@ -0,2 +1,10 @@ | ||
/** | ||
* Units of text measurement | ||
*/ | ||
var EXPECTATION_UNITS = ['CHARACTERS', 'WORDS', 'SENTENCES', 'PARAGRAPHS', 'LINES', 'PAGES']; | ||
/** | ||
* TODO: use one helper type> (string_prompt | string_javascript | string_markdown) & string_template | ||
*/ | ||
export { EXPECTATION_UNITS }; | ||
//# sourceMappingURL=index.es.js.map |
@@ -12,3 +12,3 @@ import { CommonExecutionToolsOptions } from '../execution/CommonExecutionToolsOptions'; | ||
import { Prompt } from '../types/Prompt'; | ||
import { PromptTemplateJson } from '../types/PromptTemplatePipelineJson/PromptTemplateJson'; | ||
import { EXPECTATION_UNITS, ExpectationAmount, ExpectationUnit, PromptTemplateJson } from '../types/PromptTemplatePipelineJson/PromptTemplateJson'; | ||
import { PromptTemplateParameterJson } from '../types/PromptTemplatePipelineJson/PromptTemplateParameterJson'; | ||
@@ -21,5 +21,5 @@ import { PromptTemplatePipelineJson } from '../types/PromptTemplatePipelineJson/PromptTemplatePipelineJson'; | ||
import { ILicense, IPersonProfile, IRepository, client_id, number_bytes, number_days, number_gigabytes, number_hours, number_integer, number_kilobytes, number_likeness, number_megabytes, number_miliseconds, number_minutes, number_months, number_negative, number_percent, number_positive, number_seconds, number_terabytes, number_weeks, number_years, string_attribute, string_attribute_value_scope, string_business_category_name, string_char, string_chat_prompt, string_color, string_completion_prompt, string_css, string_css_class, string_css_property, string_css_selector, string_css_value, string_data_url, string_domain, string_email, 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_license_token, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_page, string_password, string_person_fullname, string_person_profile, string_pgp_key, string_prompt, string_protocol, string_ptbk_url, string_ptbk_url_with_hashtemplate, string_script, string_sha256, string_ssh_key, string_svg, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_translate_name, string_translate_name_not_normalized, string_uri, string_uri_part, string_uriid, string_url, string_url_image, string_version, string_version_dependency, string_xml } from '../types/typeAliases'; | ||
export { CommonExecutionToolsOptions, ExecutionTools, ExecutionType, ILicense, IPersonProfile, IRepository, ModelRequirements, ModelVariant, NaturalExecutionTools, Parameters, Prompt, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptResult, PromptTemplateJson, PromptTemplateParameterJson, PromptTemplatePipelineJson, PromptTemplatePipelineString, PtpExecutor, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptLanguage, TaskProgress, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, client_id, number_bytes, number_days, number_gigabytes, number_hours, number_integer, number_kilobytes, number_likeness, number_megabytes, number_miliseconds, number_minutes, number_months, number_negative, number_percent, number_positive, number_seconds, number_terabytes, number_weeks, number_years, string_attribute, string_attribute_value_scope, string_business_category_name, string_char, string_char_emoji, string_chat_prompt, string_color, string_completion_prompt, string_css, string_css_class, string_css_property, string_css_selector, string_css_value, string_data_url, string_domain, string_email, 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_license_token, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_page, string_password, string_person_fullname, string_person_profile, string_pgp_key, string_prompt, string_protocol, string_ptbk_url, string_ptbk_url_with_hashtemplate, string_script, string_sha256, string_ssh_key, string_svg, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_translate_name, string_translate_name_not_normalized, string_uri, string_uri_part, string_uriid, string_url, string_url_image, string_version, string_version_dependency, string_xml, }; | ||
export { CommonExecutionToolsOptions, EXPECTATION_UNITS, ExecutionTools, ExecutionType, ExpectationAmount, ExpectationUnit, ILicense, IPersonProfile, IRepository, ModelRequirements, ModelVariant, NaturalExecutionTools, Parameters, Prompt, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptResult, PromptTemplateJson, PromptTemplateParameterJson, PromptTemplatePipelineJson, PromptTemplatePipelineString, PtpExecutor, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptLanguage, TaskProgress, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, client_id, number_bytes, number_days, number_gigabytes, number_hours, number_integer, number_kilobytes, number_likeness, number_megabytes, number_miliseconds, number_minutes, number_months, number_negative, number_percent, number_positive, number_seconds, number_terabytes, number_weeks, number_years, string_attribute, string_attribute_value_scope, string_business_category_name, string_char, string_char_emoji, string_chat_prompt, string_color, string_completion_prompt, string_css, string_css_class, string_css_property, string_css_selector, string_css_value, string_data_url, string_domain, string_email, 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_license_token, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_page, string_password, string_person_fullname, string_person_profile, string_pgp_key, string_prompt, string_protocol, string_ptbk_url, string_ptbk_url_with_hashtemplate, string_script, string_sha256, string_ssh_key, string_svg, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_translate_name, string_translate_name_not_normalized, string_uri, string_uri_part, string_uriid, string_url, string_url_image, string_version, string_version_dependency, string_xml, }; | ||
/** | ||
* TODO: !!! Filter out all the types that are not used in the library | ||
*/ |
@@ -0,2 +1,10 @@ | ||
import { executionReportJsonToString } from '../types/execution-report/executionReportJsonToString'; | ||
import { EMOJIS, EMOJIS_IN_CATEGORIES } from '../utils/emojis'; | ||
import { CountUtils } from '../utils/expectation-counters'; | ||
import { countCharacters } from '../utils/expectation-counters/countCharacters'; | ||
import { countLines } from '../utils/expectation-counters/countLines'; | ||
import { countPages } from '../utils/expectation-counters/countPages'; | ||
import { countParagraphs } from '../utils/expectation-counters/countParagraphs'; | ||
import { countSentences } from '../utils/expectation-counters/countSentences'; | ||
import { countWords } from '../utils/expectation-counters/countWords'; | ||
import { isValidJsonString } from '../utils/isValidJsonString'; | ||
@@ -8,7 +16,9 @@ import { extractAllBlocksFromMarkdown } from '../utils/markdown/extractAllBlocksFromMarkdown'; | ||
import { removeMarkdownFormatting } from '../utils/markdown/removeMarkdownFormatting'; | ||
import { parseNumber } from '../utils/parseNumber'; | ||
import { removeEmojis } from '../utils/removeEmojis'; | ||
import { removeQuotes } from '../utils/removeQuotes'; | ||
import { replaceParameters } from '../utils/replaceParameters'; | ||
import { trimCodeBlock } from '../utils/trimCodeBlock'; | ||
import { trimEndOfCodeBlock } from '../utils/trimEndOfCodeBlock'; | ||
import { unwrapResult } from '../utils/unwrapResult'; | ||
export { EMOJIS, EMOJIS_IN_CATEGORIES, extractAllBlocksFromMarkdown, extractAllListItemsFromMarkdown, extractOneBlockFromMarkdown, isValidJsonString, removeContentComments, removeEmojis, removeMarkdownFormatting, removeQuotes, replaceParameters, trimEndOfCodeBlock, unwrapResult, }; | ||
export { CountUtils, EMOJIS, EMOJIS_IN_CATEGORIES, countCharacters, countLines, countPages, countParagraphs, countSentences, countWords, executionReportJsonToString, extractAllBlocksFromMarkdown, extractAllListItemsFromMarkdown, extractOneBlockFromMarkdown, isValidJsonString, parseNumber, removeContentComments, removeEmojis, removeMarkdownFormatting, removeQuotes, replaceParameters, trimCodeBlock, trimEndOfCodeBlock, unwrapResult, }; |
@@ -1,3 +0,3 @@ | ||
import { string_markdown_text } from '.././types/typeAliases'; | ||
import { Command } from '../types/Command'; | ||
import type { string_markdown_text } from '.././types/typeAliases'; | ||
import type { Command } from '../types/Command'; | ||
/** | ||
@@ -4,0 +4,0 @@ * Parses one line of ul/ol to command |
@@ -1,2 +0,2 @@ | ||
import { string_model_name } from '.././types/typeAliases'; | ||
import type { string_model_name } from '.././types/typeAliases'; | ||
/** | ||
@@ -3,0 +3,0 @@ * Prompt result is the simplest concept of execution. |
@@ -1,4 +0,5 @@ | ||
import { string_markdown_text, string_name, string_version } from '.././types/typeAliases'; | ||
import { ExecutionType } from './ExecutionTypes'; | ||
import { ModelRequirements } from './ModelRequirements'; | ||
import type { string_markdown_text, string_name, string_version } from '.././types/typeAliases'; | ||
import type { ExecutionType } from './ExecutionTypes'; | ||
import type { ModelRequirements } from './ModelRequirements'; | ||
import type { ExpectationAmount, ExpectationUnit } from './PromptTemplatePipelineJson/PromptTemplateJson'; | ||
/** | ||
@@ -8,3 +9,3 @@ * Command is one piece of the prompt template which adds some logic to the prompt template or the whole pipeline. | ||
*/ | ||
export type Command = PtbkUrlCommand | PtbkVersionCommand | ExecuteCommand | ModelCommand | ParameterCommand | PostprocessCommand; | ||
export type Command = PtbkUrlCommand | PtbkVersionCommand | ExecuteCommand | ModelCommand | ParameterCommand | PostprocessCommand | ExpectCommand; | ||
/** | ||
@@ -67,1 +68,13 @@ * PtpVersion command tells which version is .ptp file using | ||
} | ||
/** | ||
* Expect command describes the desired output of the prompt template (after post-processing) | ||
* It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs,... | ||
* | ||
* Note: LLMs work with tokens, not characters, but in Promptbooks we want to use some human-recognisable and cross-model interoperable units. | ||
*/ | ||
export interface ExpectCommand { | ||
readonly type: 'EXPECT'; | ||
readonly sign: 'EXACTLY' | 'MINIMUM' | 'MAXIMUM'; | ||
readonly unit: ExpectationUnit; | ||
readonly amount: ExpectationAmount; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { string_javascript, string_markdown, string_name, string_prompt, string_template } from '../.././types/typeAliases'; | ||
import { number_integer, number_positive_or_zero, string_javascript, string_markdown, string_name, string_prompt, string_template } from '../.././types/typeAliases'; | ||
import { ExecutionType } from '../ExecutionTypes'; | ||
@@ -12,5 +12,12 @@ import { ModelRequirements } from '../ModelRequirements'; | ||
*/ | ||
interface NaturalTemplateJson extends PromptTemplateJsonCommon { | ||
export interface NaturalTemplateJson extends PromptTemplateJsonCommon { | ||
readonly executionType: 'PROMPT_TEMPLATE'; | ||
/** | ||
* Expectations for the answer | ||
*/ | ||
readonly expectations: Partial<Record<Lowercase<ExpectationUnit>, { | ||
min?: ExpectationAmount; | ||
max?: ExpectationAmount; | ||
}>>; | ||
/** | ||
* Requirements for the model | ||
@@ -22,2 +29,14 @@ * - This is required only for executionType PROMPT_TEMPLATE | ||
/** | ||
* Units of text measurement | ||
*/ | ||
export declare const EXPECTATION_UNITS: readonly ["CHARACTERS", "WORDS", "SENTENCES", "PARAGRAPHS", "LINES", "PAGES"]; | ||
/** | ||
* Unit of text measurement | ||
*/ | ||
export type ExpectationUnit = (typeof EXPECTATION_UNITS)[number]; | ||
/** | ||
* Amount of text measurement | ||
*/ | ||
export type ExpectationAmount = number_integer & number_positive_or_zero; | ||
/** | ||
* Template for simple concatenation of strings | ||
@@ -24,0 +43,0 @@ */ |
@@ -409,2 +409,4 @@ /** | ||
export type number_negative = number; | ||
export type number_positive_or_zero = number; | ||
export type number_negative_or_zero = number; | ||
export type number_integer = number; | ||
@@ -433,3 +435,3 @@ /** | ||
export type number_years = number; | ||
export type number_bytes = number_positive & number_integer; | ||
export type number_bytes = number_integer & number_positive; | ||
export type number_kilobytes = number_positive; | ||
@@ -436,0 +438,0 @@ export type number_megabytes = number_positive; |
/** | ||
* Function trimEndOfCodeBlock will remove ending code block from the string if it is present. | ||
* | ||
* This is usefull for post-processing of the result of the completion LLM model if you want to start code block in the prompt but you don't want to end it in the result. | ||
* Note: This is usefull for post-processing of the result of the completion LLM model | ||
* if you want to start code block in the prompt but you don't want to end it in the result. | ||
*/ | ||
export declare function trimEndOfCodeBlock(value: string): string; |
{ | ||
"name": "@promptbook/types", | ||
"version": "0.23.2", | ||
"version": "0.24.0-0", | ||
"description": "Library to supercharge your use of large language models", | ||
@@ -38,3 +38,3 @@ "private": false, | ||
"peerDependencies": { | ||
"@promptbook/core": "0.23.2" | ||
"@promptbook/core": "0.24.0-0" | ||
}, | ||
@@ -41,0 +41,0 @@ "main": "./umd/index.umd.js", |
@@ -1,9 +0,20 @@ | ||
(function (factory) { | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
factory(); | ||
})((function () { 'use strict'; | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-types"] = {})); | ||
})(this, (function (exports) { 'use strict'; | ||
/** | ||
* Units of text measurement | ||
*/ | ||
var EXPECTATION_UNITS = ['CHARACTERS', 'WORDS', 'SENTENCES', 'PARAGRAPHS', 'LINES', 'PAGES']; | ||
/** | ||
* TODO: use one helper type> (string_prompt | string_javascript | string_markdown) & string_template | ||
*/ | ||
exports.EXPECTATION_UNITS = EXPECTATION_UNITS; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
})); | ||
//# sourceMappingURL=index.umd.js.map |
@@ -12,3 +12,3 @@ import { CommonExecutionToolsOptions } from '../execution/CommonExecutionToolsOptions'; | ||
import { Prompt } from '../types/Prompt'; | ||
import { PromptTemplateJson } from '../types/PromptTemplatePipelineJson/PromptTemplateJson'; | ||
import { EXPECTATION_UNITS, ExpectationAmount, ExpectationUnit, PromptTemplateJson } from '../types/PromptTemplatePipelineJson/PromptTemplateJson'; | ||
import { PromptTemplateParameterJson } from '../types/PromptTemplatePipelineJson/PromptTemplateParameterJson'; | ||
@@ -21,5 +21,5 @@ import { PromptTemplatePipelineJson } from '../types/PromptTemplatePipelineJson/PromptTemplatePipelineJson'; | ||
import { ILicense, IPersonProfile, IRepository, client_id, number_bytes, number_days, number_gigabytes, number_hours, number_integer, number_kilobytes, number_likeness, number_megabytes, number_miliseconds, number_minutes, number_months, number_negative, number_percent, number_positive, number_seconds, number_terabytes, number_weeks, number_years, string_attribute, string_attribute_value_scope, string_business_category_name, string_char, string_chat_prompt, string_color, string_completion_prompt, string_css, string_css_class, string_css_property, string_css_selector, string_css_value, string_data_url, string_domain, string_email, 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_license_token, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_page, string_password, string_person_fullname, string_person_profile, string_pgp_key, string_prompt, string_protocol, string_ptbk_url, string_ptbk_url_with_hashtemplate, string_script, string_sha256, string_ssh_key, string_svg, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_translate_name, string_translate_name_not_normalized, string_uri, string_uri_part, string_uriid, string_url, string_url_image, string_version, string_version_dependency, string_xml } from '../types/typeAliases'; | ||
export { CommonExecutionToolsOptions, ExecutionTools, ExecutionType, ILicense, IPersonProfile, IRepository, ModelRequirements, ModelVariant, NaturalExecutionTools, Parameters, Prompt, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptResult, PromptTemplateJson, PromptTemplateParameterJson, PromptTemplatePipelineJson, PromptTemplatePipelineString, PtpExecutor, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptLanguage, TaskProgress, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, client_id, number_bytes, number_days, number_gigabytes, number_hours, number_integer, number_kilobytes, number_likeness, number_megabytes, number_miliseconds, number_minutes, number_months, number_negative, number_percent, number_positive, number_seconds, number_terabytes, number_weeks, number_years, string_attribute, string_attribute_value_scope, string_business_category_name, string_char, string_char_emoji, string_chat_prompt, string_color, string_completion_prompt, string_css, string_css_class, string_css_property, string_css_selector, string_css_value, string_data_url, string_domain, string_email, 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_license_token, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_page, string_password, string_person_fullname, string_person_profile, string_pgp_key, string_prompt, string_protocol, string_ptbk_url, string_ptbk_url_with_hashtemplate, string_script, string_sha256, string_ssh_key, string_svg, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_translate_name, string_translate_name_not_normalized, string_uri, string_uri_part, string_uriid, string_url, string_url_image, string_version, string_version_dependency, string_xml, }; | ||
export { CommonExecutionToolsOptions, EXPECTATION_UNITS, ExecutionTools, ExecutionType, ExpectationAmount, ExpectationUnit, ILicense, IPersonProfile, IRepository, ModelRequirements, ModelVariant, NaturalExecutionTools, Parameters, Prompt, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptResult, PromptTemplateJson, PromptTemplateParameterJson, PromptTemplatePipelineJson, PromptTemplatePipelineString, PtpExecutor, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptLanguage, TaskProgress, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, client_id, number_bytes, number_days, number_gigabytes, number_hours, number_integer, number_kilobytes, number_likeness, number_megabytes, number_miliseconds, number_minutes, number_months, number_negative, number_percent, number_positive, number_seconds, number_terabytes, number_weeks, number_years, string_attribute, string_attribute_value_scope, string_business_category_name, string_char, string_char_emoji, string_chat_prompt, string_color, string_completion_prompt, string_css, string_css_class, string_css_property, string_css_selector, string_css_value, string_data_url, string_domain, string_email, 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_license_token, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_page, string_password, string_person_fullname, string_person_profile, string_pgp_key, string_prompt, string_protocol, string_ptbk_url, string_ptbk_url_with_hashtemplate, string_script, string_sha256, string_ssh_key, string_svg, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_translate_name, string_translate_name_not_normalized, string_uri, string_uri_part, string_uriid, string_url, string_url_image, string_version, string_version_dependency, string_xml, }; | ||
/** | ||
* TODO: !!! Filter out all the types that are not used in the library | ||
*/ |
@@ -0,2 +1,10 @@ | ||
import { executionReportJsonToString } from '../types/execution-report/executionReportJsonToString'; | ||
import { EMOJIS, EMOJIS_IN_CATEGORIES } from '../utils/emojis'; | ||
import { CountUtils } from '../utils/expectation-counters'; | ||
import { countCharacters } from '../utils/expectation-counters/countCharacters'; | ||
import { countLines } from '../utils/expectation-counters/countLines'; | ||
import { countPages } from '../utils/expectation-counters/countPages'; | ||
import { countParagraphs } from '../utils/expectation-counters/countParagraphs'; | ||
import { countSentences } from '../utils/expectation-counters/countSentences'; | ||
import { countWords } from '../utils/expectation-counters/countWords'; | ||
import { isValidJsonString } from '../utils/isValidJsonString'; | ||
@@ -8,7 +16,9 @@ import { extractAllBlocksFromMarkdown } from '../utils/markdown/extractAllBlocksFromMarkdown'; | ||
import { removeMarkdownFormatting } from '../utils/markdown/removeMarkdownFormatting'; | ||
import { parseNumber } from '../utils/parseNumber'; | ||
import { removeEmojis } from '../utils/removeEmojis'; | ||
import { removeQuotes } from '../utils/removeQuotes'; | ||
import { replaceParameters } from '../utils/replaceParameters'; | ||
import { trimCodeBlock } from '../utils/trimCodeBlock'; | ||
import { trimEndOfCodeBlock } from '../utils/trimEndOfCodeBlock'; | ||
import { unwrapResult } from '../utils/unwrapResult'; | ||
export { EMOJIS, EMOJIS_IN_CATEGORIES, extractAllBlocksFromMarkdown, extractAllListItemsFromMarkdown, extractOneBlockFromMarkdown, isValidJsonString, removeContentComments, removeEmojis, removeMarkdownFormatting, removeQuotes, replaceParameters, trimEndOfCodeBlock, unwrapResult, }; | ||
export { CountUtils, EMOJIS, EMOJIS_IN_CATEGORIES, countCharacters, countLines, countPages, countParagraphs, countSentences, countWords, executionReportJsonToString, extractAllBlocksFromMarkdown, extractAllListItemsFromMarkdown, extractOneBlockFromMarkdown, isValidJsonString, parseNumber, removeContentComments, removeEmojis, removeMarkdownFormatting, removeQuotes, replaceParameters, trimCodeBlock, trimEndOfCodeBlock, unwrapResult, }; |
@@ -1,3 +0,3 @@ | ||
import { string_markdown_text } from '.././types/typeAliases'; | ||
import { Command } from '../types/Command'; | ||
import type { string_markdown_text } from '.././types/typeAliases'; | ||
import type { Command } from '../types/Command'; | ||
/** | ||
@@ -4,0 +4,0 @@ * Parses one line of ul/ol to command |
@@ -1,2 +0,2 @@ | ||
import { string_model_name } from '.././types/typeAliases'; | ||
import type { string_model_name } from '.././types/typeAliases'; | ||
/** | ||
@@ -3,0 +3,0 @@ * Prompt result is the simplest concept of execution. |
@@ -1,4 +0,5 @@ | ||
import { string_markdown_text, string_name, string_version } from '.././types/typeAliases'; | ||
import { ExecutionType } from './ExecutionTypes'; | ||
import { ModelRequirements } from './ModelRequirements'; | ||
import type { string_markdown_text, string_name, string_version } from '.././types/typeAliases'; | ||
import type { ExecutionType } from './ExecutionTypes'; | ||
import type { ModelRequirements } from './ModelRequirements'; | ||
import type { ExpectationAmount, ExpectationUnit } from './PromptTemplatePipelineJson/PromptTemplateJson'; | ||
/** | ||
@@ -8,3 +9,3 @@ * Command is one piece of the prompt template which adds some logic to the prompt template or the whole pipeline. | ||
*/ | ||
export type Command = PtbkUrlCommand | PtbkVersionCommand | ExecuteCommand | ModelCommand | ParameterCommand | PostprocessCommand; | ||
export type Command = PtbkUrlCommand | PtbkVersionCommand | ExecuteCommand | ModelCommand | ParameterCommand | PostprocessCommand | ExpectCommand; | ||
/** | ||
@@ -67,1 +68,13 @@ * PtpVersion command tells which version is .ptp file using | ||
} | ||
/** | ||
* Expect command describes the desired output of the prompt template (after post-processing) | ||
* It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs,... | ||
* | ||
* Note: LLMs work with tokens, not characters, but in Promptbooks we want to use some human-recognisable and cross-model interoperable units. | ||
*/ | ||
export interface ExpectCommand { | ||
readonly type: 'EXPECT'; | ||
readonly sign: 'EXACTLY' | 'MINIMUM' | 'MAXIMUM'; | ||
readonly unit: ExpectationUnit; | ||
readonly amount: ExpectationAmount; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { string_javascript, string_markdown, string_name, string_prompt, string_template } from '../.././types/typeAliases'; | ||
import { number_integer, number_positive_or_zero, string_javascript, string_markdown, string_name, string_prompt, string_template } from '../.././types/typeAliases'; | ||
import { ExecutionType } from '../ExecutionTypes'; | ||
@@ -12,5 +12,12 @@ import { ModelRequirements } from '../ModelRequirements'; | ||
*/ | ||
interface NaturalTemplateJson extends PromptTemplateJsonCommon { | ||
export interface NaturalTemplateJson extends PromptTemplateJsonCommon { | ||
readonly executionType: 'PROMPT_TEMPLATE'; | ||
/** | ||
* Expectations for the answer | ||
*/ | ||
readonly expectations: Partial<Record<Lowercase<ExpectationUnit>, { | ||
min?: ExpectationAmount; | ||
max?: ExpectationAmount; | ||
}>>; | ||
/** | ||
* Requirements for the model | ||
@@ -22,2 +29,14 @@ * - This is required only for executionType PROMPT_TEMPLATE | ||
/** | ||
* Units of text measurement | ||
*/ | ||
export declare const EXPECTATION_UNITS: readonly ["CHARACTERS", "WORDS", "SENTENCES", "PARAGRAPHS", "LINES", "PAGES"]; | ||
/** | ||
* Unit of text measurement | ||
*/ | ||
export type ExpectationUnit = (typeof EXPECTATION_UNITS)[number]; | ||
/** | ||
* Amount of text measurement | ||
*/ | ||
export type ExpectationAmount = number_integer & number_positive_or_zero; | ||
/** | ||
* Template for simple concatenation of strings | ||
@@ -24,0 +43,0 @@ */ |
@@ -409,2 +409,4 @@ /** | ||
export type number_negative = number; | ||
export type number_positive_or_zero = number; | ||
export type number_negative_or_zero = number; | ||
export type number_integer = number; | ||
@@ -433,3 +435,3 @@ /** | ||
export type number_years = number; | ||
export type number_bytes = number_positive & number_integer; | ||
export type number_bytes = number_integer & number_positive; | ||
export type number_kilobytes = number_positive; | ||
@@ -436,0 +438,0 @@ export type number_megabytes = number_positive; |
/** | ||
* Function trimEndOfCodeBlock will remove ending code block from the string if it is present. | ||
* | ||
* This is usefull for post-processing of the result of the completion LLM model if you want to start code block in the prompt but you don't want to end it in the result. | ||
* Note: This is usefull for post-processing of the result of the completion LLM model | ||
* if you want to start code block in the prompt but you don't want to end it in the result. | ||
*/ | ||
export declare function trimEndOfCodeBlock(value: string): string; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
268837
254
4611