@promptbook/node 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 +85 -198
- 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 -2
- package/umd/index.umd.js +85 -198
- 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/umd/index.umd.js
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
* @generated
|
|
49
49
|
* @see https://github.com/webgptorg/promptbook
|
|
50
50
|
*/
|
|
51
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
51
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-65';
|
|
52
52
|
/**
|
|
53
53
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
54
54
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -8856,8 +8856,10 @@
|
|
|
8856
8856
|
*/
|
|
8857
8857
|
const MatcherFormfactorDefinition = {
|
|
8858
8858
|
name: 'EXPERIMENTAL_MATCHER',
|
|
8859
|
-
description: `
|
|
8860
|
-
|
|
8859
|
+
description: _spaceTrim.spaceTrim(`
|
|
8860
|
+
An evaluation system that determines whether content meets specific criteria or patterns.
|
|
8861
|
+
Used for content validation, quality assessment, and intelligent filtering tasks. Currently in experimental phase.
|
|
8862
|
+
`),
|
|
8861
8863
|
documentationUrl: `https://github.com/webgptorg/promptbook/discussions/177`,
|
|
8862
8864
|
pipelineInterface: {
|
|
8863
8865
|
inputParameters: [
|
|
@@ -8914,9 +8916,11 @@
|
|
|
8914
8916
|
*/
|
|
8915
8917
|
const TranslatorFormfactorDefinition = {
|
|
8916
8918
|
name: 'TRANSLATOR',
|
|
8917
|
-
description: `
|
|
8918
|
-
|
|
8919
|
-
|
|
8919
|
+
description: _spaceTrim.spaceTrim(`
|
|
8920
|
+
A text transformation system that converts input content into different forms,
|
|
8921
|
+
including language translations, paraphrasing, style conversions, and tone adjustments.
|
|
8922
|
+
This form factor takes one input and produces one transformed output.
|
|
8923
|
+
`),
|
|
8920
8924
|
documentationUrl: `https://github.com/webgptorg/promptbook/discussions/175`,
|
|
8921
8925
|
pipelineInterface: {
|
|
8922
8926
|
inputParameters: [
|
|
@@ -10291,12 +10295,21 @@
|
|
|
10291
10295
|
// <- TODO: [🧠] Make this dynamic, async, prepare-phase HLAs
|
|
10292
10296
|
],
|
|
10293
10297
|
});
|
|
10294
|
-
// TODO: Use spaceTrim in multiline strings
|
|
10295
10298
|
$pipelineJson.tasks.push({
|
|
10296
10299
|
taskType: 'PROMPT_TASK',
|
|
10297
10300
|
name: 'create-an-answer',
|
|
10298
10301
|
title: 'Create an answer',
|
|
10299
|
-
content:
|
|
10302
|
+
content: _spaceTrim.spaceTrim(`
|
|
10303
|
+
Write a response to the user message:
|
|
10304
|
+
|
|
10305
|
+
**Question from user**
|
|
10306
|
+
|
|
10307
|
+
> {userMessage}
|
|
10308
|
+
|
|
10309
|
+
**Previous conversation**
|
|
10310
|
+
|
|
10311
|
+
> {previousConversationSummary}
|
|
10312
|
+
`),
|
|
10300
10313
|
resultingParameterName: 'chatbotResponse',
|
|
10301
10314
|
personaName,
|
|
10302
10315
|
dependentParameterNames: [
|
|
@@ -10308,7 +10321,26 @@
|
|
|
10308
10321
|
taskType: 'PROMPT_TASK',
|
|
10309
10322
|
name: 'summarize-the-conversation',
|
|
10310
10323
|
title: 'Summarize the conversation',
|
|
10311
|
-
content:
|
|
10324
|
+
content: _spaceTrim.spaceTrim(`
|
|
10325
|
+
Summarize the conversation in a few words:
|
|
10326
|
+
|
|
10327
|
+
## Rules
|
|
10328
|
+
|
|
10329
|
+
- Summarise the text of the conversation in a few words
|
|
10330
|
+
- Convert the text to its basic idea
|
|
10331
|
+
- Imagine you are writing the headline or subject line of an email
|
|
10332
|
+
- Respond with a few words of summary only
|
|
10333
|
+
|
|
10334
|
+
## Conversation
|
|
10335
|
+
|
|
10336
|
+
**User:**
|
|
10337
|
+
|
|
10338
|
+
> {userMessage}
|
|
10339
|
+
|
|
10340
|
+
**You:**
|
|
10341
|
+
|
|
10342
|
+
> {chatbotResponse}
|
|
10343
|
+
`),
|
|
10312
10344
|
resultingParameterName: 'conversationSummary',
|
|
10313
10345
|
personaName,
|
|
10314
10346
|
expectations: {
|
|
@@ -15851,18 +15883,6 @@
|
|
|
15851
15883
|
}
|
|
15852
15884
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
15853
15885
|
|
|
15854
|
-
/**
|
|
15855
|
-
* Name of the tool used by agents to search configured `KNOWLEDGE` sources.
|
|
15856
|
-
*
|
|
15857
|
-
* @public exported from `@promptbook/core`
|
|
15858
|
-
*/
|
|
15859
|
-
const KNOWLEDGE_SEARCH_TOOL_NAME = 'knowledge_search';
|
|
15860
|
-
/**
|
|
15861
|
-
* Title of the system-message section generated for `KNOWLEDGE` commitments.
|
|
15862
|
-
*
|
|
15863
|
-
* @private constant of `KnowledgeCommitmentDefinition`
|
|
15864
|
-
*/
|
|
15865
|
-
const KNOWLEDGE_SEARCH_SYSTEM_SECTION_TITLE = 'Knowledge Search';
|
|
15866
15886
|
/**
|
|
15867
15887
|
* KNOWLEDGE commitment definition
|
|
15868
15888
|
*
|
|
@@ -15984,17 +16004,9 @@
|
|
|
15984
16004
|
knowledgeInfoEntries.push(`Knowledge Source Inline: ${inlineSource.filename} (derived from inline content and processed for retrieval during chat)`);
|
|
15985
16005
|
}
|
|
15986
16006
|
if (knowledgeInfoEntries.length === 0) {
|
|
15987
|
-
return
|
|
16007
|
+
return nextRequirements;
|
|
15988
16008
|
}
|
|
15989
|
-
return
|
|
15990
|
-
}
|
|
15991
|
-
/**
|
|
15992
|
-
* Gets human-readable titles for tool functions provided by this commitment.
|
|
15993
|
-
*/
|
|
15994
|
-
getToolTitles() {
|
|
15995
|
-
return {
|
|
15996
|
-
[KNOWLEDGE_SEARCH_TOOL_NAME]: 'Knowledge search',
|
|
15997
|
-
};
|
|
16009
|
+
return this.appendToSystemMessage(nextRequirements, knowledgeInfoEntries.join('\n'), '\n\n');
|
|
15998
16010
|
}
|
|
15999
16011
|
}
|
|
16000
16012
|
/**
|
|
@@ -16008,128 +16020,6 @@
|
|
|
16008
16020
|
const significantText = contentWithoutUrls.replace(/[\s.,!?;:'"`()[\]{}<>/-]+/g, '');
|
|
16009
16021
|
return significantText.length > 0;
|
|
16010
16022
|
}
|
|
16011
|
-
/**
|
|
16012
|
-
* Adds the shared `knowledge_search` tool definition and the consolidated system-message section.
|
|
16013
|
-
*
|
|
16014
|
-
* @param requirements - Requirements after one `KNOWLEDGE` commitment was applied.
|
|
16015
|
-
* @returns Requirements with the knowledge search instructions and tool definition.
|
|
16016
|
-
*
|
|
16017
|
-
* @private internal utility of `KnowledgeCommitmentDefinition`
|
|
16018
|
-
*/
|
|
16019
|
-
function addKnowledgeSearchToolAndSystemSection(requirements) {
|
|
16020
|
-
const nextRequirements = addKnowledgeSearchTool(requirements);
|
|
16021
|
-
const section = createKnowledgeSearchSystemSection(nextRequirements);
|
|
16022
|
-
const sectionHeader = `## ${KNOWLEDGE_SEARCH_SYSTEM_SECTION_TITLE}`;
|
|
16023
|
-
if (nextRequirements.systemMessage.includes(sectionHeader)) {
|
|
16024
|
-
return {
|
|
16025
|
-
...nextRequirements,
|
|
16026
|
-
systemMessage: nextRequirements.systemMessage.replace(new RegExp(`## ${KNOWLEDGE_SEARCH_SYSTEM_SECTION_TITLE.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}[\\s\\S]*?(?=\\n\\n##|$)`), section),
|
|
16027
|
-
};
|
|
16028
|
-
}
|
|
16029
|
-
return {
|
|
16030
|
-
...nextRequirements,
|
|
16031
|
-
systemMessage: nextRequirements.systemMessage.trim()
|
|
16032
|
-
? `${nextRequirements.systemMessage}\n\n${section}`
|
|
16033
|
-
: section,
|
|
16034
|
-
};
|
|
16035
|
-
}
|
|
16036
|
-
/**
|
|
16037
|
-
* Adds the `knowledge_search` model tool when it is not already present.
|
|
16038
|
-
*
|
|
16039
|
-
* @param requirements - Current model requirements.
|
|
16040
|
-
* @returns Requirements with the tool definition available to the model.
|
|
16041
|
-
*
|
|
16042
|
-
* @private internal utility of `KnowledgeCommitmentDefinition`
|
|
16043
|
-
*/
|
|
16044
|
-
function addKnowledgeSearchTool(requirements) {
|
|
16045
|
-
const existingTools = requirements.tools || [];
|
|
16046
|
-
if (existingTools.some((tool) => tool.name === KNOWLEDGE_SEARCH_TOOL_NAME)) {
|
|
16047
|
-
return requirements;
|
|
16048
|
-
}
|
|
16049
|
-
return {
|
|
16050
|
-
...requirements,
|
|
16051
|
-
tools: [
|
|
16052
|
-
...existingTools,
|
|
16053
|
-
{
|
|
16054
|
-
name: KNOWLEDGE_SEARCH_TOOL_NAME,
|
|
16055
|
-
description: _spaceTrim.spaceTrim(`
|
|
16056
|
-
Search the agent's configured knowledge sources and return relevant excerpts with citation ids.
|
|
16057
|
-
Use this before answering questions that may depend on the agent's KNOWLEDGE commitments.
|
|
16058
|
-
`),
|
|
16059
|
-
parameters: {
|
|
16060
|
-
type: 'object',
|
|
16061
|
-
properties: {
|
|
16062
|
-
query: {
|
|
16063
|
-
type: 'string',
|
|
16064
|
-
description: 'The natural-language search query for the knowledge base.',
|
|
16065
|
-
},
|
|
16066
|
-
limit: {
|
|
16067
|
-
type: 'integer',
|
|
16068
|
-
description: 'Maximum number of matching source excerpts to return.',
|
|
16069
|
-
},
|
|
16070
|
-
},
|
|
16071
|
-
required: ['query'],
|
|
16072
|
-
},
|
|
16073
|
-
},
|
|
16074
|
-
],
|
|
16075
|
-
};
|
|
16076
|
-
}
|
|
16077
|
-
/**
|
|
16078
|
-
* Creates the model-facing system-message section for knowledge search.
|
|
16079
|
-
*
|
|
16080
|
-
* @param requirements - Current model requirements.
|
|
16081
|
-
* @returns Markdown system-message section.
|
|
16082
|
-
*
|
|
16083
|
-
* @private internal utility of `KnowledgeCommitmentDefinition`
|
|
16084
|
-
*/
|
|
16085
|
-
function createKnowledgeSearchSystemSection(requirements) {
|
|
16086
|
-
const sourceEntries = createKnowledgeSourceSystemEntries(requirements);
|
|
16087
|
-
const sourceList = sourceEntries.length > 0 ? sourceEntries.map((entry) => `- ${entry}`).join('\n') : '- None';
|
|
16088
|
-
return _spaceTrim.spaceTrim(`
|
|
16089
|
-
## ${KNOWLEDGE_SEARCH_SYSTEM_SECTION_TITLE}
|
|
16090
|
-
|
|
16091
|
-
- Use \`${KNOWLEDGE_SEARCH_TOOL_NAME}\` to search the configured knowledge sources before answering questions that depend on this agent's knowledge base.
|
|
16092
|
-
- Base source-backed factual answers on the returned excerpts.
|
|
16093
|
-
- When you use a returned excerpt, include its citation marker in the answer body, for example \`[0:0]\`.
|
|
16094
|
-
- If the search returns no relevant information, say that the knowledge base did not contain the answer instead of inventing it.
|
|
16095
|
-
|
|
16096
|
-
Configured knowledge sources:
|
|
16097
|
-
${sourceList}
|
|
16098
|
-
`);
|
|
16099
|
-
}
|
|
16100
|
-
/**
|
|
16101
|
-
* Builds a stable list of configured knowledge sources for system-message diagnostics.
|
|
16102
|
-
*
|
|
16103
|
-
* @param requirements - Current model requirements.
|
|
16104
|
-
* @returns Human-readable source entries.
|
|
16105
|
-
*
|
|
16106
|
-
* @private internal utility of `KnowledgeCommitmentDefinition`
|
|
16107
|
-
*/
|
|
16108
|
-
function createKnowledgeSourceSystemEntries(requirements) {
|
|
16109
|
-
var _a;
|
|
16110
|
-
const entries = [];
|
|
16111
|
-
const seenEntries = new Set();
|
|
16112
|
-
for (const source of requirements.knowledgeSources || []) {
|
|
16113
|
-
const entry = `Source URL: ${source} (processed for retrieval during chat)`;
|
|
16114
|
-
if (seenEntries.has(entry)) {
|
|
16115
|
-
continue;
|
|
16116
|
-
}
|
|
16117
|
-
seenEntries.add(entry);
|
|
16118
|
-
entries.push(entry);
|
|
16119
|
-
}
|
|
16120
|
-
const inlineSources = (((_a = requirements._metadata) === null || _a === void 0 ? void 0 : _a.inlineKnowledgeSources) || [])
|
|
16121
|
-
.map((source) => source.filename)
|
|
16122
|
-
.filter(Boolean);
|
|
16123
|
-
for (const filename of inlineSources) {
|
|
16124
|
-
const entry = `Knowledge Source Inline: ${filename} (Inline source: processed for retrieval during chat)`;
|
|
16125
|
-
if (seenEntries.has(entry)) {
|
|
16126
|
-
continue;
|
|
16127
|
-
}
|
|
16128
|
-
seenEntries.add(entry);
|
|
16129
|
-
entries.push(entry);
|
|
16130
|
-
}
|
|
16131
|
-
return entries;
|
|
16132
|
-
}
|
|
16133
16023
|
|
|
16134
16024
|
/**
|
|
16135
16025
|
* LANGUAGE commitment definition
|
|
@@ -21874,7 +21764,11 @@
|
|
|
21874
21764
|
// Create new system message with persona at the beginning
|
|
21875
21765
|
// Format: "You are {agentName}\n{personaContent}"
|
|
21876
21766
|
// The # PERSONA comment will be removed later by removeCommentsFromSystemMessage
|
|
21877
|
-
const personaSection =
|
|
21767
|
+
const personaSection = _spaceTrim.spaceTrim((block) => `
|
|
21768
|
+
# PERSONA
|
|
21769
|
+
You are ${agentName}
|
|
21770
|
+
${block(mergedPersonaContent)}
|
|
21771
|
+
`);
|
|
21878
21772
|
const newSystemMessage = cleanedMessage ? `${personaSection}\n\n${cleanedMessage}` : personaSection;
|
|
21879
21773
|
return {
|
|
21880
21774
|
...requirements,
|
|
@@ -34096,11 +33990,11 @@
|
|
|
34096
33990
|
if (attachments.length === 0) {
|
|
34097
33991
|
return '';
|
|
34098
33992
|
}
|
|
34099
|
-
return
|
|
34100
|
-
CHAT_ATTACHMENTS_HEADING
|
|
34101
|
-
|
|
34102
|
-
CHAT_ATTACHMENTS_INSTRUCTION
|
|
34103
|
-
|
|
33993
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
33994
|
+
${CHAT_ATTACHMENTS_HEADING}
|
|
33995
|
+
${block(attachments.map((attachment) => formatChatAttachmentLine(attachment)).join('\n'))}
|
|
33996
|
+
${CHAT_ATTACHMENTS_INSTRUCTION}
|
|
33997
|
+
`);
|
|
34104
33998
|
}
|
|
34105
33999
|
|
|
34106
34000
|
/**
|
|
@@ -34341,24 +34235,24 @@
|
|
|
34341
34235
|
: ''}`
|
|
34342
34236
|
: null;
|
|
34343
34237
|
const warningsLine = contentResolution.warnings.length > 0 ? `Warnings: ${contentResolution.warnings.join(' | ')}` : null;
|
|
34344
|
-
|
|
34238
|
+
const metadataLines = [decodingLine, warningsLine].filter((line) => Boolean(line)).join('\n');
|
|
34239
|
+
const resolvedContent = contentResolution.content;
|
|
34240
|
+
if (!resolvedContent) {
|
|
34345
34241
|
const reason = contentResolution.reason || 'content unavailable';
|
|
34346
|
-
return
|
|
34347
|
-
.
|
|
34348
|
-
|
|
34242
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
34243
|
+
- ${attachmentLabel}: ${reason}. URL: ${contentResolution.attachment.url}
|
|
34244
|
+
${block(metadataLines)}
|
|
34245
|
+
`);
|
|
34349
34246
|
}
|
|
34350
34247
|
const truncatedLabel = contentResolution.isTruncated ? ' [truncated]' : '';
|
|
34351
|
-
return
|
|
34352
|
-
|
|
34353
|
-
|
|
34354
|
-
|
|
34355
|
-
|
|
34356
|
-
|
|
34357
|
-
|
|
34358
|
-
|
|
34359
|
-
]
|
|
34360
|
-
.filter(Boolean)
|
|
34361
|
-
.join('\n');
|
|
34248
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
34249
|
+
File: ${attachmentLabel}${truncatedLabel}
|
|
34250
|
+
URL: ${contentResolution.attachment.url}
|
|
34251
|
+
${block(metadataLines)}
|
|
34252
|
+
\`\`\`text
|
|
34253
|
+
${block(resolvedContent)}
|
|
34254
|
+
\`\`\`
|
|
34255
|
+
`);
|
|
34362
34256
|
}
|
|
34363
34257
|
/**
|
|
34364
34258
|
* Formats inline attachment-content context section for the model.
|
|
@@ -34372,11 +34266,14 @@
|
|
|
34372
34266
|
if (resolvedContents.length === 0) {
|
|
34373
34267
|
return '';
|
|
34374
34268
|
}
|
|
34375
|
-
return
|
|
34376
|
-
CHAT_ATTACHMENT_CONTENT_HEADING
|
|
34377
|
-
CHAT_ATTACHMENT_CONTENT_INSTRUCTION
|
|
34378
|
-
|
|
34379
|
-
|
|
34269
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
34270
|
+
${CHAT_ATTACHMENT_CONTENT_HEADING}
|
|
34271
|
+
${CHAT_ATTACHMENT_CONTENT_INSTRUCTION}
|
|
34272
|
+
|
|
34273
|
+
${block(resolvedContents
|
|
34274
|
+
.map((resolvedContent) => formatResolvedChatAttachmentContent(resolvedContent))
|
|
34275
|
+
.join('\n\n'))}
|
|
34276
|
+
`);
|
|
34380
34277
|
}
|
|
34381
34278
|
|
|
34382
34279
|
/**
|
|
@@ -35521,9 +35418,11 @@
|
|
|
35521
35418
|
* Creates the retry-history error message shared by all OpenAI-compatible model variants.
|
|
35522
35419
|
*/
|
|
35523
35420
|
createAttemptHistoryError(finalErrorMessage) {
|
|
35524
|
-
return new PipelineExecutionError(
|
|
35525
|
-
|
|
35526
|
-
|
|
35421
|
+
return new PipelineExecutionError(_spaceTrim.spaceTrim((block) => `
|
|
35422
|
+
All attempts failed. Attempt history:
|
|
35423
|
+
${block(formatUnsupportedParameterAttemptHistory(this.attemptStack))}
|
|
35424
|
+
Final error: ${finalErrorMessage}
|
|
35425
|
+
`));
|
|
35527
35426
|
}
|
|
35528
35427
|
}
|
|
35529
35428
|
|
|
@@ -38117,7 +38016,7 @@
|
|
|
38117
38016
|
});
|
|
38118
38017
|
}
|
|
38119
38018
|
let vectorStoreId = cachedVectorStoreId;
|
|
38120
|
-
if (
|
|
38019
|
+
if (!vectorStoreId && knowledgeSources && knowledgeSources.length > 0) {
|
|
38121
38020
|
const vectorStoreResult = await this.createVectorStoreWithKnowledgeSources({
|
|
38122
38021
|
client: await this.getClient(),
|
|
38123
38022
|
name,
|
|
@@ -38126,19 +38025,13 @@
|
|
|
38126
38025
|
});
|
|
38127
38026
|
vectorStoreId = vectorStoreResult.vectorStoreId;
|
|
38128
38027
|
}
|
|
38129
|
-
else if (
|
|
38028
|
+
else if (vectorStoreId && this.options.isVerbose) {
|
|
38130
38029
|
console.info('[🤰]', 'Using cached vector store for AgentKit agent', {
|
|
38131
38030
|
name,
|
|
38132
38031
|
vectorStoreId,
|
|
38133
38032
|
});
|
|
38134
38033
|
}
|
|
38135
|
-
|
|
38136
|
-
vectorStoreId = undefined;
|
|
38137
|
-
}
|
|
38138
|
-
const agentKitTools = this.buildAgentKitTools({
|
|
38139
|
-
tools,
|
|
38140
|
-
vectorStoreId,
|
|
38141
|
-
});
|
|
38034
|
+
const agentKitTools = this.buildAgentKitTools({ tools, vectorStoreId });
|
|
38142
38035
|
const openAiAgentKitAgent = new agents.Agent({
|
|
38143
38036
|
name,
|
|
38144
38037
|
model: this.agentKitModelName,
|
|
@@ -38157,7 +38050,7 @@
|
|
|
38157
38050
|
name,
|
|
38158
38051
|
model: this.agentKitModelName,
|
|
38159
38052
|
toolCount: agentKitTools.length,
|
|
38160
|
-
hasVectorStore:
|
|
38053
|
+
hasVectorStore: Boolean(vectorStoreId),
|
|
38161
38054
|
});
|
|
38162
38055
|
}
|
|
38163
38056
|
return preparedAgent;
|
|
@@ -38656,12 +38549,6 @@
|
|
|
38656
38549
|
get agentKitOptions() {
|
|
38657
38550
|
return this.options;
|
|
38658
38551
|
}
|
|
38659
|
-
/**
|
|
38660
|
-
* Returns true when hosted OpenAI vector-store search should back `knowledgeSources`.
|
|
38661
|
-
*/
|
|
38662
|
-
get isNativeKnowledgeSearchEnabled() {
|
|
38663
|
-
return this.agentKitOptions.isNativeKnowledgeSearchEnabled !== false;
|
|
38664
|
-
}
|
|
38665
38552
|
/**
|
|
38666
38553
|
* Discriminant for type guards.
|
|
38667
38554
|
*/
|