@promptbook/core 0.66.0-7 → 0.66.0-8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.es.js +57 -10
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/azure-openai.index.d.ts +4 -0
- package/esm/typings/src/_packages/cli.index.d.ts +2 -0
- package/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/llm-providers/azure-openai/createAzureOpenAiExecutionTools.d.ts +15 -0
- package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +9 -0
- package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +11 -0
- package/package.json +1 -1
- package/umd/index.umd.js +57 -9
- package/umd/index.umd.js.map +1 -1
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { PROMPTBOOK_VERSION } from '../version';
|
|
2
2
|
import { AzureOpenAiExecutionTools } from '../llm-providers/azure-openai/AzureOpenAiExecutionTools';
|
|
3
3
|
import type { AzureOpenAiExecutionToolsOptions } from '../llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions';
|
|
4
|
+
import { createAzureOpenAiExecutionTools } from '../llm-providers/azure-openai/createAzureOpenAiExecutionTools';
|
|
5
|
+
import { _AzureOpenAiRegistration } from '../llm-providers/azure-openai/register-constructor';
|
|
4
6
|
export { PROMPTBOOK_VERSION };
|
|
5
7
|
export { AzureOpenAiExecutionTools };
|
|
6
8
|
export type { AzureOpenAiExecutionToolsOptions };
|
|
9
|
+
export { createAzureOpenAiExecutionTools };
|
|
10
|
+
export { _AzureOpenAiRegistration };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { PROMPTBOOK_VERSION } from '../version';
|
|
2
2
|
import { _CLI } from '../cli/main';
|
|
3
3
|
import { _AnthropicClaudeMetadataRegistration } from '../llm-providers/anthropic-claude/register-configuration';
|
|
4
|
+
import { _AzureOpenAiMetadataRegistration } from '../llm-providers/azure-openai/register-configuration';
|
|
4
5
|
import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
5
6
|
export { PROMPTBOOK_VERSION };
|
|
6
7
|
export { _CLI };
|
|
7
8
|
export { _AnthropicClaudeMetadataRegistration };
|
|
9
|
+
export { _AzureOpenAiMetadataRegistration };
|
|
8
10
|
export { _OpenAiMetadataRegistration };
|
|
@@ -54,6 +54,7 @@ import { cacheLlmTools } from '../llm-providers/_common/utils/cache/cacheLlmTool
|
|
|
54
54
|
import { countTotalUsage } from '../llm-providers/_common/utils/count-total-usage/countTotalUsage';
|
|
55
55
|
import { limitTotalUsage } from '../llm-providers/_common/utils/count-total-usage/limitTotalUsage';
|
|
56
56
|
import { _AnthropicClaudeMetadataRegistration } from '../llm-providers/anthropic-claude/register-configuration';
|
|
57
|
+
import { _AzureOpenAiMetadataRegistration } from '../llm-providers/azure-openai/register-configuration';
|
|
57
58
|
import { joinLlmExecutionTools } from '../llm-providers/multiple/joinLlmExecutionTools';
|
|
58
59
|
import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration';
|
|
59
60
|
import { preparePersona } from '../personas/preparePersona';
|
|
@@ -124,6 +125,7 @@ export { cacheLlmTools };
|
|
|
124
125
|
export { countTotalUsage };
|
|
125
126
|
export { limitTotalUsage };
|
|
126
127
|
export { _AnthropicClaudeMetadataRegistration };
|
|
128
|
+
export { _AzureOpenAiMetadataRegistration };
|
|
127
129
|
export { joinLlmExecutionTools };
|
|
128
130
|
export { _OpenAiMetadataRegistration };
|
|
129
131
|
export { preparePersona };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AzureOpenAiExecutionTools } from './AzureOpenAiExecutionTools';
|
|
2
|
+
import type { AzureOpenAiExecutionToolsOptions } from './AzureOpenAiExecutionToolsOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Execution Tools for calling Azure OpenAI API
|
|
5
|
+
*
|
|
6
|
+
* @public exported from `@promptbook/azure-openai`
|
|
7
|
+
*/
|
|
8
|
+
export declare const createAzureOpenAiExecutionTools: ((options: AzureOpenAiExecutionToolsOptions) => AzureOpenAiExecutionTools) & {
|
|
9
|
+
packageName: string;
|
|
10
|
+
className: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* TODO: [🦺] Is there some way how to put `packageName` and `className` on top and function definition on bottom?
|
|
14
|
+
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
15
|
+
*/
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @@@ registration1 of default configuration for Azure Open AI
|
|
3
|
+
*
|
|
4
|
+
* Note: [🏐] Configurations registrations are done in @@@ BUT constructor @@@
|
|
5
|
+
*
|
|
6
|
+
* @public exported from `@promptbook/core`
|
|
7
|
+
* @public exported from `@promptbook/cli`
|
|
8
|
+
*/
|
|
9
|
+
export declare const _AzureOpenAiMetadataRegistration: void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @@@ registration2
|
|
3
|
+
*
|
|
4
|
+
* Note: [🏐] Configurations registrations are done in @@@ BUT constructor @@@
|
|
5
|
+
*
|
|
6
|
+
* @public exported from `@promptbook/azure-openai`
|
|
7
|
+
*/
|
|
8
|
+
export declare const _AzureOpenAiRegistration: void;
|
|
9
|
+
/**
|
|
10
|
+
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
11
|
+
*/
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
/**
|
|
20
20
|
* The version of the Promptbook library
|
|
21
21
|
*/
|
|
22
|
-
var PROMPTBOOK_VERSION = '0.66.0-
|
|
22
|
+
var PROMPTBOOK_VERSION = '0.66.0-7';
|
|
23
23
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
24
24
|
|
|
25
25
|
/*! *****************************************************************************
|
|
@@ -1650,7 +1650,7 @@
|
|
|
1650
1650
|
});
|
|
1651
1651
|
}
|
|
1652
1652
|
|
|
1653
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.66.0-
|
|
1653
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.66.0-7",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",dependentParameterNames:["knowledgeContent"],resultingParameterName:"knowledgePieces"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.66.0-7",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.66.0-7",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.66.0-7",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",modelRequirements:{modelVariant:"CHAT",modelName:"gpt-4-turbo"},content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Sample\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n### Option `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Option `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Option `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",expectFormat:"JSON",dependentParameterNames:["availableModelNames","personaDescription"],resultingParameterName:"modelRequirements"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
|
|
1654
1654
|
|
|
1655
1655
|
var defaultDiacriticsRemovalMap = [
|
|
1656
1656
|
{
|
|
@@ -6551,12 +6551,13 @@
|
|
|
6551
6551
|
var packageName = registered.packageName, className = registered.className;
|
|
6552
6552
|
var existingRegistrationIndex = this.storage.findIndex(function (item) { return item.packageName === packageName && item.className === className; });
|
|
6553
6553
|
var existingRegistration = this.storage[existingRegistrationIndex];
|
|
6554
|
-
if (existingRegistration) {
|
|
6555
|
-
console.warn("
|
|
6556
|
-
this.storage
|
|
6554
|
+
if (!existingRegistration) {
|
|
6555
|
+
console.warn("[\uD83D\uDCE6] Registering ".concat(packageName, ".").concat(className, " again"));
|
|
6556
|
+
this.storage.push(registered);
|
|
6557
6557
|
}
|
|
6558
6558
|
else {
|
|
6559
|
-
|
|
6559
|
+
console.warn("[\uD83D\uDCE6] Re-registering ".concat(packageName, ".").concat(className, " again"));
|
|
6560
|
+
this.storage[existingRegistrationIndex] = registered;
|
|
6560
6561
|
}
|
|
6561
6562
|
};
|
|
6562
6563
|
return Register;
|
|
@@ -8550,6 +8551,52 @@
|
|
|
8550
8551
|
},
|
|
8551
8552
|
});
|
|
8552
8553
|
|
|
8554
|
+
/**
|
|
8555
|
+
* @@@ registration1 of default configuration for Azure Open AI
|
|
8556
|
+
*
|
|
8557
|
+
* Note: [🏐] Configurations registrations are done in @@@ BUT constructor @@@
|
|
8558
|
+
*
|
|
8559
|
+
* @public exported from `@promptbook/core`
|
|
8560
|
+
* @public exported from `@promptbook/cli`
|
|
8561
|
+
*/
|
|
8562
|
+
var _AzureOpenAiMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
8563
|
+
title: 'Azure Open AI',
|
|
8564
|
+
packageName: '@promptbook/azure-openai',
|
|
8565
|
+
className: 'AzureOpenAiExecutionTools',
|
|
8566
|
+
getBoilerplateConfiguration: function () {
|
|
8567
|
+
return {
|
|
8568
|
+
title: 'Azure Open AI (boilerplate)',
|
|
8569
|
+
packageName: '@promptbook/azure-openai',
|
|
8570
|
+
className: 'AzureOpenAiExecutionTools',
|
|
8571
|
+
options: {
|
|
8572
|
+
apiKey: 'sk-',
|
|
8573
|
+
},
|
|
8574
|
+
};
|
|
8575
|
+
},
|
|
8576
|
+
createConfigurationFromEnv: function (env) {
|
|
8577
|
+
if (typeof env.AZUREOPENAI_RESOURCE_NAME === 'string' &&
|
|
8578
|
+
typeof env.AZUREOPENAI_DEPLOYMENT_NAME === 'string' &&
|
|
8579
|
+
typeof env.AZUREOPENAI_API_KEY === 'string') {
|
|
8580
|
+
return {
|
|
8581
|
+
title: 'Azure Open AI (from env)',
|
|
8582
|
+
packageName: '@promptbook/azure-openai',
|
|
8583
|
+
className: 'AzureOpenAiExecutionTools',
|
|
8584
|
+
options: {
|
|
8585
|
+
resourceName: env.AZUREOPENAI_RESOURCE_NAME,
|
|
8586
|
+
deploymentName: env.AZUREOPENAI_DEPLOYMENT_NAME,
|
|
8587
|
+
apiKey: env.AZUREOPENAI_API_KEY,
|
|
8588
|
+
},
|
|
8589
|
+
};
|
|
8590
|
+
}
|
|
8591
|
+
else if (typeof env.AZUREOPENAI_RESOURCE_NAME === 'string' ||
|
|
8592
|
+
typeof env.AZUREOPENAI_DEPLOYMENT_NAME === 'string' ||
|
|
8593
|
+
typeof env.AZUREOPENAI_API_KEY === 'string') {
|
|
8594
|
+
throw new Error(spaceTrim__default["default"]("\n You must provide all of the following environment variables:\n \n - AZUREOPENAI_RESOURCE_NAME (".concat(typeof env.AZUREOPENAI_RESOURCE_NAME === 'string' ? 'defined' : 'not defined', ")\n - AZUREOPENAI_DEPLOYMENT_NAME (").concat(typeof env.AZUREOPENAI_DEPLOYMENT_NAME === 'string' ? 'defined' : 'not defined', ")\n - AZUREOPENAI_API_KEY (").concat(typeof env.AZUREOPENAI_API_KEY === 'string' ? 'defined' : 'not defined', ") \n ")));
|
|
8595
|
+
}
|
|
8596
|
+
return null;
|
|
8597
|
+
},
|
|
8598
|
+
});
|
|
8599
|
+
|
|
8553
8600
|
/**
|
|
8554
8601
|
* @@@ registration1 of default configuration for Open AI
|
|
8555
8602
|
*
|
|
@@ -8559,9 +8606,9 @@
|
|
|
8559
8606
|
* @public exported from `@promptbook/cli`
|
|
8560
8607
|
*/
|
|
8561
8608
|
var _OpenAiMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
8562
|
-
title: '
|
|
8563
|
-
packageName: '@promptbook/
|
|
8564
|
-
className: '
|
|
8609
|
+
title: 'Open AI',
|
|
8610
|
+
packageName: '@promptbook/openai',
|
|
8611
|
+
className: 'OpenAiExecutionTools',
|
|
8565
8612
|
getBoilerplateConfiguration: function () {
|
|
8566
8613
|
return {
|
|
8567
8614
|
title: 'Open AI (boilerplate)',
|
|
@@ -8971,6 +9018,7 @@
|
|
|
8971
9018
|
exports.VersionMismatchError = VersionMismatchError;
|
|
8972
9019
|
exports.ZERO_USAGE = ZERO_USAGE;
|
|
8973
9020
|
exports._AnthropicClaudeMetadataRegistration = _AnthropicClaudeMetadataRegistration;
|
|
9021
|
+
exports._AzureOpenAiMetadataRegistration = _AzureOpenAiMetadataRegistration;
|
|
8974
9022
|
exports._OpenAiMetadataRegistration = _OpenAiMetadataRegistration;
|
|
8975
9023
|
exports.addUsage = addUsage;
|
|
8976
9024
|
exports.assertsExecutionSuccessful = assertsExecutionSuccessful;
|