@promptbook/wizard 0.112.0-64 → 0.112.0-65
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 +87 -235
- package/esm/index.es.js.map +1 -1
- package/esm/src/_packages/components.index.d.ts +0 -2
- package/esm/src/_packages/core.index.d.ts +2 -2
- package/esm/src/_packages/types.index.d.ts +0 -2
- package/esm/src/book-2.0/book-language-documentation/BookLanguageDocumentationExample.d.ts +27 -0
- package/esm/src/book-2.0/book-language-documentation/bookLanguageCommonPitfalls.d.ts +25 -0
- package/esm/src/book-2.0/book-language-documentation/bookLanguageDocumentationExamples.d.ts +10 -0
- package/esm/src/book-2.0/book-language-documentation/createStandaloneBookLanguageMarkdown.d.ts +14 -0
- package/esm/src/book-2.0/book-language-documentation/renderGroupedCommitmentDocumentationMarkdown.d.ts +43 -0
- package/esm/src/book-components/Chat/types/ChatMessage.d.ts +0 -34
- package/esm/src/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +0 -11
- package/esm/src/commitments/_common/toolRuntimeContext.d.ts +0 -6
- package/esm/src/formfactors/index.d.ts +2 -2
- package/esm/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +1 -1
- package/esm/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +1 -1
- package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +0 -4
- package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionToolsOptions.d.ts +0 -9
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -3
- package/umd/index.umd.js +87 -235
- package/umd/index.umd.js.map +1 -1
- package/umd/src/_packages/components.index.d.ts +0 -2
- package/umd/src/_packages/core.index.d.ts +2 -2
- package/umd/src/_packages/types.index.d.ts +0 -2
- package/umd/src/book-2.0/book-language-documentation/BookLanguageDocumentationExample.d.ts +27 -0
- package/umd/src/book-2.0/book-language-documentation/bookLanguageCommonPitfalls.d.ts +25 -0
- package/umd/src/book-2.0/book-language-documentation/bookLanguageDocumentationExamples.d.ts +10 -0
- package/umd/src/book-2.0/book-language-documentation/createStandaloneBookLanguageMarkdown.d.ts +14 -0
- package/umd/src/book-2.0/book-language-documentation/renderGroupedCommitmentDocumentationMarkdown.d.ts +43 -0
- package/umd/src/book-components/Chat/types/ChatMessage.d.ts +0 -34
- package/umd/src/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +0 -11
- package/umd/src/commitments/_common/toolRuntimeContext.d.ts +0 -6
- package/umd/src/formfactors/index.d.ts +2 -2
- package/umd/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +1 -1
- package/umd/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +1 -1
- package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +0 -4
- package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionToolsOptions.d.ts +0 -9
- package/umd/src/version.d.ts +1 -1
- /package/esm/src/{commitments/KNOWLEDGE/KNOWLEDGE.test.d.ts → book-2.0/book-language-documentation/renderGroupedCommitmentDocumentationMarkdown.test.d.ts} +0 -0
- /package/umd/src/{commitments/KNOWLEDGE/KNOWLEDGE.test.d.ts → book-2.0/book-language-documentation/renderGroupedCommitmentDocumentationMarkdown.test.d.ts} +0 -0
package/esm/index.es.js
CHANGED
|
@@ -38,7 +38,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
38
38
|
* @generated
|
|
39
39
|
* @see https://github.com/webgptorg/promptbook
|
|
40
40
|
*/
|
|
41
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
41
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-65';
|
|
42
42
|
/**
|
|
43
43
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
44
44
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -9215,9 +9215,11 @@ class OpenAiCompatibleUnsupportedParameterRetrier {
|
|
|
9215
9215
|
* Creates the retry-history error message shared by all OpenAI-compatible model variants.
|
|
9216
9216
|
*/
|
|
9217
9217
|
createAttemptHistoryError(finalErrorMessage) {
|
|
9218
|
-
return new PipelineExecutionError(
|
|
9219
|
-
|
|
9220
|
-
|
|
9218
|
+
return new PipelineExecutionError(spaceTrim$1((block) => `
|
|
9219
|
+
All attempts failed. Attempt history:
|
|
9220
|
+
${block(formatUnsupportedParameterAttemptHistory(this.attemptStack))}
|
|
9221
|
+
Final error: ${finalErrorMessage}
|
|
9222
|
+
`));
|
|
9221
9223
|
}
|
|
9222
9224
|
}
|
|
9223
9225
|
|
|
@@ -20734,18 +20736,6 @@ function countOccurrences(value, searchedChar) {
|
|
|
20734
20736
|
return count;
|
|
20735
20737
|
}
|
|
20736
20738
|
|
|
20737
|
-
/**
|
|
20738
|
-
* Name of the tool used by agents to search configured `KNOWLEDGE` sources.
|
|
20739
|
-
*
|
|
20740
|
-
* @public exported from `@promptbook/core`
|
|
20741
|
-
*/
|
|
20742
|
-
const KNOWLEDGE_SEARCH_TOOL_NAME = 'knowledge_search';
|
|
20743
|
-
/**
|
|
20744
|
-
* Title of the system-message section generated for `KNOWLEDGE` commitments.
|
|
20745
|
-
*
|
|
20746
|
-
* @private constant of `KnowledgeCommitmentDefinition`
|
|
20747
|
-
*/
|
|
20748
|
-
const KNOWLEDGE_SEARCH_SYSTEM_SECTION_TITLE = 'Knowledge Search';
|
|
20749
20739
|
/**
|
|
20750
20740
|
* KNOWLEDGE commitment definition
|
|
20751
20741
|
*
|
|
@@ -20867,17 +20857,9 @@ class KnowledgeCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
20867
20857
|
knowledgeInfoEntries.push(`Knowledge Source Inline: ${inlineSource.filename} (derived from inline content and processed for retrieval during chat)`);
|
|
20868
20858
|
}
|
|
20869
20859
|
if (knowledgeInfoEntries.length === 0) {
|
|
20870
|
-
return
|
|
20860
|
+
return nextRequirements;
|
|
20871
20861
|
}
|
|
20872
|
-
return
|
|
20873
|
-
}
|
|
20874
|
-
/**
|
|
20875
|
-
* Gets human-readable titles for tool functions provided by this commitment.
|
|
20876
|
-
*/
|
|
20877
|
-
getToolTitles() {
|
|
20878
|
-
return {
|
|
20879
|
-
[KNOWLEDGE_SEARCH_TOOL_NAME]: 'Knowledge search',
|
|
20880
|
-
};
|
|
20862
|
+
return this.appendToSystemMessage(nextRequirements, knowledgeInfoEntries.join('\n'), '\n\n');
|
|
20881
20863
|
}
|
|
20882
20864
|
}
|
|
20883
20865
|
/**
|
|
@@ -20891,128 +20873,6 @@ function hasMeaningfulNonUrlText(content, urls) {
|
|
|
20891
20873
|
const significantText = contentWithoutUrls.replace(/[\s.,!?;:'"`()[\]{}<>/-]+/g, '');
|
|
20892
20874
|
return significantText.length > 0;
|
|
20893
20875
|
}
|
|
20894
|
-
/**
|
|
20895
|
-
* Adds the shared `knowledge_search` tool definition and the consolidated system-message section.
|
|
20896
|
-
*
|
|
20897
|
-
* @param requirements - Requirements after one `KNOWLEDGE` commitment was applied.
|
|
20898
|
-
* @returns Requirements with the knowledge search instructions and tool definition.
|
|
20899
|
-
*
|
|
20900
|
-
* @private internal utility of `KnowledgeCommitmentDefinition`
|
|
20901
|
-
*/
|
|
20902
|
-
function addKnowledgeSearchToolAndSystemSection(requirements) {
|
|
20903
|
-
const nextRequirements = addKnowledgeSearchTool(requirements);
|
|
20904
|
-
const section = createKnowledgeSearchSystemSection(nextRequirements);
|
|
20905
|
-
const sectionHeader = `## ${KNOWLEDGE_SEARCH_SYSTEM_SECTION_TITLE}`;
|
|
20906
|
-
if (nextRequirements.systemMessage.includes(sectionHeader)) {
|
|
20907
|
-
return {
|
|
20908
|
-
...nextRequirements,
|
|
20909
|
-
systemMessage: nextRequirements.systemMessage.replace(new RegExp(`## ${KNOWLEDGE_SEARCH_SYSTEM_SECTION_TITLE.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}[\\s\\S]*?(?=\\n\\n##|$)`), section),
|
|
20910
|
-
};
|
|
20911
|
-
}
|
|
20912
|
-
return {
|
|
20913
|
-
...nextRequirements,
|
|
20914
|
-
systemMessage: nextRequirements.systemMessage.trim()
|
|
20915
|
-
? `${nextRequirements.systemMessage}\n\n${section}`
|
|
20916
|
-
: section,
|
|
20917
|
-
};
|
|
20918
|
-
}
|
|
20919
|
-
/**
|
|
20920
|
-
* Adds the `knowledge_search` model tool when it is not already present.
|
|
20921
|
-
*
|
|
20922
|
-
* @param requirements - Current model requirements.
|
|
20923
|
-
* @returns Requirements with the tool definition available to the model.
|
|
20924
|
-
*
|
|
20925
|
-
* @private internal utility of `KnowledgeCommitmentDefinition`
|
|
20926
|
-
*/
|
|
20927
|
-
function addKnowledgeSearchTool(requirements) {
|
|
20928
|
-
const existingTools = requirements.tools || [];
|
|
20929
|
-
if (existingTools.some((tool) => tool.name === KNOWLEDGE_SEARCH_TOOL_NAME)) {
|
|
20930
|
-
return requirements;
|
|
20931
|
-
}
|
|
20932
|
-
return {
|
|
20933
|
-
...requirements,
|
|
20934
|
-
tools: [
|
|
20935
|
-
...existingTools,
|
|
20936
|
-
{
|
|
20937
|
-
name: KNOWLEDGE_SEARCH_TOOL_NAME,
|
|
20938
|
-
description: spaceTrim$1(`
|
|
20939
|
-
Search the agent's configured knowledge sources and return relevant excerpts with citation ids.
|
|
20940
|
-
Use this before answering questions that may depend on the agent's KNOWLEDGE commitments.
|
|
20941
|
-
`),
|
|
20942
|
-
parameters: {
|
|
20943
|
-
type: 'object',
|
|
20944
|
-
properties: {
|
|
20945
|
-
query: {
|
|
20946
|
-
type: 'string',
|
|
20947
|
-
description: 'The natural-language search query for the knowledge base.',
|
|
20948
|
-
},
|
|
20949
|
-
limit: {
|
|
20950
|
-
type: 'integer',
|
|
20951
|
-
description: 'Maximum number of matching source excerpts to return.',
|
|
20952
|
-
},
|
|
20953
|
-
},
|
|
20954
|
-
required: ['query'],
|
|
20955
|
-
},
|
|
20956
|
-
},
|
|
20957
|
-
],
|
|
20958
|
-
};
|
|
20959
|
-
}
|
|
20960
|
-
/**
|
|
20961
|
-
* Creates the model-facing system-message section for knowledge search.
|
|
20962
|
-
*
|
|
20963
|
-
* @param requirements - Current model requirements.
|
|
20964
|
-
* @returns Markdown system-message section.
|
|
20965
|
-
*
|
|
20966
|
-
* @private internal utility of `KnowledgeCommitmentDefinition`
|
|
20967
|
-
*/
|
|
20968
|
-
function createKnowledgeSearchSystemSection(requirements) {
|
|
20969
|
-
const sourceEntries = createKnowledgeSourceSystemEntries(requirements);
|
|
20970
|
-
const sourceList = sourceEntries.length > 0 ? sourceEntries.map((entry) => `- ${entry}`).join('\n') : '- None';
|
|
20971
|
-
return spaceTrim$1(`
|
|
20972
|
-
## ${KNOWLEDGE_SEARCH_SYSTEM_SECTION_TITLE}
|
|
20973
|
-
|
|
20974
|
-
- Use \`${KNOWLEDGE_SEARCH_TOOL_NAME}\` to search the configured knowledge sources before answering questions that depend on this agent's knowledge base.
|
|
20975
|
-
- Base source-backed factual answers on the returned excerpts.
|
|
20976
|
-
- When you use a returned excerpt, include its citation marker in the answer body, for example \`[0:0]\`.
|
|
20977
|
-
- If the search returns no relevant information, say that the knowledge base did not contain the answer instead of inventing it.
|
|
20978
|
-
|
|
20979
|
-
Configured knowledge sources:
|
|
20980
|
-
${sourceList}
|
|
20981
|
-
`);
|
|
20982
|
-
}
|
|
20983
|
-
/**
|
|
20984
|
-
* Builds a stable list of configured knowledge sources for system-message diagnostics.
|
|
20985
|
-
*
|
|
20986
|
-
* @param requirements - Current model requirements.
|
|
20987
|
-
* @returns Human-readable source entries.
|
|
20988
|
-
*
|
|
20989
|
-
* @private internal utility of `KnowledgeCommitmentDefinition`
|
|
20990
|
-
*/
|
|
20991
|
-
function createKnowledgeSourceSystemEntries(requirements) {
|
|
20992
|
-
var _a;
|
|
20993
|
-
const entries = [];
|
|
20994
|
-
const seenEntries = new Set();
|
|
20995
|
-
for (const source of requirements.knowledgeSources || []) {
|
|
20996
|
-
const entry = `Source URL: ${source} (processed for retrieval during chat)`;
|
|
20997
|
-
if (seenEntries.has(entry)) {
|
|
20998
|
-
continue;
|
|
20999
|
-
}
|
|
21000
|
-
seenEntries.add(entry);
|
|
21001
|
-
entries.push(entry);
|
|
21002
|
-
}
|
|
21003
|
-
const inlineSources = (((_a = requirements._metadata) === null || _a === void 0 ? void 0 : _a.inlineKnowledgeSources) || [])
|
|
21004
|
-
.map((source) => source.filename)
|
|
21005
|
-
.filter(Boolean);
|
|
21006
|
-
for (const filename of inlineSources) {
|
|
21007
|
-
const entry = `Knowledge Source Inline: ${filename} (Inline source: processed for retrieval during chat)`;
|
|
21008
|
-
if (seenEntries.has(entry)) {
|
|
21009
|
-
continue;
|
|
21010
|
-
}
|
|
21011
|
-
seenEntries.add(entry);
|
|
21012
|
-
entries.push(entry);
|
|
21013
|
-
}
|
|
21014
|
-
return entries;
|
|
21015
|
-
}
|
|
21016
20876
|
|
|
21017
20877
|
/**
|
|
21018
20878
|
* LANGUAGE commitment definition
|
|
@@ -26634,7 +26494,11 @@ class PersonaCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
26634
26494
|
// Create new system message with persona at the beginning
|
|
26635
26495
|
// Format: "You are {agentName}\n{personaContent}"
|
|
26636
26496
|
// The # PERSONA comment will be removed later by removeCommentsFromSystemMessage
|
|
26637
|
-
const personaSection =
|
|
26497
|
+
const personaSection = spaceTrim$1((block) => `
|
|
26498
|
+
# PERSONA
|
|
26499
|
+
You are ${agentName}
|
|
26500
|
+
${block(mergedPersonaContent)}
|
|
26501
|
+
`);
|
|
26638
26502
|
const newSystemMessage = cleanedMessage ? `${personaSection}\n\n${cleanedMessage}` : personaSection;
|
|
26639
26503
|
return {
|
|
26640
26504
|
...requirements,
|
|
@@ -36235,7 +36099,7 @@ const SDK_TRANSPILER_KNOWLEDGE_THRESHOLD = 1000;
|
|
|
36235
36099
|
*/
|
|
36236
36100
|
async function prepareSdkTranspilerContext(book, options) {
|
|
36237
36101
|
const { agentName } = await parseAgentSource(book);
|
|
36238
|
-
const
|
|
36102
|
+
const modelRequirements = await createAgentModelRequirements(book, undefined, undefined, undefined, {
|
|
36239
36103
|
agentReferenceResolver: options === null || options === void 0 ? void 0 : options.agentReferenceResolver,
|
|
36240
36104
|
inlineKnowledgeSourceUploader: options === null || options === void 0 ? void 0 : options.inlineKnowledgeSourceUploader,
|
|
36241
36105
|
teammateProfileResolver: options === null || options === void 0 ? void 0 : options.teammateProfileResolver,
|
|
@@ -36245,12 +36109,7 @@ async function prepareSdkTranspilerContext(book, options) {
|
|
|
36245
36109
|
const knowledgeContent = knowledgeCommitments.map((commitment) => commitment.content.trim());
|
|
36246
36110
|
const directKnowledge = knowledgeContent.filter((content) => !isKnowledgeSourceUrl(content));
|
|
36247
36111
|
const knowledgeSources = knowledgeContent.filter((content) => isKnowledgeSourceUrl(content));
|
|
36248
|
-
const isKnowledgeHandledWithRetrieval = directKnowledge.join('\n').length > SDK_TRANSPILER_KNOWLEDGE_THRESHOLD ||
|
|
36249
|
-
knowledgeSources.length > 0 ||
|
|
36250
|
-
knowledgeCommitments.length > 0;
|
|
36251
|
-
const modelRequirements = normalizeSdkTranspilerModelRequirements(rawModelRequirements, {
|
|
36252
|
-
isKnowledgeHandledWithRetrieval,
|
|
36253
|
-
});
|
|
36112
|
+
const isKnowledgeHandledWithRetrieval = directKnowledge.join('\n').length > SDK_TRANSPILER_KNOWLEDGE_THRESHOLD || knowledgeSources.length > 0;
|
|
36254
36113
|
const transpiledTeam = createTranspiledTeamExportForContext({
|
|
36255
36114
|
agentName,
|
|
36256
36115
|
agentSource: book,
|
|
@@ -36268,36 +36127,6 @@ async function prepareSdkTranspilerContext(book, options) {
|
|
|
36268
36127
|
transpiledTeam,
|
|
36269
36128
|
};
|
|
36270
36129
|
}
|
|
36271
|
-
/**
|
|
36272
|
-
* Removes the runtime-only knowledge-search tool from SDK harnesses that provide
|
|
36273
|
-
* their own generated retrieval scaffold.
|
|
36274
|
-
*
|
|
36275
|
-
* @param modelRequirements - Raw compiled model requirements.
|
|
36276
|
-
* @param options - Knowledge handling mode selected for the generated harness.
|
|
36277
|
-
* @returns Model requirements safe to embed into a standalone SDK export.
|
|
36278
|
-
*/
|
|
36279
|
-
function normalizeSdkTranspilerModelRequirements(modelRequirements, options) {
|
|
36280
|
-
var _a;
|
|
36281
|
-
if (!options.isKnowledgeHandledWithRetrieval) {
|
|
36282
|
-
return modelRequirements;
|
|
36283
|
-
}
|
|
36284
|
-
const tools = (_a = modelRequirements.tools) === null || _a === void 0 ? void 0 : _a.filter((tool) => tool.name !== KNOWLEDGE_SEARCH_TOOL_NAME);
|
|
36285
|
-
return {
|
|
36286
|
-
...modelRequirements,
|
|
36287
|
-
systemMessage: removeKnowledgeSearchSystemSection(modelRequirements.systemMessage),
|
|
36288
|
-
...(tools ? { tools } : {}),
|
|
36289
|
-
};
|
|
36290
|
-
}
|
|
36291
|
-
/**
|
|
36292
|
-
* Removes the generated `## Knowledge Search` instructions from SDK exports
|
|
36293
|
-
* that answer with the transpiler's native retrieval scaffold instead.
|
|
36294
|
-
*
|
|
36295
|
-
* @param systemMessage - Raw system message from compiled model requirements.
|
|
36296
|
-
* @returns System message without the runtime-only knowledge-search section.
|
|
36297
|
-
*/
|
|
36298
|
-
function removeKnowledgeSearchSystemSection(systemMessage) {
|
|
36299
|
-
return systemMessage.replace(/(?:^|\n\n)## Knowledge Search[\s\S]*?(?=\n\n##|$)/, '').trim();
|
|
36300
|
-
}
|
|
36301
36130
|
/**
|
|
36302
36131
|
* Detects whether one knowledge commitment points to a URL instead of inline text.
|
|
36303
36132
|
*
|
|
@@ -41570,8 +41399,10 @@ const ImageGeneratorFormfactorDefinition = {
|
|
|
41570
41399
|
*/
|
|
41571
41400
|
const MatcherFormfactorDefinition = {
|
|
41572
41401
|
name: 'EXPERIMENTAL_MATCHER',
|
|
41573
|
-
description: `
|
|
41574
|
-
|
|
41402
|
+
description: spaceTrim$1(`
|
|
41403
|
+
An evaluation system that determines whether content meets specific criteria or patterns.
|
|
41404
|
+
Used for content validation, quality assessment, and intelligent filtering tasks. Currently in experimental phase.
|
|
41405
|
+
`),
|
|
41575
41406
|
documentationUrl: `https://github.com/webgptorg/promptbook/discussions/177`,
|
|
41576
41407
|
pipelineInterface: {
|
|
41577
41408
|
inputParameters: [
|
|
@@ -41628,9 +41459,11 @@ const SheetsFormfactorDefinition = {
|
|
|
41628
41459
|
*/
|
|
41629
41460
|
const TranslatorFormfactorDefinition = {
|
|
41630
41461
|
name: 'TRANSLATOR',
|
|
41631
|
-
description: `
|
|
41632
|
-
|
|
41633
|
-
|
|
41462
|
+
description: spaceTrim$1(`
|
|
41463
|
+
A text transformation system that converts input content into different forms,
|
|
41464
|
+
including language translations, paraphrasing, style conversions, and tone adjustments.
|
|
41465
|
+
This form factor takes one input and produces one transformed output.
|
|
41466
|
+
`),
|
|
41634
41467
|
documentationUrl: `https://github.com/webgptorg/promptbook/discussions/175`,
|
|
41635
41468
|
pipelineInterface: {
|
|
41636
41469
|
inputParameters: [
|
|
@@ -42990,12 +42823,21 @@ const QuickChatbotHla = {
|
|
|
42990
42823
|
// <- TODO: [🧠] Make this dynamic, async, prepare-phase HLAs
|
|
42991
42824
|
],
|
|
42992
42825
|
});
|
|
42993
|
-
// TODO: Use spaceTrim in multiline strings
|
|
42994
42826
|
$pipelineJson.tasks.push({
|
|
42995
42827
|
taskType: 'PROMPT_TASK',
|
|
42996
42828
|
name: 'create-an-answer',
|
|
42997
42829
|
title: 'Create an answer',
|
|
42998
|
-
content:
|
|
42830
|
+
content: spaceTrim$1(`
|
|
42831
|
+
Write a response to the user message:
|
|
42832
|
+
|
|
42833
|
+
**Question from user**
|
|
42834
|
+
|
|
42835
|
+
> {userMessage}
|
|
42836
|
+
|
|
42837
|
+
**Previous conversation**
|
|
42838
|
+
|
|
42839
|
+
> {previousConversationSummary}
|
|
42840
|
+
`),
|
|
42999
42841
|
resultingParameterName: 'chatbotResponse',
|
|
43000
42842
|
personaName,
|
|
43001
42843
|
dependentParameterNames: [
|
|
@@ -43007,7 +42849,26 @@ const QuickChatbotHla = {
|
|
|
43007
42849
|
taskType: 'PROMPT_TASK',
|
|
43008
42850
|
name: 'summarize-the-conversation',
|
|
43009
42851
|
title: 'Summarize the conversation',
|
|
43010
|
-
content:
|
|
42852
|
+
content: spaceTrim$1(`
|
|
42853
|
+
Summarize the conversation in a few words:
|
|
42854
|
+
|
|
42855
|
+
## Rules
|
|
42856
|
+
|
|
42857
|
+
- Summarise the text of the conversation in a few words
|
|
42858
|
+
- Convert the text to its basic idea
|
|
42859
|
+
- Imagine you are writing the headline or subject line of an email
|
|
42860
|
+
- Respond with a few words of summary only
|
|
42861
|
+
|
|
42862
|
+
## Conversation
|
|
42863
|
+
|
|
42864
|
+
**User:**
|
|
42865
|
+
|
|
42866
|
+
> {userMessage}
|
|
42867
|
+
|
|
42868
|
+
**You:**
|
|
42869
|
+
|
|
42870
|
+
> {chatbotResponse}
|
|
42871
|
+
`),
|
|
43011
42872
|
resultingParameterName: 'conversationSummary',
|
|
43012
42873
|
personaName,
|
|
43013
42874
|
expectations: {
|
|
@@ -45390,11 +45251,11 @@ function formatChatAttachmentContext(attachments) {
|
|
|
45390
45251
|
if (attachments.length === 0) {
|
|
45391
45252
|
return '';
|
|
45392
45253
|
}
|
|
45393
|
-
return
|
|
45394
|
-
|
|
45395
|
-
|
|
45396
|
-
|
|
45397
|
-
|
|
45254
|
+
return spaceTrim$1((block) => `
|
|
45255
|
+
${CHAT_ATTACHMENTS_HEADING}
|
|
45256
|
+
${block(attachments.map((attachment) => formatChatAttachmentLine(attachment)).join('\n'))}
|
|
45257
|
+
${CHAT_ATTACHMENTS_INSTRUCTION}
|
|
45258
|
+
`);
|
|
45398
45259
|
}
|
|
45399
45260
|
|
|
45400
45261
|
/**
|
|
@@ -45635,24 +45496,24 @@ function formatResolvedChatAttachmentContent(contentResolution) {
|
|
|
45635
45496
|
: ''}`
|
|
45636
45497
|
: null;
|
|
45637
45498
|
const warningsLine = contentResolution.warnings.length > 0 ? `Warnings: ${contentResolution.warnings.join(' | ')}` : null;
|
|
45638
|
-
|
|
45499
|
+
const metadataLines = [decodingLine, warningsLine].filter((line) => Boolean(line)).join('\n');
|
|
45500
|
+
const resolvedContent = contentResolution.content;
|
|
45501
|
+
if (!resolvedContent) {
|
|
45639
45502
|
const reason = contentResolution.reason || 'content unavailable';
|
|
45640
|
-
return
|
|
45641
|
-
|
|
45642
|
-
|
|
45503
|
+
return spaceTrim$1((block) => `
|
|
45504
|
+
- ${attachmentLabel}: ${reason}. URL: ${contentResolution.attachment.url}
|
|
45505
|
+
${block(metadataLines)}
|
|
45506
|
+
`);
|
|
45643
45507
|
}
|
|
45644
45508
|
const truncatedLabel = contentResolution.isTruncated ? ' [truncated]' : '';
|
|
45645
|
-
return
|
|
45646
|
-
|
|
45647
|
-
|
|
45648
|
-
|
|
45649
|
-
|
|
45650
|
-
|
|
45651
|
-
|
|
45652
|
-
|
|
45653
|
-
]
|
|
45654
|
-
.filter(Boolean)
|
|
45655
|
-
.join('\n');
|
|
45509
|
+
return spaceTrim$1((block) => `
|
|
45510
|
+
File: ${attachmentLabel}${truncatedLabel}
|
|
45511
|
+
URL: ${contentResolution.attachment.url}
|
|
45512
|
+
${block(metadataLines)}
|
|
45513
|
+
\`\`\`text
|
|
45514
|
+
${block(resolvedContent)}
|
|
45515
|
+
\`\`\`
|
|
45516
|
+
`);
|
|
45656
45517
|
}
|
|
45657
45518
|
/**
|
|
45658
45519
|
* Formats inline attachment-content context section for the model.
|
|
@@ -45666,11 +45527,14 @@ function formatChatAttachmentContentContext(resolvedContents) {
|
|
|
45666
45527
|
if (resolvedContents.length === 0) {
|
|
45667
45528
|
return '';
|
|
45668
45529
|
}
|
|
45669
|
-
return
|
|
45670
|
-
|
|
45671
|
-
|
|
45672
|
-
|
|
45673
|
-
|
|
45530
|
+
return spaceTrim$1((block) => `
|
|
45531
|
+
${CHAT_ATTACHMENT_CONTENT_HEADING}
|
|
45532
|
+
${CHAT_ATTACHMENT_CONTENT_INSTRUCTION}
|
|
45533
|
+
|
|
45534
|
+
${block(resolvedContents
|
|
45535
|
+
.map((resolvedContent) => formatResolvedChatAttachmentContent(resolvedContent))
|
|
45536
|
+
.join('\n\n'))}
|
|
45537
|
+
`);
|
|
45674
45538
|
}
|
|
45675
45539
|
|
|
45676
45540
|
/**
|
|
@@ -46288,7 +46152,7 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
|
|
|
46288
46152
|
});
|
|
46289
46153
|
}
|
|
46290
46154
|
let vectorStoreId = cachedVectorStoreId;
|
|
46291
|
-
if (
|
|
46155
|
+
if (!vectorStoreId && knowledgeSources && knowledgeSources.length > 0) {
|
|
46292
46156
|
const vectorStoreResult = await this.createVectorStoreWithKnowledgeSources({
|
|
46293
46157
|
client: await this.getClient(),
|
|
46294
46158
|
name,
|
|
@@ -46297,19 +46161,13 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
|
|
|
46297
46161
|
});
|
|
46298
46162
|
vectorStoreId = vectorStoreResult.vectorStoreId;
|
|
46299
46163
|
}
|
|
46300
|
-
else if (
|
|
46164
|
+
else if (vectorStoreId && this.options.isVerbose) {
|
|
46301
46165
|
console.info('[🤰]', 'Using cached vector store for AgentKit agent', {
|
|
46302
46166
|
name,
|
|
46303
46167
|
vectorStoreId,
|
|
46304
46168
|
});
|
|
46305
46169
|
}
|
|
46306
|
-
|
|
46307
|
-
vectorStoreId = undefined;
|
|
46308
|
-
}
|
|
46309
|
-
const agentKitTools = this.buildAgentKitTools({
|
|
46310
|
-
tools,
|
|
46311
|
-
vectorStoreId,
|
|
46312
|
-
});
|
|
46170
|
+
const agentKitTools = this.buildAgentKitTools({ tools, vectorStoreId });
|
|
46313
46171
|
const openAiAgentKitAgent = new Agent$1({
|
|
46314
46172
|
name,
|
|
46315
46173
|
model: this.agentKitModelName,
|
|
@@ -46328,7 +46186,7 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
|
|
|
46328
46186
|
name,
|
|
46329
46187
|
model: this.agentKitModelName,
|
|
46330
46188
|
toolCount: agentKitTools.length,
|
|
46331
|
-
hasVectorStore:
|
|
46189
|
+
hasVectorStore: Boolean(vectorStoreId),
|
|
46332
46190
|
});
|
|
46333
46191
|
}
|
|
46334
46192
|
return preparedAgent;
|
|
@@ -46827,12 +46685,6 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
|
|
|
46827
46685
|
get agentKitOptions() {
|
|
46828
46686
|
return this.options;
|
|
46829
46687
|
}
|
|
46830
|
-
/**
|
|
46831
|
-
* Returns true when hosted OpenAI vector-store search should back `knowledgeSources`.
|
|
46832
|
-
*/
|
|
46833
|
-
get isNativeKnowledgeSearchEnabled() {
|
|
46834
|
-
return this.agentKitOptions.isNativeKnowledgeSearchEnabled !== false;
|
|
46835
|
-
}
|
|
46836
46688
|
/**
|
|
46837
46689
|
* Discriminant for type guards.
|
|
46838
46690
|
*/
|