@flutchai/flutch-sdk 0.6.12 → 0.7.0
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 +29 -0
- package/dist/index.cjs +419 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +69 -3
- package/dist/index.d.ts +69 -3
- package/dist/index.js +405 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -8,9 +8,9 @@ import Redis from 'ioredis';
|
|
|
8
8
|
import { Registry } from 'prom-client';
|
|
9
9
|
import { Response, Request as Request$1 } from 'express';
|
|
10
10
|
import { DiscoveryService, MetadataScanner, ModuleRef } from '@nestjs/core';
|
|
11
|
-
import {
|
|
11
|
+
import { BaseMessage, AIMessageChunk, ToolMessage, AIMessage } from '@langchain/core/messages';
|
|
12
12
|
import { Runnable, RunnableConfig } from '@langchain/core/runnables';
|
|
13
|
-
import {
|
|
13
|
+
import { StructuredToolInterface, StructuredTool, DynamicStructuredTool } from '@langchain/core/tools';
|
|
14
14
|
import { BaseChatModel, BaseChatModelCallOptions } from '@langchain/core/language_models/chat_models';
|
|
15
15
|
import { BaseDocumentCompressor } from '@langchain/core/retrievers/document_compressors';
|
|
16
16
|
import { Embeddings } from '@langchain/core/embeddings';
|
|
@@ -1031,6 +1031,63 @@ declare function flutchHeaders(): Record<string, string>;
|
|
|
1031
1031
|
declare function flutchMistralHook(req: Request): Request;
|
|
1032
1032
|
declare function wrapCohereFetcher<T extends (args: any) => any>(inner: T): T;
|
|
1033
1033
|
|
|
1034
|
+
interface ToolSearchEntry {
|
|
1035
|
+
name: string;
|
|
1036
|
+
description: string;
|
|
1037
|
+
params: string[];
|
|
1038
|
+
}
|
|
1039
|
+
interface ToolSearchHit {
|
|
1040
|
+
name: string;
|
|
1041
|
+
description: string;
|
|
1042
|
+
}
|
|
1043
|
+
declare function toolSearchTerms(text: string): string[];
|
|
1044
|
+
declare class ToolSearchCatalog {
|
|
1045
|
+
private readonly entries;
|
|
1046
|
+
private readonly documents;
|
|
1047
|
+
private readonly lengths;
|
|
1048
|
+
private readonly averageLength;
|
|
1049
|
+
private readonly documentFrequency;
|
|
1050
|
+
constructor(tools: Pick<StructuredToolInterface, "name" | "description" | "schema">[]);
|
|
1051
|
+
get size(): number;
|
|
1052
|
+
has(name: string): boolean;
|
|
1053
|
+
search(query: string, limit: number): ToolSearchHit[];
|
|
1054
|
+
summary(maxGroups?: number): string;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
declare const TOOL_SEARCH_NAME = "search_tools";
|
|
1058
|
+
declare function isToolSearchCall(name: string | undefined): boolean;
|
|
1059
|
+
declare function formatToolSearchResult(hits: ToolSearchHit[]): string;
|
|
1060
|
+
declare function parseToolSearchResult(content: unknown): string[];
|
|
1061
|
+
declare function loadedToolNames(messages: BaseMessage[]): string[];
|
|
1062
|
+
|
|
1063
|
+
interface ToolSearchOptions {
|
|
1064
|
+
enabled?: boolean;
|
|
1065
|
+
alwaysLoaded?: string[] | string;
|
|
1066
|
+
maxResults?: number;
|
|
1067
|
+
minTools?: number;
|
|
1068
|
+
}
|
|
1069
|
+
declare const DEFAULT_TOOL_SEARCH_RESULTS = 5;
|
|
1070
|
+
declare const DEFAULT_TOOL_SEARCH_MIN_TOOLS = 15;
|
|
1071
|
+
type ToolSearchMode = "deferred" | "rebind";
|
|
1072
|
+
declare function toolSearchApplies(options: ToolSearchOptions | undefined, toolCount: number): options is ToolSearchOptions;
|
|
1073
|
+
declare function splitTools(tools: StructuredTool[], options: ToolSearchOptions, extraCore?: StructuredTool[]): {
|
|
1074
|
+
core: StructuredTool[];
|
|
1075
|
+
deferred: StructuredTool[];
|
|
1076
|
+
};
|
|
1077
|
+
declare function createToolSearchTool(catalog: ToolSearchCatalog, maxResults?: number): DynamicStructuredTool;
|
|
1078
|
+
type BindOptions = Parameters<BaseChatModel["bindTools"]>[1];
|
|
1079
|
+
declare function bindToolsWithSearch(params: {
|
|
1080
|
+
model: BaseChatModel;
|
|
1081
|
+
core: StructuredTool[];
|
|
1082
|
+
deferred: StructuredTool[];
|
|
1083
|
+
searchTool: StructuredTool;
|
|
1084
|
+
mode: ToolSearchMode;
|
|
1085
|
+
bindOptions?: BindOptions;
|
|
1086
|
+
}): Runnable;
|
|
1087
|
+
|
|
1088
|
+
declare function rewriteToolReferences(body: string): string;
|
|
1089
|
+
declare function withToolReferences(inner: typeof fetch): typeof fetch;
|
|
1090
|
+
|
|
1034
1091
|
interface IAgentToolConfig {
|
|
1035
1092
|
toolName: string;
|
|
1036
1093
|
enabled: boolean;
|
|
@@ -1127,6 +1184,7 @@ interface ModelByIdConfig {
|
|
|
1127
1184
|
customTools?: DynamicStructuredTool[];
|
|
1128
1185
|
mcpServers?: Record<string, any>[];
|
|
1129
1186
|
mcpContext?: Record<string, any>;
|
|
1187
|
+
toolSearch?: ToolSearchOptions;
|
|
1130
1188
|
promptCache?: boolean;
|
|
1131
1189
|
promptCacheTtl?: PromptCacheTtl;
|
|
1132
1190
|
effort?: ReasoningEffort;
|
|
@@ -1193,6 +1251,7 @@ declare class ModelInitializer implements IModelInitializer {
|
|
|
1193
1251
|
private logger;
|
|
1194
1252
|
private modelConfigCache;
|
|
1195
1253
|
private modelInstanceCache;
|
|
1254
|
+
private toolSearchCatalogs;
|
|
1196
1255
|
private static readonly DEFAULT_ENV_MAP;
|
|
1197
1256
|
constructor(configFetcher?: ModelConfigFetcher, logger?: Logger, apiKeyResolver?: ApiKeyResolver);
|
|
1198
1257
|
private resolveApiKey;
|
|
@@ -1207,6 +1266,13 @@ declare class ModelInitializer implements IModelInitializer {
|
|
|
1207
1266
|
private initializeChatModelDirect;
|
|
1208
1267
|
private initializeChatModelByIdInternal;
|
|
1209
1268
|
private bindToolsToModel;
|
|
1269
|
+
searchTools(config: ModelByIdConfig, args: {
|
|
1270
|
+
query?: unknown;
|
|
1271
|
+
limit?: unknown;
|
|
1272
|
+
}, runConfig?: RunnableConfig): Promise<{
|
|
1273
|
+
content: string;
|
|
1274
|
+
success: boolean;
|
|
1275
|
+
}>;
|
|
1210
1276
|
initializeRerankModel(config: ModelByIdConfig): Promise<BaseDocumentCompressor>;
|
|
1211
1277
|
initializeEmbeddingModel(config: ModelByIdConfig): Promise<Embeddings>;
|
|
1212
1278
|
createChatModelById(modelId: string): Promise<ChatModelOrRunnable>;
|
|
@@ -1880,4 +1946,4 @@ declare class MongoTokenStore implements IOAuthTokenStore {
|
|
|
1880
1946
|
private ensureIndex;
|
|
1881
1947
|
}
|
|
1882
1948
|
|
|
1883
|
-
export { type ACLValidationResult, AbstractGraphBuilder, type ApiCallTracerOptions, type ApiKeyResolver, AttachmentType, type AuditEntry, type BaseGraphConfig, type BaseGraphContext, GraphController as BaseGraphServiceController, UniversalGraphModule as BaseGraphServiceModule, type BaseGraphState, BuilderRegistryService, Callback, CallbackACL, CallbackAuditAction, CallbackAuditor, type CallbackContext, CallbackController, type CallbackEntry, type CallbackHandler, type CallbackMetadata, CallbackMetrics, type CallbackPatch, type CallbackPatchHandler, CallbackPatchService, CallbackRateLimiter, type CallbackRecord, CallbackRegistry, type CallbackRequest, type CallbackResult, CallbackStore, CallbackTokenGuard, type CallbackUser, type ChannelState, type ChartType, ChatFeature, type ChatModelCreator, type ChatModelOrRunnable, type ChatModelWithTools, type CitationValue, type CompiledGraphFor, type CustomDocument, DEFAULT_ATTACHMENT_THRESHOLD, DEFAULT_ROUTER_URL, DEFAULT_TRACER_OPTIONS, type DataEnvelope, ENDPOINT_METADATA_KEY, type EmbeddingModelCreator, Endpoint, type EndpointDescriptor, type EndpointHandler, type EndpointMetadata, type EndpointOptions, EndpointRegistry, EventProcessor, type ExecuteToolWithAttachmentsParams, type ExecuteToolWithAttachmentsResult, type ExtendedCallbackContext, type ExtendedCallbackHandler, ExternalGraphBuilder, FileBasedDiscovery, FileTokenStore, FlutchChatBedrockConverse, type FlutchContext, GraphController, GraphEngineFactory, GraphEngineType, GraphManifestSchema, GraphManifestValidator, GraphServiceTokens, GraphTypeUtils, type IAgentToolConfig, type IAgentToolConfiguration, type IAttachment, type IBaseEntity, type IChartDataPoint, type IChartDataset, type IChartValue, type IContentBlock, type IContentChain, type IDeletionInfo, type IGenericGraphType, type IGraphAttachment, type IGraphBuilder, type IGraphCompiler, type IGraphConfigurable, type IGraphEngine, type IGraphLogger, type IGraphManifest, type IGraphMetadata, type IGraphMetadataRegistry, type IGraphRequestPayload, type IGraphResponsePayload, type IGraphRunnableConfig, type IGraphService, type IGraphServiceRegistry, type IGraphSettingsRepository, type IGraphTraceEvent, type IGraphTracer, type IGraphTypeMetadata, type IGraphTypeRegistry, type ILangGraphConfig, type IModelInitializer, type IOAuthTokenStore, type IReasoningChain, type IReasoningStep, type IStoredMessageContent, type ISystemToolCredentials, type IToolCall, type IToolCatalog, type IToolConfigOption, type IToolExecutionContext, type ITracingEvent, type IUsageMetrics, type IUsageRecorder, type IdempotencyConfig, type IdempotencyEntry, IdempotencyManager, IdempotencyStatus, type KnowledgeBaseInfo, type LLMCallRecord, type LLMConfig, type LLModel, LangGraphEngine, type LangchainReasoningBlock, type MappedChannels, McpConverter, type McpRuntimeClient, McpRuntimeHttpClient, type McpTool, McpToolFilter, type Model, type ModelByIdConfig, type ModelByIdWithTypeConfig, type ModelConfig, type ModelConfigFetcher, type ModelConfigWithToken, type ModelConfigWithTokenAndType, type ModelCreators, ModelInitializer, ModelProvider, ModelType, type MongoDBConfig, MongoTokenStore, type OAuthProviderConfig, type OAuthProviderDef, OAuthTokenManager, type OAuthTokenManagerOptions, type OAuthTokens, PROMPT_CACHE_MIN_VERSIONS, type PostgresConfig, type PromptCacheControl, type PromptCacheTtl, type RateLimitConfig, type RateLimitResult, type ReasoningEffort, type RequestContext, type RerankModelCreator, type ResolvedSamplingParams, type RetrieveQueryOptions, type RetrieverConfig, RetrieverSearchType, RetrieverService, type RouterConfig, SAMPLING_PARAM_FREE_THRESHOLDS, type SamplingParams, type SanitizedHistory, type ServiceDiscoveryProvider, SmartCallbackRouter, StaticDiscovery, type StreamAccumulator, StreamChannel, type StrictGraphRunnableConfig, TelegramPatchHandler, type ToolConfig, type ToolExecutionResult, type TraceApiCallResult, type TracingLevel, UIDispatchController, type UIDispatchDto, UIEndpoint, type UIEndpointClassMetadata, type UIEndpointMethodMetadata, UIEndpointsDiscoveryService, UniversalCallbackService, UniversalGraphModule, type UniversalGraphModuleOptions, UniversalGraphService, type VersionResolution, type VersionResolutionOptions, type VersionRoute, VersionedGraphService, type VersioningConfig, VoyageAIRerank, type VoyageAIRerankConfig, WebPatchHandler, WithCallbacks, WithEndpoints, WithUIEndpoints, _internals, bootstrap, buildEffortRequestFields, buildOAuthAuthorizationUrl, buildOpenAIModelConfig, clearAttachmentDataStore, createEndpointDescriptors, createGraphAttachment, createMongoClientAdapter, createStaticMessage, decryptTokens, dispatchAttachments, encryptTokens, executeToolWithAttachments, findCallbackMethod, findEndpointMethod, flutchFetch, flutchHeaders, flutchMistralHook, generateAttachmentSummary, generateModelCacheKey, getAttachmentData, getCallbackMetadata, getEndpointMetadata, getFlutchContext, getOAuthProvider, getOAuthProviderNames, getUIEndpointClassMetadata, getUIEndpointMethodsMetadata, hasCallbacks, hasUIEndpoints, hashToolsConfig, isInternalMode, isReasoningBlock, isReasoningModel, isSendableReasoningBlock, joinTextSteps, loadOAuthProviders, modelAcceptsSamplingParams, modelSupportsPromptCache, normalizeToolConfigs, redactConnectionString, registerFinanceExampleCallback, registerUIEndpointsFromClass, resolveOAuthProviderConfig, resolvePromptCacheControl, resolveRouterURL, resolveSamplingParams, sanitizeMessageReasoning, sanitizeReasoningForBedrock, sanitizeTraceData, storeAttachmentData, toOptionalNumber, traceApiCall, withFlutchContext, wrapCohereFetcher };
|
|
1949
|
+
export { type ACLValidationResult, AbstractGraphBuilder, type ApiCallTracerOptions, type ApiKeyResolver, AttachmentType, type AuditEntry, type BaseGraphConfig, type BaseGraphContext, GraphController as BaseGraphServiceController, UniversalGraphModule as BaseGraphServiceModule, type BaseGraphState, BuilderRegistryService, Callback, CallbackACL, CallbackAuditAction, CallbackAuditor, type CallbackContext, CallbackController, type CallbackEntry, type CallbackHandler, type CallbackMetadata, CallbackMetrics, type CallbackPatch, type CallbackPatchHandler, CallbackPatchService, CallbackRateLimiter, type CallbackRecord, CallbackRegistry, type CallbackRequest, type CallbackResult, CallbackStore, CallbackTokenGuard, type CallbackUser, type ChannelState, type ChartType, ChatFeature, type ChatModelCreator, type ChatModelOrRunnable, type ChatModelWithTools, type CitationValue, type CompiledGraphFor, type CustomDocument, DEFAULT_ATTACHMENT_THRESHOLD, DEFAULT_ROUTER_URL, DEFAULT_TOOL_SEARCH_MIN_TOOLS, DEFAULT_TOOL_SEARCH_RESULTS, DEFAULT_TRACER_OPTIONS, type DataEnvelope, ENDPOINT_METADATA_KEY, type EmbeddingModelCreator, Endpoint, type EndpointDescriptor, type EndpointHandler, type EndpointMetadata, type EndpointOptions, EndpointRegistry, EventProcessor, type ExecuteToolWithAttachmentsParams, type ExecuteToolWithAttachmentsResult, type ExtendedCallbackContext, type ExtendedCallbackHandler, ExternalGraphBuilder, FileBasedDiscovery, FileTokenStore, FlutchChatBedrockConverse, type FlutchContext, GraphController, GraphEngineFactory, GraphEngineType, GraphManifestSchema, GraphManifestValidator, GraphServiceTokens, GraphTypeUtils, type IAgentToolConfig, type IAgentToolConfiguration, type IAttachment, type IBaseEntity, type IChartDataPoint, type IChartDataset, type IChartValue, type IContentBlock, type IContentChain, type IDeletionInfo, type IGenericGraphType, type IGraphAttachment, type IGraphBuilder, type IGraphCompiler, type IGraphConfigurable, type IGraphEngine, type IGraphLogger, type IGraphManifest, type IGraphMetadata, type IGraphMetadataRegistry, type IGraphRequestPayload, type IGraphResponsePayload, type IGraphRunnableConfig, type IGraphService, type IGraphServiceRegistry, type IGraphSettingsRepository, type IGraphTraceEvent, type IGraphTracer, type IGraphTypeMetadata, type IGraphTypeRegistry, type ILangGraphConfig, type IModelInitializer, type IOAuthTokenStore, type IReasoningChain, type IReasoningStep, type IStoredMessageContent, type ISystemToolCredentials, type IToolCall, type IToolCatalog, type IToolConfigOption, type IToolExecutionContext, type ITracingEvent, type IUsageMetrics, type IUsageRecorder, type IdempotencyConfig, type IdempotencyEntry, IdempotencyManager, IdempotencyStatus, type KnowledgeBaseInfo, type LLMCallRecord, type LLMConfig, type LLModel, LangGraphEngine, type LangchainReasoningBlock, type MappedChannels, McpConverter, type McpRuntimeClient, McpRuntimeHttpClient, type McpTool, McpToolFilter, type Model, type ModelByIdConfig, type ModelByIdWithTypeConfig, type ModelConfig, type ModelConfigFetcher, type ModelConfigWithToken, type ModelConfigWithTokenAndType, type ModelCreators, ModelInitializer, ModelProvider, ModelType, type MongoDBConfig, MongoTokenStore, type OAuthProviderConfig, type OAuthProviderDef, OAuthTokenManager, type OAuthTokenManagerOptions, type OAuthTokens, PROMPT_CACHE_MIN_VERSIONS, type PostgresConfig, type PromptCacheControl, type PromptCacheTtl, type RateLimitConfig, type RateLimitResult, type ReasoningEffort, type RequestContext, type RerankModelCreator, type ResolvedSamplingParams, type RetrieveQueryOptions, type RetrieverConfig, RetrieverSearchType, RetrieverService, type RouterConfig, SAMPLING_PARAM_FREE_THRESHOLDS, type SamplingParams, type SanitizedHistory, type ServiceDiscoveryProvider, SmartCallbackRouter, StaticDiscovery, type StreamAccumulator, StreamChannel, type StrictGraphRunnableConfig, TOOL_SEARCH_NAME, TelegramPatchHandler, type ToolConfig, type ToolExecutionResult, ToolSearchCatalog, type ToolSearchEntry, type ToolSearchHit, type ToolSearchMode, type ToolSearchOptions, type TraceApiCallResult, type TracingLevel, UIDispatchController, type UIDispatchDto, UIEndpoint, type UIEndpointClassMetadata, type UIEndpointMethodMetadata, UIEndpointsDiscoveryService, UniversalCallbackService, UniversalGraphModule, type UniversalGraphModuleOptions, UniversalGraphService, type VersionResolution, type VersionResolutionOptions, type VersionRoute, VersionedGraphService, type VersioningConfig, VoyageAIRerank, type VoyageAIRerankConfig, WebPatchHandler, WithCallbacks, WithEndpoints, WithUIEndpoints, _internals, bindToolsWithSearch, bootstrap, buildEffortRequestFields, buildOAuthAuthorizationUrl, buildOpenAIModelConfig, clearAttachmentDataStore, createEndpointDescriptors, createGraphAttachment, createMongoClientAdapter, createStaticMessage, createToolSearchTool, decryptTokens, dispatchAttachments, encryptTokens, executeToolWithAttachments, findCallbackMethod, findEndpointMethod, flutchFetch, flutchHeaders, flutchMistralHook, formatToolSearchResult, generateAttachmentSummary, generateModelCacheKey, getAttachmentData, getCallbackMetadata, getEndpointMetadata, getFlutchContext, getOAuthProvider, getOAuthProviderNames, getUIEndpointClassMetadata, getUIEndpointMethodsMetadata, hasCallbacks, hasUIEndpoints, hashToolsConfig, isInternalMode, isReasoningBlock, isReasoningModel, isSendableReasoningBlock, isToolSearchCall, joinTextSteps, loadOAuthProviders, loadedToolNames, modelAcceptsSamplingParams, modelSupportsPromptCache, normalizeToolConfigs, parseToolSearchResult, redactConnectionString, registerFinanceExampleCallback, registerUIEndpointsFromClass, resolveOAuthProviderConfig, resolvePromptCacheControl, resolveRouterURL, resolveSamplingParams, rewriteToolReferences, sanitizeMessageReasoning, sanitizeReasoningForBedrock, sanitizeTraceData, splitTools, storeAttachmentData, toOptionalNumber, toolSearchApplies, toolSearchTerms, traceApiCall, withFlutchContext, withToolReferences, wrapCohereFetcher };
|
package/dist/index.d.ts
CHANGED
|
@@ -8,9 +8,9 @@ import Redis from 'ioredis';
|
|
|
8
8
|
import { Registry } from 'prom-client';
|
|
9
9
|
import { Response, Request as Request$1 } from 'express';
|
|
10
10
|
import { DiscoveryService, MetadataScanner, ModuleRef } from '@nestjs/core';
|
|
11
|
-
import {
|
|
11
|
+
import { BaseMessage, AIMessageChunk, ToolMessage, AIMessage } from '@langchain/core/messages';
|
|
12
12
|
import { Runnable, RunnableConfig } from '@langchain/core/runnables';
|
|
13
|
-
import {
|
|
13
|
+
import { StructuredToolInterface, StructuredTool, DynamicStructuredTool } from '@langchain/core/tools';
|
|
14
14
|
import { BaseChatModel, BaseChatModelCallOptions } from '@langchain/core/language_models/chat_models';
|
|
15
15
|
import { BaseDocumentCompressor } from '@langchain/core/retrievers/document_compressors';
|
|
16
16
|
import { Embeddings } from '@langchain/core/embeddings';
|
|
@@ -1031,6 +1031,63 @@ declare function flutchHeaders(): Record<string, string>;
|
|
|
1031
1031
|
declare function flutchMistralHook(req: Request): Request;
|
|
1032
1032
|
declare function wrapCohereFetcher<T extends (args: any) => any>(inner: T): T;
|
|
1033
1033
|
|
|
1034
|
+
interface ToolSearchEntry {
|
|
1035
|
+
name: string;
|
|
1036
|
+
description: string;
|
|
1037
|
+
params: string[];
|
|
1038
|
+
}
|
|
1039
|
+
interface ToolSearchHit {
|
|
1040
|
+
name: string;
|
|
1041
|
+
description: string;
|
|
1042
|
+
}
|
|
1043
|
+
declare function toolSearchTerms(text: string): string[];
|
|
1044
|
+
declare class ToolSearchCatalog {
|
|
1045
|
+
private readonly entries;
|
|
1046
|
+
private readonly documents;
|
|
1047
|
+
private readonly lengths;
|
|
1048
|
+
private readonly averageLength;
|
|
1049
|
+
private readonly documentFrequency;
|
|
1050
|
+
constructor(tools: Pick<StructuredToolInterface, "name" | "description" | "schema">[]);
|
|
1051
|
+
get size(): number;
|
|
1052
|
+
has(name: string): boolean;
|
|
1053
|
+
search(query: string, limit: number): ToolSearchHit[];
|
|
1054
|
+
summary(maxGroups?: number): string;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
declare const TOOL_SEARCH_NAME = "search_tools";
|
|
1058
|
+
declare function isToolSearchCall(name: string | undefined): boolean;
|
|
1059
|
+
declare function formatToolSearchResult(hits: ToolSearchHit[]): string;
|
|
1060
|
+
declare function parseToolSearchResult(content: unknown): string[];
|
|
1061
|
+
declare function loadedToolNames(messages: BaseMessage[]): string[];
|
|
1062
|
+
|
|
1063
|
+
interface ToolSearchOptions {
|
|
1064
|
+
enabled?: boolean;
|
|
1065
|
+
alwaysLoaded?: string[] | string;
|
|
1066
|
+
maxResults?: number;
|
|
1067
|
+
minTools?: number;
|
|
1068
|
+
}
|
|
1069
|
+
declare const DEFAULT_TOOL_SEARCH_RESULTS = 5;
|
|
1070
|
+
declare const DEFAULT_TOOL_SEARCH_MIN_TOOLS = 15;
|
|
1071
|
+
type ToolSearchMode = "deferred" | "rebind";
|
|
1072
|
+
declare function toolSearchApplies(options: ToolSearchOptions | undefined, toolCount: number): options is ToolSearchOptions;
|
|
1073
|
+
declare function splitTools(tools: StructuredTool[], options: ToolSearchOptions, extraCore?: StructuredTool[]): {
|
|
1074
|
+
core: StructuredTool[];
|
|
1075
|
+
deferred: StructuredTool[];
|
|
1076
|
+
};
|
|
1077
|
+
declare function createToolSearchTool(catalog: ToolSearchCatalog, maxResults?: number): DynamicStructuredTool;
|
|
1078
|
+
type BindOptions = Parameters<BaseChatModel["bindTools"]>[1];
|
|
1079
|
+
declare function bindToolsWithSearch(params: {
|
|
1080
|
+
model: BaseChatModel;
|
|
1081
|
+
core: StructuredTool[];
|
|
1082
|
+
deferred: StructuredTool[];
|
|
1083
|
+
searchTool: StructuredTool;
|
|
1084
|
+
mode: ToolSearchMode;
|
|
1085
|
+
bindOptions?: BindOptions;
|
|
1086
|
+
}): Runnable;
|
|
1087
|
+
|
|
1088
|
+
declare function rewriteToolReferences(body: string): string;
|
|
1089
|
+
declare function withToolReferences(inner: typeof fetch): typeof fetch;
|
|
1090
|
+
|
|
1034
1091
|
interface IAgentToolConfig {
|
|
1035
1092
|
toolName: string;
|
|
1036
1093
|
enabled: boolean;
|
|
@@ -1127,6 +1184,7 @@ interface ModelByIdConfig {
|
|
|
1127
1184
|
customTools?: DynamicStructuredTool[];
|
|
1128
1185
|
mcpServers?: Record<string, any>[];
|
|
1129
1186
|
mcpContext?: Record<string, any>;
|
|
1187
|
+
toolSearch?: ToolSearchOptions;
|
|
1130
1188
|
promptCache?: boolean;
|
|
1131
1189
|
promptCacheTtl?: PromptCacheTtl;
|
|
1132
1190
|
effort?: ReasoningEffort;
|
|
@@ -1193,6 +1251,7 @@ declare class ModelInitializer implements IModelInitializer {
|
|
|
1193
1251
|
private logger;
|
|
1194
1252
|
private modelConfigCache;
|
|
1195
1253
|
private modelInstanceCache;
|
|
1254
|
+
private toolSearchCatalogs;
|
|
1196
1255
|
private static readonly DEFAULT_ENV_MAP;
|
|
1197
1256
|
constructor(configFetcher?: ModelConfigFetcher, logger?: Logger, apiKeyResolver?: ApiKeyResolver);
|
|
1198
1257
|
private resolveApiKey;
|
|
@@ -1207,6 +1266,13 @@ declare class ModelInitializer implements IModelInitializer {
|
|
|
1207
1266
|
private initializeChatModelDirect;
|
|
1208
1267
|
private initializeChatModelByIdInternal;
|
|
1209
1268
|
private bindToolsToModel;
|
|
1269
|
+
searchTools(config: ModelByIdConfig, args: {
|
|
1270
|
+
query?: unknown;
|
|
1271
|
+
limit?: unknown;
|
|
1272
|
+
}, runConfig?: RunnableConfig): Promise<{
|
|
1273
|
+
content: string;
|
|
1274
|
+
success: boolean;
|
|
1275
|
+
}>;
|
|
1210
1276
|
initializeRerankModel(config: ModelByIdConfig): Promise<BaseDocumentCompressor>;
|
|
1211
1277
|
initializeEmbeddingModel(config: ModelByIdConfig): Promise<Embeddings>;
|
|
1212
1278
|
createChatModelById(modelId: string): Promise<ChatModelOrRunnable>;
|
|
@@ -1880,4 +1946,4 @@ declare class MongoTokenStore implements IOAuthTokenStore {
|
|
|
1880
1946
|
private ensureIndex;
|
|
1881
1947
|
}
|
|
1882
1948
|
|
|
1883
|
-
export { type ACLValidationResult, AbstractGraphBuilder, type ApiCallTracerOptions, type ApiKeyResolver, AttachmentType, type AuditEntry, type BaseGraphConfig, type BaseGraphContext, GraphController as BaseGraphServiceController, UniversalGraphModule as BaseGraphServiceModule, type BaseGraphState, BuilderRegistryService, Callback, CallbackACL, CallbackAuditAction, CallbackAuditor, type CallbackContext, CallbackController, type CallbackEntry, type CallbackHandler, type CallbackMetadata, CallbackMetrics, type CallbackPatch, type CallbackPatchHandler, CallbackPatchService, CallbackRateLimiter, type CallbackRecord, CallbackRegistry, type CallbackRequest, type CallbackResult, CallbackStore, CallbackTokenGuard, type CallbackUser, type ChannelState, type ChartType, ChatFeature, type ChatModelCreator, type ChatModelOrRunnable, type ChatModelWithTools, type CitationValue, type CompiledGraphFor, type CustomDocument, DEFAULT_ATTACHMENT_THRESHOLD, DEFAULT_ROUTER_URL, DEFAULT_TRACER_OPTIONS, type DataEnvelope, ENDPOINT_METADATA_KEY, type EmbeddingModelCreator, Endpoint, type EndpointDescriptor, type EndpointHandler, type EndpointMetadata, type EndpointOptions, EndpointRegistry, EventProcessor, type ExecuteToolWithAttachmentsParams, type ExecuteToolWithAttachmentsResult, type ExtendedCallbackContext, type ExtendedCallbackHandler, ExternalGraphBuilder, FileBasedDiscovery, FileTokenStore, FlutchChatBedrockConverse, type FlutchContext, GraphController, GraphEngineFactory, GraphEngineType, GraphManifestSchema, GraphManifestValidator, GraphServiceTokens, GraphTypeUtils, type IAgentToolConfig, type IAgentToolConfiguration, type IAttachment, type IBaseEntity, type IChartDataPoint, type IChartDataset, type IChartValue, type IContentBlock, type IContentChain, type IDeletionInfo, type IGenericGraphType, type IGraphAttachment, type IGraphBuilder, type IGraphCompiler, type IGraphConfigurable, type IGraphEngine, type IGraphLogger, type IGraphManifest, type IGraphMetadata, type IGraphMetadataRegistry, type IGraphRequestPayload, type IGraphResponsePayload, type IGraphRunnableConfig, type IGraphService, type IGraphServiceRegistry, type IGraphSettingsRepository, type IGraphTraceEvent, type IGraphTracer, type IGraphTypeMetadata, type IGraphTypeRegistry, type ILangGraphConfig, type IModelInitializer, type IOAuthTokenStore, type IReasoningChain, type IReasoningStep, type IStoredMessageContent, type ISystemToolCredentials, type IToolCall, type IToolCatalog, type IToolConfigOption, type IToolExecutionContext, type ITracingEvent, type IUsageMetrics, type IUsageRecorder, type IdempotencyConfig, type IdempotencyEntry, IdempotencyManager, IdempotencyStatus, type KnowledgeBaseInfo, type LLMCallRecord, type LLMConfig, type LLModel, LangGraphEngine, type LangchainReasoningBlock, type MappedChannels, McpConverter, type McpRuntimeClient, McpRuntimeHttpClient, type McpTool, McpToolFilter, type Model, type ModelByIdConfig, type ModelByIdWithTypeConfig, type ModelConfig, type ModelConfigFetcher, type ModelConfigWithToken, type ModelConfigWithTokenAndType, type ModelCreators, ModelInitializer, ModelProvider, ModelType, type MongoDBConfig, MongoTokenStore, type OAuthProviderConfig, type OAuthProviderDef, OAuthTokenManager, type OAuthTokenManagerOptions, type OAuthTokens, PROMPT_CACHE_MIN_VERSIONS, type PostgresConfig, type PromptCacheControl, type PromptCacheTtl, type RateLimitConfig, type RateLimitResult, type ReasoningEffort, type RequestContext, type RerankModelCreator, type ResolvedSamplingParams, type RetrieveQueryOptions, type RetrieverConfig, RetrieverSearchType, RetrieverService, type RouterConfig, SAMPLING_PARAM_FREE_THRESHOLDS, type SamplingParams, type SanitizedHistory, type ServiceDiscoveryProvider, SmartCallbackRouter, StaticDiscovery, type StreamAccumulator, StreamChannel, type StrictGraphRunnableConfig, TelegramPatchHandler, type ToolConfig, type ToolExecutionResult, type TraceApiCallResult, type TracingLevel, UIDispatchController, type UIDispatchDto, UIEndpoint, type UIEndpointClassMetadata, type UIEndpointMethodMetadata, UIEndpointsDiscoveryService, UniversalCallbackService, UniversalGraphModule, type UniversalGraphModuleOptions, UniversalGraphService, type VersionResolution, type VersionResolutionOptions, type VersionRoute, VersionedGraphService, type VersioningConfig, VoyageAIRerank, type VoyageAIRerankConfig, WebPatchHandler, WithCallbacks, WithEndpoints, WithUIEndpoints, _internals, bootstrap, buildEffortRequestFields, buildOAuthAuthorizationUrl, buildOpenAIModelConfig, clearAttachmentDataStore, createEndpointDescriptors, createGraphAttachment, createMongoClientAdapter, createStaticMessage, decryptTokens, dispatchAttachments, encryptTokens, executeToolWithAttachments, findCallbackMethod, findEndpointMethod, flutchFetch, flutchHeaders, flutchMistralHook, generateAttachmentSummary, generateModelCacheKey, getAttachmentData, getCallbackMetadata, getEndpointMetadata, getFlutchContext, getOAuthProvider, getOAuthProviderNames, getUIEndpointClassMetadata, getUIEndpointMethodsMetadata, hasCallbacks, hasUIEndpoints, hashToolsConfig, isInternalMode, isReasoningBlock, isReasoningModel, isSendableReasoningBlock, joinTextSteps, loadOAuthProviders, modelAcceptsSamplingParams, modelSupportsPromptCache, normalizeToolConfigs, redactConnectionString, registerFinanceExampleCallback, registerUIEndpointsFromClass, resolveOAuthProviderConfig, resolvePromptCacheControl, resolveRouterURL, resolveSamplingParams, sanitizeMessageReasoning, sanitizeReasoningForBedrock, sanitizeTraceData, storeAttachmentData, toOptionalNumber, traceApiCall, withFlutchContext, wrapCohereFetcher };
|
|
1949
|
+
export { type ACLValidationResult, AbstractGraphBuilder, type ApiCallTracerOptions, type ApiKeyResolver, AttachmentType, type AuditEntry, type BaseGraphConfig, type BaseGraphContext, GraphController as BaseGraphServiceController, UniversalGraphModule as BaseGraphServiceModule, type BaseGraphState, BuilderRegistryService, Callback, CallbackACL, CallbackAuditAction, CallbackAuditor, type CallbackContext, CallbackController, type CallbackEntry, type CallbackHandler, type CallbackMetadata, CallbackMetrics, type CallbackPatch, type CallbackPatchHandler, CallbackPatchService, CallbackRateLimiter, type CallbackRecord, CallbackRegistry, type CallbackRequest, type CallbackResult, CallbackStore, CallbackTokenGuard, type CallbackUser, type ChannelState, type ChartType, ChatFeature, type ChatModelCreator, type ChatModelOrRunnable, type ChatModelWithTools, type CitationValue, type CompiledGraphFor, type CustomDocument, DEFAULT_ATTACHMENT_THRESHOLD, DEFAULT_ROUTER_URL, DEFAULT_TOOL_SEARCH_MIN_TOOLS, DEFAULT_TOOL_SEARCH_RESULTS, DEFAULT_TRACER_OPTIONS, type DataEnvelope, ENDPOINT_METADATA_KEY, type EmbeddingModelCreator, Endpoint, type EndpointDescriptor, type EndpointHandler, type EndpointMetadata, type EndpointOptions, EndpointRegistry, EventProcessor, type ExecuteToolWithAttachmentsParams, type ExecuteToolWithAttachmentsResult, type ExtendedCallbackContext, type ExtendedCallbackHandler, ExternalGraphBuilder, FileBasedDiscovery, FileTokenStore, FlutchChatBedrockConverse, type FlutchContext, GraphController, GraphEngineFactory, GraphEngineType, GraphManifestSchema, GraphManifestValidator, GraphServiceTokens, GraphTypeUtils, type IAgentToolConfig, type IAgentToolConfiguration, type IAttachment, type IBaseEntity, type IChartDataPoint, type IChartDataset, type IChartValue, type IContentBlock, type IContentChain, type IDeletionInfo, type IGenericGraphType, type IGraphAttachment, type IGraphBuilder, type IGraphCompiler, type IGraphConfigurable, type IGraphEngine, type IGraphLogger, type IGraphManifest, type IGraphMetadata, type IGraphMetadataRegistry, type IGraphRequestPayload, type IGraphResponsePayload, type IGraphRunnableConfig, type IGraphService, type IGraphServiceRegistry, type IGraphSettingsRepository, type IGraphTraceEvent, type IGraphTracer, type IGraphTypeMetadata, type IGraphTypeRegistry, type ILangGraphConfig, type IModelInitializer, type IOAuthTokenStore, type IReasoningChain, type IReasoningStep, type IStoredMessageContent, type ISystemToolCredentials, type IToolCall, type IToolCatalog, type IToolConfigOption, type IToolExecutionContext, type ITracingEvent, type IUsageMetrics, type IUsageRecorder, type IdempotencyConfig, type IdempotencyEntry, IdempotencyManager, IdempotencyStatus, type KnowledgeBaseInfo, type LLMCallRecord, type LLMConfig, type LLModel, LangGraphEngine, type LangchainReasoningBlock, type MappedChannels, McpConverter, type McpRuntimeClient, McpRuntimeHttpClient, type McpTool, McpToolFilter, type Model, type ModelByIdConfig, type ModelByIdWithTypeConfig, type ModelConfig, type ModelConfigFetcher, type ModelConfigWithToken, type ModelConfigWithTokenAndType, type ModelCreators, ModelInitializer, ModelProvider, ModelType, type MongoDBConfig, MongoTokenStore, type OAuthProviderConfig, type OAuthProviderDef, OAuthTokenManager, type OAuthTokenManagerOptions, type OAuthTokens, PROMPT_CACHE_MIN_VERSIONS, type PostgresConfig, type PromptCacheControl, type PromptCacheTtl, type RateLimitConfig, type RateLimitResult, type ReasoningEffort, type RequestContext, type RerankModelCreator, type ResolvedSamplingParams, type RetrieveQueryOptions, type RetrieverConfig, RetrieverSearchType, RetrieverService, type RouterConfig, SAMPLING_PARAM_FREE_THRESHOLDS, type SamplingParams, type SanitizedHistory, type ServiceDiscoveryProvider, SmartCallbackRouter, StaticDiscovery, type StreamAccumulator, StreamChannel, type StrictGraphRunnableConfig, TOOL_SEARCH_NAME, TelegramPatchHandler, type ToolConfig, type ToolExecutionResult, ToolSearchCatalog, type ToolSearchEntry, type ToolSearchHit, type ToolSearchMode, type ToolSearchOptions, type TraceApiCallResult, type TracingLevel, UIDispatchController, type UIDispatchDto, UIEndpoint, type UIEndpointClassMetadata, type UIEndpointMethodMetadata, UIEndpointsDiscoveryService, UniversalCallbackService, UniversalGraphModule, type UniversalGraphModuleOptions, UniversalGraphService, type VersionResolution, type VersionResolutionOptions, type VersionRoute, VersionedGraphService, type VersioningConfig, VoyageAIRerank, type VoyageAIRerankConfig, WebPatchHandler, WithCallbacks, WithEndpoints, WithUIEndpoints, _internals, bindToolsWithSearch, bootstrap, buildEffortRequestFields, buildOAuthAuthorizationUrl, buildOpenAIModelConfig, clearAttachmentDataStore, createEndpointDescriptors, createGraphAttachment, createMongoClientAdapter, createStaticMessage, createToolSearchTool, decryptTokens, dispatchAttachments, encryptTokens, executeToolWithAttachments, findCallbackMethod, findEndpointMethod, flutchFetch, flutchHeaders, flutchMistralHook, formatToolSearchResult, generateAttachmentSummary, generateModelCacheKey, getAttachmentData, getCallbackMetadata, getEndpointMetadata, getFlutchContext, getOAuthProvider, getOAuthProviderNames, getUIEndpointClassMetadata, getUIEndpointMethodsMetadata, hasCallbacks, hasUIEndpoints, hashToolsConfig, isInternalMode, isReasoningBlock, isReasoningModel, isSendableReasoningBlock, isToolSearchCall, joinTextSteps, loadOAuthProviders, loadedToolNames, modelAcceptsSamplingParams, modelSupportsPromptCache, normalizeToolConfigs, parseToolSearchResult, redactConnectionString, registerFinanceExampleCallback, registerUIEndpointsFromClass, resolveOAuthProviderConfig, resolvePromptCacheControl, resolveRouterURL, resolveSamplingParams, rewriteToolReferences, sanitizeMessageReasoning, sanitizeReasoningForBedrock, sanitizeTraceData, splitTools, storeAttachmentData, toOptionalNumber, toolSearchApplies, toolSearchTerms, traceApiCall, withFlutchContext, withToolReferences, wrapCohereFetcher };
|