@promptbook/execute-javascript
Advanced tools
Comparing version 0.20.6 to 0.21.0
@@ -179,2 +179,14 @@ import { capitalize, decapitalize, nameToUriPart, nameToUriParts, removeDiacritics, normalizeWhitespaces, normalizeToKebabCase, normalizeTo_camelCase, normalizeTo_snake_case, normalizeTo_PascalCase, parseKeywordsFromString, normalizeTo_SCREAMING_CASE } from 'n12'; | ||
/** | ||
* 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. | ||
*/ | ||
function trimEndOfCodeBlock(value) { | ||
value = spaceTrim(value); | ||
value = value.replace(/```$/g, ''); | ||
value = spaceTrim(value); | ||
return value; | ||
} | ||
/** | ||
* Removes quotes and optional introduce text from a string | ||
@@ -304,3 +316,3 @@ * | ||
return __awaiter(this, void 0, void 0, function () { | ||
var scriptLanguage, parameters, script, spaceTrim, removeQuotes$1, unwrapResult$1, trim, reverse, removeEmojis$1, capitalize$1, decapitalize$1, nameToUriPart$1, nameToUriParts$1, removeDiacritics$1, normalizeWhitespaces$1, normalizeToKebabCase$1, normalizeTo_camelCase$1, normalizeTo_snake_case$1, normalizeTo_PascalCase$1, parseKeywords, normalizeTo_SCREAMING_CASE$1, statementToEvaluate, result; | ||
var scriptLanguage, parameters, script, spaceTrim, removeQuotes$1, unwrapResult$1, trimEndOfCodeBlock$1, trim, reverse, removeEmojis$1, capitalize$1, decapitalize$1, nameToUriPart$1, nameToUriParts$1, removeDiacritics$1, normalizeWhitespaces$1, normalizeToKebabCase$1, normalizeTo_camelCase$1, normalizeTo_snake_case$1, normalizeTo_PascalCase$1, parseKeywords, normalizeTo_SCREAMING_CASE$1, statementToEvaluate, result; | ||
return __generator(this, function (_a) { | ||
@@ -318,2 +330,4 @@ scriptLanguage = options.scriptLanguage, parameters = options.parameters; | ||
preserve(unwrapResult$1); | ||
trimEndOfCodeBlock$1 = trimEndOfCodeBlock; | ||
preserve(trimEndOfCodeBlock$1); | ||
trim = function (str) { return str.trim(); }; | ||
@@ -320,0 +334,0 @@ preserve(trim); |
@@ -10,3 +10,4 @@ import { EMOJIS, EMOJIS_IN_CATEGORIES } from '../utils/emojis'; | ||
import { replaceParameters } from '../utils/replaceParameters'; | ||
import { trimEndOfCodeBlock } from '../utils/trimEndOfCodeBlock'; | ||
import { unwrapResult } from '../utils/unwrapResult'; | ||
export { EMOJIS, EMOJIS_IN_CATEGORIES, extractAllListItemsFromMarkdown, extractBlocksFromMarkdown, extractOneBlockFromMarkdown, removeContentComments, removeEmojis, removeMarkdownFormatting, removeQuotes, replaceParameters, unwrapResult, }; | ||
export { EMOJIS, EMOJIS_IN_CATEGORIES, extractAllListItemsFromMarkdown, extractBlocksFromMarkdown, extractOneBlockFromMarkdown, removeContentComments, removeEmojis, removeMarkdownFormatting, removeQuotes, replaceParameters, trimEndOfCodeBlock, unwrapResult, }; |
@@ -15,3 +15,4 @@ import { ModelRequirements } from './types/ModelRequirements'; | ||
/** | ||
* TODO: !!! Different default model for different model variant | ||
* TODO: [๐ง ] What should be the default model? | ||
*/ |
{ | ||
"name": "@promptbook/execute-javascript", | ||
"version": "0.20.6", | ||
"version": "0.21.0", | ||
"description": "Library to supercharge your use of large language models", | ||
@@ -42,3 +42,3 @@ "private": false, | ||
"peerDependencies": { | ||
"@promptbook/core": "0.20.6" | ||
"@promptbook/core": "0.21.0" | ||
}, | ||
@@ -45,0 +45,0 @@ "main": "./umd/index.umd.js", |
@@ -185,2 +185,14 @@ (function (global, factory) { | ||
/** | ||
* 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. | ||
*/ | ||
function trimEndOfCodeBlock(value) { | ||
value = spaceTrim__default["default"](value); | ||
value = value.replace(/```$/g, ''); | ||
value = spaceTrim__default["default"](value); | ||
return value; | ||
} | ||
/** | ||
* Removes quotes and optional introduce text from a string | ||
@@ -310,3 +322,3 @@ * | ||
return __awaiter(this, void 0, void 0, function () { | ||
var scriptLanguage, parameters, script, spaceTrim$1, removeQuotes$1, unwrapResult$1, trim, reverse, removeEmojis$1, capitalize, decapitalize, nameToUriPart, nameToUriParts, removeDiacritics, normalizeWhitespaces, normalizeToKebabCase, normalizeTo_camelCase, normalizeTo_snake_case, normalizeTo_PascalCase, parseKeywords, normalizeTo_SCREAMING_CASE, statementToEvaluate, result; | ||
var scriptLanguage, parameters, script, spaceTrim$1, removeQuotes$1, unwrapResult$1, trimEndOfCodeBlock$1, trim, reverse, removeEmojis$1, capitalize, decapitalize, nameToUriPart, nameToUriParts, removeDiacritics, normalizeWhitespaces, normalizeToKebabCase, normalizeTo_camelCase, normalizeTo_snake_case, normalizeTo_PascalCase, parseKeywords, normalizeTo_SCREAMING_CASE, statementToEvaluate, result; | ||
return __generator(this, function (_a) { | ||
@@ -324,2 +336,4 @@ scriptLanguage = options.scriptLanguage, parameters = options.parameters; | ||
preserve(unwrapResult$1); | ||
trimEndOfCodeBlock$1 = trimEndOfCodeBlock; | ||
preserve(trimEndOfCodeBlock$1); | ||
trim = function (str) { return str.trim(); }; | ||
@@ -326,0 +340,0 @@ preserve(trim); |
@@ -10,3 +10,4 @@ import { EMOJIS, EMOJIS_IN_CATEGORIES } from '../utils/emojis'; | ||
import { replaceParameters } from '../utils/replaceParameters'; | ||
import { trimEndOfCodeBlock } from '../utils/trimEndOfCodeBlock'; | ||
import { unwrapResult } from '../utils/unwrapResult'; | ||
export { EMOJIS, EMOJIS_IN_CATEGORIES, extractAllListItemsFromMarkdown, extractBlocksFromMarkdown, extractOneBlockFromMarkdown, removeContentComments, removeEmojis, removeMarkdownFormatting, removeQuotes, replaceParameters, unwrapResult, }; | ||
export { EMOJIS, EMOJIS_IN_CATEGORIES, extractAllListItemsFromMarkdown, extractBlocksFromMarkdown, extractOneBlockFromMarkdown, removeContentComments, removeEmojis, removeMarkdownFormatting, removeQuotes, replaceParameters, trimEndOfCodeBlock, unwrapResult, }; |
@@ -15,3 +15,4 @@ import { ModelRequirements } from './types/ModelRequirements'; | ||
/** | ||
* TODO: !!! Different default model for different model variant | ||
* TODO: [๐ง ] What should be the default model? | ||
*/ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
424143
210
5353