langchain 1.1.4 → 1.1.6-dev-1765431816670
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/CHANGELOG.md +7 -0
- package/README.md +1 -1
- package/dist/agents/ReactAgent.d.cts.map +1 -0
- package/dist/agents/ReactAgent.d.ts.map +1 -0
- package/dist/agents/constants.d.cts.map +1 -0
- package/dist/agents/constants.d.ts.map +1 -0
- package/dist/agents/errors.d.cts.map +1 -0
- package/dist/agents/errors.d.ts.map +1 -0
- package/dist/agents/index.d.cts.map +1 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/middleware/contextEditing.d.cts.map +1 -0
- package/dist/agents/middleware/contextEditing.d.ts.map +1 -0
- package/dist/agents/middleware/dynamicSystemPrompt.d.cts.map +1 -0
- package/dist/agents/middleware/dynamicSystemPrompt.d.ts.map +1 -0
- package/dist/agents/middleware/hitl.d.cts.map +1 -0
- package/dist/agents/middleware/hitl.d.ts.map +1 -0
- package/dist/agents/middleware/llmToolSelector.d.cts.map +1 -0
- package/dist/agents/middleware/llmToolSelector.d.ts.map +1 -0
- package/dist/agents/middleware/modelCallLimit.d.cts.map +1 -0
- package/dist/agents/middleware/modelCallLimit.d.ts.map +1 -0
- package/dist/agents/middleware/modelFallback.d.cts.map +1 -0
- package/dist/agents/middleware/modelFallback.d.ts.map +1 -0
- package/dist/agents/middleware/modelRetry.d.cts.map +1 -0
- package/dist/agents/middleware/modelRetry.d.ts.map +1 -0
- package/dist/agents/middleware/pii.d.cts.map +1 -0
- package/dist/agents/middleware/pii.d.ts.map +1 -0
- package/dist/agents/middleware/piiRedaction.d.cts.map +1 -0
- package/dist/agents/middleware/piiRedaction.d.ts.map +1 -0
- package/dist/agents/middleware/provider/anthropic/promptCaching.d.cts.map +1 -0
- package/dist/agents/middleware/provider/anthropic/promptCaching.d.ts.map +1 -0
- package/dist/agents/middleware/provider/openai/moderation.d.cts.map +1 -0
- package/dist/agents/middleware/provider/openai/moderation.d.ts.map +1 -0
- package/dist/agents/middleware/summarization.d.cts.map +1 -0
- package/dist/agents/middleware/summarization.d.ts.map +1 -0
- package/dist/agents/middleware/todoListMiddleware.d.cts.map +1 -0
- package/dist/agents/middleware/todoListMiddleware.d.ts.map +1 -0
- package/dist/agents/middleware/toolCallLimit.d.cts.map +1 -0
- package/dist/agents/middleware/toolCallLimit.d.ts.map +1 -0
- package/dist/agents/middleware/toolEmulator.d.cts.map +1 -0
- package/dist/agents/middleware/toolEmulator.d.ts.map +1 -0
- package/dist/agents/middleware/toolRetry.d.cts.map +1 -0
- package/dist/agents/middleware/toolRetry.d.ts.map +1 -0
- package/dist/agents/middleware/types.d.cts.map +1 -0
- package/dist/agents/middleware/types.d.ts.map +1 -0
- package/dist/agents/middleware/utils.d.cts.map +1 -0
- package/dist/agents/middleware/utils.d.ts.map +1 -0
- package/dist/agents/middleware.d.cts.map +1 -0
- package/dist/agents/middleware.d.ts.map +1 -0
- package/dist/agents/nodes/types.d.cts.map +1 -0
- package/dist/agents/nodes/types.d.ts.map +1 -0
- package/dist/agents/responses.d.cts.map +1 -0
- package/dist/agents/responses.d.ts.map +1 -0
- package/dist/agents/runtime.d.cts.map +1 -0
- package/dist/agents/runtime.d.ts.map +1 -0
- package/dist/agents/tests/utils.d.cts.map +1 -0
- package/dist/agents/tests/utils.d.ts.map +1 -0
- package/dist/agents/types.d.cts.map +1 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/chat_models/universal.d.cts.map +1 -0
- package/dist/chat_models/universal.d.ts.map +1 -0
- package/dist/hub/base.d.cts.map +1 -0
- package/dist/hub/base.d.ts.map +1 -0
- package/dist/hub/index.d.cts.map +1 -0
- package/dist/hub/index.d.ts.map +1 -0
- package/dist/hub/node.cjs +22 -2
- package/dist/hub/node.cjs.map +1 -1
- package/dist/hub/node.d.cts.map +1 -0
- package/dist/hub/node.d.ts.map +1 -0
- package/dist/hub/node.js +22 -2
- package/dist/hub/node.js.map +1 -1
- package/dist/load/import_type.d.cts.map +1 -0
- package/dist/load/import_type.d.ts.map +1 -0
- package/dist/load/index.d.cts.map +1 -0
- package/dist/load/index.d.ts.map +1 -0
- package/dist/storage/encoder_backed.d.cts.map +1 -0
- package/dist/storage/encoder_backed.d.ts.map +1 -0
- package/dist/storage/file_system.d.cts.map +1 -0
- package/dist/storage/file_system.d.ts.map +1 -0
- package/package.json +8 -7
- package/chat_models/universal.cjs +0 -1
- package/chat_models/universal.d.cts +0 -1
- package/chat_models/universal.d.ts +0 -1
- package/chat_models/universal.js +0 -1
- package/hub/node.cjs +0 -1
- package/hub/node.d.cts +0 -1
- package/hub/node.d.ts +0 -1
- package/hub/node.js +0 -1
- package/hub.cjs +0 -1
- package/hub.d.cts +0 -1
- package/hub.d.ts +0 -1
- package/hub.js +0 -1
- package/load/serializable.cjs +0 -1
- package/load/serializable.d.cts +0 -1
- package/load/serializable.d.ts +0 -1
- package/load/serializable.js +0 -1
- package/load.cjs +0 -1
- package/load.d.cts +0 -1
- package/load.d.ts +0 -1
- package/load.js +0 -1
- package/storage/encoder_backed.cjs +0 -1
- package/storage/encoder_backed.d.cts +0 -1
- package/storage/encoder_backed.d.ts +0 -1
- package/storage/encoder_backed.js +0 -1
- package/storage/file_system.cjs +0 -1
- package/storage/file_system.d.cts +0 -1
- package/storage/file_system.d.ts +0 -1
- package/storage/file_system.js +0 -1
- package/storage/in_memory.cjs +0 -1
- package/storage/in_memory.d.cts +0 -1
- package/storage/in_memory.d.ts +0 -1
- package/storage/in_memory.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"universal.d.ts","names":["BaseLanguageModelInput","ToolDefinition","BaseChatModel","BaseChatModelParams","BindToolsInput","BaseChatModelCallOptions","BaseMessage","AIMessageChunk","MessageStructure","RunnableBatchOptions","RunnableBinding","RunnableConfig","RunnableToolLike","IterableReadableStream","LogStreamCallbackHandlerInput","RunLogPatch","StreamEvent","StructuredToolInterface","CallbackManagerForLLMRun","ChatResult","ModelProfile","EventStreamCallbackHandlerInput","Omit","ConfigurableChatModelCallOptions","Record","MODEL_PROVIDER_CONFIG","ChatModelProvider","getChatModelByClassName","Promise","_inferModelProvider","ConfigurableModelFields","ConfigurableModel","RunInput","CallOptions","Partial","Error","AsyncGenerator","Uint8Array","InitChatModelFields","ConfigurableFields","initChatModel"],"sources":["../../src/chat_models/universal.d.ts"],"sourcesContent":["import { BaseLanguageModelInput, ToolDefinition } from \"@langchain/core/language_models/base\";\nimport { BaseChatModel, BaseChatModelParams, BindToolsInput, type BaseChatModelCallOptions } from \"@langchain/core/language_models/chat_models\";\nimport { BaseMessage, type AIMessageChunk, MessageStructure } from \"@langchain/core/messages\";\nimport { type RunnableBatchOptions, RunnableBinding, type RunnableConfig, type RunnableToolLike } from \"@langchain/core/runnables\";\nimport { IterableReadableStream } from \"@langchain/core/utils/stream\";\nimport { type LogStreamCallbackHandlerInput, type RunLogPatch, type StreamEvent } from \"@langchain/core/tracers/log_stream\";\nimport { type StructuredToolInterface } from \"@langchain/core/tools\";\nimport { CallbackManagerForLLMRun } from \"@langchain/core/callbacks/manager\";\nimport { ChatResult } from \"@langchain/core/outputs\";\nimport { ModelProfile } from \"@langchain/core/language_models/profile\";\ninterface EventStreamCallbackHandlerInput extends Omit<LogStreamCallbackHandlerInput, \"_schemaFormat\"> {\n}\nexport interface ConfigurableChatModelCallOptions extends BaseChatModelCallOptions {\n tools?: (StructuredToolInterface | Record<string, unknown> | ToolDefinition | RunnableToolLike)[];\n}\nexport declare const MODEL_PROVIDER_CONFIG: {\n readonly openai: {\n readonly package: \"@langchain/openai\";\n readonly className: \"ChatOpenAI\";\n };\n readonly anthropic: {\n readonly package: \"@langchain/anthropic\";\n readonly className: \"ChatAnthropic\";\n };\n readonly azure_openai: {\n readonly package: \"@langchain/openai\";\n readonly className: \"AzureChatOpenAI\";\n };\n readonly cohere: {\n readonly package: \"@langchain/cohere\";\n readonly className: \"ChatCohere\";\n };\n readonly \"google-vertexai\": {\n readonly package: \"@langchain/google-vertexai\";\n readonly className: \"ChatVertexAI\";\n };\n readonly \"google-vertexai-web\": {\n readonly package: \"@langchain/google-vertexai-web\";\n readonly className: \"ChatVertexAI\";\n };\n readonly \"google-genai\": {\n readonly package: \"@langchain/google-genai\";\n readonly className: \"ChatGoogleGenerativeAI\";\n };\n readonly ollama: {\n readonly package: \"@langchain/ollama\";\n readonly className: \"ChatOllama\";\n };\n readonly mistralai: {\n readonly package: \"@langchain/mistralai\";\n readonly className: \"ChatMistralAI\";\n };\n readonly mistral: {\n readonly package: \"@langchain/mistralai\";\n readonly className: \"ChatMistralAI\";\n };\n readonly groq: {\n readonly package: \"@langchain/groq\";\n readonly className: \"ChatGroq\";\n };\n readonly cerebras: {\n readonly package: \"@langchain/cerebras\";\n readonly className: \"ChatCerebras\";\n };\n readonly bedrock: {\n readonly package: \"@langchain/aws\";\n readonly className: \"ChatBedrockConverse\";\n };\n readonly deepseek: {\n readonly package: \"@langchain/deepseek\";\n readonly className: \"ChatDeepSeek\";\n };\n readonly xai: {\n readonly package: \"@langchain/xai\";\n readonly className: \"ChatXAI\";\n };\n readonly fireworks: {\n readonly package: \"@langchain/community/chat_models/fireworks\";\n readonly className: \"ChatFireworks\";\n readonly hasCircularDependency: true;\n };\n readonly together: {\n readonly package: \"@langchain/community/chat_models/togetherai\";\n readonly className: \"ChatTogetherAI\";\n readonly hasCircularDependency: true;\n };\n readonly perplexity: {\n readonly package: \"@langchain/community/chat_models/perplexity\";\n readonly className: \"ChatPerplexity\";\n readonly hasCircularDependency: true;\n };\n};\nexport type ChatModelProvider = keyof typeof MODEL_PROVIDER_CONFIG;\n/**\n * Helper function to get a chat model class by its class name\n * @param className The class name (e.g., \"ChatOpenAI\", \"ChatAnthropic\")\n * @returns The imported model class or undefined if not found\n */\nexport declare function getChatModelByClassName(className: string): Promise<any>;\n/**\n * Attempts to infer the model provider based on the given model name.\n *\n * @param {string} modelName - The name of the model to infer the provider for.\n * @returns {string | undefined} The inferred model provider name, or undefined if unable to infer.\n *\n * @example\n * _inferModelProvider(\"gpt-4\"); // returns \"openai\"\n * _inferModelProvider(\"claude-2\"); // returns \"anthropic\"\n * _inferModelProvider(\"unknown-model\"); // returns undefined\n */\nexport declare function _inferModelProvider(modelName: string): string | undefined;\ninterface ConfigurableModelFields extends BaseChatModelParams {\n defaultConfig?: Record<string, any>;\n /**\n * @default \"any\"\n */\n configurableFields?: string[] | \"any\";\n /**\n * @default \"\"\n */\n configPrefix?: string;\n /**\n * Methods which should be called after the model is initialized.\n * The key will be the method name, and the value will be the arguments.\n */\n queuedMethodOperations?: Record<string, any>;\n /**\n * Overrides the profiling information for the model. If not provided,\n * the profile will be inferred from the inner model instance.\n */\n profile?: ModelProfile;\n}\n/**\n * Internal class used to create chat models.\n *\n * @internal\n */\nexport declare class ConfigurableModel<RunInput extends BaseLanguageModelInput = BaseLanguageModelInput, CallOptions extends ConfigurableChatModelCallOptions = ConfigurableChatModelCallOptions> extends BaseChatModel<CallOptions, AIMessageChunk> {\n _llmType(): string;\n lc_namespace: string[];\n _defaultConfig?: Record<string, any>;\n /**\n * @default \"any\"\n */\n _configurableFields: string[] | \"any\";\n /**\n * @default \"\"\n */\n _configPrefix: string;\n /**\n * Methods which should be called after the model is initialized.\n * The key will be the method name, and the value will be the arguments.\n */\n _queuedMethodOperations: Record<string, any>;\n /** @internal */\n private _modelInstanceCache;\n /** @internal */\n private _profile?;\n constructor(fields: ConfigurableModelFields);\n _getModelInstance(config?: RunnableConfig): Promise<BaseChatModel<BaseChatModelCallOptions, AIMessageChunk<MessageStructure>>>;\n _generate(messages: BaseMessage[], options?: this[\"ParsedCallOptions\"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;\n bindTools(tools: BindToolsInput[], params?: Record<string, any>): ConfigurableModel<RunInput, CallOptions>;\n withStructuredOutput: BaseChatModel[\"withStructuredOutput\"];\n _modelParams(config?: RunnableConfig): Record<string, any>;\n _removePrefix(str: string, prefix: string): string;\n /**\n * Bind config to a Runnable, returning a new Runnable.\n * @param {RunnableConfig | undefined} [config] - The config to bind.\n * @returns {RunnableBinding<RunInput, RunOutput, CallOptions>} A new RunnableBinding with the bound config.\n */\n withConfig(config?: RunnableConfig): RunnableBinding<RunInput, AIMessageChunk, CallOptions>;\n invoke(input: RunInput, options?: CallOptions): Promise<AIMessageChunk>;\n stream(input: RunInput, options?: CallOptions): Promise<IterableReadableStream<AIMessageChunk>>;\n batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions & {\n returnExceptions?: false;\n }): Promise<AIMessageChunk[]>;\n batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions & {\n returnExceptions: true;\n }): Promise<(AIMessageChunk | Error)[]>;\n batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions): Promise<(AIMessageChunk | Error)[]>;\n transform(generator: AsyncGenerator<RunInput>, options: CallOptions): AsyncGenerator<AIMessageChunk>;\n streamLog(input: RunInput, options?: Partial<CallOptions>, streamOptions?: Omit<LogStreamCallbackHandlerInput, \"autoClose\">): AsyncGenerator<RunLogPatch>;\n streamEvents(input: RunInput, options: Partial<CallOptions> & {\n version: \"v1\" | \"v2\";\n }, streamOptions?: Omit<EventStreamCallbackHandlerInput, \"autoClose\">): IterableReadableStream<StreamEvent>;\n streamEvents(input: RunInput, options: Partial<CallOptions> & {\n version: \"v1\" | \"v2\";\n encoding: \"text/event-stream\";\n }, streamOptions?: Omit<EventStreamCallbackHandlerInput, \"autoClose\">): IterableReadableStream<Uint8Array>;\n /**\n * Return profiling information for the model.\n *\n * @returns {ModelProfile} An object describing the model's capabilities and constraints\n */\n get profile(): ModelProfile;\n}\nexport interface InitChatModelFields extends Partial<Record<string, any>> {\n modelProvider?: string;\n configurableFields?: string[] | \"any\";\n configPrefix?: string;\n}\nexport type ConfigurableFields = \"any\" | string[];\nexport declare function initChatModel<RunInput extends BaseLanguageModelInput = BaseLanguageModelInput, CallOptions extends ConfigurableChatModelCallOptions = ConfigurableChatModelCallOptions>(model: string, fields?: Partial<Record<string, any>> & {\n modelProvider?: string;\n configurableFields?: never;\n configPrefix?: string;\n}): Promise<ConfigurableModel<RunInput, CallOptions>>;\nexport declare function initChatModel<RunInput extends BaseLanguageModelInput = BaseLanguageModelInput, CallOptions extends ConfigurableChatModelCallOptions = ConfigurableChatModelCallOptions>(model: never, options?: Partial<Record<string, any>> & {\n modelProvider?: string;\n configurableFields?: never;\n configPrefix?: string;\n profile?: ModelProfile;\n}): Promise<ConfigurableModel<RunInput, CallOptions>>;\nexport declare function initChatModel<RunInput extends BaseLanguageModelInput = BaseLanguageModelInput, CallOptions extends ConfigurableChatModelCallOptions = ConfigurableChatModelCallOptions>(model?: string, options?: Partial<Record<string, any>> & {\n modelProvider?: string;\n configurableFields?: ConfigurableFields;\n configPrefix?: string;\n profile?: ModelProfile;\n}): Promise<ConfigurableModel<RunInput, CallOptions>>;\nexport {};\n//# sourceMappingURL=universal.d.ts.map"],"mappings":";;;;;;;;;;;;UAUUqB,+BAAAA,SAAwCC,KAAKR;AAA7CO,UAEOE,gCAAAA,SAAyClB,wBAFRiB,CAAAA;EAEjCC,KAAAA,CAAAA,EAAAA,CACJN,uBADIM,GACsBC,MADU,CAAA,MAAA,EAAA,OAAA,CAAA,GACgBvB,cADhB,GACiCW,gBADjC,CAAA,EAAA;;AACVY,cAElBC,qBAFkBD,EAAAA;EAA0BvB,SAAAA,MAAAA,EAAAA;IAAiBW,SAAAA,OAAAA,EAAAA,mBAAAA;IADxBP,SAAAA,SAAAA,EAAAA,YAAAA;EAAwB,CAAA;EAG7DoB,SAAAA,SAAAA,EAAAA;IA6ETC,SAAAA,OAAiB,EAAA,sBAAgBD;IAMrBE,SAAAA,SAAAA,EAAAA,eAA4CC;EAY5CC,CAAAA;EACdC,SAAAA,YAAAA,EAAAA;IACUN,SAAAA,OAAAA,EAAAA,mBAAAA;IAaSA,SAAAA,SA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;;;;IAI7NI,QAAQG,kBAAkBC,UAAUC;iBAChBO,+BAA+BxC,yBAAyBA,4CAA4CuB,mCAAmCA,0DAA0DW,QAAQV;;;;YAInNJ;IACVQ,QAAQG,kBAAkBC,UAAUC;iBAChBO,+BAA+BxC,yBAAyBA,4CAA4CuB,mCAAmCA,4DAA4DW,QAAQV;;uBAE1Me;;YAEXnB;IACVQ,QAAQG,kBAAkBC,UAAUC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.cts","names":["BaseLanguageModel","Runnable","PromptCommit","basePush","Promise","basePull","generateModelImportMap","Record","generateOptionalImportMap","bindOutputSchema","T"],"sources":["../../src/hub/base.d.ts"],"sourcesContent":["import type { BaseLanguageModel } from \"@langchain/core/language_models/base\";\nimport type { Runnable } from \"@langchain/core/runnables\";\nimport type { PromptCommit } from \"langsmith/schemas\";\n/**\n * Push a prompt to the hub.\n * If the specified repo doesn't already exist, it will be created.\n * @param repoFullName The full name of the repo.\n * @param runnable The prompt to push.\n * @param options\n * @returns The URL of the newly pushed prompt in the hub.\n */\nexport declare function basePush(repoFullName: string, runnable: Runnable, options?: {\n apiKey?: string;\n apiUrl?: string;\n parentCommitHash?: string;\n isPublic?: boolean;\n description?: string;\n readme?: string;\n tags?: string[];\n}): Promise<string>;\nexport declare function basePull(ownerRepoCommit: string, options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n}): Promise<PromptCommit>;\nexport declare function generateModelImportMap(modelClass?: new (...args: any[]) => BaseLanguageModel): Record<string, any>;\nexport declare function generateOptionalImportMap(modelClass?: new (...args: any[]) => BaseLanguageModel): Record<string, any>;\nexport declare function bindOutputSchema<T extends Runnable>(loadedSequence: T): T;\n//# sourceMappingURL=base.d.ts.map"],"mappings":";;;;;;AAWA;;;;;;;iBAAwBG,QAAAA,iCAAyCF;;;;;;;;IAQ7DG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","names":["BaseLanguageModel","Runnable","PromptCommit","basePush","Promise","basePull","generateModelImportMap","Record","generateOptionalImportMap","bindOutputSchema","T"],"sources":["../../src/hub/base.d.ts"],"sourcesContent":["import type { BaseLanguageModel } from \"@langchain/core/language_models/base\";\nimport type { Runnable } from \"@langchain/core/runnables\";\nimport type { PromptCommit } from \"langsmith/schemas\";\n/**\n * Push a prompt to the hub.\n * If the specified repo doesn't already exist, it will be created.\n * @param repoFullName The full name of the repo.\n * @param runnable The prompt to push.\n * @param options\n * @returns The URL of the newly pushed prompt in the hub.\n */\nexport declare function basePush(repoFullName: string, runnable: Runnable, options?: {\n apiKey?: string;\n apiUrl?: string;\n parentCommitHash?: string;\n isPublic?: boolean;\n description?: string;\n readme?: string;\n tags?: string[];\n}): Promise<string>;\nexport declare function basePull(ownerRepoCommit: string, options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n}): Promise<PromptCommit>;\nexport declare function generateModelImportMap(modelClass?: new (...args: any[]) => BaseLanguageModel): Record<string, any>;\nexport declare function generateOptionalImportMap(modelClass?: new (...args: any[]) => BaseLanguageModel): Record<string, any>;\nexport declare function bindOutputSchema<T extends Runnable>(loadedSequence: T): T;\n//# sourceMappingURL=base.d.ts.map"],"mappings":";;;;;;AAWA;;;;;;;iBAAwBG,QAAAA,iCAAyCF;;;;;;;;IAQ7DG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":["Runnable","BaseLanguageModel","basePush","push","pull","T","Promise"],"sources":["../../src/hub/index.d.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nimport type { BaseLanguageModel } from \"@langchain/core/language_models/base\";\nimport { basePush } from \"./base.js\";\nexport { basePush as push };\n/**\n * Pull a prompt from the hub.\n *\n * @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.\n * @param options.apiKey LangSmith API key to use when pulling the prompt\n * @param options.apiUrl LangSmith API URL to use when pulling the prompt\n * @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,\n * if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will\n * also invoke the instantiated model. For non-OpenAI models, you must also set \"modelClass\" to the\n * correct class of the model.\n * @param options.modelClass If includeModel is true, the class of the model to instantiate. Required\n * for non-OpenAI models. If you are running in Node or another environment that supports dynamic imports,\n * you may instead import this function from \"langchain/hub/node\" and pass \"includeModel: true\" instead\n * of specifying this parameter.\n * @returns\n */\nexport declare function pull<T extends Runnable>(ownerRepoCommit: string, options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n modelClass?: new (...args: any[]) => BaseLanguageModel;\n}): Promise<T>;\n//# sourceMappingURL=index.d.ts.map"],"mappings":";;;;;;;AAoBA;;;;;AAKW;;;;;;;;;;iBALaI,eAAeJ;;;;uCAIEC;IACrCK,QAAQD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["Runnable","BaseLanguageModel","basePush","push","pull","T","Promise"],"sources":["../../src/hub/index.d.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nimport type { BaseLanguageModel } from \"@langchain/core/language_models/base\";\nimport { basePush } from \"./base.js\";\nexport { basePush as push };\n/**\n * Pull a prompt from the hub.\n *\n * @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.\n * @param options.apiKey LangSmith API key to use when pulling the prompt\n * @param options.apiUrl LangSmith API URL to use when pulling the prompt\n * @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,\n * if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will\n * also invoke the instantiated model. For non-OpenAI models, you must also set \"modelClass\" to the\n * correct class of the model.\n * @param options.modelClass If includeModel is true, the class of the model to instantiate. Required\n * for non-OpenAI models. If you are running in Node or another environment that supports dynamic imports,\n * you may instead import this function from \"langchain/hub/node\" and pass \"includeModel: true\" instead\n * of specifying this parameter.\n * @returns\n */\nexport declare function pull<T extends Runnable>(ownerRepoCommit: string, options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n modelClass?: new (...args: any[]) => BaseLanguageModel;\n}): Promise<T>;\n//# sourceMappingURL=index.d.ts.map"],"mappings":";;;;;;;AAoBA;;;;;AAKW;;;;;;;;;;iBALaI,eAAeJ;;;;uCAIEC;IACrCK,QAAQD"}
|
package/dist/hub/node.cjs
CHANGED
|
@@ -3,6 +3,25 @@ const require_load_index = require('../load/index.cjs');
|
|
|
3
3
|
const require_base = require('./base.cjs');
|
|
4
4
|
|
|
5
5
|
//#region src/hub/node.ts
|
|
6
|
+
function _idEquals(a, b) {
|
|
7
|
+
if (!Array.isArray(a) || !Array.isArray(b)) return false;
|
|
8
|
+
if (a.length !== b.length) return false;
|
|
9
|
+
for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
function isRunnableBinding(a) {
|
|
13
|
+
const wellKnownIds = [[
|
|
14
|
+
"langchain_core",
|
|
15
|
+
"runnables",
|
|
16
|
+
"RunnableBinding"
|
|
17
|
+
], [
|
|
18
|
+
"langchain",
|
|
19
|
+
"schema",
|
|
20
|
+
"runnable",
|
|
21
|
+
"RunnableBinding"
|
|
22
|
+
]];
|
|
23
|
+
return wellKnownIds.some((id) => _idEquals(a, id));
|
|
24
|
+
}
|
|
6
25
|
/**
|
|
7
26
|
* Pull a prompt from the hub.
|
|
8
27
|
* @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.
|
|
@@ -17,8 +36,9 @@ async function pull(ownerRepoCommit, options) {
|
|
|
17
36
|
const promptObject = await require_base.basePull(ownerRepoCommit, options);
|
|
18
37
|
let modelClass;
|
|
19
38
|
if (options?.includeModel) {
|
|
20
|
-
|
|
21
|
-
|
|
39
|
+
const chatModelObject = isRunnableBinding(promptObject.manifest.kwargs?.last?.id) ? promptObject.manifest.kwargs?.last?.kwargs?.bound : promptObject.manifest.kwargs?.last;
|
|
40
|
+
if (Array.isArray(chatModelObject?.id)) {
|
|
41
|
+
const modelName = chatModelObject?.id.at(-1);
|
|
22
42
|
if (modelName) {
|
|
23
43
|
modelClass = await require_chat_models_universal.getChatModelByClassName(modelName);
|
|
24
44
|
if (!modelClass) console.warn(`Received unknown model name from prompt hub: "${modelName}"`);
|
package/dist/hub/node.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.cjs","names":["ownerRepoCommit: string","options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n }","basePull","getChatModelByClassName","load","generateOptionalImportMap","generateModelImportMap","bindOutputSchema"],"sources":["../../src/hub/node.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nimport {\n basePull,\n generateModelImportMap,\n generateOptionalImportMap,\n bindOutputSchema,\n} from \"./base.js\";\nimport { load } from \"../load/index.js\";\nimport { getChatModelByClassName } from \"../chat_models/universal.js\";\n\n
|
|
1
|
+
{"version":3,"file":"node.cjs","names":["a: string[]","b: string[]","ownerRepoCommit: string","options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n }","basePull","getChatModelByClassName","load","generateOptionalImportMap","generateModelImportMap","bindOutputSchema"],"sources":["../../src/hub/node.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nimport {\n basePull,\n generateModelImportMap,\n generateOptionalImportMap,\n bindOutputSchema,\n} from \"./base.js\";\nimport { load } from \"../load/index.js\";\nimport { getChatModelByClassName } from \"../chat_models/universal.js\";\n\nexport { basePush as push } from \"./base.js\";\n\nfunction _idEquals(a: string[], b: string[]): boolean {\n if (!Array.isArray(a) || !Array.isArray(b)) {\n return false;\n }\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n\nfunction isRunnableBinding(a: string[]): boolean {\n const wellKnownIds = [\n [\"langchain_core\", \"runnables\", \"RunnableBinding\"],\n [\"langchain\", \"schema\", \"runnable\", \"RunnableBinding\"],\n ];\n return wellKnownIds.some((id) => _idEquals(a, id));\n}\n\n/**\n * Pull a prompt from the hub.\n * @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.\n * @param options.apiKey LangSmith API key to use when pulling the prompt\n * @param options.apiUrl LangSmith API URL to use when pulling the prompt\n * @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,\n * if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will\n * also invoke the instantiated model. You must have the appropriate LangChain integration package installed.\n * @returns\n */\nexport async function pull<T extends Runnable>(\n ownerRepoCommit: string,\n options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n }\n) {\n const promptObject = await basePull(ownerRepoCommit, options);\n let modelClass;\n if (options?.includeModel) {\n const chatModelObject = isRunnableBinding(\n promptObject.manifest.kwargs?.last?.id\n )\n ? promptObject.manifest.kwargs?.last?.kwargs?.bound\n : promptObject.manifest.kwargs?.last;\n\n if (Array.isArray(chatModelObject?.id)) {\n const modelName = chatModelObject?.id.at(-1);\n\n if (modelName) {\n modelClass = await getChatModelByClassName(modelName);\n if (!modelClass) {\n console.warn(\n `Received unknown model name from prompt hub: \"${modelName}\"`\n );\n }\n }\n }\n }\n const loadedPrompt = await load<T>(\n JSON.stringify(promptObject.manifest),\n undefined,\n generateOptionalImportMap(modelClass),\n generateModelImportMap(modelClass)\n );\n return bindOutputSchema(loadedPrompt);\n}\n"],"mappings":";;;;;AAYA,SAAS,UAAUA,GAAaC,GAAsB;AACpD,KAAI,CAAC,MAAM,QAAQ,EAAE,IAAI,CAAC,MAAM,QAAQ,EAAE,CACxC,QAAO;AAET,KAAI,EAAE,WAAW,EAAE,OACjB,QAAO;AAET,MAAK,IAAI,IAAI,GAAG,IAAI,EAAE,QAAQ,IAC5B,KAAI,EAAE,OAAO,EAAE,GACb,QAAO;AAGX,QAAO;AACR;AAED,SAAS,kBAAkBD,GAAsB;CAC/C,MAAM,eAAe,CACnB;EAAC;EAAkB;EAAa;CAAkB,GAClD;EAAC;EAAa;EAAU;EAAY;CAAkB,CACvD;AACD,QAAO,aAAa,KAAK,CAAC,OAAO,UAAU,GAAG,GAAG,CAAC;AACnD;;;;;;;;;;;AAYD,eAAsB,KACpBE,iBACAC,SAKA;CACA,MAAM,eAAe,MAAMC,sBAAS,iBAAiB,QAAQ;CAC7D,IAAI;AACJ,KAAI,SAAS,cAAc;EACzB,MAAM,kBAAkB,kBACtB,aAAa,SAAS,QAAQ,MAAM,GACrC,GACG,aAAa,SAAS,QAAQ,MAAM,QAAQ,QAC5C,aAAa,SAAS,QAAQ;AAElC,MAAI,MAAM,QAAQ,iBAAiB,GAAG,EAAE;GACtC,MAAM,YAAY,iBAAiB,GAAG,GAAG,GAAG;AAE5C,OAAI,WAAW;IACb,aAAa,MAAMC,sDAAwB,UAAU;AACrD,QAAI,CAAC,YACH,QAAQ,KACN,CAAC,8CAA8C,EAAE,UAAU,CAAC,CAAC,CAC9D;GAEJ;EACF;CACF;CACD,MAAM,eAAe,MAAMC,wBACzB,KAAK,UAAU,aAAa,SAAS,EACrC,QACAC,uCAA0B,WAAW,EACrCC,oCAAuB,WAAW,CACnC;AACD,QAAOC,8BAAiB,aAAa;AACtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.cts","names":["Runnable","basePush","push","pull","T","Promise"],"sources":["../../src/hub/node.d.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nexport { basePush as push } from \"./base.js\";\n/**\n * Pull a prompt from the hub.\n * @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.\n * @param options.apiKey LangSmith API key to use when pulling the prompt\n * @param options.apiUrl LangSmith API URL to use when pulling the prompt\n * @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,\n * if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will\n * also invoke the instantiated model. You must have the appropriate LangChain integration package installed.\n * @returns\n */\nexport declare function pull<T extends Runnable>(ownerRepoCommit: string, options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n}): Promise<T>;\n//# sourceMappingURL=node.d.ts.map"],"mappings":";;;;;;;AAYA;;;;AAIW;;;;iBAJaG,eAAeH;;;;IAInCK,QAAQD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","names":["Runnable","basePush","push","pull","T","Promise"],"sources":["../../src/hub/node.d.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nexport { basePush as push } from \"./base.js\";\n/**\n * Pull a prompt from the hub.\n * @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.\n * @param options.apiKey LangSmith API key to use when pulling the prompt\n * @param options.apiUrl LangSmith API URL to use when pulling the prompt\n * @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,\n * if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will\n * also invoke the instantiated model. You must have the appropriate LangChain integration package installed.\n * @returns\n */\nexport declare function pull<T extends Runnable>(ownerRepoCommit: string, options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n}): Promise<T>;\n//# sourceMappingURL=node.d.ts.map"],"mappings":";;;;;;;AAYA;;;;AAIW;;;;iBAJaG,eAAeH;;;;IAInCK,QAAQD"}
|
package/dist/hub/node.js
CHANGED
|
@@ -3,6 +3,25 @@ import { load } from "../load/index.js";
|
|
|
3
3
|
import { basePull, basePush, bindOutputSchema, generateModelImportMap, generateOptionalImportMap } from "./base.js";
|
|
4
4
|
|
|
5
5
|
//#region src/hub/node.ts
|
|
6
|
+
function _idEquals(a, b) {
|
|
7
|
+
if (!Array.isArray(a) || !Array.isArray(b)) return false;
|
|
8
|
+
if (a.length !== b.length) return false;
|
|
9
|
+
for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
function isRunnableBinding(a) {
|
|
13
|
+
const wellKnownIds = [[
|
|
14
|
+
"langchain_core",
|
|
15
|
+
"runnables",
|
|
16
|
+
"RunnableBinding"
|
|
17
|
+
], [
|
|
18
|
+
"langchain",
|
|
19
|
+
"schema",
|
|
20
|
+
"runnable",
|
|
21
|
+
"RunnableBinding"
|
|
22
|
+
]];
|
|
23
|
+
return wellKnownIds.some((id) => _idEquals(a, id));
|
|
24
|
+
}
|
|
6
25
|
/**
|
|
7
26
|
* Pull a prompt from the hub.
|
|
8
27
|
* @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.
|
|
@@ -17,8 +36,9 @@ async function pull(ownerRepoCommit, options) {
|
|
|
17
36
|
const promptObject = await basePull(ownerRepoCommit, options);
|
|
18
37
|
let modelClass;
|
|
19
38
|
if (options?.includeModel) {
|
|
20
|
-
|
|
21
|
-
|
|
39
|
+
const chatModelObject = isRunnableBinding(promptObject.manifest.kwargs?.last?.id) ? promptObject.manifest.kwargs?.last?.kwargs?.bound : promptObject.manifest.kwargs?.last;
|
|
40
|
+
if (Array.isArray(chatModelObject?.id)) {
|
|
41
|
+
const modelName = chatModelObject?.id.at(-1);
|
|
22
42
|
if (modelName) {
|
|
23
43
|
modelClass = await getChatModelByClassName(modelName);
|
|
24
44
|
if (!modelClass) console.warn(`Received unknown model name from prompt hub: "${modelName}"`);
|
package/dist/hub/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","names":["ownerRepoCommit: string","options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n }"],"sources":["../../src/hub/node.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nimport {\n basePull,\n generateModelImportMap,\n generateOptionalImportMap,\n bindOutputSchema,\n} from \"./base.js\";\nimport { load } from \"../load/index.js\";\nimport { getChatModelByClassName } from \"../chat_models/universal.js\";\n\n
|
|
1
|
+
{"version":3,"file":"node.js","names":["a: string[]","b: string[]","ownerRepoCommit: string","options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n }"],"sources":["../../src/hub/node.ts"],"sourcesContent":["import { Runnable } from \"@langchain/core/runnables\";\nimport {\n basePull,\n generateModelImportMap,\n generateOptionalImportMap,\n bindOutputSchema,\n} from \"./base.js\";\nimport { load } from \"../load/index.js\";\nimport { getChatModelByClassName } from \"../chat_models/universal.js\";\n\nexport { basePush as push } from \"./base.js\";\n\nfunction _idEquals(a: string[], b: string[]): boolean {\n if (!Array.isArray(a) || !Array.isArray(b)) {\n return false;\n }\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n\nfunction isRunnableBinding(a: string[]): boolean {\n const wellKnownIds = [\n [\"langchain_core\", \"runnables\", \"RunnableBinding\"],\n [\"langchain\", \"schema\", \"runnable\", \"RunnableBinding\"],\n ];\n return wellKnownIds.some((id) => _idEquals(a, id));\n}\n\n/**\n * Pull a prompt from the hub.\n * @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.\n * @param options.apiKey LangSmith API key to use when pulling the prompt\n * @param options.apiUrl LangSmith API URL to use when pulling the prompt\n * @param options.includeModel Whether to also instantiate and attach a model instance to the prompt,\n * if the prompt has associated model metadata. If set to true, invoking the resulting pulled prompt will\n * also invoke the instantiated model. You must have the appropriate LangChain integration package installed.\n * @returns\n */\nexport async function pull<T extends Runnable>(\n ownerRepoCommit: string,\n options?: {\n apiKey?: string;\n apiUrl?: string;\n includeModel?: boolean;\n }\n) {\n const promptObject = await basePull(ownerRepoCommit, options);\n let modelClass;\n if (options?.includeModel) {\n const chatModelObject = isRunnableBinding(\n promptObject.manifest.kwargs?.last?.id\n )\n ? promptObject.manifest.kwargs?.last?.kwargs?.bound\n : promptObject.manifest.kwargs?.last;\n\n if (Array.isArray(chatModelObject?.id)) {\n const modelName = chatModelObject?.id.at(-1);\n\n if (modelName) {\n modelClass = await getChatModelByClassName(modelName);\n if (!modelClass) {\n console.warn(\n `Received unknown model name from prompt hub: \"${modelName}\"`\n );\n }\n }\n }\n }\n const loadedPrompt = await load<T>(\n JSON.stringify(promptObject.manifest),\n undefined,\n generateOptionalImportMap(modelClass),\n generateModelImportMap(modelClass)\n );\n return bindOutputSchema(loadedPrompt);\n}\n"],"mappings":";;;;;AAYA,SAAS,UAAUA,GAAaC,GAAsB;AACpD,KAAI,CAAC,MAAM,QAAQ,EAAE,IAAI,CAAC,MAAM,QAAQ,EAAE,CACxC,QAAO;AAET,KAAI,EAAE,WAAW,EAAE,OACjB,QAAO;AAET,MAAK,IAAI,IAAI,GAAG,IAAI,EAAE,QAAQ,IAC5B,KAAI,EAAE,OAAO,EAAE,GACb,QAAO;AAGX,QAAO;AACR;AAED,SAAS,kBAAkBD,GAAsB;CAC/C,MAAM,eAAe,CACnB;EAAC;EAAkB;EAAa;CAAkB,GAClD;EAAC;EAAa;EAAU;EAAY;CAAkB,CACvD;AACD,QAAO,aAAa,KAAK,CAAC,OAAO,UAAU,GAAG,GAAG,CAAC;AACnD;;;;;;;;;;;AAYD,eAAsB,KACpBE,iBACAC,SAKA;CACA,MAAM,eAAe,MAAM,SAAS,iBAAiB,QAAQ;CAC7D,IAAI;AACJ,KAAI,SAAS,cAAc;EACzB,MAAM,kBAAkB,kBACtB,aAAa,SAAS,QAAQ,MAAM,GACrC,GACG,aAAa,SAAS,QAAQ,MAAM,QAAQ,QAC5C,aAAa,SAAS,QAAQ;AAElC,MAAI,MAAM,QAAQ,iBAAiB,GAAG,EAAE;GACtC,MAAM,YAAY,iBAAiB,GAAG,GAAG,GAAG;AAE5C,OAAI,WAAW;IACb,aAAa,MAAM,wBAAwB,UAAU;AACrD,QAAI,CAAC,YACH,QAAQ,KACN,CAAC,8CAA8C,EAAE,UAAU,CAAC,CAAC,CAC9D;GAEJ;EACF;CACF;CACD,MAAM,eAAe,MAAM,KACzB,KAAK,UAAU,aAAa,SAAS,EACrC,QACA,0BAA0B,WAAW,EACrC,uBAAuB,WAAW,CACnC;AACD,QAAO,iBAAiB,aAAa;AACtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import_type.d.cts","names":["OptionalImportMap","SecretMap"],"sources":["../../src/load/import_type.d.ts"],"sourcesContent":["export interface OptionalImportMap {\n}\nexport interface SecretMap {\n OPENAI_API_KEY?: string;\n}\n//# sourceMappingURL=import_type.d.ts.map"],"mappings":";UAAiBA,iBAAAA,EAAjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import_type.d.ts","names":["OptionalImportMap","SecretMap"],"sources":["../../src/load/import_type.d.ts"],"sourcesContent":["export interface OptionalImportMap {\n}\nexport interface SecretMap {\n OPENAI_API_KEY?: string;\n}\n//# sourceMappingURL=import_type.d.ts.map"],"mappings":";UAAiBA,iBAAAA,EAAjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":["OptionalImportMap","load","T","Record","Promise"],"sources":["../../src/load/index.d.ts"],"sourcesContent":["import { OptionalImportMap } from \"./import_type.js\";\n/**\n * Load a LangChain module from a serialized text representation.\n * NOTE: This functionality is currently in beta.\n * Loaded classes may change independently of semver.\n * @param text Serialized text representation of the module.\n * @param secretsMap\n * @param optionalImportsMap\n * @returns A loaded instance of a LangChain module.\n */\nexport declare function load<T>(text: string, secretsMap?: Record<string, any>, optionalImportsMap?: OptionalImportMap & Record<string, any>, additionalImportsMap?: Record<string, any>): Promise<T>;\n//# sourceMappingURL=index.d.ts.map"],"mappings":";;;;;;AAUA;;;;;;;AAAkM,iBAA1KC,IAA0K,CAAA,CAAA,CAAA,CAAA,IAAA,EAAA,MAAA,EAAA,UAAA,CAAA,EAAvIE,MAAuI,CAAA,MAAA,EAAA,GAAA,CAAA,EAAA,kBAAA,CAAA,EAA7FH,iBAA6F,GAAzEG,MAAyE,CAAA,MAAA,EAAA,GAAA,CAAA,EAAA,oBAAA,CAAA,EAA7BA,MAA6B,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,EAAPC,OAAO,CAACF,CAAD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["OptionalImportMap","load","T","Record","Promise"],"sources":["../../src/load/index.d.ts"],"sourcesContent":["import { OptionalImportMap } from \"./import_type.js\";\n/**\n * Load a LangChain module from a serialized text representation.\n * NOTE: This functionality is currently in beta.\n * Loaded classes may change independently of semver.\n * @param text Serialized text representation of the module.\n * @param secretsMap\n * @param optionalImportsMap\n * @returns A loaded instance of a LangChain module.\n */\nexport declare function load<T>(text: string, secretsMap?: Record<string, any>, optionalImportsMap?: OptionalImportMap & Record<string, any>, additionalImportsMap?: Record<string, any>): Promise<T>;\n//# sourceMappingURL=index.d.ts.map"],"mappings":";;;;;;AAUA;;;;;;;AAAkM,iBAA1KC,IAA0K,CAAA,CAAA,CAAA,CAAA,IAAA,EAAA,MAAA,EAAA,UAAA,CAAA,EAAvIE,MAAuI,CAAA,MAAA,EAAA,GAAA,CAAA,EAAA,kBAAA,CAAA,EAA7FH,iBAA6F,GAAzEG,MAAyE,CAAA,MAAA,EAAA,GAAA,CAAA,EAAA,oBAAA,CAAA,EAA7BA,MAA6B,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,EAAPC,OAAO,CAACF,CAAD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encoder_backed.d.cts","names":["Document","BaseStore","EncoderBackedStore","K","V","SerializedType","Promise","AsyncGenerator","createDocumentStoreFromByteStore","Uint8Array","Record","ArrayBufferLike"],"sources":["../../src/storage/encoder_backed.d.ts"],"sourcesContent":["import { Document } from \"@langchain/core/documents\";\nimport { BaseStore } from \"@langchain/core/stores\";\n/**\n * Class that provides a layer of abstraction over the base storage,\n * allowing for the encoding and decoding of keys and values. It extends\n * the BaseStore class.\n */\nexport declare class EncoderBackedStore<K, V, SerializedType = any> extends BaseStore<K, V> {\n lc_namespace: string[];\n store: BaseStore<string, SerializedType>;\n keyEncoder: (key: K) => string;\n valueSerializer: (value: V) => SerializedType;\n valueDeserializer: (value: SerializedType) => V;\n constructor(fields: {\n store: BaseStore<string, SerializedType>;\n keyEncoder: (key: K) => string;\n valueSerializer: (value: V) => SerializedType;\n valueDeserializer: (value: SerializedType) => V;\n });\n /**\n * Method to get multiple keys at once. It works with the encoded keys and\n * serialized values.\n * @param keys Array of keys to get\n * @returns Promise that resolves with an array of values or undefined for each key\n */\n mget(keys: K[]): Promise<(V | undefined)[]>;\n /**\n * Method to set multiple keys at once. It works with the encoded keys and\n * serialized values.\n * @param keyValuePairs Array of key-value pairs to set\n * @returns Promise that resolves when the operation is complete\n */\n mset(keyValuePairs: [K, V][]): Promise<void>;\n /**\n * Method to delete multiple keys at once. It works with the encoded keys.\n * @param keys Array of keys to delete\n * @returns Promise that resolves when the operation is complete\n */\n mdelete(keys: K[]): Promise<void>;\n /**\n * Method to yield keys. It works with the encoded keys.\n * @param prefix Optional prefix to filter keys\n * @returns AsyncGenerator that yields keys\n */\n yieldKeys(prefix?: string | undefined): AsyncGenerator<string | K>;\n}\nexport declare function createDocumentStoreFromByteStore(store: BaseStore<string, Uint8Array>): EncoderBackedStore<string, Document<Record<string, any>>, Uint8Array<ArrayBufferLike>>;\n//# sourceMappingURL=encoder_backed.d.ts.map"],"mappings":";;;;;;;AAOA;;;AAE6BK,cAFRH,kBAEQG,CAAAA,CAAAA,EAAAA,CAAAA,EAAAA,iBAAAA,GAAAA,CAAAA,SAF+CJ,SAE/CI,CAFyDF,CAEzDE,EAF4DD,CAE5DC,CAAAA,CAAAA;EAAlBJ,YAAAA,EAAAA,MAAAA,EAAAA;EACWE,KAAAA,EADXF,SACWE,CAAAA,MAAAA,EADOE,cACPF,CAAAA;EACOC,UAAAA,EAAAA,CAAAA,GAAAA,EADPD,CACOC,EAAAA,GAAAA,MAAAA;EAAMC,eAAAA,EAAAA,CAAAA,KAAAA,EAAND,CAAMC,EAAAA,GAAAA,cAAAA;EACJA,iBAAAA,EAAAA,CAAAA,KAAAA,EAAAA,cAAAA,EAAAA,GAAmBD,CAAnBC;EAAmBD,WAAAA,CAAAA,MAAAA,EAAAA;IAEjBC,KAAAA,EAAlBJ,SAAkBI,CAAAA,MAAAA,EAAAA,cAAAA,CAAAA;IAAlBJ,UAAAA,EAAAA,CAAAA,GAAAA,EACWE,CADXF,EAAAA,GAAAA,MAAAA;IACWE,eAAAA,EAAAA,CAAAA,KAAAA,EACOC,CADPD,EAAAA,GACaE,cADbF;IACOC,iBAAAA,EAAAA,CAAAA,KAAAA,EACEC,cADFD,EAAAA,GACqBA,CADrBA;EAAMC,CAAAA;EACJA;;;;;;EAePD,IAAAA,CAAAA,IAAAA,EAPbD,CAOaC,EAAAA,CAAAA,EAPPE,OAOOF,CAAAA,CAPEA,CAOFA,GAAAA,SAAAA,CAAAA,EAAAA,CAAAA;EAAOE;;;;;;EAzBkD,IAAA,CAAA,aAAA,EAAA,CAyB5DH,CAzB4D,EAyBzDC,CAzByD,CAAA,EAAA,CAAA,EAyBlDE,OAzBkD,CAAA,IAAA,CAAA;EAuC7DE;;;;;EAA6IG,OAAAA,CAAAA,IAAAA,EARnJR,CAQmJQ,EAAAA,CAAAA,EAR7IL,OAQ6IK,CAAAA,IAAAA,CAAAA;EAAXF;;AAAxC;;;0CAFtEF,wBAAwBJ;;iBAE5CK,gCAAAA,QAAwCP,kBAAkBQ,cAAcP,2BAA2BF,SAASU,sBAAsBD,WAAWE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encoder_backed.d.ts","names":["Document","BaseStore","EncoderBackedStore","K","V","SerializedType","Promise","AsyncGenerator","createDocumentStoreFromByteStore","Uint8Array","Record","ArrayBufferLike"],"sources":["../../src/storage/encoder_backed.d.ts"],"sourcesContent":["import { Document } from \"@langchain/core/documents\";\nimport { BaseStore } from \"@langchain/core/stores\";\n/**\n * Class that provides a layer of abstraction over the base storage,\n * allowing for the encoding and decoding of keys and values. It extends\n * the BaseStore class.\n */\nexport declare class EncoderBackedStore<K, V, SerializedType = any> extends BaseStore<K, V> {\n lc_namespace: string[];\n store: BaseStore<string, SerializedType>;\n keyEncoder: (key: K) => string;\n valueSerializer: (value: V) => SerializedType;\n valueDeserializer: (value: SerializedType) => V;\n constructor(fields: {\n store: BaseStore<string, SerializedType>;\n keyEncoder: (key: K) => string;\n valueSerializer: (value: V) => SerializedType;\n valueDeserializer: (value: SerializedType) => V;\n });\n /**\n * Method to get multiple keys at once. It works with the encoded keys and\n * serialized values.\n * @param keys Array of keys to get\n * @returns Promise that resolves with an array of values or undefined for each key\n */\n mget(keys: K[]): Promise<(V | undefined)[]>;\n /**\n * Method to set multiple keys at once. It works with the encoded keys and\n * serialized values.\n * @param keyValuePairs Array of key-value pairs to set\n * @returns Promise that resolves when the operation is complete\n */\n mset(keyValuePairs: [K, V][]): Promise<void>;\n /**\n * Method to delete multiple keys at once. It works with the encoded keys.\n * @param keys Array of keys to delete\n * @returns Promise that resolves when the operation is complete\n */\n mdelete(keys: K[]): Promise<void>;\n /**\n * Method to yield keys. It works with the encoded keys.\n * @param prefix Optional prefix to filter keys\n * @returns AsyncGenerator that yields keys\n */\n yieldKeys(prefix?: string | undefined): AsyncGenerator<string | K>;\n}\nexport declare function createDocumentStoreFromByteStore(store: BaseStore<string, Uint8Array>): EncoderBackedStore<string, Document<Record<string, any>>, Uint8Array<ArrayBufferLike>>;\n//# sourceMappingURL=encoder_backed.d.ts.map"],"mappings":";;;;;;;AAOA;;;AAE6BK,cAFRH,kBAEQG,CAAAA,CAAAA,EAAAA,CAAAA,EAAAA,iBAAAA,GAAAA,CAAAA,SAF+CJ,SAE/CI,CAFyDF,CAEzDE,EAF4DD,CAE5DC,CAAAA,CAAAA;EAAlBJ,YAAAA,EAAAA,MAAAA,EAAAA;EACWE,KAAAA,EADXF,SACWE,CAAAA,MAAAA,EADOE,cACPF,CAAAA;EACOC,UAAAA,EAAAA,CAAAA,GAAAA,EADPD,CACOC,EAAAA,GAAAA,MAAAA;EAAMC,eAAAA,EAAAA,CAAAA,KAAAA,EAAND,CAAMC,EAAAA,GAAAA,cAAAA;EACJA,iBAAAA,EAAAA,CAAAA,KAAAA,EAAAA,cAAAA,EAAAA,GAAmBD,CAAnBC;EAAmBD,WAAAA,CAAAA,MAAAA,EAAAA;IAEjBC,KAAAA,EAAlBJ,SAAkBI,CAAAA,MAAAA,EAAAA,cAAAA,CAAAA;IAAlBJ,UAAAA,EAAAA,CAAAA,GAAAA,EACWE,CADXF,EAAAA,GAAAA,MAAAA;IACWE,eAAAA,EAAAA,CAAAA,KAAAA,EACOC,CADPD,EAAAA,GACaE,cADbF;IACOC,iBAAAA,EAAAA,CAAAA,KAAAA,EACEC,cADFD,EAAAA,GACqBA,CADrBA;EAAMC,CAAAA;EACJA;;;;;;EAePD,IAAAA,CAAAA,IAAAA,EAPbD,CAOaC,EAAAA,CAAAA,EAPPE,OAOOF,CAAAA,CAPEA,CAOFA,GAAAA,SAAAA,CAAAA,EAAAA,CAAAA;EAAOE;;;;;;EAzBkD,IAAA,CAAA,aAAA,EAAA,CAyB5DH,CAzB4D,EAyBzDC,CAzByD,CAAA,EAAA,CAAA,EAyBlDE,OAzBkD,CAAA,IAAA,CAAA;EAuC7DE;;;;;EAA6IG,OAAAA,CAAAA,IAAAA,EARnJR,CAQmJQ,EAAAA,CAAAA,EAR7IL,OAQ6IK,CAAAA,IAAAA,CAAAA;EAAXF;;AAAxC;;;0CAFtEF,wBAAwBJ;;iBAE5CK,gCAAAA,QAAwCP,kBAAkBQ,cAAcP,2BAA2BF,SAASU,sBAAsBD,WAAWE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file_system.d.cts","names":["BaseStore","LocalFileStore","Uint8Array","ArrayBufferLike","Promise","AsyncGenerator"],"sources":["../../src/storage/file_system.d.ts"],"sourcesContent":["import { BaseStore } from \"@langchain/core/stores\";\n/**\n * File system implementation of the BaseStore using a dictionary. Used for\n * storing key-value pairs in the file system.\n * @example\n * ```typescript\n * const store = await LocalFileStore.fromPath(\"./messages\");\n * await store.mset(\n * Array.from({ length: 5 }).map((_, index) => [\n * `message:id:${index}`,\n * new TextEncoder().encode(\n * JSON.stringify(\n * index % 2 === 0\n * ? new AIMessage(\"ai stuff...\")\n * : new HumanMessage(\"human stuff...\"),\n * ),\n * ),\n * ]),\n * );\n * const retrievedMessages = await store.mget([\"message:id:0\", \"message:id:1\"]);\n * console.log(retrievedMessages.map((v) => new TextDecoder().decode(v)));\n * for await (const key of store.yieldKeys(\"message:id:\")) {\n * await store.mdelete([key]);\n * }\n * ```\n *\n * @security **Security Notice** This file store\n * can alter any text file in the provided directory and any subfolders.\n * Make sure that the path you specify when initializing the store is free\n * of other files.\n */\nexport declare class LocalFileStore extends BaseStore<string, Uint8Array> {\n lc_namespace: string[];\n rootPath: string;\n constructor(fields: {\n rootPath: string;\n });\n private getParsedFile;\n private setFileContent;\n /**\n * Returns the full path of the file where the value of the given key is stored.\n * @param key the key to get the full path for\n */\n private getFullPath;\n /**\n * Retrieves the values associated with the given keys from the store.\n * @param keys Keys to retrieve values for.\n * @returns Array of values associated with the given keys.\n */\n mget(keys: string[]): Promise<(Uint8Array<ArrayBufferLike> | undefined)[]>;\n /**\n * Sets the values for the given keys in the store.\n * @param keyValuePairs Array of key-value pairs to set in the store.\n * @returns Promise that resolves when all key-value pairs have been set.\n */\n mset(keyValuePairs: [string, Uint8Array][]): Promise<void>;\n /**\n * Deletes the given keys and their associated values from the store.\n * @param keys Keys to delete from the store.\n * @returns Promise that resolves when all keys have been deleted.\n */\n mdelete(keys: string[]): Promise<void>;\n /**\n * Asynchronous generator that yields keys from the store. If a prefix is\n * provided, it only yields keys that start with the prefix.\n * @param prefix Optional prefix to filter keys.\n * @returns AsyncGenerator that yields keys from the store.\n */\n yieldKeys(prefix?: string): AsyncGenerator<string>;\n /**\n * Static method for initializing the class.\n * Preforms a check to see if the directory exists, and if not, creates it.\n * @param path Path to the directory.\n * @returns Promise that resolves to an instance of the class.\n */\n static fromPath(rootPath: string): Promise<LocalFileStore>;\n}\n//# sourceMappingURL=file_system.d.ts.map"],"mappings":";;;;;;AA+BA;;;;;;;;;;;;AAAqD;;;;;;;;;;;;;;;;cAAhCC,cAAAA,SAAuBD,kBAAkBE;;;;;;;;;;;;;;;;;;wBAkBpCE,SAASF,WAAWC;;;;;;+BAMbD,gBAAgBE;;;;;;2BAMpBA;;;;;;;8BAOGC;;;;;;;qCAOOD,QAAQH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file_system.d.ts","names":["BaseStore","LocalFileStore","Uint8Array","ArrayBufferLike","Promise","AsyncGenerator"],"sources":["../../src/storage/file_system.d.ts"],"sourcesContent":["import { BaseStore } from \"@langchain/core/stores\";\n/**\n * File system implementation of the BaseStore using a dictionary. Used for\n * storing key-value pairs in the file system.\n * @example\n * ```typescript\n * const store = await LocalFileStore.fromPath(\"./messages\");\n * await store.mset(\n * Array.from({ length: 5 }).map((_, index) => [\n * `message:id:${index}`,\n * new TextEncoder().encode(\n * JSON.stringify(\n * index % 2 === 0\n * ? new AIMessage(\"ai stuff...\")\n * : new HumanMessage(\"human stuff...\"),\n * ),\n * ),\n * ]),\n * );\n * const retrievedMessages = await store.mget([\"message:id:0\", \"message:id:1\"]);\n * console.log(retrievedMessages.map((v) => new TextDecoder().decode(v)));\n * for await (const key of store.yieldKeys(\"message:id:\")) {\n * await store.mdelete([key]);\n * }\n * ```\n *\n * @security **Security Notice** This file store\n * can alter any text file in the provided directory and any subfolders.\n * Make sure that the path you specify when initializing the store is free\n * of other files.\n */\nexport declare class LocalFileStore extends BaseStore<string, Uint8Array> {\n lc_namespace: string[];\n rootPath: string;\n constructor(fields: {\n rootPath: string;\n });\n private getParsedFile;\n private setFileContent;\n /**\n * Returns the full path of the file where the value of the given key is stored.\n * @param key the key to get the full path for\n */\n private getFullPath;\n /**\n * Retrieves the values associated with the given keys from the store.\n * @param keys Keys to retrieve values for.\n * @returns Array of values associated with the given keys.\n */\n mget(keys: string[]): Promise<(Uint8Array<ArrayBufferLike> | undefined)[]>;\n /**\n * Sets the values for the given keys in the store.\n * @param keyValuePairs Array of key-value pairs to set in the store.\n * @returns Promise that resolves when all key-value pairs have been set.\n */\n mset(keyValuePairs: [string, Uint8Array][]): Promise<void>;\n /**\n * Deletes the given keys and their associated values from the store.\n * @param keys Keys to delete from the store.\n * @returns Promise that resolves when all keys have been deleted.\n */\n mdelete(keys: string[]): Promise<void>;\n /**\n * Asynchronous generator that yields keys from the store. If a prefix is\n * provided, it only yields keys that start with the prefix.\n * @param prefix Optional prefix to filter keys.\n * @returns AsyncGenerator that yields keys from the store.\n */\n yieldKeys(prefix?: string): AsyncGenerator<string>;\n /**\n * Static method for initializing the class.\n * Preforms a check to see if the directory exists, and if not, creates it.\n * @param path Path to the directory.\n * @returns Promise that resolves to an instance of the class.\n */\n static fromPath(rootPath: string): Promise<LocalFileStore>;\n}\n//# sourceMappingURL=file_system.d.ts.map"],"mappings":";;;;;;AA+BA;;;;;;;;;;;;AAAqD;;;;;;;;;;;;;;;;cAAhCC,cAAAA,SAAuBD,kBAAkBE;;;;;;;;;;;;;;;;;;wBAkBpCE,SAASF,WAAWC;;;;;;+BAMbD,gBAAgBE;;;;;;2BAMpBA;;;;;;;8BAOGC;;;;;;;qCAOOD,QAAQH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "langchain",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6-dev-1765431816670",
|
|
4
4
|
"description": "Typescript bindings for langchain",
|
|
5
5
|
"author": "LangChain",
|
|
6
6
|
"license": "MIT",
|
|
@@ -53,14 +53,15 @@
|
|
|
53
53
|
"typescript": "~5.8.3",
|
|
54
54
|
"vitest": "^3.2.4",
|
|
55
55
|
"yaml": "^2.8.1",
|
|
56
|
-
"@langchain/anthropic": "1.
|
|
56
|
+
"@langchain/anthropic": "1.3.0-dev-1765431816670",
|
|
57
57
|
"@langchain/cohere": "1.0.1",
|
|
58
|
-
"@langchain/core": "1.1.
|
|
58
|
+
"@langchain/core": "1.1.5-dev-1765431816670",
|
|
59
59
|
"@langchain/eslint": "0.1.1",
|
|
60
|
-
"@langchain/openai": "1.
|
|
60
|
+
"@langchain/openai": "1.2.0-dev-1765431816670",
|
|
61
|
+
"@langchain/tsconfig": "0.0.1"
|
|
61
62
|
},
|
|
62
63
|
"peerDependencies": {
|
|
63
|
-
"@langchain/core": "1.1.
|
|
64
|
+
"@langchain/core": "1.1.5-dev-1765431816670"
|
|
64
65
|
},
|
|
65
66
|
"dependencies": {
|
|
66
67
|
"@langchain/langgraph": "^1.0.0",
|
|
@@ -204,7 +205,7 @@
|
|
|
204
205
|
"test:watch": "vitest --watch",
|
|
205
206
|
"test:bench": "vitest --mode bench --run",
|
|
206
207
|
"test:integration": "vitest --mode int",
|
|
207
|
-
"format": "prettier --
|
|
208
|
-
"format:check": "prettier --
|
|
208
|
+
"format": "prettier --write \"src\"",
|
|
209
|
+
"format:check": "prettier --check \"src\""
|
|
209
210
|
}
|
|
210
211
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../dist/chat_models/universal.cjs");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../dist/chat_models/universal.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../dist/chat_models/universal.js";
|
package/chat_models/universal.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../dist/chat_models/universal.js";
|
package/hub/node.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../dist/hub/node.cjs");
|
package/hub/node.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../dist/hub/node.js";
|
package/hub/node.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../dist/hub/node.js";
|
package/hub/node.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../dist/hub/node.js";
|
package/hub.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("./dist/hub/index.cjs");
|
package/hub.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./dist/hub/index.js";
|
package/hub.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./dist/hub/index.js";
|
package/hub.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./dist/hub/index.js";
|
package/load/serializable.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../dist/load/serializable.cjs");
|
package/load/serializable.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../dist/load/serializable.js";
|
package/load/serializable.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../dist/load/serializable.js";
|
package/load/serializable.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../dist/load/serializable.js";
|
package/load.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("./dist/load/index.cjs");
|
package/load.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./dist/load/index.js";
|
package/load.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./dist/load/index.js";
|
package/load.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./dist/load/index.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../dist/storage/encoder_backed.cjs");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../dist/storage/encoder_backed.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../dist/storage/encoder_backed.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../dist/storage/encoder_backed.js";
|
package/storage/file_system.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../dist/storage/file_system.cjs");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../dist/storage/file_system.js";
|
package/storage/file_system.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../dist/storage/file_system.js";
|
package/storage/file_system.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../dist/storage/file_system.js";
|
package/storage/in_memory.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("../dist/storage/in_memory.cjs");
|
package/storage/in_memory.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../dist/storage/in_memory.js";
|
package/storage/in_memory.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../dist/storage/in_memory.js";
|
package/storage/in_memory.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../dist/storage/in_memory.js";
|