@promptbook/utils 0.112.0-72 → 0.112.0-73
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 +5 -2
- package/esm/index.es.js.map +1 -1
- package/esm/src/book-components/Chat/save/_common/chatExportRendering.d.ts +28 -0
- package/esm/src/book-components/Chat/save/_common/getPromptbookExportBranding.d.ts +18 -0
- package/esm/src/book-components/Chat/save/html/htmlSaveFormatDefinition.d.ts +1 -1
- package/esm/src/book-components/Chat/save/html/htmlSaveFormatDefinition.test.d.ts +1 -0
- package/esm/src/book-components/Chat/save/index.d.ts +4 -4
- package/esm/src/book-components/Chat/save/markdown/mdSaveFormatDefinition.d.ts +1 -1
- package/esm/src/book-components/Chat/save/markdown/mdSaveFormatDefinition.test.d.ts +1 -0
- package/esm/src/book-components/Chat/save/pdf/buildChatPdf.d.ts +3 -2
- package/esm/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.d.ts +2 -2
- package/esm/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.test.d.ts +1 -0
- package/esm/src/book-components/Chat/save/react/reactSaveFormatDefinition.test.d.ts +1 -0
- package/esm/src/book-components/Chat/utils/renderMarkdown.d.ts +26 -0
- package/esm/src/cli/cli-commands/agent/agentRunCliOptions.d.ts +2 -0
- package/esm/src/cli/cli-commands/agent/initializeAgentRunnerCommand.d.ts +1 -0
- package/esm/src/cli/cli-commands/common/handleActionErrors.d.ts +9 -4
- package/esm/src/conversion/pipelineJsonToString/appendMarkdownBlock.d.ts +7 -0
- package/esm/src/conversion/pipelineJsonToString/createPipelineCommands.d.ts +7 -0
- package/esm/src/conversion/pipelineJsonToString/createPipelineIntroduction.d.ts +8 -0
- package/esm/src/conversion/pipelineJsonToString/createTaskSerialization.d.ts +23 -0
- package/esm/src/conversion/pipelineJsonToString/stringifyCommands.d.ts +7 -0
- package/esm/src/conversion/pipelineJsonToString/stringifyTask.d.ts +8 -0
- package/esm/src/conversion/pipelineJsonToString.test.d.ts +1 -0
- package/esm/src/execution/createPipelineExecutor/executeSingleAttempt.d.ts +31 -0
- package/esm/src/execution/createPipelineExecutor/handleAttemptFailure.d.ts +40 -0
- package/esm/src/execution/createPipelineExecutor/reportPromptExecution.d.ts +34 -0
- package/esm/src/execution/resolveTaskTldr.d.ts +32 -0
- package/esm/src/execution/resolveTaskTldr.test.d.ts +1 -0
- package/esm/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +22 -63
- package/esm/src/llm-providers/agent/AgentLlmExecutionToolsAgentKitRunner.d.ts +51 -0
- package/esm/src/llm-providers/agent/AgentLlmExecutionToolsOpenAiAssistantRunner.d.ts +43 -0
- package/esm/src/llm-providers/agent/AgentLlmExecutionToolsPromptPreparer.d.ts +41 -0
- package/esm/src/llm-providers/agent/emitAgentLlmExecutionToolsAssistantPreparationProgress.d.ts +26 -0
- package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +16 -93
- package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionToolsInputBuilder.d.ts +41 -0
- package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionToolsOutputTypeMapper.d.ts +56 -0
- package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionToolsToolBuilder.d.ts +99 -0
- package/esm/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +24 -120
- package/esm/src/llm-providers/openai/OpenAiAssistantExecutionToolsProgressReporter.d.ts +62 -0
- package/esm/src/llm-providers/openai/OpenAiAssistantExecutionToolsPromptBuilder.d.ts +29 -0
- package/esm/src/llm-providers/openai/OpenAiAssistantExecutionToolsStreamRunner.d.ts +63 -0
- package/esm/src/llm-providers/openai/OpenAiAssistantExecutionToolsToolRunner.d.ts +89 -0
- package/esm/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +9 -28
- package/esm/src/llm-providers/openai/OpenAiCompatibleModelCatalog.d.ts +31 -0
- package/esm/src/llm-providers/openai/OpenAiCompatibleNonChatPromptCaller.d.ts +57 -0
- package/esm/src/llm-providers/openai/OpenAiCompatibleRequestManager.d.ts +29 -0
- package/esm/src/llm-providers/openai/OpenAiVectorStoreFileBatchHandler.d.ts +51 -0
- package/esm/src/llm-providers/openai/OpenAiVectorStoreFileBatchPoller.d.ts +75 -0
- package/esm/src/llm-providers/openai/OpenAiVectorStoreHandler.d.ts +1 -98
- package/esm/src/llm-providers/openai/OpenAiVectorStoreKnowledgeSourcePreparer.d.ts +44 -0
- package/esm/src/llm-providers/openai/utils/OpenAiCompatibleChatProgressReporter.d.ts +86 -0
- package/esm/src/llm-providers/openai/utils/OpenAiCompatibleChatPromptBuilder.d.ts +57 -0
- package/esm/src/llm-providers/openai/utils/OpenAiCompatibleChatToolCaller.d.ts +57 -0
- package/esm/src/remote-server/startRemoteServer/RemoteServerRuntime.d.ts +14 -0
- package/esm/src/remote-server/startRemoteServer/SocketResponse.d.ts +9 -0
- package/esm/src/remote-server/startRemoteServer/StartRemoteServerConfiguration.d.ts +18 -0
- package/esm/src/remote-server/startRemoteServer/createRemoteServerExpressApp.d.ts +7 -0
- package/esm/src/remote-server/startRemoteServer/createRemoteServerHandle.d.ts +11 -0
- package/esm/src/remote-server/startRemoteServer/createSocketServer.d.ts +9 -0
- package/esm/src/remote-server/startRemoteServer/getExecutionToolsFromIdentification.d.ts +12 -0
- package/esm/src/remote-server/startRemoteServer/registerBookRoutes.d.ts +7 -0
- package/esm/src/remote-server/startRemoteServer/registerExecutionRoutes.d.ts +7 -0
- package/esm/src/remote-server/startRemoteServer/registerListModelsSocketHandler.d.ts +8 -0
- package/esm/src/remote-server/startRemoteServer/registerLoginRoute.d.ts +7 -0
- package/esm/src/remote-server/startRemoteServer/registerNotFoundRoute.d.ts +7 -0
- package/esm/src/remote-server/startRemoteServer/registerOpenAiCompatibleChatCompletionsRoute.d.ts +7 -0
- package/esm/src/remote-server/startRemoteServer/registerOpenApiRoutes.d.ts +7 -0
- package/esm/src/remote-server/startRemoteServer/registerPreparePipelineSocketHandler.d.ts +8 -0
- package/esm/src/remote-server/startRemoteServer/registerPromptSocketHandler.d.ts +8 -0
- package/esm/src/remote-server/startRemoteServer/registerRemoteServerHttpRoutes.d.ts +7 -0
- package/esm/src/remote-server/startRemoteServer/registerRemoteServerSocketHandlers.d.ts +8 -0
- package/esm/src/remote-server/startRemoteServer/registerServerIndexRoute.d.ts +7 -0
- package/esm/src/remote-server/startRemoteServer/resolveStartRemoteServerConfiguration.d.ts +8 -0
- package/esm/src/remote-server/startRemoteServer/respondToSocketRequest.d.ts +8 -0
- package/esm/src/remote-server/startRemoteServer/startListening.d.ts +9 -0
- package/esm/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +14 -1
- package/esm/src/utils/serialization/serializeToPromptbookJavascript.d.ts +2 -0
- package/esm/src/utils/serialization/serializeToPromptbookJavascript.test.d.ts +1 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +5 -2
- package/umd/index.umd.js.map +1 -1
- package/umd/src/book-components/Chat/save/_common/chatExportRendering.d.ts +28 -0
- package/umd/src/book-components/Chat/save/_common/getPromptbookExportBranding.d.ts +18 -0
- package/umd/src/book-components/Chat/save/html/htmlSaveFormatDefinition.d.ts +1 -1
- package/umd/src/book-components/Chat/save/html/htmlSaveFormatDefinition.test.d.ts +1 -0
- package/umd/src/book-components/Chat/save/index.d.ts +4 -4
- package/umd/src/book-components/Chat/save/markdown/mdSaveFormatDefinition.d.ts +1 -1
- package/umd/src/book-components/Chat/save/markdown/mdSaveFormatDefinition.test.d.ts +1 -0
- package/umd/src/book-components/Chat/save/pdf/buildChatPdf.d.ts +3 -2
- package/umd/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.d.ts +2 -2
- package/umd/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.test.d.ts +1 -0
- package/umd/src/book-components/Chat/save/react/reactSaveFormatDefinition.test.d.ts +1 -0
- package/umd/src/book-components/Chat/utils/renderMarkdown.d.ts +26 -0
- package/umd/src/cli/cli-commands/agent/agentRunCliOptions.d.ts +2 -0
- package/umd/src/cli/cli-commands/agent/initializeAgentRunnerCommand.d.ts +1 -0
- package/umd/src/cli/cli-commands/common/handleActionErrors.d.ts +9 -4
- package/umd/src/conversion/pipelineJsonToString/appendMarkdownBlock.d.ts +7 -0
- package/umd/src/conversion/pipelineJsonToString/createPipelineCommands.d.ts +7 -0
- package/umd/src/conversion/pipelineJsonToString/createPipelineIntroduction.d.ts +8 -0
- package/umd/src/conversion/pipelineJsonToString/createTaskSerialization.d.ts +23 -0
- package/umd/src/conversion/pipelineJsonToString/stringifyCommands.d.ts +7 -0
- package/umd/src/conversion/pipelineJsonToString/stringifyTask.d.ts +8 -0
- package/umd/src/conversion/pipelineJsonToString.test.d.ts +1 -0
- package/umd/src/execution/createPipelineExecutor/executeSingleAttempt.d.ts +31 -0
- package/umd/src/execution/createPipelineExecutor/handleAttemptFailure.d.ts +40 -0
- package/umd/src/execution/createPipelineExecutor/reportPromptExecution.d.ts +34 -0
- package/umd/src/execution/resolveTaskTldr.d.ts +32 -0
- package/umd/src/execution/resolveTaskTldr.test.d.ts +1 -0
- package/umd/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +22 -63
- package/umd/src/llm-providers/agent/AgentLlmExecutionToolsAgentKitRunner.d.ts +51 -0
- package/umd/src/llm-providers/agent/AgentLlmExecutionToolsOpenAiAssistantRunner.d.ts +43 -0
- package/umd/src/llm-providers/agent/AgentLlmExecutionToolsPromptPreparer.d.ts +41 -0
- package/umd/src/llm-providers/agent/emitAgentLlmExecutionToolsAssistantPreparationProgress.d.ts +26 -0
- package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +16 -93
- package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionToolsInputBuilder.d.ts +41 -0
- package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionToolsOutputTypeMapper.d.ts +56 -0
- package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionToolsToolBuilder.d.ts +99 -0
- package/umd/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +24 -120
- package/umd/src/llm-providers/openai/OpenAiAssistantExecutionToolsProgressReporter.d.ts +62 -0
- package/umd/src/llm-providers/openai/OpenAiAssistantExecutionToolsPromptBuilder.d.ts +29 -0
- package/umd/src/llm-providers/openai/OpenAiAssistantExecutionToolsStreamRunner.d.ts +63 -0
- package/umd/src/llm-providers/openai/OpenAiAssistantExecutionToolsToolRunner.d.ts +89 -0
- package/umd/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +9 -28
- package/umd/src/llm-providers/openai/OpenAiCompatibleModelCatalog.d.ts +31 -0
- package/umd/src/llm-providers/openai/OpenAiCompatibleNonChatPromptCaller.d.ts +57 -0
- package/umd/src/llm-providers/openai/OpenAiCompatibleRequestManager.d.ts +29 -0
- package/umd/src/llm-providers/openai/OpenAiVectorStoreFileBatchHandler.d.ts +51 -0
- package/umd/src/llm-providers/openai/OpenAiVectorStoreFileBatchPoller.d.ts +75 -0
- package/umd/src/llm-providers/openai/OpenAiVectorStoreHandler.d.ts +1 -98
- package/umd/src/llm-providers/openai/OpenAiVectorStoreKnowledgeSourcePreparer.d.ts +44 -0
- package/umd/src/llm-providers/openai/utils/OpenAiCompatibleChatProgressReporter.d.ts +86 -0
- package/umd/src/llm-providers/openai/utils/OpenAiCompatibleChatPromptBuilder.d.ts +57 -0
- package/umd/src/llm-providers/openai/utils/OpenAiCompatibleChatToolCaller.d.ts +57 -0
- package/umd/src/remote-server/startRemoteServer/RemoteServerRuntime.d.ts +14 -0
- package/umd/src/remote-server/startRemoteServer/SocketResponse.d.ts +9 -0
- package/umd/src/remote-server/startRemoteServer/StartRemoteServerConfiguration.d.ts +18 -0
- package/umd/src/remote-server/startRemoteServer/createRemoteServerExpressApp.d.ts +7 -0
- package/umd/src/remote-server/startRemoteServer/createRemoteServerHandle.d.ts +11 -0
- package/umd/src/remote-server/startRemoteServer/createSocketServer.d.ts +9 -0
- package/umd/src/remote-server/startRemoteServer/getExecutionToolsFromIdentification.d.ts +12 -0
- package/umd/src/remote-server/startRemoteServer/registerBookRoutes.d.ts +7 -0
- package/umd/src/remote-server/startRemoteServer/registerExecutionRoutes.d.ts +7 -0
- package/umd/src/remote-server/startRemoteServer/registerListModelsSocketHandler.d.ts +8 -0
- package/umd/src/remote-server/startRemoteServer/registerLoginRoute.d.ts +7 -0
- package/umd/src/remote-server/startRemoteServer/registerNotFoundRoute.d.ts +7 -0
- package/umd/src/remote-server/startRemoteServer/registerOpenAiCompatibleChatCompletionsRoute.d.ts +7 -0
- package/umd/src/remote-server/startRemoteServer/registerOpenApiRoutes.d.ts +7 -0
- package/umd/src/remote-server/startRemoteServer/registerPreparePipelineSocketHandler.d.ts +8 -0
- package/umd/src/remote-server/startRemoteServer/registerPromptSocketHandler.d.ts +8 -0
- package/umd/src/remote-server/startRemoteServer/registerRemoteServerHttpRoutes.d.ts +7 -0
- package/umd/src/remote-server/startRemoteServer/registerRemoteServerSocketHandlers.d.ts +8 -0
- package/umd/src/remote-server/startRemoteServer/registerServerIndexRoute.d.ts +7 -0
- package/umd/src/remote-server/startRemoteServer/resolveStartRemoteServerConfiguration.d.ts +8 -0
- package/umd/src/remote-server/startRemoteServer/respondToSocketRequest.d.ts +8 -0
- package/umd/src/remote-server/startRemoteServer/startListening.d.ts +9 -0
- package/umd/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +14 -1
- package/umd/src/utils/serialization/serializeToPromptbookJavascript.d.ts +2 -0
- package/umd/src/utils/serialization/serializeToPromptbookJavascript.test.d.ts +1 -0
- package/umd/src/version.d.ts +1 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { CallChatModelStreamOptions } from '../../execution/LlmExecutionTools';
|
|
2
|
+
import type { ChatPromptResult, CommonPromptResult } from '../../execution/PromptResult';
|
|
3
|
+
import type { Prompt } from '../../types/Prompt';
|
|
4
|
+
import type { string_model_name } from '../../types/string_model_name';
|
|
5
|
+
import type { string_title } from '../../types/string_title';
|
|
6
|
+
import { OpenAiAssistantExecutionTools } from '../openai/OpenAiAssistantExecutionTools';
|
|
7
|
+
import type { AgentLlmExecutionToolsPromptPreparer } from './AgentLlmExecutionToolsPromptPreparer';
|
|
8
|
+
/**
|
|
9
|
+
* Handles deprecated OpenAI Assistant-backed executions for `AgentLlmExecutionTools`.
|
|
10
|
+
*
|
|
11
|
+
* @private internal utility of `AgentLlmExecutionTools`
|
|
12
|
+
*/
|
|
13
|
+
export declare class AgentLlmExecutionToolsOpenAiAssistantRunner {
|
|
14
|
+
private readonly context;
|
|
15
|
+
/**
|
|
16
|
+
* Cache of OpenAI assistants to avoid creating duplicates.
|
|
17
|
+
*/
|
|
18
|
+
private static assistantCache;
|
|
19
|
+
constructor(context: {
|
|
20
|
+
readonly getTitle: () => string_title;
|
|
21
|
+
readonly getModelName: () => string_model_name;
|
|
22
|
+
readonly isVerbose?: boolean;
|
|
23
|
+
readonly assistantPreparationMode?: 'internal' | 'external';
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Runs one prepared prompt through the deprecated OpenAI Assistant backend.
|
|
27
|
+
*/
|
|
28
|
+
callChatModelStream(options: {
|
|
29
|
+
readonly llmTools: OpenAiAssistantExecutionTools;
|
|
30
|
+
readonly originalPrompt: Prompt;
|
|
31
|
+
readonly preparedChatPrompt: Awaited<ReturnType<AgentLlmExecutionToolsPromptPreparer['prepareChatPrompt']>>;
|
|
32
|
+
readonly onProgress: (chunk: ChatPromptResult) => void;
|
|
33
|
+
readonly streamOptions?: CallChatModelStreamOptions;
|
|
34
|
+
}): Promise<CommonPromptResult>;
|
|
35
|
+
/**
|
|
36
|
+
* Returns an assistant instance matching the current agent requirements, reusing caches when possible.
|
|
37
|
+
*/
|
|
38
|
+
private getOrPrepareOpenAiAssistant;
|
|
39
|
+
/**
|
|
40
|
+
* Stores one assistant id in the shared assistant cache for this agent title.
|
|
41
|
+
*/
|
|
42
|
+
private storeAssistantCache;
|
|
43
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
|
+
import type { ChatPrompt, Prompt } from '../../types/Prompt';
|
|
3
|
+
import type { string_title } from '../../types/string_title';
|
|
4
|
+
/**
|
|
5
|
+
* Agent model requirements stripped of prompt-only bookkeeping before forwarding to runtime tools.
|
|
6
|
+
*/
|
|
7
|
+
type SanitizedAgentModelRequirements = Omit<AgentModelRequirements, '_metadata' | 'promptSuffix'>;
|
|
8
|
+
/**
|
|
9
|
+
* Resolves runtime prompts into the fully enriched prompt shape forwarded by `AgentLlmExecutionTools`.
|
|
10
|
+
*
|
|
11
|
+
* @private internal utility of `AgentLlmExecutionTools`
|
|
12
|
+
*/
|
|
13
|
+
export declare class AgentLlmExecutionToolsPromptPreparer {
|
|
14
|
+
private readonly context;
|
|
15
|
+
constructor(context: {
|
|
16
|
+
readonly getModelRequirements: () => Promise<AgentModelRequirements>;
|
|
17
|
+
readonly getTitle: () => string_title;
|
|
18
|
+
readonly isVerbose?: boolean;
|
|
19
|
+
readonly hasPrecomputedModelRequirements: () => boolean;
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* Resolves agent requirements, attachments, and runtime overrides into one forwarded chat prompt.
|
|
23
|
+
*/
|
|
24
|
+
prepareChatPrompt(prompt: Prompt): Promise<{
|
|
25
|
+
readonly forwardedPrompt: ChatPrompt;
|
|
26
|
+
readonly sanitizedRequirements: SanitizedAgentModelRequirements;
|
|
27
|
+
readonly mergedTools: Array<NonNullable<ChatPrompt['tools']>[number]>;
|
|
28
|
+
readonly knowledgeSourcesForAgent?: Array<string>;
|
|
29
|
+
readonly hasAttachmentSources: boolean;
|
|
30
|
+
readonly hasRuntimePromptTools: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
/**
|
|
33
|
+
* Removes bookkeeping-only properties from compiled agent requirements before forwarding them.
|
|
34
|
+
*/
|
|
35
|
+
private getSanitizedAgentModelRequirements;
|
|
36
|
+
/**
|
|
37
|
+
* Ensures the agent wrapper only processes chat prompts.
|
|
38
|
+
*/
|
|
39
|
+
private requireChatPrompt;
|
|
40
|
+
}
|
|
41
|
+
export {};
|
package/esm/src/llm-providers/agent/emitAgentLlmExecutionToolsAssistantPreparationProgress.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ChatPromptResult } from '../../execution/PromptResult';
|
|
2
|
+
import type { Prompt } from '../../types/Prompt';
|
|
3
|
+
import type { string_model_name } from '../../types/string_model_name';
|
|
4
|
+
/**
|
|
5
|
+
* Emits a progress update to signal assistant preparation before long setup work.
|
|
6
|
+
*
|
|
7
|
+
* @private internal utility of `AgentLlmExecutionTools`
|
|
8
|
+
*/
|
|
9
|
+
export declare function emitAgentLlmExecutionToolsAssistantPreparationProgress(options: {
|
|
10
|
+
/**
|
|
11
|
+
* Callback to send progress updates to the caller.
|
|
12
|
+
*/
|
|
13
|
+
readonly onProgress: (chunk: ChatPromptResult) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Original prompt being executed.
|
|
16
|
+
*/
|
|
17
|
+
readonly prompt: Prompt;
|
|
18
|
+
/**
|
|
19
|
+
* Model name used for the update payload.
|
|
20
|
+
*/
|
|
21
|
+
readonly modelName: string_model_name;
|
|
22
|
+
/**
|
|
23
|
+
* Optional detail describing the current preparation phase.
|
|
24
|
+
*/
|
|
25
|
+
readonly phase?: string;
|
|
26
|
+
}): void;
|
|
@@ -1,60 +1,13 @@
|
|
|
1
1
|
import { Agent as AgentFromKit } from '@openai/agents';
|
|
2
|
-
import OpenAI from 'openai';
|
|
3
2
|
import type { CallChatModelStreamOptions, LlmExecutionTools } from '../../execution/LlmExecutionTools';
|
|
4
3
|
import type { ChatPromptResult } from '../../execution/PromptResult';
|
|
5
4
|
import type { ModelRequirements } from '../../types/ModelRequirements';
|
|
6
5
|
import type { Prompt } from '../../types/Prompt';
|
|
7
6
|
import type { string_markdown, string_markdown_text } from '../../types/string_markdown';
|
|
8
7
|
import type { string_title } from '../../types/string_title';
|
|
9
|
-
import type { TODO_any } from '../../utils/organization/TODO_any';
|
|
10
8
|
import type { OpenAiAgentKitExecutionToolsOptions } from './OpenAiAgentKitExecutionToolsOptions';
|
|
9
|
+
import { OpenAiAgentKitExecutionToolsOutputTypeMapper } from './OpenAiAgentKitExecutionToolsOutputTypeMapper';
|
|
11
10
|
import { OpenAiVectorStoreHandler } from './OpenAiVectorStoreHandler';
|
|
12
|
-
/**
|
|
13
|
-
* Represents the AgentKit output configuration used to match OpenAI `response_format` expectations.
|
|
14
|
-
*
|
|
15
|
-
* @private utility of Open AI
|
|
16
|
-
*/
|
|
17
|
-
export type AgentOutputType = 'text' | JsonSchemaDefinition;
|
|
18
|
-
/**
|
|
19
|
-
* Type describing Json schema definition entry.
|
|
20
|
-
*/
|
|
21
|
-
type JsonSchemaDefinitionEntry = {
|
|
22
|
-
type?: string;
|
|
23
|
-
description?: string;
|
|
24
|
-
properties?: Record<string, JsonSchemaDefinitionEntry>;
|
|
25
|
-
required?: Array<string>;
|
|
26
|
-
items?: JsonSchemaDefinitionEntry;
|
|
27
|
-
[key: string]: TODO_any;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Definition of Json schema.
|
|
31
|
-
*/
|
|
32
|
-
type JsonSchemaDefinition = {
|
|
33
|
-
type: 'json_schema';
|
|
34
|
-
name: string;
|
|
35
|
-
strict: boolean;
|
|
36
|
-
schema: {
|
|
37
|
-
type: 'object';
|
|
38
|
-
properties: Record<string, JsonSchemaDefinitionEntry>;
|
|
39
|
-
required: Array<string>;
|
|
40
|
-
additionalProperties: boolean;
|
|
41
|
-
description?: string;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Type describing open Ai chat response format.
|
|
46
|
-
*/
|
|
47
|
-
type OpenAiChatResponseFormat = OpenAI.Chat.Completions.ChatCompletionCreateParamsNonStreaming['response_format'];
|
|
48
|
-
/**
|
|
49
|
-
* Maps OpenAI `response_format` payloads to AgentKit output types so the runner can forward
|
|
50
|
-
* structured-output preferences to OpenAI while still reusing the same AgentKit agent instance.
|
|
51
|
-
*
|
|
52
|
-
* @param responseFormat - The OpenAI `response_format` payload from the user request.
|
|
53
|
-
* @returns An Agent output type compatible with the requested schema or `undefined` when no impact is required.
|
|
54
|
-
*
|
|
55
|
-
* @private utility of Open AI
|
|
56
|
-
*/
|
|
57
|
-
export declare function mapResponseFormatToAgentOutputType(responseFormat?: OpenAiChatResponseFormat): AgentOutputType | undefined;
|
|
58
11
|
/**
|
|
59
12
|
* Alias for OpenAI AgentKit agent to avoid naming confusion with Promptbook agents.
|
|
60
13
|
*/
|
|
@@ -66,6 +19,10 @@ type OpenAiAgentKitPreparedAgent = {
|
|
|
66
19
|
readonly agent: OpenAiAgentKitAgent;
|
|
67
20
|
readonly vectorStoreId?: string;
|
|
68
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* AgentKit output type returned by the dedicated response-format mapper.
|
|
24
|
+
*/
|
|
25
|
+
type OpenAiAgentKitAgentOutputType = ReturnType<typeof OpenAiAgentKitExecutionToolsOutputTypeMapper.mapResponseFormatToAgentOutputType>;
|
|
69
26
|
/**
|
|
70
27
|
* Execution tools for OpenAI AgentKit (Agents SDK).
|
|
71
28
|
*
|
|
@@ -73,9 +30,9 @@ type OpenAiAgentKitPreparedAgent = {
|
|
|
73
30
|
*/
|
|
74
31
|
export declare class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler implements LlmExecutionTools {
|
|
75
32
|
private preparedAgentKitAgent;
|
|
76
|
-
private readonly agentKitToolResultsByCallId;
|
|
77
|
-
private readonly agentKitToolSnapshotsByCallId;
|
|
78
33
|
private readonly agentKitModelName;
|
|
34
|
+
private readonly inputBuilder;
|
|
35
|
+
private readonly toolBuilder;
|
|
79
36
|
/**
|
|
80
37
|
* Creates OpenAI AgentKit execution tools.
|
|
81
38
|
*/
|
|
@@ -113,18 +70,6 @@ export declare class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandl
|
|
|
113
70
|
readonly vectorStoreId?: string;
|
|
114
71
|
readonly storeAsPrepared?: boolean;
|
|
115
72
|
}): Promise<OpenAiAgentKitPreparedAgent>;
|
|
116
|
-
/**
|
|
117
|
-
* Ensures the AgentKit SDK is wired to the OpenAI client and API key.
|
|
118
|
-
*/
|
|
119
|
-
private ensureAgentKitDefaults;
|
|
120
|
-
/**
|
|
121
|
-
* Builds the tool list for AgentKit, including hosted file search when applicable.
|
|
122
|
-
*/
|
|
123
|
-
private buildAgentKitTools;
|
|
124
|
-
/**
|
|
125
|
-
* Resolves the configured script tools for tool execution.
|
|
126
|
-
*/
|
|
127
|
-
private resolveScriptTools;
|
|
128
73
|
/**
|
|
129
74
|
* Runs a prepared AgentKit agent and streams results back to the caller.
|
|
130
75
|
*/
|
|
@@ -135,50 +80,28 @@ export declare class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandl
|
|
|
135
80
|
readonly onProgress: (chunk: ChatPromptResult & {
|
|
136
81
|
isFinished?: boolean;
|
|
137
82
|
}) => void;
|
|
138
|
-
readonly responseFormatOutputType?:
|
|
83
|
+
readonly responseFormatOutputType?: OpenAiAgentKitAgentOutputType;
|
|
139
84
|
/**
|
|
140
85
|
* Optional abort signal propagated from chat surfaces so stream generation can be cancelled.
|
|
141
86
|
*/
|
|
142
87
|
readonly signal?: AbortSignal;
|
|
143
88
|
}): Promise<ChatPromptResult>;
|
|
144
89
|
/**
|
|
145
|
-
*
|
|
146
|
-
*/
|
|
147
|
-
private buildAgentKitInputItems;
|
|
148
|
-
/**
|
|
149
|
-
* Builds the user message content for AgentKit runs, including file inputs when provided.
|
|
150
|
-
*/
|
|
151
|
-
private buildAgentKitUserContent;
|
|
152
|
-
/**
|
|
153
|
-
* Converts uploaded `File` objects into AgentKit `input_image` entries.
|
|
154
|
-
*/
|
|
155
|
-
private createAgentKitInputImageItemsFromFiles;
|
|
156
|
-
/**
|
|
157
|
-
* Converts image chat attachments into AgentKit `input_image` entries.
|
|
158
|
-
*
|
|
159
|
-
* Note: This keeps images in the same completion request as multimodal input.
|
|
160
|
-
*/
|
|
161
|
-
private createAgentKitInputImageItemsFromAttachments;
|
|
162
|
-
/**
|
|
163
|
-
* Builds AgentKit user content that can include text, uploaded files, and image attachments.
|
|
164
|
-
*/
|
|
165
|
-
private buildAgentKitUserContentWithAttachments;
|
|
166
|
-
/**
|
|
167
|
-
* Normalizes AgentKit tool outputs into a string for Promptbook tool call results.
|
|
168
|
-
*/
|
|
169
|
-
private formatAgentKitToolOutput;
|
|
170
|
-
/**
|
|
171
|
-
* Resolves the assistant-visible AgentKit tool response while preserving structured tool result data.
|
|
90
|
+
* Ensures the AgentKit SDK is wired to the OpenAI client and API key.
|
|
172
91
|
*/
|
|
173
|
-
private
|
|
92
|
+
private ensureAgentKitDefaults;
|
|
174
93
|
/**
|
|
175
|
-
*
|
|
94
|
+
* Builds the tool list for AgentKit while keeping the public facade small.
|
|
176
95
|
*/
|
|
177
|
-
private
|
|
96
|
+
private buildAgentKitTools;
|
|
178
97
|
/**
|
|
179
98
|
* Returns AgentKit-specific options.
|
|
180
99
|
*/
|
|
181
100
|
private get agentKitOptions();
|
|
101
|
+
/**
|
|
102
|
+
* Formats raw prompt content with the AgentKit model injected.
|
|
103
|
+
*/
|
|
104
|
+
private templatePromptContent;
|
|
182
105
|
/**
|
|
183
106
|
* Discriminant for type guards.
|
|
184
107
|
*/
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Prompt } from '../../types/Prompt';
|
|
2
|
+
import type { TODO_any } from '../../utils/organization/TODO_any';
|
|
3
|
+
/**
|
|
4
|
+
* Builds AgentKit input items, including multimodal attachments.
|
|
5
|
+
*
|
|
6
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
7
|
+
*/
|
|
8
|
+
export declare class OpenAiAgentKitExecutionToolsInputBuilder {
|
|
9
|
+
/**
|
|
10
|
+
* Builds AgentKit input items from the prompt and optional thread.
|
|
11
|
+
*/
|
|
12
|
+
buildAgentKitInputItems(prompt: Prompt, rawPromptContent: string): Promise<Array<TODO_any>>;
|
|
13
|
+
/**
|
|
14
|
+
* Builds the user message content for AgentKit runs, including file inputs when provided.
|
|
15
|
+
*/
|
|
16
|
+
private buildAgentKitUserContent;
|
|
17
|
+
/**
|
|
18
|
+
* Converts uploaded `File` objects into AgentKit `input_image` entries.
|
|
19
|
+
*/
|
|
20
|
+
private createAgentKitInputImageItemsFromFiles;
|
|
21
|
+
/**
|
|
22
|
+
* Converts image chat attachments into AgentKit `input_image` entries.
|
|
23
|
+
*/
|
|
24
|
+
private createAgentKitInputImageItemsFromAttachments;
|
|
25
|
+
/**
|
|
26
|
+
* Builds AgentKit user content that can include text, uploaded files, and image attachments.
|
|
27
|
+
*/
|
|
28
|
+
private buildAgentKitUserContentWithAttachments;
|
|
29
|
+
/**
|
|
30
|
+
* Checks whether one chat attachment can be sent as an image input.
|
|
31
|
+
*/
|
|
32
|
+
private isImageAttachment;
|
|
33
|
+
/**
|
|
34
|
+
* Returns one lowercase extension extracted from a filename/pathname.
|
|
35
|
+
*/
|
|
36
|
+
private getLowercaseFilenameExtension;
|
|
37
|
+
/**
|
|
38
|
+
* Tries to extract one extension from URL pathname.
|
|
39
|
+
*/
|
|
40
|
+
private getUrlPathnameExtension;
|
|
41
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type OpenAI from 'openai';
|
|
2
|
+
import type { TODO_any } from '../../utils/organization/TODO_any';
|
|
3
|
+
/**
|
|
4
|
+
* Type describing Json schema definition entry.
|
|
5
|
+
*/
|
|
6
|
+
type JsonSchemaDefinitionEntry = {
|
|
7
|
+
type?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
properties?: Record<string, JsonSchemaDefinitionEntry>;
|
|
10
|
+
required?: Array<string>;
|
|
11
|
+
items?: JsonSchemaDefinitionEntry;
|
|
12
|
+
[key: string]: TODO_any;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Definition of Json schema.
|
|
16
|
+
*/
|
|
17
|
+
type JsonSchemaDefinition = {
|
|
18
|
+
type: 'json_schema';
|
|
19
|
+
name: string;
|
|
20
|
+
strict: boolean;
|
|
21
|
+
schema: {
|
|
22
|
+
type: 'object';
|
|
23
|
+
properties: Record<string, JsonSchemaDefinitionEntry>;
|
|
24
|
+
required: Array<string>;
|
|
25
|
+
additionalProperties: boolean;
|
|
26
|
+
description?: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Type describing open Ai chat response format.
|
|
31
|
+
*/
|
|
32
|
+
type OpenAiChatResponseFormat = OpenAI.Chat.Completions.ChatCompletionCreateParamsNonStreaming['response_format'];
|
|
33
|
+
/**
|
|
34
|
+
* Maps OpenAI `response_format` payloads to AgentKit output types.
|
|
35
|
+
*
|
|
36
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
37
|
+
*/
|
|
38
|
+
export declare class OpenAiAgentKitExecutionToolsOutputTypeMapper {
|
|
39
|
+
/**
|
|
40
|
+
* Maps one OpenAI `response_format` payload to the AgentKit output type shape.
|
|
41
|
+
*/
|
|
42
|
+
static mapResponseFormatToAgentOutputType(responseFormat?: OpenAiChatResponseFormat): 'text' | JsonSchemaDefinition | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Determines whether a schema fragment includes meaningful constraints.
|
|
45
|
+
*/
|
|
46
|
+
private static hasJsonSchemaContent;
|
|
47
|
+
/**
|
|
48
|
+
* Normalizes inline OpenAI JSON schema payloads to the AgentKit structure.
|
|
49
|
+
*/
|
|
50
|
+
private static normalizeJsonSchemaInput;
|
|
51
|
+
/**
|
|
52
|
+
* Builds an AgentKit-compatible JSON schema definition from the supplied payload.
|
|
53
|
+
*/
|
|
54
|
+
private static buildJsonSchemaDefinition;
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { Tool as AgentKitTool } from '@openai/agents';
|
|
2
|
+
import type { ToolCallProgressUpdate } from '../../commitments/_common/toolRuntimeContext';
|
|
3
|
+
import type { ModelRequirements } from '../../types/ModelRequirements';
|
|
4
|
+
import type { ToolCall, ToolCallLogEntry, ToolCallState } from '../../types/ToolCall';
|
|
5
|
+
import type { OpenAiAgentKitExecutionToolsOptions } from './OpenAiAgentKitExecutionToolsOptions';
|
|
6
|
+
/**
|
|
7
|
+
* Builds AgentKit tools and tracks their execution state.
|
|
8
|
+
*
|
|
9
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
10
|
+
*/
|
|
11
|
+
export declare class OpenAiAgentKitExecutionToolsToolBuilder {
|
|
12
|
+
private readonly context;
|
|
13
|
+
private readonly agentKitToolResultsByCallId;
|
|
14
|
+
private readonly agentKitToolSnapshotsByCallId;
|
|
15
|
+
constructor(context: {
|
|
16
|
+
readonly options: OpenAiAgentKitExecutionToolsOptions;
|
|
17
|
+
readonly agentKitModelName: string;
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* Clears per-run tool state before a new AgentKit stream starts.
|
|
21
|
+
*/
|
|
22
|
+
clearRunState(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Stores one latest tool-call snapshot keyed by AgentKit call id.
|
|
25
|
+
*/
|
|
26
|
+
storeToolSnapshot(callId: string | undefined, toolCall: ToolCall): void;
|
|
27
|
+
/**
|
|
28
|
+
* Returns one latest tool-call snapshot keyed by AgentKit call id.
|
|
29
|
+
*/
|
|
30
|
+
getToolSnapshot(callId: string | undefined): ToolCall | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Deletes one latest tool-call snapshot keyed by AgentKit call id.
|
|
33
|
+
*/
|
|
34
|
+
deleteToolSnapshot(callId: string | undefined): void;
|
|
35
|
+
/**
|
|
36
|
+
* Builds the tool list for AgentKit, including hosted file search when applicable.
|
|
37
|
+
*/
|
|
38
|
+
buildAgentKitTools(options: {
|
|
39
|
+
readonly tools?: ModelRequirements['tools'];
|
|
40
|
+
readonly vectorStoreId?: string;
|
|
41
|
+
}): Array<AgentKitTool>;
|
|
42
|
+
/**
|
|
43
|
+
* Resolves the stored Promptbook tool result for one AgentKit tool call.
|
|
44
|
+
*/
|
|
45
|
+
resolveAgentKitToolOutputResult(callId: string | undefined, output: unknown): ToolCall['result'];
|
|
46
|
+
/**
|
|
47
|
+
* Creates one structured log entry for streamed tool-call updates.
|
|
48
|
+
*/
|
|
49
|
+
static createToolCallLogEntry(options: {
|
|
50
|
+
readonly kind: string;
|
|
51
|
+
readonly title: string;
|
|
52
|
+
readonly message: string;
|
|
53
|
+
readonly level?: ToolCallLogEntry['level'];
|
|
54
|
+
readonly payload?: unknown;
|
|
55
|
+
}): ToolCallLogEntry;
|
|
56
|
+
/**
|
|
57
|
+
* Appends one incremental progress update to the currently tracked tool-call snapshot.
|
|
58
|
+
*/
|
|
59
|
+
static applyToolCallProgressUpdate(toolCall: ToolCall, update: ToolCallProgressUpdate): ToolCall;
|
|
60
|
+
/**
|
|
61
|
+
* Resolves the final lifecycle state for one AgentKit tool call after execution ends.
|
|
62
|
+
*/
|
|
63
|
+
static resolveFinalToolCallState(options: {
|
|
64
|
+
readonly currentState: ToolCallState | undefined;
|
|
65
|
+
readonly errors: ReadonlyArray<unknown> | undefined;
|
|
66
|
+
}): ToolCallState;
|
|
67
|
+
/**
|
|
68
|
+
* Returns true when one tool definition represents the dedicated DeepSearch capability.
|
|
69
|
+
*/
|
|
70
|
+
private isDeepSearchToolDefinition;
|
|
71
|
+
/**
|
|
72
|
+
* Normalizes Promptbook JSON-schema tool parameters for AgentKit function tools.
|
|
73
|
+
*/
|
|
74
|
+
private normalizeAgentKitToolParameters;
|
|
75
|
+
/**
|
|
76
|
+
* Creates the native Agent SDK tool used for `USE DEEPSEARCH`.
|
|
77
|
+
*/
|
|
78
|
+
private createDeepSearchAgentKitTool;
|
|
79
|
+
/**
|
|
80
|
+
* Creates instructions for the nested DeepSearch specialist agent.
|
|
81
|
+
*/
|
|
82
|
+
private createDeepSearchAgentInstructions;
|
|
83
|
+
/**
|
|
84
|
+
* Builds the nested DeepSearch prompt from structured tool arguments.
|
|
85
|
+
*/
|
|
86
|
+
private buildDeepSearchToolInput;
|
|
87
|
+
/**
|
|
88
|
+
* Resolves the configured script tools for tool execution.
|
|
89
|
+
*/
|
|
90
|
+
private resolveScriptTools;
|
|
91
|
+
/**
|
|
92
|
+
* Resolves the assistant-visible AgentKit tool response while preserving structured tool result data.
|
|
93
|
+
*/
|
|
94
|
+
private resolveAgentKitToolResponse;
|
|
95
|
+
/**
|
|
96
|
+
* Normalizes AgentKit tool outputs into a string for Promptbook tool call results.
|
|
97
|
+
*/
|
|
98
|
+
private formatAgentKitToolOutput;
|
|
99
|
+
}
|
|
@@ -26,6 +26,10 @@ import { OpenAiVectorStoreHandler } from './OpenAiVectorStoreHandler';
|
|
|
26
26
|
export declare class OpenAiAssistantExecutionTools extends OpenAiVectorStoreHandler implements LlmExecutionTools {
|
|
27
27
|
readonly assistantId: string_token;
|
|
28
28
|
private readonly isCreatingNewAssistantsAllowed;
|
|
29
|
+
private readonly promptBuilder;
|
|
30
|
+
private readonly progressReporter;
|
|
31
|
+
private readonly toolRunner;
|
|
32
|
+
private readonly streamRunner;
|
|
29
33
|
/**
|
|
30
34
|
* Creates OpenAI Execution Tools.
|
|
31
35
|
*
|
|
@@ -42,10 +46,6 @@ export declare class OpenAiAssistantExecutionTools extends OpenAiVectorStoreHand
|
|
|
42
46
|
* Calls OpenAI API to use a chat model with streaming.
|
|
43
47
|
*/
|
|
44
48
|
callChatModelStream(prompt: Prompt, onProgress: (chunk: ChatPromptResult) => void, options?: CallChatModelStreamOptions): Promise<ChatPromptResult>;
|
|
45
|
-
/**
|
|
46
|
-
* Logs one assistant chat call when verbose output is enabled.
|
|
47
|
-
*/
|
|
48
|
-
private logAssistantChatCall;
|
|
49
49
|
/**
|
|
50
50
|
* Validates the subset of model requirements supported by OpenAI Assistants.
|
|
51
51
|
*/
|
|
@@ -54,122 +54,6 @@ export declare class OpenAiAssistantExecutionTools extends OpenAiVectorStoreHand
|
|
|
54
54
|
* Returns true when the prompt exposes callable tools that require the Runs API flow.
|
|
55
55
|
*/
|
|
56
56
|
private hasAssistantTools;
|
|
57
|
-
/**
|
|
58
|
-
* Resolves the raw user-visible prompt content sent to the assistant.
|
|
59
|
-
*/
|
|
60
|
-
private createAssistantRawPromptContent;
|
|
61
|
-
/**
|
|
62
|
-
* Builds the thread history plus the current user message for one assistant call.
|
|
63
|
-
*/
|
|
64
|
-
private createAssistantThreadMessages;
|
|
65
|
-
/**
|
|
66
|
-
* Converts the existing prompt thread into OpenAI assistant thread messages.
|
|
67
|
-
*/
|
|
68
|
-
private createAssistantThreadHistoryMessages;
|
|
69
|
-
/**
|
|
70
|
-
* Creates the current user message, including uploaded file attachments when present.
|
|
71
|
-
*/
|
|
72
|
-
private createAssistantCurrentUserMessage;
|
|
73
|
-
/**
|
|
74
|
-
* Runs assistant calls with tools through the non-streaming Runs API.
|
|
75
|
-
*/
|
|
76
|
-
private callChatModelStreamWithTools;
|
|
77
|
-
/**
|
|
78
|
-
* Builds the non-streaming assistant request payload used when tool calls are enabled.
|
|
79
|
-
*/
|
|
80
|
-
private createAssistantToolRunRequest;
|
|
81
|
-
/**
|
|
82
|
-
* Starts the assistant run and keeps polling until the run completes or fails.
|
|
83
|
-
*/
|
|
84
|
-
private executeAssistantToolRun;
|
|
85
|
-
/**
|
|
86
|
-
* Polls one assistant run, executing and submitting tool outputs when OpenAI requests them.
|
|
87
|
-
*/
|
|
88
|
-
private waitForAssistantToolRun;
|
|
89
|
-
/**
|
|
90
|
-
* Executes all required assistant tool calls and submits their outputs back to OpenAI.
|
|
91
|
-
*/
|
|
92
|
-
private submitAssistantRequiredToolOutputs;
|
|
93
|
-
/**
|
|
94
|
-
* Waits a bit and then fetches the latest assistant run status.
|
|
95
|
-
*/
|
|
96
|
-
private retrieveAssistantRunAfterDelay;
|
|
97
|
-
/**
|
|
98
|
-
* Executes each function tool requested by the assistant and records progress snapshots.
|
|
99
|
-
*/
|
|
100
|
-
private executeAssistantRequiredToolCalls;
|
|
101
|
-
/**
|
|
102
|
-
* Executes one function tool requested by the assistant.
|
|
103
|
-
*/
|
|
104
|
-
private executeAssistantRequiredToolCall;
|
|
105
|
-
/**
|
|
106
|
-
* Creates the initial pending snapshot for one assistant tool call.
|
|
107
|
-
*/
|
|
108
|
-
private createPendingAssistantToolCall;
|
|
109
|
-
/**
|
|
110
|
-
* Resolves the configured script tools for assistant tool execution.
|
|
111
|
-
*/
|
|
112
|
-
private resolveAssistantScriptTools;
|
|
113
|
-
/**
|
|
114
|
-
* Executes the configured script tool for one assistant-requested function call.
|
|
115
|
-
*/
|
|
116
|
-
private executeAssistantFunctionTool;
|
|
117
|
-
/**
|
|
118
|
-
* Finalizes one assistant tool-call snapshot after execution ends.
|
|
119
|
-
*/
|
|
120
|
-
private createCompletedAssistantToolCall;
|
|
121
|
-
/**
|
|
122
|
-
* Extracts the latest assistant text response from a completed thread.
|
|
123
|
-
*/
|
|
124
|
-
private extractCompletedAssistantTextContent;
|
|
125
|
-
/**
|
|
126
|
-
* Runs assistant calls without tools through the streaming Assistants API.
|
|
127
|
-
*/
|
|
128
|
-
private callChatModelStreamWithoutTools;
|
|
129
|
-
/**
|
|
130
|
-
* Builds the streaming assistant request payload used when no tool execution flow is needed.
|
|
131
|
-
*/
|
|
132
|
-
private createAssistantStreamingRequest;
|
|
133
|
-
/**
|
|
134
|
-
* Registers verbose stream diagnostics plus incremental text progress forwarding.
|
|
135
|
-
*/
|
|
136
|
-
private attachAssistantStreamListeners;
|
|
137
|
-
/**
|
|
138
|
-
* Resolves the final visible assistant text from a streaming response.
|
|
139
|
-
*/
|
|
140
|
-
private resolveAssistantStreamingResultContent;
|
|
141
|
-
/**
|
|
142
|
-
* Extracts the single text content block returned by the assistant stream.
|
|
143
|
-
*/
|
|
144
|
-
private extractSingleAssistantTextContentBlock;
|
|
145
|
-
/**
|
|
146
|
-
* Rewrites file citation markers to use retrieved filenames instead of generic source labels.
|
|
147
|
-
*/
|
|
148
|
-
private replaceAssistantFileCitationMarkers;
|
|
149
|
-
/**
|
|
150
|
-
* Returns one citation filename, caching OpenAI file lookups across annotations.
|
|
151
|
-
*/
|
|
152
|
-
private retrieveAssistantCitationFilename;
|
|
153
|
-
/**
|
|
154
|
-
* Emits one assistant progress chunk with shared timing and prompt metadata.
|
|
155
|
-
*/
|
|
156
|
-
private emitAssistantProgress;
|
|
157
|
-
/**
|
|
158
|
-
* Creates the final assistant prompt result with uncertain usage plus measured duration.
|
|
159
|
-
*/
|
|
160
|
-
private createAssistantPromptResult;
|
|
161
|
-
/**
|
|
162
|
-
* Computes the usage payload for assistant responses.
|
|
163
|
-
*/
|
|
164
|
-
private createAssistantUsage;
|
|
165
|
-
/**
|
|
166
|
-
* Wraps the final assistant prompt result in the standard exported JSON envelope.
|
|
167
|
-
*/
|
|
168
|
-
private exportAssistantPromptResult;
|
|
169
|
-
/**
|
|
170
|
-
* Logs one assistant request payload when verbose output is enabled.
|
|
171
|
-
*/
|
|
172
|
-
private logVerboseAssistantRequest;
|
|
173
57
|
/**
|
|
174
58
|
* Get an existing assistant tool wrapper
|
|
175
59
|
*/
|
|
@@ -214,6 +98,26 @@ export declare class OpenAiAssistantExecutionTools extends OpenAiVectorStoreHand
|
|
|
214
98
|
*/
|
|
215
99
|
readonly tools?: ModelRequirements['tools'];
|
|
216
100
|
}): Promise<OpenAiAssistantExecutionTools>;
|
|
101
|
+
/**
|
|
102
|
+
* Ensures assistant creation/update helpers stay disabled unless explicitly enabled.
|
|
103
|
+
*/
|
|
104
|
+
private assertAssistantMutationsAllowed;
|
|
105
|
+
/**
|
|
106
|
+
* Prepares the optional vector store backing assistant file search.
|
|
107
|
+
*/
|
|
108
|
+
private prepareAssistantVectorStore;
|
|
109
|
+
/**
|
|
110
|
+
* Builds the assistant tool definition list shared by create and update flows.
|
|
111
|
+
*/
|
|
112
|
+
private createAssistantToolDefinitions;
|
|
113
|
+
/**
|
|
114
|
+
* Creates a new tools wrapper bound to one assistant id.
|
|
115
|
+
*/
|
|
116
|
+
private createAssistantWrapper;
|
|
117
|
+
/**
|
|
118
|
+
* Returns assistant-specific options with direct OpenAI execution helpers attached.
|
|
119
|
+
*/
|
|
120
|
+
private get assistantOptions();
|
|
217
121
|
/**
|
|
218
122
|
* Discriminant for type guards
|
|
219
123
|
*/
|