langchain 0.0.192 → 0.0.193
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/dist/agents/agent.cjs +24 -0
- package/dist/agents/agent.d.ts +24 -0
- package/dist/agents/agent.js +24 -0
- package/dist/agents/chat/outputParser.cjs +32 -0
- package/dist/agents/chat/outputParser.d.ts +32 -0
- package/dist/agents/chat/outputParser.js +32 -0
- package/dist/agents/executor.cjs +14 -0
- package/dist/agents/executor.d.ts +14 -0
- package/dist/agents/executor.js +14 -0
- package/dist/agents/mrkl/index.cjs +21 -0
- package/dist/agents/mrkl/index.d.ts +21 -0
- package/dist/agents/mrkl/index.js +21 -0
- package/dist/agents/openai/output_parser.cjs +65 -0
- package/dist/agents/openai/output_parser.d.ts +65 -0
- package/dist/agents/openai/output_parser.js +65 -0
- package/dist/agents/react/output_parser.cjs +16 -0
- package/dist/agents/react/output_parser.d.ts +16 -0
- package/dist/agents/react/output_parser.js +16 -0
- package/dist/agents/structured_chat/outputParser.cjs +12 -0
- package/dist/agents/structured_chat/outputParser.d.ts +12 -0
- package/dist/agents/structured_chat/outputParser.js +12 -0
- package/dist/agents/toolkits/aws_sfn.cjs +20 -0
- package/dist/agents/toolkits/aws_sfn.d.ts +20 -0
- package/dist/agents/toolkits/aws_sfn.js +20 -0
- package/dist/agents/toolkits/json/json.cjs +8 -0
- package/dist/agents/toolkits/json/json.d.ts +8 -0
- package/dist/agents/toolkits/json/json.js +8 -0
- package/dist/agents/toolkits/openapi/openapi.cjs +18 -0
- package/dist/agents/toolkits/openapi/openapi.d.ts +18 -0
- package/dist/agents/toolkits/openapi/openapi.js +18 -0
- package/dist/agents/toolkits/sql/sql.cjs +8 -0
- package/dist/agents/toolkits/sql/sql.d.ts +8 -0
- package/dist/agents/toolkits/sql/sql.js +8 -0
- package/dist/agents/toolkits/vectorstore/vectorstore.cjs +16 -0
- package/dist/agents/toolkits/vectorstore/vectorstore.d.ts +16 -0
- package/dist/agents/toolkits/vectorstore/vectorstore.js +16 -0
- package/dist/agents/toolkits/zapier/zapier.cjs +10 -0
- package/dist/agents/toolkits/zapier/zapier.d.ts +10 -0
- package/dist/agents/toolkits/zapier/zapier.js +10 -0
- package/dist/agents/xml/output_parser.cjs +21 -0
- package/dist/agents/xml/output_parser.d.ts +21 -0
- package/dist/agents/xml/output_parser.js +21 -0
- package/dist/cache/cloudflare_kv.cjs +13 -0
- package/dist/cache/cloudflare_kv.d.ts +13 -0
- package/dist/cache/cloudflare_kv.js +13 -0
- package/dist/cache/ioredis.cjs +13 -0
- package/dist/cache/ioredis.d.ts +13 -0
- package/dist/cache/ioredis.js +13 -0
- package/dist/cache/momento.cjs +19 -0
- package/dist/cache/momento.d.ts +19 -0
- package/dist/cache/momento.js +19 -0
- package/dist/cache/redis.cjs +10 -0
- package/dist/cache/redis.d.ts +10 -0
- package/dist/cache/redis.js +10 -0
- package/dist/cache/upstash_redis.cjs +15 -0
- package/dist/cache/upstash_redis.d.ts +15 -0
- package/dist/cache/upstash_redis.js +15 -0
- package/dist/callbacks/handlers/console.cjs +10 -0
- package/dist/callbacks/handlers/console.d.ts +10 -0
- package/dist/callbacks/handlers/console.js +10 -0
- package/dist/callbacks/manager.cjs +49 -0
- package/dist/callbacks/manager.d.ts +49 -0
- package/dist/callbacks/manager.js +49 -0
- package/dist/chains/analyze_documents_chain.cjs +18 -0
- package/dist/chains/analyze_documents_chain.d.ts +18 -0
- package/dist/chains/analyze_documents_chain.js +18 -0
- package/dist/chains/constitutional_ai/constitutional_chain.cjs +21 -0
- package/dist/chains/constitutional_ai/constitutional_chain.d.ts +21 -0
- package/dist/chains/constitutional_ai/constitutional_chain.js +21 -0
- package/dist/chains/constitutional_ai/constitutional_principle.cjs +21 -0
- package/dist/chains/constitutional_ai/constitutional_principle.d.ts +21 -0
- package/dist/chains/constitutional_ai/constitutional_principle.js +21 -0
- package/dist/chains/conversation.cjs +13 -0
- package/dist/chains/conversation.d.ts +13 -0
- package/dist/chains/conversation.js +13 -0
- package/dist/chains/conversational_retrieval_chain.cjs +29 -0
- package/dist/chains/conversational_retrieval_chain.d.ts +29 -0
- package/dist/chains/conversational_retrieval_chain.js +29 -0
- package/dist/chains/graph_qa/cypher.cjs +10 -0
- package/dist/chains/graph_qa/cypher.d.ts +10 -0
- package/dist/chains/graph_qa/cypher.js +10 -0
- package/dist/chains/openai_moderation.cjs +28 -0
- package/dist/chains/openai_moderation.d.ts +28 -0
- package/dist/chains/openai_moderation.js +28 -0
- package/dist/chains/retrieval_qa.cjs +21 -0
- package/dist/chains/retrieval_qa.d.ts +21 -0
- package/dist/chains/retrieval_qa.js +21 -0
- package/dist/chains/router/multi_prompt.cjs +19 -0
- package/dist/chains/router/multi_prompt.d.ts +19 -0
- package/dist/chains/router/multi_prompt.js +19 -0
- package/dist/chains/router/multi_retrieval_qa.cjs +29 -0
- package/dist/chains/router/multi_retrieval_qa.d.ts +29 -0
- package/dist/chains/router/multi_retrieval_qa.js +29 -0
- package/dist/chains/sequential_chain.cjs +43 -0
- package/dist/chains/sequential_chain.d.ts +43 -0
- package/dist/chains/sequential_chain.js +43 -0
- package/dist/chains/sql_db/sql_db_chain.cjs +9 -0
- package/dist/chains/sql_db/sql_db_chain.d.ts +9 -0
- package/dist/chains/sql_db/sql_db_chain.js +9 -0
- package/dist/chat_models/anthropic.cjs +9 -1
- package/dist/chat_models/anthropic.d.ts +9 -1
- package/dist/chat_models/anthropic.js +9 -1
- package/dist/chat_models/baiduwenxin.cjs +20 -0
- package/dist/chat_models/baiduwenxin.d.ts +20 -0
- package/dist/chat_models/baiduwenxin.js +20 -0
- package/dist/chat_models/base.cjs +2 -0
- package/dist/chat_models/base.d.ts +1 -1
- package/dist/chat_models/base.js +2 -0
- package/dist/chat_models/bedrock/index.cjs +11 -0
- package/dist/chat_models/bedrock/index.d.ts +11 -0
- package/dist/chat_models/bedrock/index.js +11 -0
- package/dist/chat_models/bedrock/web.cjs +9 -0
- package/dist/chat_models/bedrock/web.d.ts +9 -0
- package/dist/chat_models/bedrock/web.js +9 -0
- package/dist/chat_models/cloudflare_workersai.cjs +15 -0
- package/dist/chat_models/cloudflare_workersai.d.ts +15 -0
- package/dist/chat_models/cloudflare_workersai.js +15 -0
- package/dist/chat_models/fake.cjs +16 -0
- package/dist/chat_models/fake.d.ts +16 -0
- package/dist/chat_models/fake.js +16 -0
- package/dist/chat_models/fireworks.cjs +10 -0
- package/dist/chat_models/fireworks.d.ts +10 -0
- package/dist/chat_models/fireworks.js +10 -0
- package/dist/chat_models/googlepalm.cjs +24 -0
- package/dist/chat_models/googlepalm.d.ts +24 -0
- package/dist/chat_models/googlepalm.js +24 -0
- package/dist/chat_models/googlevertexai/index.cjs +7 -0
- package/dist/chat_models/googlevertexai/index.d.ts +7 -0
- package/dist/chat_models/googlevertexai/index.js +7 -0
- package/dist/chat_models/googlevertexai/web.cjs +9 -0
- package/dist/chat_models/googlevertexai/web.d.ts +9 -0
- package/dist/chat_models/googlevertexai/web.js +9 -0
- package/dist/chat_models/iflytek_xinghuo/index.cjs +8 -0
- package/dist/chat_models/iflytek_xinghuo/index.d.ts +8 -0
- package/dist/chat_models/iflytek_xinghuo/index.js +8 -0
- package/dist/chat_models/iflytek_xinghuo/web.cjs +8 -0
- package/dist/chat_models/iflytek_xinghuo/web.d.ts +8 -0
- package/dist/chat_models/iflytek_xinghuo/web.js +8 -0
- package/dist/chat_models/llama_cpp.cjs +17 -0
- package/dist/chat_models/llama_cpp.d.ts +17 -0
- package/dist/chat_models/llama_cpp.js +17 -0
- package/dist/chat_models/minimax.cjs +27 -0
- package/dist/chat_models/minimax.d.ts +27 -0
- package/dist/chat_models/minimax.js +27 -0
- package/dist/chat_models/ollama.cjs +24 -0
- package/dist/chat_models/ollama.d.ts +24 -0
- package/dist/chat_models/ollama.js +24 -0
- package/dist/chat_models/openai.cjs +15 -0
- package/dist/chat_models/openai.d.ts +15 -0
- package/dist/chat_models/openai.js +15 -0
- package/dist/chat_models/yandex.cjs +14 -0
- package/dist/chat_models/yandex.d.ts +14 -0
- package/dist/chat_models/yandex.js +14 -0
- package/dist/document_loaders/fs/directory.cjs +14 -0
- package/dist/document_loaders/fs/directory.d.ts +14 -0
- package/dist/document_loaders/fs/directory.js +14 -0
- package/dist/document_loaders/fs/openai_whisper_audio.cjs +10 -0
- package/dist/document_loaders/fs/openai_whisper_audio.d.ts +10 -0
- package/dist/document_loaders/fs/openai_whisper_audio.js +10 -0
- package/dist/document_loaders/fs/pdf.cjs +6 -0
- package/dist/document_loaders/fs/pdf.d.ts +6 -0
- package/dist/document_loaders/fs/pdf.js +6 -0
- package/dist/document_loaders/fs/srt.cjs +6 -0
- package/dist/document_loaders/fs/srt.d.ts +6 -0
- package/dist/document_loaders/fs/srt.js +6 -0
- package/dist/document_loaders/fs/text.cjs +5 -0
- package/dist/document_loaders/fs/text.d.ts +5 -0
- package/dist/document_loaders/fs/text.js +5 -0
- package/dist/document_loaders/fs/unstructured.cjs +7 -0
- package/dist/document_loaders/fs/unstructured.d.ts +7 -0
- package/dist/document_loaders/fs/unstructured.js +7 -0
- package/dist/document_loaders/web/apify_dataset.cjs +21 -0
- package/dist/document_loaders/web/apify_dataset.d.ts +21 -0
- package/dist/document_loaders/web/apify_dataset.js +21 -0
- package/dist/document_loaders/web/assemblyai.cjs +24 -0
- package/dist/document_loaders/web/assemblyai.d.ts +24 -0
- package/dist/document_loaders/web/assemblyai.js +24 -0
- package/dist/document_loaders/web/azure_blob_storage_file.cjs +11 -0
- package/dist/document_loaders/web/azure_blob_storage_file.d.ts +11 -0
- package/dist/document_loaders/web/azure_blob_storage_file.js +11 -0
- package/dist/document_loaders/web/cheerio.cjs +6 -0
- package/dist/document_loaders/web/cheerio.d.ts +6 -0
- package/dist/document_loaders/web/cheerio.js +6 -0
- package/dist/document_loaders/web/college_confidential.cjs +6 -0
- package/dist/document_loaders/web/college_confidential.d.ts +6 -0
- package/dist/document_loaders/web/college_confidential.js +6 -0
- package/dist/document_loaders/web/confluence.cjs +11 -0
- package/dist/document_loaders/web/confluence.d.ts +11 -0
- package/dist/document_loaders/web/confluence.js +11 -0
- package/dist/document_loaders/web/figma.cjs +9 -0
- package/dist/document_loaders/web/figma.d.ts +9 -0
- package/dist/document_loaders/web/figma.js +9 -0
- package/dist/document_loaders/web/notionapi.cjs +16 -0
- package/dist/document_loaders/web/notionapi.d.ts +16 -0
- package/dist/document_loaders/web/notionapi.js +16 -0
- package/dist/document_loaders/web/notiondb.cjs +11 -1
- package/dist/document_loaders/web/notiondb.d.ts +11 -1
- package/dist/document_loaders/web/notiondb.js +11 -1
- package/dist/document_loaders/web/pdf.cjs +6 -0
- package/dist/document_loaders/web/pdf.d.ts +6 -0
- package/dist/document_loaders/web/pdf.js +6 -0
- package/dist/document_loaders/web/puppeteer.cjs +12 -0
- package/dist/document_loaders/web/puppeteer.d.ts +12 -0
- package/dist/document_loaders/web/puppeteer.js +12 -0
- package/dist/document_loaders/web/s3.cjs +17 -0
- package/dist/document_loaders/web/s3.d.ts +17 -0
- package/dist/document_loaders/web/s3.js +17 -0
- package/dist/document_loaders/web/searchapi.cjs +9 -0
- package/dist/document_loaders/web/searchapi.d.ts +9 -0
- package/dist/document_loaders/web/searchapi.js +9 -0
- package/dist/document_loaders/web/serpapi.cjs +5 -0
- package/dist/document_loaders/web/serpapi.d.ts +5 -0
- package/dist/document_loaders/web/serpapi.js +5 -0
- package/dist/document_loaders/web/sonix_audio.cjs +12 -0
- package/dist/document_loaders/web/sonix_audio.d.ts +12 -0
- package/dist/document_loaders/web/sonix_audio.js +12 -0
- package/dist/document_loaders/web/sort_xyz_blockchain.cjs +22 -0
- package/dist/document_loaders/web/sort_xyz_blockchain.d.ts +22 -0
- package/dist/document_loaders/web/sort_xyz_blockchain.js +22 -0
- package/dist/document_loaders/web/youtube.cjs +9 -0
- package/dist/document_loaders/web/youtube.d.ts +9 -0
- package/dist/document_loaders/web/youtube.js +9 -0
- package/dist/document_transformers/html_to_text.cjs +18 -0
- package/dist/document_transformers/html_to_text.d.ts +18 -0
- package/dist/document_transformers/html_to_text.js +18 -0
- package/dist/document_transformers/mozilla_readability.cjs +18 -0
- package/dist/document_transformers/mozilla_readability.d.ts +18 -0
- package/dist/document_transformers/mozilla_readability.js +18 -0
- package/dist/embeddings/bedrock.cjs +17 -0
- package/dist/embeddings/bedrock.d.ts +17 -0
- package/dist/embeddings/bedrock.js +17 -0
- package/dist/embeddings/cache_backed.cjs +37 -0
- package/dist/embeddings/cache_backed.d.ts +37 -0
- package/dist/embeddings/cache_backed.js +37 -0
- package/dist/embeddings/cohere.cjs +10 -0
- package/dist/embeddings/cohere.d.ts +10 -0
- package/dist/embeddings/cohere.js +10 -0
- package/dist/embeddings/googlepalm.cjs +17 -0
- package/dist/embeddings/googlepalm.d.ts +17 -0
- package/dist/embeddings/googlepalm.js +17 -0
- package/dist/embeddings/googlevertexai.cjs +8 -0
- package/dist/embeddings/googlevertexai.d.ts +8 -0
- package/dist/embeddings/googlevertexai.js +8 -0
- package/dist/embeddings/hf_transformers.cjs +18 -0
- package/dist/embeddings/hf_transformers.d.ts +18 -0
- package/dist/embeddings/hf_transformers.js +18 -0
- package/dist/embeddings/llama_cpp.cjs +16 -0
- package/dist/embeddings/llama_cpp.d.ts +16 -0
- package/dist/embeddings/llama_cpp.js +16 -0
- package/dist/embeddings/minimax.cjs +15 -0
- package/dist/embeddings/minimax.d.ts +15 -0
- package/dist/embeddings/minimax.js +15 -0
- package/dist/embeddings/openai.cjs +10 -0
- package/dist/embeddings/openai.d.ts +10 -0
- package/dist/embeddings/openai.js +10 -0
- package/dist/embeddings/tensorflow.cjs +16 -0
- package/dist/embeddings/tensorflow.d.ts +16 -0
- package/dist/embeddings/tensorflow.js +16 -0
- package/dist/experimental/autogpt/agent.cjs +21 -0
- package/dist/experimental/autogpt/agent.d.ts +21 -0
- package/dist/experimental/autogpt/agent.js +21 -0
- package/dist/experimental/babyagi/agent.cjs +12 -0
- package/dist/experimental/babyagi/agent.d.ts +12 -0
- package/dist/experimental/babyagi/agent.js +12 -0
- package/dist/experimental/chat_models/ollama_functions.cjs +12 -15
- package/dist/experimental/chat_models/ollama_functions.d.ts +3 -4
- package/dist/experimental/chat_models/ollama_functions.js +13 -16
- package/dist/experimental/generative_agents/generative_agent.cjs +30 -0
- package/dist/experimental/generative_agents/generative_agent.d.ts +30 -0
- package/dist/experimental/generative_agents/generative_agent.js +30 -0
- package/dist/experimental/generative_agents/generative_agent_memory.cjs +18 -0
- package/dist/experimental/generative_agents/generative_agent_memory.d.ts +18 -0
- package/dist/experimental/generative_agents/generative_agent_memory.js +18 -0
- package/dist/llms/base.cjs +3 -1
- package/dist/llms/base.d.ts +1 -1
- package/dist/llms/base.js +3 -1
- package/dist/llms/cohere.cjs +13 -0
- package/dist/llms/cohere.d.ts +13 -0
- package/dist/llms/cohere.js +13 -0
- package/dist/llms/googlevertexai/index.cjs +12 -0
- package/dist/llms/googlevertexai/index.d.ts +12 -0
- package/dist/llms/googlevertexai/index.js +12 -0
- package/dist/llms/googlevertexai/web.cjs +12 -0
- package/dist/llms/googlevertexai/web.d.ts +12 -0
- package/dist/llms/googlevertexai/web.js +12 -0
- package/dist/llms/hf.cjs +13 -0
- package/dist/llms/hf.d.ts +13 -0
- package/dist/llms/hf.js +13 -0
- package/dist/llms/ollama.cjs +19 -0
- package/dist/llms/ollama.d.ts +19 -0
- package/dist/llms/ollama.js +19 -0
- package/dist/llms/openai-chat.cjs +17 -0
- package/dist/llms/openai-chat.d.ts +17 -0
- package/dist/llms/openai-chat.js +17 -0
- package/dist/llms/openai.cjs +14 -0
- package/dist/llms/openai.d.ts +14 -0
- package/dist/llms/openai.js +14 -0
- package/dist/llms/portkey.cjs +24 -0
- package/dist/llms/portkey.d.ts +24 -0
- package/dist/llms/portkey.js +24 -0
- package/dist/llms/replicate.cjs +11 -0
- package/dist/llms/replicate.d.ts +11 -0
- package/dist/llms/replicate.js +11 -0
- package/dist/memory/buffer_memory.cjs +24 -0
- package/dist/memory/buffer_memory.d.ts +24 -0
- package/dist/memory/buffer_memory.js +24 -0
- package/dist/memory/buffer_token_memory.cjs +15 -0
- package/dist/memory/buffer_token_memory.d.ts +15 -0
- package/dist/memory/buffer_token_memory.js +15 -0
- package/dist/memory/buffer_window_memory.cjs +23 -0
- package/dist/memory/buffer_window_memory.d.ts +23 -0
- package/dist/memory/buffer_window_memory.js +23 -0
- package/dist/memory/entity_memory.cjs +29 -0
- package/dist/memory/entity_memory.d.ts +29 -0
- package/dist/memory/entity_memory.js +29 -0
- package/dist/memory/summary.cjs +24 -0
- package/dist/memory/summary.d.ts +24 -0
- package/dist/memory/summary.js +24 -0
- package/dist/memory/summary_buffer.cjs +32 -0
- package/dist/memory/summary_buffer.d.ts +32 -0
- package/dist/memory/summary_buffer.js +32 -0
- package/dist/memory/vector_store.cjs +24 -0
- package/dist/memory/vector_store.d.ts +24 -0
- package/dist/memory/vector_store.js +24 -0
- package/dist/memory/zep.cjs +34 -0
- package/dist/memory/zep.d.ts +34 -0
- package/dist/memory/zep.js +34 -0
- package/dist/prompts/chat.cjs +31 -0
- package/dist/prompts/chat.d.ts +31 -0
- package/dist/prompts/chat.js +31 -0
- package/dist/prompts/few_shot.cjs +31 -0
- package/dist/prompts/few_shot.d.ts +31 -0
- package/dist/prompts/few_shot.js +31 -0
- package/dist/prompts/pipeline.cjs +39 -0
- package/dist/prompts/pipeline.d.ts +39 -0
- package/dist/prompts/pipeline.js +39 -0
- package/dist/prompts/selectors/LengthBasedExampleSelector.cjs +36 -0
- package/dist/prompts/selectors/LengthBasedExampleSelector.d.ts +36 -0
- package/dist/prompts/selectors/LengthBasedExampleSelector.js +36 -0
- package/dist/prompts/selectors/SemanticSimilarityExampleSelector.cjs +25 -0
- package/dist/prompts/selectors/SemanticSimilarityExampleSelector.d.ts +25 -0
- package/dist/prompts/selectors/SemanticSimilarityExampleSelector.js +25 -0
- package/dist/retrievers/amazon_kendra.cjs +16 -0
- package/dist/retrievers/amazon_kendra.d.ts +16 -0
- package/dist/retrievers/amazon_kendra.js +16 -0
- package/dist/retrievers/chaindesk.cjs +11 -0
- package/dist/retrievers/chaindesk.d.ts +11 -0
- package/dist/retrievers/chaindesk.js +11 -0
- package/dist/retrievers/contextual_compression.cjs +10 -0
- package/dist/retrievers/contextual_compression.d.ts +10 -0
- package/dist/retrievers/contextual_compression.js +10 -0
- package/dist/retrievers/document_compressors/embeddings_filter.cjs +13 -0
- package/dist/retrievers/document_compressors/embeddings_filter.d.ts +13 -0
- package/dist/retrievers/document_compressors/embeddings_filter.js +13 -0
- package/dist/retrievers/document_compressors/index.cjs +26 -0
- package/dist/retrievers/document_compressors/index.d.ts +26 -0
- package/dist/retrievers/document_compressors/index.js +26 -0
- package/dist/retrievers/hyde.cjs +19 -0
- package/dist/retrievers/hyde.d.ts +19 -0
- package/dist/retrievers/hyde.js +19 -0
- package/dist/retrievers/metal.cjs +11 -0
- package/dist/retrievers/metal.d.ts +11 -0
- package/dist/retrievers/metal.js +11 -0
- package/dist/retrievers/multi_query.cjs +13 -1
- package/dist/retrievers/multi_query.d.ts +13 -0
- package/dist/retrievers/multi_query.js +13 -1
- package/dist/retrievers/multi_vector.cjs +13 -0
- package/dist/retrievers/multi_vector.d.ts +13 -0
- package/dist/retrievers/multi_vector.js +13 -0
- package/dist/retrievers/parent_document.cjs +21 -0
- package/dist/retrievers/parent_document.d.ts +21 -0
- package/dist/retrievers/parent_document.js +21 -0
- package/dist/retrievers/remote/chatgpt-plugin.cjs +10 -0
- package/dist/retrievers/remote/chatgpt-plugin.d.ts +10 -0
- package/dist/retrievers/remote/chatgpt-plugin.js +10 -0
- package/dist/retrievers/self_query/chroma.cjs +15 -0
- package/dist/retrievers/self_query/chroma.d.ts +15 -0
- package/dist/retrievers/self_query/chroma.js +15 -0
- package/dist/retrievers/self_query/functional.cjs +7 -0
- package/dist/retrievers/self_query/functional.d.ts +7 -0
- package/dist/retrievers/self_query/functional.js +7 -0
- package/dist/retrievers/self_query/index.cjs +13 -0
- package/dist/retrievers/self_query/index.d.ts +13 -0
- package/dist/retrievers/self_query/index.js +13 -0
- package/dist/retrievers/self_query/pinecone.cjs +14 -0
- package/dist/retrievers/self_query/pinecone.d.ts +14 -0
- package/dist/retrievers/self_query/pinecone.js +14 -0
- package/dist/retrievers/self_query/supabase.cjs +14 -0
- package/dist/retrievers/self_query/supabase.d.ts +14 -0
- package/dist/retrievers/self_query/supabase.js +14 -0
- package/dist/retrievers/self_query/weaviate.cjs +14 -0
- package/dist/retrievers/self_query/weaviate.d.ts +14 -0
- package/dist/retrievers/self_query/weaviate.js +14 -0
- package/dist/retrievers/time_weighted.cjs +16 -0
- package/dist/retrievers/time_weighted.d.ts +16 -0
- package/dist/retrievers/time_weighted.js +16 -0
- package/dist/retrievers/vespa.cjs +15 -0
- package/dist/retrievers/vespa.d.ts +15 -0
- package/dist/retrievers/vespa.js +15 -0
- package/dist/retrievers/zep.cjs +10 -0
- package/dist/retrievers/zep.d.ts +10 -0
- package/dist/retrievers/zep.js +10 -0
- package/dist/schema/index.d.ts +8 -6
- package/dist/schema/output_parser.cjs +15 -0
- package/dist/schema/output_parser.d.ts +15 -0
- package/dist/schema/output_parser.js +15 -0
- package/dist/schema/runnable/base.cjs +20 -0
- package/dist/schema/runnable/base.d.ts +20 -0
- package/dist/schema/runnable/base.js +20 -0
- package/dist/schema/runnable/branch.cjs +28 -0
- package/dist/schema/runnable/branch.d.ts +28 -0
- package/dist/schema/runnable/branch.js +28 -0
- package/dist/storage/file_system.cjs +21 -0
- package/dist/storage/file_system.d.ts +21 -0
- package/dist/storage/file_system.js +21 -0
- package/dist/storage/in_memory.cjs +15 -0
- package/dist/storage/in_memory.d.ts +15 -0
- package/dist/storage/in_memory.js +15 -0
- package/dist/storage/ioredis.cjs +24 -0
- package/dist/storage/ioredis.d.ts +24 -0
- package/dist/storage/ioredis.js +24 -0
- package/dist/storage/upstash_redis.cjs +19 -0
- package/dist/storage/upstash_redis.d.ts +19 -0
- package/dist/storage/upstash_redis.js +19 -0
- package/dist/storage/vercel_kv.cjs +16 -0
- package/dist/storage/vercel_kv.d.ts +16 -0
- package/dist/storage/vercel_kv.js +16 -0
- package/dist/stores/message/cassandra.cjs +25 -0
- package/dist/stores/message/cassandra.d.ts +25 -0
- package/dist/stores/message/cassandra.js +25 -0
- package/dist/stores/message/cloudflare_d1.cjs +18 -0
- package/dist/stores/message/cloudflare_d1.d.ts +18 -0
- package/dist/stores/message/cloudflare_d1.js +18 -0
- package/dist/stores/message/firestore.cjs +19 -0
- package/dist/stores/message/firestore.d.ts +19 -0
- package/dist/stores/message/firestore.js +19 -0
- package/dist/stores/message/ioredis.cjs +18 -0
- package/dist/stores/message/ioredis.d.ts +18 -0
- package/dist/stores/message/ioredis.js +18 -0
- package/dist/stores/message/momento.cjs +18 -0
- package/dist/stores/message/momento.d.ts +18 -0
- package/dist/stores/message/momento.js +18 -0
- package/dist/stores/message/mongodb.cjs +11 -0
- package/dist/stores/message/mongodb.d.ts +11 -0
- package/dist/stores/message/mongodb.js +11 -0
- package/dist/stores/message/planetscale.cjs +18 -0
- package/dist/stores/message/planetscale.d.ts +18 -0
- package/dist/stores/message/planetscale.js +18 -0
- package/dist/stores/message/redis.cjs +18 -0
- package/dist/stores/message/redis.d.ts +18 -0
- package/dist/stores/message/redis.js +18 -0
- package/dist/stores/message/xata.cjs +23 -0
- package/dist/stores/message/xata.d.ts +23 -0
- package/dist/stores/message/xata.js +23 -0
- package/dist/tools/calculator.cjs +6 -0
- package/dist/tools/calculator.d.ts +6 -0
- package/dist/tools/calculator.js +6 -0
- package/dist/tools/google_calendar/create.cjs +22 -0
- package/dist/tools/google_calendar/create.d.ts +22 -0
- package/dist/tools/google_calendar/create.js +22 -0
- package/dist/tools/google_calendar/view.cjs +20 -0
- package/dist/tools/google_calendar/view.d.ts +20 -0
- package/dist/tools/google_calendar/view.js +20 -0
- package/dist/tools/searchapi.cjs +27 -0
- package/dist/tools/searchapi.d.ts +27 -0
- package/dist/tools/searchapi.js +27 -0
- package/dist/tools/searxng_search.cjs +20 -1
- package/dist/tools/searxng_search.d.ts +20 -1
- package/dist/tools/searxng_search.js +20 -1
- package/dist/tools/webbrowser.cjs +8 -0
- package/dist/tools/webbrowser.d.ts +8 -0
- package/dist/tools/webbrowser.js +8 -0
- package/dist/tools/wikipedia_query_run.cjs +8 -0
- package/dist/tools/wikipedia_query_run.d.ts +8 -0
- package/dist/tools/wikipedia_query_run.js +8 -0
- package/dist/tools/wolframalpha.cjs +9 -0
- package/dist/tools/wolframalpha.d.ts +9 -0
- package/dist/tools/wolframalpha.js +9 -0
- package/dist/util/googlevertexai-connection.cjs +3 -9
- package/dist/util/googlevertexai-connection.js +3 -9
- package/dist/vectorstores/opensearch.cjs +2 -1
- package/dist/vectorstores/opensearch.js +2 -1
- package/dist/vectorstores/prisma.cjs +6 -0
- package/dist/vectorstores/prisma.d.ts +3 -0
- package/dist/vectorstores/prisma.js +6 -0
- package/package.json +1 -1
|
@@ -7,6 +7,21 @@ const base_js_1 = require("./remote/base.cjs");
|
|
|
7
7
|
* Class responsible for retrieving data from Vespa. It extends the
|
|
8
8
|
* `RemoteRetriever` class and includes methods for creating the JSON body
|
|
9
9
|
* for a query and processing the JSON response from Vespa.
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const retriever = new VespaRetriever({
|
|
13
|
+
* url: "https:
|
|
14
|
+
* auth: false,
|
|
15
|
+
* query_body: {
|
|
16
|
+
* yql: "select content from paragraph where userQuery()",
|
|
17
|
+
* hits: 5,
|
|
18
|
+
* ranking: "documentation",
|
|
19
|
+
* locale: "en-us",
|
|
20
|
+
* },
|
|
21
|
+
* content_field: "content",
|
|
22
|
+
* });
|
|
23
|
+
* const result = await retriever.getRelevantDocuments("what is vespa?");
|
|
24
|
+
* ```
|
|
10
25
|
*/
|
|
11
26
|
class VespaRetriever extends base_js_1.RemoteRetriever {
|
|
12
27
|
static lc_name() {
|
|
@@ -14,6 +14,21 @@ export interface VespaRetrieverParams extends RemoteRetrieverParams {
|
|
|
14
14
|
* Class responsible for retrieving data from Vespa. It extends the
|
|
15
15
|
* `RemoteRetriever` class and includes methods for creating the JSON body
|
|
16
16
|
* for a query and processing the JSON response from Vespa.
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const retriever = new VespaRetriever({
|
|
20
|
+
* url: "https:
|
|
21
|
+
* auth: false,
|
|
22
|
+
* query_body: {
|
|
23
|
+
* yql: "select content from paragraph where userQuery()",
|
|
24
|
+
* hits: 5,
|
|
25
|
+
* ranking: "documentation",
|
|
26
|
+
* locale: "en-us",
|
|
27
|
+
* },
|
|
28
|
+
* content_field: "content",
|
|
29
|
+
* });
|
|
30
|
+
* const result = await retriever.getRelevantDocuments("what is vespa?");
|
|
31
|
+
* ```
|
|
17
32
|
*/
|
|
18
33
|
export declare class VespaRetriever extends RemoteRetriever {
|
|
19
34
|
static lc_name(): string;
|
package/dist/retrievers/vespa.js
CHANGED
|
@@ -4,6 +4,21 @@ import { RemoteRetriever, } from "./remote/base.js";
|
|
|
4
4
|
* Class responsible for retrieving data from Vespa. It extends the
|
|
5
5
|
* `RemoteRetriever` class and includes methods for creating the JSON body
|
|
6
6
|
* for a query and processing the JSON response from Vespa.
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const retriever = new VespaRetriever({
|
|
10
|
+
* url: "https:
|
|
11
|
+
* auth: false,
|
|
12
|
+
* query_body: {
|
|
13
|
+
* yql: "select content from paragraph where userQuery()",
|
|
14
|
+
* hits: 5,
|
|
15
|
+
* ranking: "documentation",
|
|
16
|
+
* locale: "en-us",
|
|
17
|
+
* },
|
|
18
|
+
* content_field: "content",
|
|
19
|
+
* });
|
|
20
|
+
* const result = await retriever.getRelevantDocuments("what is vespa?");
|
|
21
|
+
* ```
|
|
7
22
|
*/
|
|
8
23
|
export class VespaRetriever extends RemoteRetriever {
|
|
9
24
|
static lc_name() {
|
package/dist/retrievers/zep.cjs
CHANGED
|
@@ -7,6 +7,16 @@ const document_js_1 = require("../document.cjs");
|
|
|
7
7
|
/**
|
|
8
8
|
* Class for retrieving information from a Zep long-term memory store.
|
|
9
9
|
* Extends the BaseRetriever class.
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const retriever = new ZepRetriever({
|
|
13
|
+
* url: "http:
|
|
14
|
+
* sessionId: "session_exampleUUID",
|
|
15
|
+
* topK: 3,
|
|
16
|
+
* });
|
|
17
|
+
* const query = "Can I drive red cars in France?";
|
|
18
|
+
* const docs = await retriever.getRelevantDocuments(query);
|
|
19
|
+
* ```
|
|
10
20
|
*/
|
|
11
21
|
class ZepRetriever extends retriever_js_1.BaseRetriever {
|
|
12
22
|
static lc_name() {
|
package/dist/retrievers/zep.d.ts
CHANGED
|
@@ -27,6 +27,16 @@ export interface ZepRetrieverConfig extends BaseRetrieverInput {
|
|
|
27
27
|
/**
|
|
28
28
|
* Class for retrieving information from a Zep long-term memory store.
|
|
29
29
|
* Extends the BaseRetriever class.
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const retriever = new ZepRetriever({
|
|
33
|
+
* url: "http:
|
|
34
|
+
* sessionId: "session_exampleUUID",
|
|
35
|
+
* topK: 3,
|
|
36
|
+
* });
|
|
37
|
+
* const query = "Can I drive red cars in France?";
|
|
38
|
+
* const docs = await retriever.getRelevantDocuments(query);
|
|
39
|
+
* ```
|
|
30
40
|
*/
|
|
31
41
|
export declare class ZepRetriever extends BaseRetriever {
|
|
32
42
|
static lc_name(): string;
|
package/dist/retrievers/zep.js
CHANGED
|
@@ -4,6 +4,16 @@ import { Document } from "../document.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* Class for retrieving information from a Zep long-term memory store.
|
|
6
6
|
* Extends the BaseRetriever class.
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const retriever = new ZepRetriever({
|
|
10
|
+
* url: "http:
|
|
11
|
+
* sessionId: "session_exampleUUID",
|
|
12
|
+
* topK: 3,
|
|
13
|
+
* });
|
|
14
|
+
* const query = "Can I drive red cars in France?";
|
|
15
|
+
* const docs = await retriever.getRelevantDocuments(query);
|
|
16
|
+
* ```
|
|
7
17
|
*/
|
|
8
18
|
export class ZepRetriever extends BaseRetriever {
|
|
9
19
|
static lc_name() {
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -66,14 +66,16 @@ export interface StoredGeneration {
|
|
|
66
66
|
message?: StoredMessage;
|
|
67
67
|
}
|
|
68
68
|
export type MessageType = "human" | "ai" | "generic" | "system" | "function" | "tool";
|
|
69
|
-
export type MessageContent = string | {
|
|
70
|
-
type: "text"
|
|
71
|
-
text
|
|
72
|
-
|
|
69
|
+
export type MessageContent = string | ({
|
|
70
|
+
type: "text";
|
|
71
|
+
text: string;
|
|
72
|
+
} | {
|
|
73
|
+
type: "image_url";
|
|
74
|
+
image_url: string | {
|
|
73
75
|
url: string;
|
|
74
|
-
detail?: "low" | "high";
|
|
76
|
+
detail?: "auto" | "low" | "high";
|
|
75
77
|
};
|
|
76
|
-
}[];
|
|
78
|
+
})[];
|
|
77
79
|
export interface BaseMessageFields {
|
|
78
80
|
content: MessageContent;
|
|
79
81
|
name?: string;
|
|
@@ -171,6 +171,21 @@ class BaseCumulativeTransformOutputParser extends BaseTransformOutputParser {
|
|
|
171
171
|
exports.BaseCumulativeTransformOutputParser = BaseCumulativeTransformOutputParser;
|
|
172
172
|
/**
|
|
173
173
|
* OutputParser that parses LLMResult into the top likely string.
|
|
174
|
+
* @example
|
|
175
|
+
* ```typescript
|
|
176
|
+
* const promptTemplate = PromptTemplate.fromTemplate(
|
|
177
|
+
* "Tell me a joke about {topic}",
|
|
178
|
+
* );
|
|
179
|
+
*
|
|
180
|
+
* const chain = RunnableSequence.from([
|
|
181
|
+
* promptTemplate,
|
|
182
|
+
* new ChatOpenAI({}),
|
|
183
|
+
* new StringOutputParser(),
|
|
184
|
+
* ]);
|
|
185
|
+
*
|
|
186
|
+
* const result = await chain.invoke({ topic: "bears" });
|
|
187
|
+
* console.log("What do you call a bear with no teeth? A gummy bear!");
|
|
188
|
+
* ```
|
|
174
189
|
*/
|
|
175
190
|
class StringOutputParser extends BaseTransformOutputParser {
|
|
176
191
|
constructor() {
|
|
@@ -104,6 +104,21 @@ export declare abstract class BaseCumulativeTransformOutputParser<T = unknown> e
|
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
106
106
|
* OutputParser that parses LLMResult into the top likely string.
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* const promptTemplate = PromptTemplate.fromTemplate(
|
|
110
|
+
* "Tell me a joke about {topic}",
|
|
111
|
+
* );
|
|
112
|
+
*
|
|
113
|
+
* const chain = RunnableSequence.from([
|
|
114
|
+
* promptTemplate,
|
|
115
|
+
* new ChatOpenAI({}),
|
|
116
|
+
* new StringOutputParser(),
|
|
117
|
+
* ]);
|
|
118
|
+
*
|
|
119
|
+
* const result = await chain.invoke({ topic: "bears" });
|
|
120
|
+
* console.log("What do you call a bear with no teeth? A gummy bear!");
|
|
121
|
+
* ```
|
|
107
122
|
*/
|
|
108
123
|
export declare class StringOutputParser extends BaseTransformOutputParser<string> {
|
|
109
124
|
static lc_name(): string;
|
|
@@ -164,6 +164,21 @@ export class BaseCumulativeTransformOutputParser extends BaseTransformOutputPars
|
|
|
164
164
|
}
|
|
165
165
|
/**
|
|
166
166
|
* OutputParser that parses LLMResult into the top likely string.
|
|
167
|
+
* @example
|
|
168
|
+
* ```typescript
|
|
169
|
+
* const promptTemplate = PromptTemplate.fromTemplate(
|
|
170
|
+
* "Tell me a joke about {topic}",
|
|
171
|
+
* );
|
|
172
|
+
*
|
|
173
|
+
* const chain = RunnableSequence.from([
|
|
174
|
+
* promptTemplate,
|
|
175
|
+
* new ChatOpenAI({}),
|
|
176
|
+
* new StringOutputParser(),
|
|
177
|
+
* ]);
|
|
178
|
+
*
|
|
179
|
+
* const result = await chain.invoke({ topic: "bears" });
|
|
180
|
+
* console.log("What do you call a bear with no teeth? A gummy bear!");
|
|
181
|
+
* ```
|
|
167
182
|
*/
|
|
168
183
|
export class StringOutputParser extends BaseTransformOutputParser {
|
|
169
184
|
constructor() {
|
|
@@ -654,6 +654,14 @@ class RunnableRetry extends RunnableBinding {
|
|
|
654
654
|
exports.RunnableRetry = RunnableRetry;
|
|
655
655
|
/**
|
|
656
656
|
* A sequence of runnables, where the output of each is the input of the next.
|
|
657
|
+
* @example
|
|
658
|
+
* ```typescript
|
|
659
|
+
* const promptTemplate = PromptTemplate.fromTemplate(
|
|
660
|
+
* "Tell me a joke about {topic}",
|
|
661
|
+
* );
|
|
662
|
+
* const chain = RunnableSequence.from([promptTemplate, new ChatOpenAI({})]);
|
|
663
|
+
* const result = await chain.invoke({ topic: "bears" });
|
|
664
|
+
* ```
|
|
657
665
|
*/
|
|
658
666
|
class RunnableSequence extends Runnable {
|
|
659
667
|
static lc_name() {
|
|
@@ -839,6 +847,18 @@ exports.RunnableSequence = RunnableSequence;
|
|
|
839
847
|
/**
|
|
840
848
|
* A runnable that runs a mapping of runnables in parallel,
|
|
841
849
|
* and returns a mapping of their outputs.
|
|
850
|
+
* @example
|
|
851
|
+
* ```typescript
|
|
852
|
+
* const mapChain = RunnableMap.from({
|
|
853
|
+
* joke: PromptTemplate.fromTemplate("Tell me a joke about {topic}").pipe(
|
|
854
|
+
* new ChatAnthropic({}),
|
|
855
|
+
* ),
|
|
856
|
+
* poem: PromptTemplate.fromTemplate("write a 2-line poem about {topic}").pipe(
|
|
857
|
+
* new ChatAnthropic({}),
|
|
858
|
+
* ),
|
|
859
|
+
* });
|
|
860
|
+
* const result = await mapChain.invoke({ topic: "bear" });
|
|
861
|
+
* ```
|
|
842
862
|
*/
|
|
843
863
|
class RunnableMap extends Runnable {
|
|
844
864
|
static lc_name() {
|
|
@@ -249,6 +249,14 @@ export declare class RunnableRetry<RunInput = any, RunOutput = any, CallOptions
|
|
|
249
249
|
}
|
|
250
250
|
/**
|
|
251
251
|
* A sequence of runnables, where the output of each is the input of the next.
|
|
252
|
+
* @example
|
|
253
|
+
* ```typescript
|
|
254
|
+
* const promptTemplate = PromptTemplate.fromTemplate(
|
|
255
|
+
* "Tell me a joke about {topic}",
|
|
256
|
+
* );
|
|
257
|
+
* const chain = RunnableSequence.from([promptTemplate, new ChatOpenAI({})]);
|
|
258
|
+
* const result = await chain.invoke({ topic: "bears" });
|
|
259
|
+
* ```
|
|
252
260
|
*/
|
|
253
261
|
export declare class RunnableSequence<RunInput = any, RunOutput = any> extends Runnable<RunInput, RunOutput> {
|
|
254
262
|
static lc_name(): string;
|
|
@@ -283,6 +291,18 @@ export declare class RunnableSequence<RunInput = any, RunOutput = any> extends R
|
|
|
283
291
|
/**
|
|
284
292
|
* A runnable that runs a mapping of runnables in parallel,
|
|
285
293
|
* and returns a mapping of their outputs.
|
|
294
|
+
* @example
|
|
295
|
+
* ```typescript
|
|
296
|
+
* const mapChain = RunnableMap.from({
|
|
297
|
+
* joke: PromptTemplate.fromTemplate("Tell me a joke about {topic}").pipe(
|
|
298
|
+
* new ChatAnthropic({}),
|
|
299
|
+
* ),
|
|
300
|
+
* poem: PromptTemplate.fromTemplate("write a 2-line poem about {topic}").pipe(
|
|
301
|
+
* new ChatAnthropic({}),
|
|
302
|
+
* ),
|
|
303
|
+
* });
|
|
304
|
+
* const result = await mapChain.invoke({ topic: "bear" });
|
|
305
|
+
* ```
|
|
286
306
|
*/
|
|
287
307
|
export declare class RunnableMap<RunInput> extends Runnable<RunInput, Record<string, any>> {
|
|
288
308
|
static lc_name(): string;
|
|
@@ -644,6 +644,14 @@ export class RunnableRetry extends RunnableBinding {
|
|
|
644
644
|
}
|
|
645
645
|
/**
|
|
646
646
|
* A sequence of runnables, where the output of each is the input of the next.
|
|
647
|
+
* @example
|
|
648
|
+
* ```typescript
|
|
649
|
+
* const promptTemplate = PromptTemplate.fromTemplate(
|
|
650
|
+
* "Tell me a joke about {topic}",
|
|
651
|
+
* );
|
|
652
|
+
* const chain = RunnableSequence.from([promptTemplate, new ChatOpenAI({})]);
|
|
653
|
+
* const result = await chain.invoke({ topic: "bears" });
|
|
654
|
+
* ```
|
|
647
655
|
*/
|
|
648
656
|
export class RunnableSequence extends Runnable {
|
|
649
657
|
static lc_name() {
|
|
@@ -828,6 +836,18 @@ export class RunnableSequence extends Runnable {
|
|
|
828
836
|
/**
|
|
829
837
|
* A runnable that runs a mapping of runnables in parallel,
|
|
830
838
|
* and returns a mapping of their outputs.
|
|
839
|
+
* @example
|
|
840
|
+
* ```typescript
|
|
841
|
+
* const mapChain = RunnableMap.from({
|
|
842
|
+
* joke: PromptTemplate.fromTemplate("Tell me a joke about {topic}").pipe(
|
|
843
|
+
* new ChatAnthropic({}),
|
|
844
|
+
* ),
|
|
845
|
+
* poem: PromptTemplate.fromTemplate("write a 2-line poem about {topic}").pipe(
|
|
846
|
+
* new ChatAnthropic({}),
|
|
847
|
+
* ),
|
|
848
|
+
* });
|
|
849
|
+
* const result = await mapChain.invoke({ topic: "bear" });
|
|
850
|
+
* ```
|
|
831
851
|
*/
|
|
832
852
|
export class RunnableMap extends Runnable {
|
|
833
853
|
static lc_name() {
|
|
@@ -8,6 +8,34 @@ const base_js_1 = require("./base.cjs");
|
|
|
8
8
|
* it evaluates the condition of each branch in order and executes the
|
|
9
9
|
* corresponding branch if the condition is true. If none of the conditions
|
|
10
10
|
* are true, it executes the default branch.
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const branch = RunnableBranch.from([
|
|
14
|
+
* [
|
|
15
|
+
* (x: { topic: string; question: string }) =>
|
|
16
|
+
* x.topic.toLowerCase().includes("anthropic"),
|
|
17
|
+
* anthropicChain,
|
|
18
|
+
* ],
|
|
19
|
+
* [
|
|
20
|
+
* (x: { topic: string; question: string }) =>
|
|
21
|
+
* x.topic.toLowerCase().includes("langchain"),
|
|
22
|
+
* langChainChain,
|
|
23
|
+
* ],
|
|
24
|
+
* generalChain,
|
|
25
|
+
* ]);
|
|
26
|
+
*
|
|
27
|
+
* const fullChain = RunnableSequence.from([
|
|
28
|
+
* {
|
|
29
|
+
* topic: classificationChain,
|
|
30
|
+
* question: (input: { question: string }) => input.question,
|
|
31
|
+
* },
|
|
32
|
+
* branch,
|
|
33
|
+
* ]);
|
|
34
|
+
*
|
|
35
|
+
* const result = await fullChain.invoke({
|
|
36
|
+
* question: "how do I use LangChain?",
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
11
39
|
*/
|
|
12
40
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
41
|
class RunnableBranch extends base_js_1.Runnable {
|
|
@@ -21,6 +21,34 @@ export type BranchLike<RunInput, RunOutput> = [
|
|
|
21
21
|
* it evaluates the condition of each branch in order and executes the
|
|
22
22
|
* corresponding branch if the condition is true. If none of the conditions
|
|
23
23
|
* are true, it executes the default branch.
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const branch = RunnableBranch.from([
|
|
27
|
+
* [
|
|
28
|
+
* (x: { topic: string; question: string }) =>
|
|
29
|
+
* x.topic.toLowerCase().includes("anthropic"),
|
|
30
|
+
* anthropicChain,
|
|
31
|
+
* ],
|
|
32
|
+
* [
|
|
33
|
+
* (x: { topic: string; question: string }) =>
|
|
34
|
+
* x.topic.toLowerCase().includes("langchain"),
|
|
35
|
+
* langChainChain,
|
|
36
|
+
* ],
|
|
37
|
+
* generalChain,
|
|
38
|
+
* ]);
|
|
39
|
+
*
|
|
40
|
+
* const fullChain = RunnableSequence.from([
|
|
41
|
+
* {
|
|
42
|
+
* topic: classificationChain,
|
|
43
|
+
* question: (input: { question: string }) => input.question,
|
|
44
|
+
* },
|
|
45
|
+
* branch,
|
|
46
|
+
* ]);
|
|
47
|
+
*
|
|
48
|
+
* const result = await fullChain.invoke({
|
|
49
|
+
* question: "how do I use LangChain?",
|
|
50
|
+
* });
|
|
51
|
+
* ```
|
|
24
52
|
*/
|
|
25
53
|
export declare class RunnableBranch<RunInput = any, RunOutput = any> extends Runnable<RunInput, RunOutput> {
|
|
26
54
|
static lc_name(): string;
|
|
@@ -5,6 +5,34 @@ import { Runnable, _coerceToRunnable } from "./base.js";
|
|
|
5
5
|
* it evaluates the condition of each branch in order and executes the
|
|
6
6
|
* corresponding branch if the condition is true. If none of the conditions
|
|
7
7
|
* are true, it executes the default branch.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const branch = RunnableBranch.from([
|
|
11
|
+
* [
|
|
12
|
+
* (x: { topic: string; question: string }) =>
|
|
13
|
+
* x.topic.toLowerCase().includes("anthropic"),
|
|
14
|
+
* anthropicChain,
|
|
15
|
+
* ],
|
|
16
|
+
* [
|
|
17
|
+
* (x: { topic: string; question: string }) =>
|
|
18
|
+
* x.topic.toLowerCase().includes("langchain"),
|
|
19
|
+
* langChainChain,
|
|
20
|
+
* ],
|
|
21
|
+
* generalChain,
|
|
22
|
+
* ]);
|
|
23
|
+
*
|
|
24
|
+
* const fullChain = RunnableSequence.from([
|
|
25
|
+
* {
|
|
26
|
+
* topic: classificationChain,
|
|
27
|
+
* question: (input: { question: string }) => input.question,
|
|
28
|
+
* },
|
|
29
|
+
* branch,
|
|
30
|
+
* ]);
|
|
31
|
+
*
|
|
32
|
+
* const result = await fullChain.invoke({
|
|
33
|
+
* question: "how do I use LangChain?",
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
8
36
|
*/
|
|
9
37
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
38
|
export class RunnableBranch extends Runnable {
|
|
@@ -30,6 +30,27 @@ const storage_js_1 = require("../schema/storage.cjs");
|
|
|
30
30
|
/**
|
|
31
31
|
* File system implementation of the BaseStore using a dictionary. Used for
|
|
32
32
|
* storing key-value pairs in the file system.
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const store = await LocalFileStore.fromPath("./messages");
|
|
36
|
+
* await store.mset(
|
|
37
|
+
* Array.from({ length: 5 }).map((_, index) => [
|
|
38
|
+
* `message:id:${index}`,
|
|
39
|
+
* new TextEncoder().encode(
|
|
40
|
+
* JSON.stringify(
|
|
41
|
+
* index % 2 === 0
|
|
42
|
+
* ? new AIMessage("ai stuff...")
|
|
43
|
+
* : new HumanMessage("human stuff..."),
|
|
44
|
+
* ),
|
|
45
|
+
* ),
|
|
46
|
+
* ]),
|
|
47
|
+
* );
|
|
48
|
+
* const retrievedMessages = await store.mget(["message:id:0", "message:id:1"]);
|
|
49
|
+
* console.log(retrievedMessages.map((v) => new TextDecoder().decode(v)));
|
|
50
|
+
* for await (const key of store.yieldKeys("message:id:")) {
|
|
51
|
+
* await store.mdelete([key]);
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
33
54
|
*/
|
|
34
55
|
class LocalFileStore extends storage_js_1.BaseStore {
|
|
35
56
|
constructor(fields) {
|
|
@@ -2,6 +2,27 @@ import { BaseStore } from "../schema/storage.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* File system implementation of the BaseStore using a dictionary. Used for
|
|
4
4
|
* storing key-value pairs in the file system.
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* const store = await LocalFileStore.fromPath("./messages");
|
|
8
|
+
* await store.mset(
|
|
9
|
+
* Array.from({ length: 5 }).map((_, index) => [
|
|
10
|
+
* `message:id:${index}`,
|
|
11
|
+
* new TextEncoder().encode(
|
|
12
|
+
* JSON.stringify(
|
|
13
|
+
* index % 2 === 0
|
|
14
|
+
* ? new AIMessage("ai stuff...")
|
|
15
|
+
* : new HumanMessage("human stuff..."),
|
|
16
|
+
* ),
|
|
17
|
+
* ),
|
|
18
|
+
* ]),
|
|
19
|
+
* );
|
|
20
|
+
* const retrievedMessages = await store.mget(["message:id:0", "message:id:1"]);
|
|
21
|
+
* console.log(retrievedMessages.map((v) => new TextDecoder().decode(v)));
|
|
22
|
+
* for await (const key of store.yieldKeys("message:id:")) {
|
|
23
|
+
* await store.mdelete([key]);
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
5
26
|
*/
|
|
6
27
|
export declare class LocalFileStore extends BaseStore<string, Uint8Array> {
|
|
7
28
|
lc_namespace: string[];
|
|
@@ -4,6 +4,27 @@ import { BaseStore } from "../schema/storage.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* File system implementation of the BaseStore using a dictionary. Used for
|
|
6
6
|
* storing key-value pairs in the file system.
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const store = await LocalFileStore.fromPath("./messages");
|
|
10
|
+
* await store.mset(
|
|
11
|
+
* Array.from({ length: 5 }).map((_, index) => [
|
|
12
|
+
* `message:id:${index}`,
|
|
13
|
+
* new TextEncoder().encode(
|
|
14
|
+
* JSON.stringify(
|
|
15
|
+
* index % 2 === 0
|
|
16
|
+
* ? new AIMessage("ai stuff...")
|
|
17
|
+
* : new HumanMessage("human stuff..."),
|
|
18
|
+
* ),
|
|
19
|
+
* ),
|
|
20
|
+
* ]),
|
|
21
|
+
* );
|
|
22
|
+
* const retrievedMessages = await store.mget(["message:id:0", "message:id:1"]);
|
|
23
|
+
* console.log(retrievedMessages.map((v) => new TextDecoder().decode(v)));
|
|
24
|
+
* for await (const key of store.yieldKeys("message:id:")) {
|
|
25
|
+
* await store.mdelete([key]);
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
7
28
|
*/
|
|
8
29
|
export class LocalFileStore extends BaseStore {
|
|
9
30
|
constructor(fields) {
|
|
@@ -5,6 +5,21 @@ const storage_js_1 = require("../schema/storage.cjs");
|
|
|
5
5
|
/**
|
|
6
6
|
* In-memory implementation of the BaseStore using a dictionary. Used for
|
|
7
7
|
* storing key-value pairs in memory.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const store = new InMemoryStore<BaseMessage>();
|
|
11
|
+
* await store.mset(
|
|
12
|
+
* Array.from({ length: 5 }).map((_, index) => [
|
|
13
|
+
* `message:id:${index}`,
|
|
14
|
+
* index % 2 === 0
|
|
15
|
+
* ? new AIMessage("ai stuff...")
|
|
16
|
+
* : new HumanMessage("human stuff..."),
|
|
17
|
+
* ]),
|
|
18
|
+
* );
|
|
19
|
+
*
|
|
20
|
+
* const retrievedMessages = await store.mget(["message:id:0", "message:id:1"]);
|
|
21
|
+
* await store.mdelete(await store.yieldKeys("message:id:").toArray());
|
|
22
|
+
* ```
|
|
8
23
|
*/
|
|
9
24
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
25
|
class InMemoryStore extends storage_js_1.BaseStore {
|
|
@@ -2,6 +2,21 @@ import { BaseStore } from "../schema/storage.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* In-memory implementation of the BaseStore using a dictionary. Used for
|
|
4
4
|
* storing key-value pairs in memory.
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* const store = new InMemoryStore<BaseMessage>();
|
|
8
|
+
* await store.mset(
|
|
9
|
+
* Array.from({ length: 5 }).map((_, index) => [
|
|
10
|
+
* `message:id:${index}`,
|
|
11
|
+
* index % 2 === 0
|
|
12
|
+
* ? new AIMessage("ai stuff...")
|
|
13
|
+
* : new HumanMessage("human stuff..."),
|
|
14
|
+
* ]),
|
|
15
|
+
* );
|
|
16
|
+
*
|
|
17
|
+
* const retrievedMessages = await store.mget(["message:id:0", "message:id:1"]);
|
|
18
|
+
* await store.mdelete(await store.yieldKeys("message:id:").toArray());
|
|
19
|
+
* ```
|
|
5
20
|
*/
|
|
6
21
|
export declare class InMemoryStore<T = any> extends BaseStore<string, T> {
|
|
7
22
|
lc_namespace: string[];
|
|
@@ -2,6 +2,21 @@ import { BaseStore } from "../schema/storage.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* In-memory implementation of the BaseStore using a dictionary. Used for
|
|
4
4
|
* storing key-value pairs in memory.
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* const store = new InMemoryStore<BaseMessage>();
|
|
8
|
+
* await store.mset(
|
|
9
|
+
* Array.from({ length: 5 }).map((_, index) => [
|
|
10
|
+
* `message:id:${index}`,
|
|
11
|
+
* index % 2 === 0
|
|
12
|
+
* ? new AIMessage("ai stuff...")
|
|
13
|
+
* : new HumanMessage("human stuff..."),
|
|
14
|
+
* ]),
|
|
15
|
+
* );
|
|
16
|
+
*
|
|
17
|
+
* const retrievedMessages = await store.mget(["message:id:0", "message:id:1"]);
|
|
18
|
+
* await store.mdelete(await store.yieldKeys("message:id:").toArray());
|
|
19
|
+
* ```
|
|
5
20
|
*/
|
|
6
21
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
22
|
export class InMemoryStore extends BaseStore {
|
package/dist/storage/ioredis.cjs
CHANGED
|
@@ -6,6 +6,30 @@ const storage_js_1 = require("../schema/storage.cjs");
|
|
|
6
6
|
* Class that extends the BaseStore class to interact with a Redis
|
|
7
7
|
* database. It provides methods for getting, setting, and deleting data,
|
|
8
8
|
* as well as yielding keys from the database.
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const store = new RedisByteStore({ client: new Redis({}) });
|
|
12
|
+
* await store.mset([
|
|
13
|
+
* [
|
|
14
|
+
* "message:id:0",
|
|
15
|
+
* new TextEncoder().encode(JSON.stringify(new AIMessage("ai stuff..."))),
|
|
16
|
+
* ],
|
|
17
|
+
* [
|
|
18
|
+
* "message:id:1",
|
|
19
|
+
* new TextEncoder().encode(
|
|
20
|
+
* JSON.stringify(new HumanMessage("human stuff...")),
|
|
21
|
+
* ),
|
|
22
|
+
* ],
|
|
23
|
+
* ]);
|
|
24
|
+
* const retrievedMessages = await store.mget(["message:id:0", "message:id:1"]);
|
|
25
|
+
* console.log(retrievedMessages.map((v) => new TextDecoder().decode(v)));
|
|
26
|
+
* const yieldedKeys = [];
|
|
27
|
+
* for await (const key of store.yieldKeys("message:id:")) {
|
|
28
|
+
* yieldedKeys.push(key);
|
|
29
|
+
* }
|
|
30
|
+
* console.log(yieldedKeys);
|
|
31
|
+
* await store.mdelete(yieldedKeys);
|
|
32
|
+
* ```
|
|
9
33
|
*/
|
|
10
34
|
class RedisByteStore extends storage_js_1.BaseStore {
|
|
11
35
|
constructor(fields) {
|
|
@@ -5,6 +5,30 @@ import { BaseStore } from "../schema/storage.js";
|
|
|
5
5
|
* Class that extends the BaseStore class to interact with a Redis
|
|
6
6
|
* database. It provides methods for getting, setting, and deleting data,
|
|
7
7
|
* as well as yielding keys from the database.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const store = new RedisByteStore({ client: new Redis({}) });
|
|
11
|
+
* await store.mset([
|
|
12
|
+
* [
|
|
13
|
+
* "message:id:0",
|
|
14
|
+
* new TextEncoder().encode(JSON.stringify(new AIMessage("ai stuff..."))),
|
|
15
|
+
* ],
|
|
16
|
+
* [
|
|
17
|
+
* "message:id:1",
|
|
18
|
+
* new TextEncoder().encode(
|
|
19
|
+
* JSON.stringify(new HumanMessage("human stuff...")),
|
|
20
|
+
* ),
|
|
21
|
+
* ],
|
|
22
|
+
* ]);
|
|
23
|
+
* const retrievedMessages = await store.mget(["message:id:0", "message:id:1"]);
|
|
24
|
+
* console.log(retrievedMessages.map((v) => new TextDecoder().decode(v)));
|
|
25
|
+
* const yieldedKeys = [];
|
|
26
|
+
* for await (const key of store.yieldKeys("message:id:")) {
|
|
27
|
+
* yieldedKeys.push(key);
|
|
28
|
+
* }
|
|
29
|
+
* console.log(yieldedKeys);
|
|
30
|
+
* await store.mdelete(yieldedKeys);
|
|
31
|
+
* ```
|
|
8
32
|
*/
|
|
9
33
|
export declare class RedisByteStore extends BaseStore<string, Uint8Array> {
|
|
10
34
|
lc_namespace: string[];
|
package/dist/storage/ioredis.js
CHANGED
|
@@ -3,6 +3,30 @@ import { BaseStore } from "../schema/storage.js";
|
|
|
3
3
|
* Class that extends the BaseStore class to interact with a Redis
|
|
4
4
|
* database. It provides methods for getting, setting, and deleting data,
|
|
5
5
|
* as well as yielding keys from the database.
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* const store = new RedisByteStore({ client: new Redis({}) });
|
|
9
|
+
* await store.mset([
|
|
10
|
+
* [
|
|
11
|
+
* "message:id:0",
|
|
12
|
+
* new TextEncoder().encode(JSON.stringify(new AIMessage("ai stuff..."))),
|
|
13
|
+
* ],
|
|
14
|
+
* [
|
|
15
|
+
* "message:id:1",
|
|
16
|
+
* new TextEncoder().encode(
|
|
17
|
+
* JSON.stringify(new HumanMessage("human stuff...")),
|
|
18
|
+
* ),
|
|
19
|
+
* ],
|
|
20
|
+
* ]);
|
|
21
|
+
* const retrievedMessages = await store.mget(["message:id:0", "message:id:1"]);
|
|
22
|
+
* console.log(retrievedMessages.map((v) => new TextDecoder().decode(v)));
|
|
23
|
+
* const yieldedKeys = [];
|
|
24
|
+
* for await (const key of store.yieldKeys("message:id:")) {
|
|
25
|
+
* yieldedKeys.push(key);
|
|
26
|
+
* }
|
|
27
|
+
* console.log(yieldedKeys);
|
|
28
|
+
* await store.mdelete(yieldedKeys);
|
|
29
|
+
* ```
|
|
6
30
|
*/
|
|
7
31
|
export class RedisByteStore extends BaseStore {
|
|
8
32
|
constructor(fields) {
|