langchain 0.0.191 → 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/cache/file_system.cjs +1 -0
- package/cache/file_system.d.ts +1 -0
- package/cache/file_system.js +1 -0
- 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/file_system.cjs +73 -0
- package/dist/cache/file_system.d.ts +33 -0
- package/dist/cache/file_system.js +66 -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 +10 -1
- package/dist/chat_models/bedrock/web.d.ts +9 -0
- package/dist/chat_models/bedrock/web.js +10 -1
- 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 +15 -2
- package/dist/document_loaders/fs/pdf.d.ts +9 -1
- package/dist/document_loaders/fs/pdf.js +15 -2
- 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 +26 -2
- package/dist/document_loaders/web/apify_dataset.d.ts +25 -1
- package/dist/document_loaders/web/apify_dataset.js +26 -2
- 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 +15 -2
- package/dist/document_loaders/web/pdf.d.ts +9 -1
- package/dist/document_loaders/web/pdf.js +15 -2
- 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/bedrock/web.cjs +1 -1
- package/dist/llms/bedrock/web.js +1 -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/load/import_constants.cjs +2 -0
- package/dist/load/import_constants.js +2 -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 +20 -2
- package/dist/vectorstores/prisma.d.ts +4 -0
- package/dist/vectorstores/prisma.js +20 -2
- package/dist/vectorstores/rockset.cjs +353 -0
- package/dist/vectorstores/rockset.d.ts +202 -0
- package/dist/vectorstores/rockset.js +347 -0
- package/package.json +24 -5
- package/vectorstores/rockset.cjs +1 -0
- package/vectorstores/rockset.d.ts +1 -0
- package/vectorstores/rockset.js +1 -0
|
@@ -12,6 +12,25 @@ import { RouterOutputParser } from "../../output_parsers/router.js";
|
|
|
12
12
|
* A class that represents a multi-prompt chain in the LangChain
|
|
13
13
|
* framework. It extends the MultiRouteChain class and provides additional
|
|
14
14
|
* functionality specific to multi-prompt chains.
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const multiPromptChain = MultiPromptChain.fromLLMAndPrompts(new ChatOpenAI(), {
|
|
18
|
+
* promptNames: ["physics", "math", "history"],
|
|
19
|
+
* promptDescriptions: [
|
|
20
|
+
* "Good for answering questions about physics",
|
|
21
|
+
* "Good for answering math questions",
|
|
22
|
+
* "Good for answering questions about history",
|
|
23
|
+
* ],
|
|
24
|
+
* promptTemplates: [
|
|
25
|
+
* `You are a very smart physics professor. Here is a question:\n{input}\n`,
|
|
26
|
+
* `You are a very good mathematician. Here is a question:\n{input}\n`,
|
|
27
|
+
* `You are a very smart history professor. Here is a question:\n{input}\n`,
|
|
28
|
+
* ],
|
|
29
|
+
* });
|
|
30
|
+
* const result = await multiPromptChain.call({
|
|
31
|
+
* input: "What is the speed of light?",
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
15
34
|
*/
|
|
16
35
|
export class MultiPromptChain extends MultiRouteChain {
|
|
17
36
|
/**
|
|
@@ -16,6 +16,35 @@ const router_js_1 = require("../../output_parsers/router.cjs");
|
|
|
16
16
|
* the LangChain framework. It extends the MultiRouteChain class and
|
|
17
17
|
* provides additional functionality specific to multi-retrieval QA
|
|
18
18
|
* chains.
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const multiRetrievalQAChain = MultiRetrievalQAChain.fromLLMAndRetrievers(
|
|
22
|
+
* new ChatOpenAI(),
|
|
23
|
+
* {
|
|
24
|
+
* retrieverNames: ["aqua teen", "mst3k", "animaniacs"],
|
|
25
|
+
* retrieverDescriptions: [
|
|
26
|
+
* "Good for answering questions about Aqua Teen Hunger Force theme song",
|
|
27
|
+
* "Good for answering questions about Mystery Science Theater 3000 theme song",
|
|
28
|
+
* "Good for answering questions about Animaniacs theme song",
|
|
29
|
+
* ],
|
|
30
|
+
* retrievers: [
|
|
31
|
+
* new MemoryVectorStore().asRetriever(3),
|
|
32
|
+
* new MemoryVectorStore().asRetriever(3),
|
|
33
|
+
* new MemoryVectorStore().asRetriever(3),
|
|
34
|
+
* ],
|
|
35
|
+
* retrievalQAChainOpts: {
|
|
36
|
+
* returnSourceDocuments: true,
|
|
37
|
+
* },
|
|
38
|
+
* },
|
|
39
|
+
* );
|
|
40
|
+
*
|
|
41
|
+
* const result = await multiRetrievalQAChain.call({
|
|
42
|
+
* input:
|
|
43
|
+
* "In the Aqua Teen Hunger Force theme song, who calls himself the mike rula?",
|
|
44
|
+
* });
|
|
45
|
+
*
|
|
46
|
+
* console.log(result.sourceDocuments, result.text);
|
|
47
|
+
* ```
|
|
19
48
|
*/
|
|
20
49
|
class MultiRetrievalQAChain extends multi_route_js_1.MultiRouteChain {
|
|
21
50
|
get outputKeys() {
|
|
@@ -19,6 +19,35 @@ export type MultiRetrievalDefaults = {
|
|
|
19
19
|
* the LangChain framework. It extends the MultiRouteChain class and
|
|
20
20
|
* provides additional functionality specific to multi-retrieval QA
|
|
21
21
|
* chains.
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const multiRetrievalQAChain = MultiRetrievalQAChain.fromLLMAndRetrievers(
|
|
25
|
+
* new ChatOpenAI(),
|
|
26
|
+
* {
|
|
27
|
+
* retrieverNames: ["aqua teen", "mst3k", "animaniacs"],
|
|
28
|
+
* retrieverDescriptions: [
|
|
29
|
+
* "Good for answering questions about Aqua Teen Hunger Force theme song",
|
|
30
|
+
* "Good for answering questions about Mystery Science Theater 3000 theme song",
|
|
31
|
+
* "Good for answering questions about Animaniacs theme song",
|
|
32
|
+
* ],
|
|
33
|
+
* retrievers: [
|
|
34
|
+
* new MemoryVectorStore().asRetriever(3),
|
|
35
|
+
* new MemoryVectorStore().asRetriever(3),
|
|
36
|
+
* new MemoryVectorStore().asRetriever(3),
|
|
37
|
+
* ],
|
|
38
|
+
* retrievalQAChainOpts: {
|
|
39
|
+
* returnSourceDocuments: true,
|
|
40
|
+
* },
|
|
41
|
+
* },
|
|
42
|
+
* );
|
|
43
|
+
*
|
|
44
|
+
* const result = await multiRetrievalQAChain.call({
|
|
45
|
+
* input:
|
|
46
|
+
* "In the Aqua Teen Hunger Force theme song, who calls himself the mike rula?",
|
|
47
|
+
* });
|
|
48
|
+
*
|
|
49
|
+
* console.log(result.sourceDocuments, result.text);
|
|
50
|
+
* ```
|
|
22
51
|
*/
|
|
23
52
|
export declare class MultiRetrievalQAChain extends MultiRouteChain {
|
|
24
53
|
get outputKeys(): string[];
|
|
@@ -13,6 +13,35 @@ import { RouterOutputParser } from "../../output_parsers/router.js";
|
|
|
13
13
|
* the LangChain framework. It extends the MultiRouteChain class and
|
|
14
14
|
* provides additional functionality specific to multi-retrieval QA
|
|
15
15
|
* chains.
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const multiRetrievalQAChain = MultiRetrievalQAChain.fromLLMAndRetrievers(
|
|
19
|
+
* new ChatOpenAI(),
|
|
20
|
+
* {
|
|
21
|
+
* retrieverNames: ["aqua teen", "mst3k", "animaniacs"],
|
|
22
|
+
* retrieverDescriptions: [
|
|
23
|
+
* "Good for answering questions about Aqua Teen Hunger Force theme song",
|
|
24
|
+
* "Good for answering questions about Mystery Science Theater 3000 theme song",
|
|
25
|
+
* "Good for answering questions about Animaniacs theme song",
|
|
26
|
+
* ],
|
|
27
|
+
* retrievers: [
|
|
28
|
+
* new MemoryVectorStore().asRetriever(3),
|
|
29
|
+
* new MemoryVectorStore().asRetriever(3),
|
|
30
|
+
* new MemoryVectorStore().asRetriever(3),
|
|
31
|
+
* ],
|
|
32
|
+
* retrievalQAChainOpts: {
|
|
33
|
+
* returnSourceDocuments: true,
|
|
34
|
+
* },
|
|
35
|
+
* },
|
|
36
|
+
* );
|
|
37
|
+
*
|
|
38
|
+
* const result = await multiRetrievalQAChain.call({
|
|
39
|
+
* input:
|
|
40
|
+
* "In the Aqua Teen Hunger Force theme song, who calls himself the mike rula?",
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* console.log(result.sourceDocuments, result.text);
|
|
44
|
+
* ```
|
|
16
45
|
*/
|
|
17
46
|
export class MultiRetrievalQAChain extends MultiRouteChain {
|
|
18
47
|
get outputKeys() {
|
|
@@ -10,6 +10,49 @@ function formatSet(input) {
|
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Chain where the outputs of one chain feed directly into next.
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const promptTemplate = new PromptTemplate({
|
|
16
|
+
* template: `You are a playwright. Given the title of play and the era it is set in, it is your job to write a synopsis for that title.
|
|
17
|
+
* Title: {title}
|
|
18
|
+
* Era: {era}
|
|
19
|
+
* Playwright: This is a synopsis for the above play:`,
|
|
20
|
+
* inputVariables: ["title", "era"],
|
|
21
|
+
* });
|
|
22
|
+
|
|
23
|
+
* const reviewPromptTemplate = new PromptTemplate({
|
|
24
|
+
* template: `You are a play critic from the New York Times. Given the synopsis of play, it is your job to write a review for that play.
|
|
25
|
+
*
|
|
26
|
+
* Play Synopsis:
|
|
27
|
+
* {synopsis}
|
|
28
|
+
* Review from a New York Times play critic of the above play:`,
|
|
29
|
+
* inputVariables: ["synopsis"],
|
|
30
|
+
* });
|
|
31
|
+
|
|
32
|
+
* const overallChain = new SequentialChain({
|
|
33
|
+
* chains: [
|
|
34
|
+
* new LLMChain({
|
|
35
|
+
* llm: new ChatOpenAI({ temperature: 0 }),
|
|
36
|
+
* prompt: promptTemplate,
|
|
37
|
+
* outputKey: "synopsis",
|
|
38
|
+
* }),
|
|
39
|
+
* new LLMChain({
|
|
40
|
+
* llm: new OpenAI({ temperature: 0 }),
|
|
41
|
+
* prompt: reviewPromptTemplate,
|
|
42
|
+
* outputKey: "review",
|
|
43
|
+
* }),
|
|
44
|
+
* ],
|
|
45
|
+
* inputVariables: ["era", "title"],
|
|
46
|
+
* outputVariables: ["synopsis", "review"],
|
|
47
|
+
* verbose: true,
|
|
48
|
+
* });
|
|
49
|
+
|
|
50
|
+
* const chainExecutionResult = await overallChain.call({
|
|
51
|
+
* title: "Tragedy at sunset on the beach",
|
|
52
|
+
* era: "Victorian England",
|
|
53
|
+
* });
|
|
54
|
+
* console.log(chainExecutionResult);
|
|
55
|
+
* ```
|
|
13
56
|
*/
|
|
14
57
|
class SequentialChain extends base_js_1.BaseChain {
|
|
15
58
|
static lc_name() {
|
|
@@ -17,6 +17,49 @@ export interface SequentialChainInput extends ChainInputs {
|
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Chain where the outputs of one chain feed directly into next.
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const promptTemplate = new PromptTemplate({
|
|
23
|
+
* template: `You are a playwright. Given the title of play and the era it is set in, it is your job to write a synopsis for that title.
|
|
24
|
+
* Title: {title}
|
|
25
|
+
* Era: {era}
|
|
26
|
+
* Playwright: This is a synopsis for the above play:`,
|
|
27
|
+
* inputVariables: ["title", "era"],
|
|
28
|
+
* });
|
|
29
|
+
|
|
30
|
+
* const reviewPromptTemplate = new PromptTemplate({
|
|
31
|
+
* template: `You are a play critic from the New York Times. Given the synopsis of play, it is your job to write a review for that play.
|
|
32
|
+
*
|
|
33
|
+
* Play Synopsis:
|
|
34
|
+
* {synopsis}
|
|
35
|
+
* Review from a New York Times play critic of the above play:`,
|
|
36
|
+
* inputVariables: ["synopsis"],
|
|
37
|
+
* });
|
|
38
|
+
|
|
39
|
+
* const overallChain = new SequentialChain({
|
|
40
|
+
* chains: [
|
|
41
|
+
* new LLMChain({
|
|
42
|
+
* llm: new ChatOpenAI({ temperature: 0 }),
|
|
43
|
+
* prompt: promptTemplate,
|
|
44
|
+
* outputKey: "synopsis",
|
|
45
|
+
* }),
|
|
46
|
+
* new LLMChain({
|
|
47
|
+
* llm: new OpenAI({ temperature: 0 }),
|
|
48
|
+
* prompt: reviewPromptTemplate,
|
|
49
|
+
* outputKey: "review",
|
|
50
|
+
* }),
|
|
51
|
+
* ],
|
|
52
|
+
* inputVariables: ["era", "title"],
|
|
53
|
+
* outputVariables: ["synopsis", "review"],
|
|
54
|
+
* verbose: true,
|
|
55
|
+
* });
|
|
56
|
+
|
|
57
|
+
* const chainExecutionResult = await overallChain.call({
|
|
58
|
+
* title: "Tragedy at sunset on the beach",
|
|
59
|
+
* era: "Victorian England",
|
|
60
|
+
* });
|
|
61
|
+
* console.log(chainExecutionResult);
|
|
62
|
+
* ```
|
|
20
63
|
*/
|
|
21
64
|
export declare class SequentialChain extends BaseChain implements SequentialChainInput {
|
|
22
65
|
static lc_name(): string;
|
|
@@ -7,6 +7,49 @@ function formatSet(input) {
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Chain where the outputs of one chain feed directly into next.
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const promptTemplate = new PromptTemplate({
|
|
13
|
+
* template: `You are a playwright. Given the title of play and the era it is set in, it is your job to write a synopsis for that title.
|
|
14
|
+
* Title: {title}
|
|
15
|
+
* Era: {era}
|
|
16
|
+
* Playwright: This is a synopsis for the above play:`,
|
|
17
|
+
* inputVariables: ["title", "era"],
|
|
18
|
+
* });
|
|
19
|
+
|
|
20
|
+
* const reviewPromptTemplate = new PromptTemplate({
|
|
21
|
+
* template: `You are a play critic from the New York Times. Given the synopsis of play, it is your job to write a review for that play.
|
|
22
|
+
*
|
|
23
|
+
* Play Synopsis:
|
|
24
|
+
* {synopsis}
|
|
25
|
+
* Review from a New York Times play critic of the above play:`,
|
|
26
|
+
* inputVariables: ["synopsis"],
|
|
27
|
+
* });
|
|
28
|
+
|
|
29
|
+
* const overallChain = new SequentialChain({
|
|
30
|
+
* chains: [
|
|
31
|
+
* new LLMChain({
|
|
32
|
+
* llm: new ChatOpenAI({ temperature: 0 }),
|
|
33
|
+
* prompt: promptTemplate,
|
|
34
|
+
* outputKey: "synopsis",
|
|
35
|
+
* }),
|
|
36
|
+
* new LLMChain({
|
|
37
|
+
* llm: new OpenAI({ temperature: 0 }),
|
|
38
|
+
* prompt: reviewPromptTemplate,
|
|
39
|
+
* outputKey: "review",
|
|
40
|
+
* }),
|
|
41
|
+
* ],
|
|
42
|
+
* inputVariables: ["era", "title"],
|
|
43
|
+
* outputVariables: ["synopsis", "review"],
|
|
44
|
+
* verbose: true,
|
|
45
|
+
* });
|
|
46
|
+
|
|
47
|
+
* const chainExecutionResult = await overallChain.call({
|
|
48
|
+
* title: "Tragedy at sunset on the beach",
|
|
49
|
+
* era: "Victorian England",
|
|
50
|
+
* });
|
|
51
|
+
* console.log(chainExecutionResult);
|
|
52
|
+
* ```
|
|
10
53
|
*/
|
|
11
54
|
export class SequentialChain extends BaseChain {
|
|
12
55
|
static lc_name() {
|
|
@@ -21,6 +21,15 @@ const sql_utils_js_1 = require("../../util/sql_utils.cjs");
|
|
|
21
21
|
* to limit which tables can/cannot be accessed.
|
|
22
22
|
*
|
|
23
23
|
* @link See https://js.langchain.com/docs/security for more information.
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const chain = new SqlDatabaseChain({
|
|
27
|
+
* llm: new OpenAI({ temperature: 0 }),
|
|
28
|
+
* database: new SqlDatabase({ ...config }),
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* const result = await chain.run("How many tracks are there?");
|
|
32
|
+
* ```
|
|
24
33
|
*/
|
|
25
34
|
class SqlDatabaseChain extends base_js_1.BaseChain {
|
|
26
35
|
static lc_name() {
|
|
@@ -33,6 +33,15 @@ export interface SqlDatabaseChainInput extends ChainInputs {
|
|
|
33
33
|
* to limit which tables can/cannot be accessed.
|
|
34
34
|
*
|
|
35
35
|
* @link See https://js.langchain.com/docs/security for more information.
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* const chain = new SqlDatabaseChain({
|
|
39
|
+
* llm: new OpenAI({ temperature: 0 }),
|
|
40
|
+
* database: new SqlDatabase({ ...config }),
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* const result = await chain.run("How many tracks are there?");
|
|
44
|
+
* ```
|
|
36
45
|
*/
|
|
37
46
|
export declare class SqlDatabaseChain extends BaseChain {
|
|
38
47
|
static lc_name(): string;
|
|
@@ -18,6 +18,15 @@ import { getPromptTemplateFromDataSource } from "../../util/sql_utils.js";
|
|
|
18
18
|
* to limit which tables can/cannot be accessed.
|
|
19
19
|
*
|
|
20
20
|
* @link See https://js.langchain.com/docs/security for more information.
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const chain = new SqlDatabaseChain({
|
|
24
|
+
* llm: new OpenAI({ temperature: 0 }),
|
|
25
|
+
* database: new SqlDatabase({ ...config }),
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* const result = await chain.run("How many tracks are there?");
|
|
29
|
+
* ```
|
|
21
30
|
*/
|
|
22
31
|
export class SqlDatabaseChain extends BaseChain {
|
|
23
32
|
static lc_name() {
|
|
@@ -53,7 +53,15 @@ exports.DEFAULT_STOP_SEQUENCES = [sdk_1.HUMAN_PROMPT];
|
|
|
53
53
|
* https://console.anthropic.com/docs/api/reference |
|
|
54
54
|
* `anthropic.complete`} can be passed through {@link invocationKwargs},
|
|
55
55
|
* even if not explicitly available on this class.
|
|
56
|
-
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* const model = new ChatAnthropic({
|
|
59
|
+
* temperature: 0.9,
|
|
60
|
+
* anthropicApiKey: 'YOUR-API-KEY',
|
|
61
|
+
* });
|
|
62
|
+
* const res = await model.invoke({ input: 'Hello!' });
|
|
63
|
+
* console.log(res);
|
|
64
|
+
* ```
|
|
57
65
|
*/
|
|
58
66
|
class ChatAnthropic extends base_js_1.BaseChatModel {
|
|
59
67
|
static lc_name() {
|
|
@@ -69,7 +69,15 @@ type Kwargs = Record<string, any>;
|
|
|
69
69
|
* https://console.anthropic.com/docs/api/reference |
|
|
70
70
|
* `anthropic.complete`} can be passed through {@link invocationKwargs},
|
|
71
71
|
* even if not explicitly available on this class.
|
|
72
|
-
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* const model = new ChatAnthropic({
|
|
75
|
+
* temperature: 0.9,
|
|
76
|
+
* anthropicApiKey: 'YOUR-API-KEY',
|
|
77
|
+
* });
|
|
78
|
+
* const res = await model.invoke({ input: 'Hello!' });
|
|
79
|
+
* console.log(res);
|
|
80
|
+
* ```
|
|
73
81
|
*/
|
|
74
82
|
export declare class ChatAnthropic<CallOptions extends BaseLanguageModelCallOptions = BaseLanguageModelCallOptions> extends BaseChatModel<CallOptions> implements AnthropicInput {
|
|
75
83
|
static lc_name(): string;
|
|
@@ -50,7 +50,15 @@ export const DEFAULT_STOP_SEQUENCES = [HUMAN_PROMPT];
|
|
|
50
50
|
* https://console.anthropic.com/docs/api/reference |
|
|
51
51
|
* `anthropic.complete`} can be passed through {@link invocationKwargs},
|
|
52
52
|
* even if not explicitly available on this class.
|
|
53
|
-
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* const model = new ChatAnthropic({
|
|
56
|
+
* temperature: 0.9,
|
|
57
|
+
* anthropicApiKey: 'YOUR-API-KEY',
|
|
58
|
+
* });
|
|
59
|
+
* const res = await model.invoke({ input: 'Hello!' });
|
|
60
|
+
* console.log(res);
|
|
61
|
+
* ```
|
|
54
62
|
*/
|
|
55
63
|
export class ChatAnthropic extends BaseChatModel {
|
|
56
64
|
static lc_name() {
|
|
@@ -48,6 +48,26 @@ function messageToWenxinRole(message) {
|
|
|
48
48
|
*
|
|
49
49
|
* @augments BaseLLM
|
|
50
50
|
* @augments BaiduERNIEInput
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const ernieTurbo = new ChatBaiduWenxin({
|
|
54
|
+
* baiduApiKey: "YOUR-API-KEY",
|
|
55
|
+
* baiduSecretKey: "YOUR-SECRET-KEY",
|
|
56
|
+
* });
|
|
57
|
+
*
|
|
58
|
+
* const ernie = new ChatBaiduWenxin({
|
|
59
|
+
* modelName: "ERNIE-Bot",
|
|
60
|
+
* temperature: 1,
|
|
61
|
+
* baiduApiKey: "YOUR-API-KEY",
|
|
62
|
+
* baiduSecretKey: "YOUR-SECRET-KEY",
|
|
63
|
+
* });
|
|
64
|
+
*
|
|
65
|
+
* const messages = [new HumanMessage("Hello")];
|
|
66
|
+
*
|
|
67
|
+
* let res = await ernieTurbo.call(messages);
|
|
68
|
+
*
|
|
69
|
+
* res = await ernie.call(messages);
|
|
70
|
+
* ```
|
|
51
71
|
*/
|
|
52
72
|
class ChatBaiduWenxin extends base_js_1.BaseChatModel {
|
|
53
73
|
static lc_name() {
|
|
@@ -73,6 +73,26 @@ declare interface BaiduWenxinChatInput {
|
|
|
73
73
|
*
|
|
74
74
|
* @augments BaseLLM
|
|
75
75
|
* @augments BaiduERNIEInput
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* const ernieTurbo = new ChatBaiduWenxin({
|
|
79
|
+
* baiduApiKey: "YOUR-API-KEY",
|
|
80
|
+
* baiduSecretKey: "YOUR-SECRET-KEY",
|
|
81
|
+
* });
|
|
82
|
+
*
|
|
83
|
+
* const ernie = new ChatBaiduWenxin({
|
|
84
|
+
* modelName: "ERNIE-Bot",
|
|
85
|
+
* temperature: 1,
|
|
86
|
+
* baiduApiKey: "YOUR-API-KEY",
|
|
87
|
+
* baiduSecretKey: "YOUR-SECRET-KEY",
|
|
88
|
+
* });
|
|
89
|
+
*
|
|
90
|
+
* const messages = [new HumanMessage("Hello")];
|
|
91
|
+
*
|
|
92
|
+
* let res = await ernieTurbo.call(messages);
|
|
93
|
+
*
|
|
94
|
+
* res = await ernie.call(messages);
|
|
95
|
+
* ```
|
|
76
96
|
*/
|
|
77
97
|
export declare class ChatBaiduWenxin extends BaseChatModel implements BaiduWenxinChatInput {
|
|
78
98
|
static lc_name(): string;
|
|
@@ -45,6 +45,26 @@ function messageToWenxinRole(message) {
|
|
|
45
45
|
*
|
|
46
46
|
* @augments BaseLLM
|
|
47
47
|
* @augments BaiduERNIEInput
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const ernieTurbo = new ChatBaiduWenxin({
|
|
51
|
+
* baiduApiKey: "YOUR-API-KEY",
|
|
52
|
+
* baiduSecretKey: "YOUR-SECRET-KEY",
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* const ernie = new ChatBaiduWenxin({
|
|
56
|
+
* modelName: "ERNIE-Bot",
|
|
57
|
+
* temperature: 1,
|
|
58
|
+
* baiduApiKey: "YOUR-API-KEY",
|
|
59
|
+
* baiduSecretKey: "YOUR-SECRET-KEY",
|
|
60
|
+
* });
|
|
61
|
+
*
|
|
62
|
+
* const messages = [new HumanMessage("Hello")];
|
|
63
|
+
*
|
|
64
|
+
* let res = await ernieTurbo.call(messages);
|
|
65
|
+
*
|
|
66
|
+
* res = await ernie.call(messages);
|
|
67
|
+
* ```
|
|
48
68
|
*/
|
|
49
69
|
export class ChatBaiduWenxin extends BaseChatModel {
|
|
50
70
|
static lc_name() {
|
|
@@ -72,6 +72,7 @@ class BaseChatModel extends index_js_2.BaseLanguageModel {
|
|
|
72
72
|
const extra = {
|
|
73
73
|
options: callOptions,
|
|
74
74
|
invocation_params: this?.invocationParams(callOptions),
|
|
75
|
+
batch_size: 1,
|
|
75
76
|
};
|
|
76
77
|
const runManagers = await callbackManager_?.handleChatModelStart(this.toJSON(), [messages], undefined, undefined, extra, undefined, undefined, runnableConfig.runName);
|
|
77
78
|
let generationChunk;
|
|
@@ -104,6 +105,7 @@ class BaseChatModel extends index_js_2.BaseLanguageModel {
|
|
|
104
105
|
const extra = {
|
|
105
106
|
options: parsedOptions,
|
|
106
107
|
invocation_params: this?.invocationParams(parsedOptions),
|
|
108
|
+
batch_size: 1,
|
|
107
109
|
};
|
|
108
110
|
const runManagers = await callbackManager_?.handleChatModelStart(this.toJSON(), baseMessages, undefined, undefined, extra, undefined, undefined, handledOptions.runName);
|
|
109
111
|
// generate results
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseMessage,
|
|
1
|
+
import { BaseMessage, BaseMessageChunk, BaseMessageLike, BasePromptValue, ChatGenerationChunk, ChatResult, LLMResult } from "../schema/index.js";
|
|
2
2
|
import { BaseLanguageModel, BaseLanguageModelCallOptions, BaseLanguageModelInput, BaseLanguageModelParams } from "../base_language/index.js";
|
|
3
3
|
import { CallbackManagerForLLMRun, Callbacks } from "../callbacks/manager.js";
|
|
4
4
|
import { RunnableConfig } from "../schema/runnable/config.js";
|
package/dist/chat_models/base.js
CHANGED
|
@@ -68,6 +68,7 @@ export class BaseChatModel extends BaseLanguageModel {
|
|
|
68
68
|
const extra = {
|
|
69
69
|
options: callOptions,
|
|
70
70
|
invocation_params: this?.invocationParams(callOptions),
|
|
71
|
+
batch_size: 1,
|
|
71
72
|
};
|
|
72
73
|
const runManagers = await callbackManager_?.handleChatModelStart(this.toJSON(), [messages], undefined, undefined, extra, undefined, undefined, runnableConfig.runName);
|
|
73
74
|
let generationChunk;
|
|
@@ -100,6 +101,7 @@ export class BaseChatModel extends BaseLanguageModel {
|
|
|
100
101
|
const extra = {
|
|
101
102
|
options: parsedOptions,
|
|
102
103
|
invocation_params: this?.invocationParams(parsedOptions),
|
|
104
|
+
batch_size: 1,
|
|
103
105
|
};
|
|
104
106
|
const runManagers = await callbackManager_?.handleChatModelStart(this.toJSON(), baseMessages, undefined, undefined, extra, undefined, undefined, handledOptions.runName);
|
|
105
107
|
// generate results
|
|
@@ -3,6 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ChatBedrock = exports.convertMessagesToPrompt = exports.convertMessagesToPromptAnthropic = exports.BedrockChat = void 0;
|
|
4
4
|
const credential_provider_node_1 = require("@aws-sdk/credential-provider-node");
|
|
5
5
|
const web_js_1 = require("./web.cjs");
|
|
6
|
+
/**
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const model = new BedrockChat({
|
|
10
|
+
* model: "anthropic.claude-v2",
|
|
11
|
+
* region: "us-east-1",
|
|
12
|
+
* });
|
|
13
|
+
* const res = await model.invoke([{ content: "Tell me a joke" }]);
|
|
14
|
+
* console.log(res);
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
6
17
|
class BedrockChat extends web_js_1.BedrockChat {
|
|
7
18
|
static lc_name() {
|
|
8
19
|
return "BedrockChat";
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { BaseBedrockInput } from "../../util/bedrock.js";
|
|
2
2
|
import { BedrockChat as BaseBedrockChat } from "./web.js";
|
|
3
3
|
import { BaseChatModelParams } from "../base.js";
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* const model = new BedrockChat({
|
|
8
|
+
* model: "anthropic.claude-v2",
|
|
9
|
+
* region: "us-east-1",
|
|
10
|
+
* });
|
|
11
|
+
* const res = await model.invoke([{ content: "Tell me a joke" }]);
|
|
12
|
+
* console.log(res);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
4
15
|
export declare class BedrockChat extends BaseBedrockChat {
|
|
5
16
|
static lc_name(): string;
|
|
6
17
|
constructor(fields?: Partial<BaseBedrockInput> & BaseChatModelParams);
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { defaultProvider } from "@aws-sdk/credential-provider-node";
|
|
2
2
|
import { BedrockChat as BaseBedrockChat } from "./web.js";
|
|
3
|
+
/**
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* const model = new BedrockChat({
|
|
7
|
+
* model: "anthropic.claude-v2",
|
|
8
|
+
* region: "us-east-1",
|
|
9
|
+
* });
|
|
10
|
+
* const res = await model.invoke([{ content: "Tell me a joke" }]);
|
|
11
|
+
* console.log(res);
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
3
14
|
export class BedrockChat extends BaseBedrockChat {
|
|
4
15
|
static lc_name() {
|
|
5
16
|
return "BedrockChat";
|
|
@@ -59,6 +59,15 @@ exports.convertMessagesToPrompt = convertMessagesToPrompt;
|
|
|
59
59
|
* Services (AWS). It uses AWS credentials for authentication and can be
|
|
60
60
|
* configured with various parameters such as the model to use, the AWS
|
|
61
61
|
* region, and the maximum number of tokens to generate.
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const model = new BedrockChat({
|
|
65
|
+
* model: "anthropic.claude-v2",
|
|
66
|
+
* region: "us-east-1",
|
|
67
|
+
* });
|
|
68
|
+
* const res = await model.invoke([{ content: "Tell me a joke" }]);
|
|
69
|
+
* console.log(res);
|
|
70
|
+
* ```
|
|
62
71
|
*/
|
|
63
72
|
class BedrockChat extends base_js_1.SimpleChatModel {
|
|
64
73
|
get lc_aliases() {
|
|
@@ -174,7 +183,7 @@ class BedrockChat extends base_js_1.SimpleChatModel {
|
|
|
174
183
|
this.credentials = credentials;
|
|
175
184
|
this.temperature = fields?.temperature ?? this.temperature;
|
|
176
185
|
this.maxTokens = fields?.maxTokens ?? this.maxTokens;
|
|
177
|
-
this.fetchFn = fields?.fetchFn ?? fetch;
|
|
186
|
+
this.fetchFn = fields?.fetchFn ?? fetch.bind(globalThis);
|
|
178
187
|
this.endpointHost = fields?.endpointHost ?? fields?.endpointUrl;
|
|
179
188
|
this.stopSequences = fields?.stopSequences;
|
|
180
189
|
this.modelKwargs = fields?.modelKwargs;
|
|
@@ -22,6 +22,15 @@ export declare function convertMessagesToPrompt(messages: BaseMessage[], provide
|
|
|
22
22
|
* Services (AWS). It uses AWS credentials for authentication and can be
|
|
23
23
|
* configured with various parameters such as the model to use, the AWS
|
|
24
24
|
* region, and the maximum number of tokens to generate.
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const model = new BedrockChat({
|
|
28
|
+
* model: "anthropic.claude-v2",
|
|
29
|
+
* region: "us-east-1",
|
|
30
|
+
* });
|
|
31
|
+
* const res = await model.invoke([{ content: "Tell me a joke" }]);
|
|
32
|
+
* console.log(res);
|
|
33
|
+
* ```
|
|
25
34
|
*/
|
|
26
35
|
export declare class BedrockChat extends SimpleChatModel implements BaseBedrockInput {
|
|
27
36
|
model: string;
|
|
@@ -54,6 +54,15 @@ export function convertMessagesToPrompt(messages, provider) {
|
|
|
54
54
|
* Services (AWS). It uses AWS credentials for authentication and can be
|
|
55
55
|
* configured with various parameters such as the model to use, the AWS
|
|
56
56
|
* region, and the maximum number of tokens to generate.
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const model = new BedrockChat({
|
|
60
|
+
* model: "anthropic.claude-v2",
|
|
61
|
+
* region: "us-east-1",
|
|
62
|
+
* });
|
|
63
|
+
* const res = await model.invoke([{ content: "Tell me a joke" }]);
|
|
64
|
+
* console.log(res);
|
|
65
|
+
* ```
|
|
57
66
|
*/
|
|
58
67
|
export class BedrockChat extends SimpleChatModel {
|
|
59
68
|
get lc_aliases() {
|
|
@@ -169,7 +178,7 @@ export class BedrockChat extends SimpleChatModel {
|
|
|
169
178
|
this.credentials = credentials;
|
|
170
179
|
this.temperature = fields?.temperature ?? this.temperature;
|
|
171
180
|
this.maxTokens = fields?.maxTokens ?? this.maxTokens;
|
|
172
|
-
this.fetchFn = fields?.fetchFn ?? fetch;
|
|
181
|
+
this.fetchFn = fields?.fetchFn ?? fetch.bind(globalThis);
|
|
173
182
|
this.endpointHost = fields?.endpointHost ?? fields?.endpointUrl;
|
|
174
183
|
this.stopSequences = fields?.stopSequences;
|
|
175
184
|
this.modelKwargs = fields?.modelKwargs;
|
|
@@ -9,6 +9,21 @@ const event_source_parse_js_1 = require("../util/event-source-parse.cjs");
|
|
|
9
9
|
* A class that enables calls to the Cloudflare Workers AI API to access large language
|
|
10
10
|
* models in a chat-like fashion. It extends the SimpleChatModel class and
|
|
11
11
|
* implements the CloudflareWorkersAIInput interface.
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const model = new ChatCloudflareWorkersAI({
|
|
15
|
+
* model: "@cf/meta/llama-2-7b-chat-int8",
|
|
16
|
+
* cloudflareAccountId: process.env.CLOUDFLARE_ACCOUNT_ID,
|
|
17
|
+
* cloudflareApiToken: process.env.CLOUDFLARE_API_TOKEN
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* const response = await model.invoke([
|
|
21
|
+
* ["system", "You are a helpful assistant that translates English to German."],
|
|
22
|
+
* ["human", `Translate "I love programming".`]
|
|
23
|
+
* ]);
|
|
24
|
+
*
|
|
25
|
+
* console.log(response);
|
|
26
|
+
* ```
|
|
12
27
|
*/
|
|
13
28
|
class ChatCloudflareWorkersAI extends base_js_1.SimpleChatModel {
|
|
14
29
|
static lc_name() {
|