@promptbook/google 0.112.0-39 → 0.112.0-41
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/README.md +23 -21
- package/esm/index.es.js +1 -1
- package/esm/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.d.ts +8 -2
- package/esm/src/book-components/Chat/Chat/ChatInputArea.d.ts +0 -10
- package/esm/src/book-components/Chat/Chat/ChatInputUploadedFile.d.ts +10 -0
- package/esm/src/book-components/Chat/Chat/ChatToolCallModalContent.d.ts +46 -0
- package/esm/src/book-components/Chat/Chat/resolveRunBrowserToolCallDetailsState.d.ts +146 -0
- package/esm/src/book-components/Chat/Chat/useChatInputAreaAttachments.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/useChatInputAreaComposer.d.ts +39 -0
- package/esm/src/book-components/Chat/Chat/useChatPostprocessedMessages.d.ts +17 -0
- package/esm/src/book-components/Chat/Chat/useChatScrollState.d.ts +34 -0
- package/esm/src/book-components/Chat/Chat/useChatToolCallModalState.d.ts +61 -0
- package/esm/src/book-components/Chat/Chat/useChatToolCallState.d.ts +35 -0
- package/esm/src/book-components/Chat/LlmChat/useLlmChatMessageHandler.d.ts +58 -0
- package/esm/src/book-components/Chat/LlmChat/useLlmChatMessages.d.ts +29 -0
- package/esm/src/book-components/Chat/LlmChat/useLlmChatState.d.ts +53 -0
- package/esm/src/collection/pipeline-collection/constructors/createPipelineCollectionFromDirectory.d.ts +7 -1
- package/esm/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +52 -0
- package/esm/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +128 -0
- package/esm/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +3 -3
- package/esm/src/llm-providers/openai/OpenAiVectorStoreHandler.d.ts +54 -0
- package/esm/src/llm-providers/openai/utils/OpenAiCompatibleUnsupportedParameterRetrier.d.ts +29 -0
- package/esm/src/llm-providers/openai/utils/callOpenAiCompatibleChatModel.d.ts +28 -0
- package/esm/src/types/number_usd.d.ts +1 -1
- package/esm/src/types/string_parameter_name.d.ts +2 -2
- package/esm/src/types/typeAliases.d.ts +2 -2
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +1 -1
- package/umd/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.d.ts +8 -2
- package/umd/src/book-components/Chat/Chat/ChatInputArea.d.ts +0 -10
- package/umd/src/book-components/Chat/Chat/ChatInputUploadedFile.d.ts +10 -0
- package/umd/src/book-components/Chat/Chat/ChatToolCallModalContent.d.ts +46 -0
- package/umd/src/book-components/Chat/Chat/resolveRunBrowserToolCallDetailsState.d.ts +146 -0
- package/umd/src/book-components/Chat/Chat/useChatInputAreaAttachments.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/useChatInputAreaComposer.d.ts +39 -0
- package/umd/src/book-components/Chat/Chat/useChatPostprocessedMessages.d.ts +17 -0
- package/umd/src/book-components/Chat/Chat/useChatScrollState.d.ts +34 -0
- package/umd/src/book-components/Chat/Chat/useChatToolCallModalState.d.ts +61 -0
- package/umd/src/book-components/Chat/Chat/useChatToolCallState.d.ts +35 -0
- package/umd/src/book-components/Chat/LlmChat/useLlmChatMessageHandler.d.ts +58 -0
- package/umd/src/book-components/Chat/LlmChat/useLlmChatMessages.d.ts +29 -0
- package/umd/src/book-components/Chat/LlmChat/useLlmChatState.d.ts +53 -0
- package/umd/src/collection/pipeline-collection/constructors/createPipelineCollectionFromDirectory.d.ts +7 -1
- package/umd/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +52 -0
- package/umd/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +128 -0
- package/umd/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +3 -3
- package/umd/src/llm-providers/openai/OpenAiVectorStoreHandler.d.ts +54 -0
- package/umd/src/llm-providers/openai/utils/OpenAiCompatibleUnsupportedParameterRetrier.d.ts +29 -0
- package/umd/src/llm-providers/openai/utils/callOpenAiCompatibleChatModel.d.ts +28 -0
- package/umd/src/types/number_usd.d.ts +1 -1
- package/umd/src/types/string_parameter_name.d.ts +2 -2
- package/umd/src/types/typeAliases.d.ts +2 -2
- package/umd/src/version.d.ts +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ChatMessage } from '../types/ChatMessage';
|
|
2
|
+
import type { ChatParticipant } from '../types/ChatParticipant';
|
|
3
|
+
import type { LlmChatProps } from './LlmChatProps';
|
|
4
|
+
/**
|
|
5
|
+
* Metadata for a teammate agent tool.
|
|
6
|
+
*
|
|
7
|
+
* @private function of `useLlmChatState`
|
|
8
|
+
*/
|
|
9
|
+
type TeammateMetadata = {
|
|
10
|
+
readonly url: string;
|
|
11
|
+
readonly label?: string;
|
|
12
|
+
readonly instructions?: string;
|
|
13
|
+
readonly toolName: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Lookup map of teammate metadata by tool name.
|
|
17
|
+
*
|
|
18
|
+
* @private function of `useLlmChatState`
|
|
19
|
+
*/
|
|
20
|
+
type TeammatesMap = Record<string, TeammateMetadata>;
|
|
21
|
+
/**
|
|
22
|
+
* Minimal task-progress item rendered by `<Chat/>`.
|
|
23
|
+
*
|
|
24
|
+
* @private function of `useLlmChatState`
|
|
25
|
+
*/
|
|
26
|
+
type LlmChatTaskProgress = {
|
|
27
|
+
readonly id: string;
|
|
28
|
+
readonly name: string;
|
|
29
|
+
readonly progress?: number;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* State returned by `useLlmChatState`.
|
|
33
|
+
*
|
|
34
|
+
* @private function of `useLlmChatState`
|
|
35
|
+
*/
|
|
36
|
+
type UseLlmChatStateResult = {
|
|
37
|
+
readonly handleMessage: (messageContent: string, attachments?: ChatMessage['attachments']) => Promise<void>;
|
|
38
|
+
readonly handleReset: () => Promise<void>;
|
|
39
|
+
readonly handleStopStreaming: () => void;
|
|
40
|
+
readonly isStreaming: boolean;
|
|
41
|
+
readonly isVoiceCalling: boolean;
|
|
42
|
+
readonly messages: Array<ChatMessage>;
|
|
43
|
+
readonly participants: ReadonlyArray<ChatParticipant>;
|
|
44
|
+
readonly tasksProgress: Array<LlmChatTaskProgress>;
|
|
45
|
+
readonly teammates: TeammatesMap | undefined;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Coordinates derived state and handlers consumed by `<LlmChat/>`.
|
|
49
|
+
*
|
|
50
|
+
* @private function of `<LlmChat/>`
|
|
51
|
+
*/
|
|
52
|
+
export declare function useLlmChatState(props: LlmChatProps): UseLlmChatStateResult;
|
|
53
|
+
export {};
|
|
@@ -43,6 +43,12 @@ type CreatePipelineCollectionFromDirectoryOptions = Omit<PrepareAndScrapeOptions
|
|
|
43
43
|
*/
|
|
44
44
|
isCrashedOnError?: boolean;
|
|
45
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Tools used by `createPipelineCollectionFromDirectory`.
|
|
48
|
+
*
|
|
49
|
+
* @private internal function of `createPipelineCollectionFromDirectory`
|
|
50
|
+
*/
|
|
51
|
+
type CreatePipelineCollectionFromDirectoryTools = Pick<ExecutionTools, 'llm' | 'fs' | 'scrapers'>;
|
|
46
52
|
/**
|
|
47
53
|
* Constructs `PipelineCollection` from given directory
|
|
48
54
|
*
|
|
@@ -55,5 +61,5 @@ type CreatePipelineCollectionFromDirectoryOptions = Omit<PrepareAndScrapeOptions
|
|
|
55
61
|
*
|
|
56
62
|
* @public exported from `@promptbook/node`
|
|
57
63
|
*/
|
|
58
|
-
export declare function createPipelineCollectionFromDirectory(rootPath: string_dirname, tools?:
|
|
64
|
+
export declare function createPipelineCollectionFromDirectory(rootPath: string_dirname, tools?: CreatePipelineCollectionFromDirectoryTools, options?: CreatePipelineCollectionFromDirectoryOptions): Promise<PipelineCollection>;
|
|
59
65
|
export {};
|
|
@@ -84,4 +84,56 @@ export declare class AgentLlmExecutionTools implements LlmExecutionTools {
|
|
|
84
84
|
* Calls the chat model with agent-specific system prompt and requirements with streaming
|
|
85
85
|
*/
|
|
86
86
|
callChatModelStream(prompt: Prompt, onProgress: (chunk: ChatPromptResult) => void, options?: CallChatModelStreamOptions): Promise<ChatPromptResult>;
|
|
87
|
+
/**
|
|
88
|
+
* Ensures the agent wrapper only processes chat prompts.
|
|
89
|
+
*/
|
|
90
|
+
private requireChatPrompt;
|
|
91
|
+
/**
|
|
92
|
+
* Resolves agent requirements, attachments, and runtime overrides into one forwarded chat prompt.
|
|
93
|
+
*/
|
|
94
|
+
private prepareChatPrompt;
|
|
95
|
+
/**
|
|
96
|
+
* Removes bookkeeping-only properties from compiled agent requirements before forwarding them.
|
|
97
|
+
*/
|
|
98
|
+
private getSanitizedAgentModelRequirements;
|
|
99
|
+
/**
|
|
100
|
+
* Dispatches one prepared agent prompt to the correct underlying LLM backend.
|
|
101
|
+
*/
|
|
102
|
+
private callPreparedChatModelStream;
|
|
103
|
+
/**
|
|
104
|
+
* Runs one prepared prompt through the OpenAI AgentKit backend.
|
|
105
|
+
*/
|
|
106
|
+
private callOpenAiAgentKitChatModelStream;
|
|
107
|
+
/**
|
|
108
|
+
* Resolves the AgentKit cache state for the current prompt, including external and in-memory caches.
|
|
109
|
+
*/
|
|
110
|
+
private resolveAgentKitCacheState;
|
|
111
|
+
/**
|
|
112
|
+
* Returns a prepared AgentKit agent, creating one only when the cache could not satisfy the request.
|
|
113
|
+
*/
|
|
114
|
+
private getOrPrepareAgentKitAgent;
|
|
115
|
+
/**
|
|
116
|
+
* Stores freshly prepared AgentKit resources back into the in-memory caches when caching is allowed.
|
|
117
|
+
*/
|
|
118
|
+
private storeAgentKitCache;
|
|
119
|
+
/**
|
|
120
|
+
* Runs one prepared prompt through the deprecated OpenAI Assistant backend.
|
|
121
|
+
*/
|
|
122
|
+
private callOpenAiAssistantChatModelStream;
|
|
123
|
+
/**
|
|
124
|
+
* Returns an assistant instance matching the current agent requirements, reusing caches when possible.
|
|
125
|
+
*/
|
|
126
|
+
private getOrPrepareOpenAiAssistant;
|
|
127
|
+
/**
|
|
128
|
+
* Stores one assistant id in the shared assistant cache for this agent title.
|
|
129
|
+
*/
|
|
130
|
+
private storeAssistantCache;
|
|
131
|
+
/**
|
|
132
|
+
* Runs one prepared prompt through generic LLM tools that do not need special assistant preparation.
|
|
133
|
+
*/
|
|
134
|
+
private callGenericChatModelStream;
|
|
135
|
+
/**
|
|
136
|
+
* Applies the final agent-level content normalization to the underlying LLM result.
|
|
137
|
+
*/
|
|
138
|
+
private finalizeAgentResult;
|
|
87
139
|
}
|
|
@@ -40,6 +40,134 @@ export declare class OpenAiAssistantExecutionTools extends OpenAiVectorStoreHand
|
|
|
40
40
|
* Calls OpenAI API to use a chat model with streaming.
|
|
41
41
|
*/
|
|
42
42
|
callChatModelStream(prompt: Prompt, onProgress: (chunk: ChatPromptResult) => void, options?: CallChatModelStreamOptions): Promise<ChatPromptResult>;
|
|
43
|
+
/**
|
|
44
|
+
* Logs one assistant chat call when verbose output is enabled.
|
|
45
|
+
*/
|
|
46
|
+
private logAssistantChatCall;
|
|
47
|
+
/**
|
|
48
|
+
* Validates the subset of model requirements supported by OpenAI Assistants.
|
|
49
|
+
*/
|
|
50
|
+
private assertSupportedAssistantModelRequirements;
|
|
51
|
+
/**
|
|
52
|
+
* Returns true when the prompt exposes callable tools that require the Runs API flow.
|
|
53
|
+
*/
|
|
54
|
+
private hasAssistantTools;
|
|
55
|
+
/**
|
|
56
|
+
* Resolves the raw user-visible prompt content sent to the assistant.
|
|
57
|
+
*/
|
|
58
|
+
private createAssistantRawPromptContent;
|
|
59
|
+
/**
|
|
60
|
+
* Builds the thread history plus the current user message for one assistant call.
|
|
61
|
+
*/
|
|
62
|
+
private createAssistantThreadMessages;
|
|
63
|
+
/**
|
|
64
|
+
* Converts the existing prompt thread into OpenAI assistant thread messages.
|
|
65
|
+
*/
|
|
66
|
+
private createAssistantThreadHistoryMessages;
|
|
67
|
+
/**
|
|
68
|
+
* Creates the current user message, including uploaded file attachments when present.
|
|
69
|
+
*/
|
|
70
|
+
private createAssistantCurrentUserMessage;
|
|
71
|
+
/**
|
|
72
|
+
* Runs assistant calls with tools through the non-streaming Runs API.
|
|
73
|
+
*/
|
|
74
|
+
private callChatModelStreamWithTools;
|
|
75
|
+
/**
|
|
76
|
+
* Builds the non-streaming assistant request payload used when tool calls are enabled.
|
|
77
|
+
*/
|
|
78
|
+
private createAssistantToolRunRequest;
|
|
79
|
+
/**
|
|
80
|
+
* Starts the assistant run and keeps polling until the run completes or fails.
|
|
81
|
+
*/
|
|
82
|
+
private executeAssistantToolRun;
|
|
83
|
+
/**
|
|
84
|
+
* Polls one assistant run, executing and submitting tool outputs when OpenAI requests them.
|
|
85
|
+
*/
|
|
86
|
+
private waitForAssistantToolRun;
|
|
87
|
+
/**
|
|
88
|
+
* Executes all required assistant tool calls and submits their outputs back to OpenAI.
|
|
89
|
+
*/
|
|
90
|
+
private submitAssistantRequiredToolOutputs;
|
|
91
|
+
/**
|
|
92
|
+
* Waits a bit and then fetches the latest assistant run status.
|
|
93
|
+
*/
|
|
94
|
+
private retrieveAssistantRunAfterDelay;
|
|
95
|
+
/**
|
|
96
|
+
* Executes each function tool requested by the assistant and records progress snapshots.
|
|
97
|
+
*/
|
|
98
|
+
private executeAssistantRequiredToolCalls;
|
|
99
|
+
/**
|
|
100
|
+
* Executes one function tool requested by the assistant.
|
|
101
|
+
*/
|
|
102
|
+
private executeAssistantRequiredToolCall;
|
|
103
|
+
/**
|
|
104
|
+
* Creates the initial pending snapshot for one assistant tool call.
|
|
105
|
+
*/
|
|
106
|
+
private createPendingAssistantToolCall;
|
|
107
|
+
/**
|
|
108
|
+
* Resolves the configured script tools for assistant tool execution.
|
|
109
|
+
*/
|
|
110
|
+
private resolveAssistantScriptTools;
|
|
111
|
+
/**
|
|
112
|
+
* Executes the configured script tool for one assistant-requested function call.
|
|
113
|
+
*/
|
|
114
|
+
private executeAssistantFunctionTool;
|
|
115
|
+
/**
|
|
116
|
+
* Finalizes one assistant tool-call snapshot after execution ends.
|
|
117
|
+
*/
|
|
118
|
+
private createCompletedAssistantToolCall;
|
|
119
|
+
/**
|
|
120
|
+
* Extracts the latest assistant text response from a completed thread.
|
|
121
|
+
*/
|
|
122
|
+
private extractCompletedAssistantTextContent;
|
|
123
|
+
/**
|
|
124
|
+
* Runs assistant calls without tools through the streaming Assistants API.
|
|
125
|
+
*/
|
|
126
|
+
private callChatModelStreamWithoutTools;
|
|
127
|
+
/**
|
|
128
|
+
* Builds the streaming assistant request payload used when no tool execution flow is needed.
|
|
129
|
+
*/
|
|
130
|
+
private createAssistantStreamingRequest;
|
|
131
|
+
/**
|
|
132
|
+
* Registers verbose stream diagnostics plus incremental text progress forwarding.
|
|
133
|
+
*/
|
|
134
|
+
private attachAssistantStreamListeners;
|
|
135
|
+
/**
|
|
136
|
+
* Resolves the final visible assistant text from a streaming response.
|
|
137
|
+
*/
|
|
138
|
+
private resolveAssistantStreamingResultContent;
|
|
139
|
+
/**
|
|
140
|
+
* Extracts the single text content block returned by the assistant stream.
|
|
141
|
+
*/
|
|
142
|
+
private extractSingleAssistantTextContentBlock;
|
|
143
|
+
/**
|
|
144
|
+
* Rewrites file citation markers to use retrieved filenames instead of generic source labels.
|
|
145
|
+
*/
|
|
146
|
+
private replaceAssistantFileCitationMarkers;
|
|
147
|
+
/**
|
|
148
|
+
* Returns one citation filename, caching OpenAI file lookups across annotations.
|
|
149
|
+
*/
|
|
150
|
+
private retrieveAssistantCitationFilename;
|
|
151
|
+
/**
|
|
152
|
+
* Emits one assistant progress chunk with shared timing and prompt metadata.
|
|
153
|
+
*/
|
|
154
|
+
private emitAssistantProgress;
|
|
155
|
+
/**
|
|
156
|
+
* Creates the final assistant prompt result with uncertain usage plus measured duration.
|
|
157
|
+
*/
|
|
158
|
+
private createAssistantPromptResult;
|
|
159
|
+
/**
|
|
160
|
+
* Computes the usage payload for assistant responses.
|
|
161
|
+
*/
|
|
162
|
+
private createAssistantUsage;
|
|
163
|
+
/**
|
|
164
|
+
* Wraps the final assistant prompt result in the standard exported JSON envelope.
|
|
165
|
+
*/
|
|
166
|
+
private exportAssistantPromptResult;
|
|
167
|
+
/**
|
|
168
|
+
* Logs one assistant request payload when verbose output is enabled.
|
|
169
|
+
*/
|
|
170
|
+
private logVerboseAssistantRequest;
|
|
43
171
|
/**
|
|
44
172
|
* Get an existing assistant tool wrapper
|
|
45
173
|
*/
|
|
@@ -49,11 +49,11 @@ export declare abstract class OpenAiCompatibleExecutionTools implements LlmExecu
|
|
|
49
49
|
/**
|
|
50
50
|
* Calls OpenAI compatible API to use a chat model with streaming.
|
|
51
51
|
*/
|
|
52
|
-
callChatModelStream(prompt: Prompt, onProgress: (chunk: ChatPromptResult) => void,
|
|
52
|
+
callChatModelStream(prompt: Prompt, onProgress: (chunk: ChatPromptResult) => void, _options?: CallChatModelStreamOptions): Promise<ChatPromptResult>;
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* Executes one OpenAI request under the shared rate limiter and network retry policy.
|
|
55
55
|
*/
|
|
56
|
-
private
|
|
56
|
+
private executeRateLimitedRequest;
|
|
57
57
|
/**
|
|
58
58
|
* Calls OpenAI API to use a complete model.
|
|
59
59
|
*/
|
|
@@ -6,6 +6,8 @@ import type { OpenAiCompatibleExecutionToolsOptions } from './OpenAiCompatibleEx
|
|
|
6
6
|
import { OpenAiExecutionTools } from './OpenAiExecutionTools';
|
|
7
7
|
/**
|
|
8
8
|
* Metadata for uploaded knowledge source files used for vector store diagnostics.
|
|
9
|
+
*
|
|
10
|
+
* @private internal utility of `OpenAiVectorStoreHandler`
|
|
9
11
|
*/
|
|
10
12
|
type KnowledgeSourceUploadMetadata = {
|
|
11
13
|
readonly fileId: string;
|
|
@@ -117,6 +119,58 @@ export declare abstract class OpenAiVectorStoreHandler extends OpenAiExecutionTo
|
|
|
117
119
|
readonly totalBytes: number;
|
|
118
120
|
readonly logLabel: string;
|
|
119
121
|
}): Promise<TODO_any | null>;
|
|
122
|
+
/**
|
|
123
|
+
* Uploads the prepared knowledge-source files with bounded concurrency.
|
|
124
|
+
*/
|
|
125
|
+
private uploadPreparedKnowledgeSourceFiles;
|
|
126
|
+
/**
|
|
127
|
+
* Reuses the shared iterator to upload one slice of knowledge-source files.
|
|
128
|
+
*/
|
|
129
|
+
private uploadPreparedKnowledgeSourceFilesWorker;
|
|
130
|
+
/**
|
|
131
|
+
* Uploads one prepared knowledge-source file to OpenAI and records detailed diagnostics.
|
|
132
|
+
*/
|
|
133
|
+
private uploadPreparedKnowledgeSourceFile;
|
|
134
|
+
/**
|
|
135
|
+
* Creates the OpenAI vector-store file batch for the uploaded knowledge-source files.
|
|
136
|
+
*/
|
|
137
|
+
private createVectorStoreFileBatch;
|
|
138
|
+
/**
|
|
139
|
+
* Logs warnings for unexpected vector-store batch metadata right after creation.
|
|
140
|
+
*/
|
|
141
|
+
private logCreatedVectorStoreFileBatchIssues;
|
|
142
|
+
/**
|
|
143
|
+
* Polls the created vector-store batch until ingestion completes, fails, or times out.
|
|
144
|
+
*/
|
|
145
|
+
private pollVectorStoreFileBatchUntilSettled;
|
|
146
|
+
/**
|
|
147
|
+
* Resolves the next batch id to poll and retrieves the freshest OpenAI batch snapshot.
|
|
148
|
+
*/
|
|
149
|
+
private retrieveVectorStoreFileBatchForPolling;
|
|
150
|
+
/**
|
|
151
|
+
* Normalizes the batch identifier returned by OpenAI and logs unusual id situations once.
|
|
152
|
+
*/
|
|
153
|
+
private resolveVectorStoreFileBatchId;
|
|
154
|
+
/**
|
|
155
|
+
* Tracks observed polling progress and emits throttled verbose status logs.
|
|
156
|
+
*/
|
|
157
|
+
private trackVectorStoreFileBatchProgress;
|
|
158
|
+
/**
|
|
159
|
+
* Emits deeper diagnostics when vector-store ingestion appears stalled for too long.
|
|
160
|
+
*/
|
|
161
|
+
private maybeLogStalledVectorStoreFileBatch;
|
|
162
|
+
/**
|
|
163
|
+
* Handles terminal vector-store batch states that do not require further polling.
|
|
164
|
+
*/
|
|
165
|
+
private handleVectorStoreFileBatchTerminalState;
|
|
166
|
+
/**
|
|
167
|
+
* Stops polling once the batch exceeds the configured timeout and handles optional cancellation.
|
|
168
|
+
*/
|
|
169
|
+
private handleVectorStoreFileBatchTimeout;
|
|
170
|
+
/**
|
|
171
|
+
* Attempts to cancel a timed-out vector-store batch and logs any unusual id situation.
|
|
172
|
+
*/
|
|
173
|
+
private cancelVectorStoreFileBatchAfterTimeout;
|
|
120
174
|
/**
|
|
121
175
|
* Creates a vector store and uploads knowledge sources, returning its ID.
|
|
122
176
|
*/
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ModelRequirements } from '../../../types/ModelRequirements';
|
|
2
|
+
import type { string_model_name } from '../../../types/typeAliases';
|
|
3
|
+
/**
|
|
4
|
+
* Tracks unsupported-parameter retries for one OpenAI-compatible model call.
|
|
5
|
+
*
|
|
6
|
+
* @private helper of `OpenAiCompatibleExecutionTools`
|
|
7
|
+
*/
|
|
8
|
+
export declare class OpenAiCompatibleUnsupportedParameterRetrier {
|
|
9
|
+
private readonly isVerbose;
|
|
10
|
+
private readonly attemptStack;
|
|
11
|
+
private readonly retriedUnsupportedParameters;
|
|
12
|
+
constructor(isVerbose: boolean | undefined);
|
|
13
|
+
/**
|
|
14
|
+
* Resolves the next retry attempt after an unsupported-parameter failure or rethrows the final error.
|
|
15
|
+
*/
|
|
16
|
+
resolveRetryOrThrow<TModelRequirements extends ModelRequirements>(options: {
|
|
17
|
+
readonly error: Error;
|
|
18
|
+
readonly modelName: string_model_name;
|
|
19
|
+
readonly currentModelRequirements: TModelRequirements;
|
|
20
|
+
}): TModelRequirements;
|
|
21
|
+
/**
|
|
22
|
+
* Rethrows the original error or wraps it with the collected retry history.
|
|
23
|
+
*/
|
|
24
|
+
private throwWithAttemptHistory;
|
|
25
|
+
/**
|
|
26
|
+
* Creates the retry-history error message shared by all OpenAI-compatible model variants.
|
|
27
|
+
*/
|
|
28
|
+
private createAttemptHistoryError;
|
|
29
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import OpenAI from 'openai';
|
|
2
|
+
import type { AvailableModel } from '../../../execution/AvailableModel';
|
|
3
|
+
import type { ChatPromptResult } from '../../../execution/PromptResult';
|
|
4
|
+
import type { Usage } from '../../../execution/Usage';
|
|
5
|
+
import type { Prompt } from '../../../types/Prompt';
|
|
6
|
+
import type { string_markdown_text, string_title } from '../../../types/typeAliases';
|
|
7
|
+
import type { computeOpenAiUsage } from '../computeOpenAiUsage';
|
|
8
|
+
import type { OpenAiCompatibleExecutionToolsNonProxiedOptions } from '../OpenAiCompatibleExecutionToolsOptions';
|
|
9
|
+
/**
|
|
10
|
+
* Type describing dependencies needed by `callOpenAiCompatibleChatModel`.
|
|
11
|
+
*/
|
|
12
|
+
type CallOpenAiCompatibleChatModelOptions = {
|
|
13
|
+
readonly prompt: Prompt;
|
|
14
|
+
readonly onProgress: (chunk: ChatPromptResult) => void;
|
|
15
|
+
readonly title: string_title & string_markdown_text;
|
|
16
|
+
readonly executionToolsOptions: OpenAiCompatibleExecutionToolsNonProxiedOptions;
|
|
17
|
+
readonly getClient: () => Promise<OpenAI>;
|
|
18
|
+
readonly executeRateLimitedRequest: <T>(requestFn: () => Promise<T>) => Promise<T>;
|
|
19
|
+
readonly computeUsage: (...args: Parameters<typeof computeOpenAiUsage>) => Usage;
|
|
20
|
+
readonly getDefaultChatModel: () => AvailableModel;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Calls the OpenAI-compatible chat model flow, including tool execution and unsupported-parameter retries.
|
|
24
|
+
*
|
|
25
|
+
* @private function of `OpenAiCompatibleExecutionTools`
|
|
26
|
+
*/
|
|
27
|
+
export declare function callOpenAiCompatibleChatModel(options: CallOpenAiCompatibleChatModelOptions): Promise<ChatPromptResult>;
|
|
28
|
+
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Semantic helper for US Dollars
|
|
3
3
|
*/
|
|
4
4
|
export type number_usd = number;
|
|
5
|
-
export type { number_bytes, number_gigabytes, number_kilobytes, number_megabytes, number_terabytes } from './number_bytes';
|
|
5
|
+
export type { number_bytes, number_gigabytes, number_kilobytes, number_megabytes, number_terabytes, } from './number_bytes';
|
|
6
6
|
export type { number_id, number_linecol_number, number_tokens } from './number_id';
|
|
7
7
|
export type { number_likeness } from './number_likeness';
|
|
8
8
|
export type { number_days, number_hours, number_milliseconds, number_minutes, number_months, number_seconds, number_weeks, number_years, } from './number_milliseconds';
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* The concrete type declarations live in focused modules under `src/types`.
|
|
5
5
|
*/
|
|
6
6
|
export type { InputParameters, Parameters, ReservedParameters } from './Parameters';
|
|
7
|
-
export type { string_agent_hash, string_agent_name, string_agent_name_in_book, string_agent_permanent_id } from './string_agent_name';
|
|
7
|
+
export type { string_agent_hash, string_agent_name, string_agent_name_in_book, string_agent_permanent_id, } from './string_agent_name';
|
|
8
8
|
export type { string_business_category_name } from './string_business_category_name';
|
|
9
9
|
export type { string_model_name } from './string_model_name';
|
|
10
|
-
export type { string_name, string_parameter_name, string_parameter_value, string_reserved_parameter_name } from './string_name';
|
|
10
|
+
export type { string_name, string_parameter_name, string_parameter_value, string_reserved_parameter_name, } from './string_name';
|
|
11
11
|
export type { string_page, string_char } from './string_page';
|
|
12
12
|
export type { string_chat_prompt, string_completion_prompt, string_prompt, string_prompt_image, string_system_message, string_template, string_text_prompt, } from './string_prompt';
|
|
13
13
|
export type { string_persona_description, string_model_description } from './string_persona_description';
|
|
@@ -6,10 +6,10 @@ export type { string_base64, string_base_url, string_data_url, string_domain, st
|
|
|
6
6
|
export type { string_knowledge_source_content, string_knowledge_source_link } from './string_knowledge_source_content';
|
|
7
7
|
export type { string_attribute, string_attribute_value_scope, string_color, string_javascript_name, string_legal_entity, string_license, string_person_firstname, string_person_fullname, string_person_lastname, string_person_profile, string_postprocessing_function_name, string_translate_language, string_translate_name, string_translate_name_not_normalized, } from './string_person_fullname';
|
|
8
8
|
export type { id, string_app_id, string_date_iso8601, string_language, string_license_token, string_password, string_pgp_key, string_promptbook_token, string_ssh_key, string_token, string_user_id, task_id, } from './string_token';
|
|
9
|
-
export type { number_id, number_linecol_number, number_tokens
|
|
9
|
+
export type { number_id, number_linecol_number, number_tokens } from './number_id';
|
|
10
10
|
export type { number_integer, number_negative, number_port, number_positive } from './number_positive';
|
|
11
11
|
export type { number_model_temperature, number_percent, number_seed } from './number_percent';
|
|
12
12
|
export type { number_likeness } from './number_likeness';
|
|
13
13
|
export type { number_weeks, number_days, number_hours, number_milliseconds, number_minutes, number_months, number_seconds, number_years, } from './number_milliseconds';
|
|
14
|
-
export type { number_bytes, number_gigabytes, number_kilobytes, number_megabytes, number_terabytes } from './number_bytes';
|
|
14
|
+
export type { number_bytes, number_gigabytes, number_kilobytes, number_megabytes, number_terabytes, } from './number_bytes';
|
|
15
15
|
export type { number_usd } from './number_usd';
|
package/esm/src/version.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.112.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.112.0-40`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/google",
|
|
3
|
-
"version": "0.112.0-
|
|
3
|
+
"version": "0.112.0-41",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"module": "./esm/index.es.js",
|
|
99
99
|
"typings": "./esm/typings/src/_packages/google.index.d.ts",
|
|
100
100
|
"peerDependencies": {
|
|
101
|
-
"@promptbook/core": "0.112.0-
|
|
101
|
+
"@promptbook/core": "0.112.0-41"
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
104
|
"@ai-sdk/google": "1.0.17",
|
package/umd/index.umd.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* @generated
|
|
23
23
|
* @see https://github.com/webgptorg/promptbook
|
|
24
24
|
*/
|
|
25
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
25
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-41';
|
|
26
26
|
/**
|
|
27
27
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
28
28
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -3,8 +3,14 @@ import type { AgentModelRequirements } from './AgentModelRequirements';
|
|
|
3
3
|
import type { CreateAgentModelRequirementsOptions } from './CreateAgentModelRequirementsOptions';
|
|
4
4
|
import type { string_book } from './string_book';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Creates agent model requirements by parsing commitments, applying them in source order,
|
|
7
|
+
* and finalizing derived sections such as imports, example interactions, and inline knowledge uploads.
|
|
7
8
|
*
|
|
8
|
-
* @
|
|
9
|
+
* @param agentSource - Agent source book to parse.
|
|
10
|
+
* @param modelName - Optional override for the agent model name.
|
|
11
|
+
* @param options - Additional options such as reference and teammate resolvers.
|
|
12
|
+
* @returns Fully prepared model requirements for the parsed agent source.
|
|
13
|
+
*
|
|
14
|
+
* @private internal utility of `createAgentModelRequirements`
|
|
9
15
|
*/
|
|
10
16
|
export declare function createAgentModelRequirementsWithCommitments(agentSource: string_book, modelName?: string_model_name, options?: CreateAgentModelRequirementsOptions): Promise<AgentModelRequirements>;
|
|
@@ -10,16 +10,6 @@ import type { ChatProps, ChatSoundSystem } from './ChatProps';
|
|
|
10
10
|
* @private component of `<Chat/>`
|
|
11
11
|
*/
|
|
12
12
|
export type ChatInputButtonClickHandler = (handler?: (event: MouseEvent<HTMLButtonElement>) => void) => (event: MouseEvent<HTMLButtonElement>) => void;
|
|
13
|
-
/**
|
|
14
|
-
* Internal representation of an uploaded file in the chat input.
|
|
15
|
-
*
|
|
16
|
-
* @private component of `<Chat/>`
|
|
17
|
-
*/
|
|
18
|
-
export type ChatInputUploadedFile = {
|
|
19
|
-
id: string;
|
|
20
|
-
file: File;
|
|
21
|
-
content: string;
|
|
22
|
-
};
|
|
23
13
|
/**
|
|
24
14
|
* Props for the chat input area.
|
|
25
15
|
*
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import { Color } from '../../../utils/color/Color';
|
|
3
|
+
import type { WithTake } from '../../../utils/take/interfaces/ITakeChain';
|
|
4
|
+
import type { ChatMessage } from '../types/ChatMessage';
|
|
5
|
+
import type { ChatParticipant } from '../types/ChatParticipant';
|
|
6
|
+
import { type TeamToolCallSummary, type TransitiveToolCall } from '../utils/collectTeamToolCallSummary';
|
|
7
|
+
import type { AgentProfileData } from '../utils/loadAgentProfile';
|
|
8
|
+
import type { TeamToolResult } from '../utils/toolCallParsing';
|
|
9
|
+
import type { ChatUiTranslations } from './ChatProps';
|
|
10
|
+
/**
|
|
11
|
+
* Tool-call snapshot rendered by the modal body.
|
|
12
|
+
*
|
|
13
|
+
* @private function of `ChatToolCallModalContent`
|
|
14
|
+
*/
|
|
15
|
+
type ToolCallModalToolCall = NonNullable<ChatMessage['toolCalls']>[number];
|
|
16
|
+
/**
|
|
17
|
+
* Props consumed by `<ChatToolCallModalContent/>`.
|
|
18
|
+
*
|
|
19
|
+
* @private function of `ChatToolCallModalContent`
|
|
20
|
+
*/
|
|
21
|
+
type ChatToolCallModalContentProps = {
|
|
22
|
+
readonly agentParticipant?: ChatParticipant;
|
|
23
|
+
readonly availableTools?: ChatMessage['availableTools'];
|
|
24
|
+
readonly buttonColor: WithTake<Color>;
|
|
25
|
+
readonly chatUiTranslations?: ChatUiTranslations;
|
|
26
|
+
readonly focusedToolCall: ToolCallModalToolCall;
|
|
27
|
+
readonly isAdvancedView: boolean;
|
|
28
|
+
readonly locale?: string;
|
|
29
|
+
readonly onClearSelectedTeamToolCall: () => void;
|
|
30
|
+
readonly onRequestAdvancedView: () => void;
|
|
31
|
+
readonly onSelectTeamToolCall: (toolCall: TransitiveToolCall) => void;
|
|
32
|
+
readonly selectedTeamToolCall: TransitiveToolCall | null;
|
|
33
|
+
readonly teamProfiles: Record<string, AgentProfileData>;
|
|
34
|
+
readonly teamResult: TeamToolResult | null;
|
|
35
|
+
readonly teamToolCallSummary: TeamToolCallSummary;
|
|
36
|
+
readonly toolCall: ToolCallModalToolCall;
|
|
37
|
+
readonly toolCallDate: Date | null;
|
|
38
|
+
readonly toolTitles?: Record<string, string>;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Renders the simple TEAM view, the simple single-tool view, or the advanced raw-payload view.
|
|
42
|
+
*
|
|
43
|
+
* @private component of `ChatToolCallModal`
|
|
44
|
+
*/
|
|
45
|
+
export declare function ChatToolCallModalContent({ agentParticipant, availableTools, buttonColor, chatUiTranslations, focusedToolCall, isAdvancedView, locale, onClearSelectedTeamToolCall, onRequestAdvancedView, onSelectTeamToolCall, selectedTeamToolCall, teamProfiles, teamResult, teamToolCallSummary, toolCall, toolCallDate, toolTitles, }: ChatToolCallModalContentProps): ReactElement;
|
|
46
|
+
export {};
|