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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../dist/cache/file_system.cjs');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/cache/file_system.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/cache/file_system.js'
|
package/dist/agents/agent.cjs
CHANGED
|
@@ -135,6 +135,30 @@ exports.RunnableAgent = RunnableAgent;
|
|
|
135
135
|
* Class representing a single action agent using a LLMChain in LangChain.
|
|
136
136
|
* Extends the BaseSingleActionAgent class and provides methods for
|
|
137
137
|
* planning agent actions based on LLMChain outputs.
|
|
138
|
+
* @example
|
|
139
|
+
* ```typescript
|
|
140
|
+
* const customPromptTemplate = new CustomPromptTemplate({
|
|
141
|
+
* tools: [new Calculator()],
|
|
142
|
+
* inputVariables: ["input", "agent_scratchpad"],
|
|
143
|
+
* });
|
|
144
|
+
* const customOutputParser = new CustomOutputParser();
|
|
145
|
+
* const agent = new LLMSingleActionAgent({
|
|
146
|
+
* llmChain: new LLMChain({
|
|
147
|
+
* prompt: customPromptTemplate,
|
|
148
|
+
* llm: new ChatOpenAI({ temperature: 0 }),
|
|
149
|
+
* }),
|
|
150
|
+
* outputParser: customOutputParser,
|
|
151
|
+
* stop: ["\nObservation"],
|
|
152
|
+
* });
|
|
153
|
+
* const executor = new AgentExecutor({
|
|
154
|
+
* agent,
|
|
155
|
+
* tools: [new Calculator()],
|
|
156
|
+
* });
|
|
157
|
+
* const result = await executor.invoke({
|
|
158
|
+
* input:
|
|
159
|
+
* "Who is Olivia Wilde's boyfriend? What is his current age raised to the 0.23 power?",
|
|
160
|
+
* });
|
|
161
|
+
* ```
|
|
138
162
|
*/
|
|
139
163
|
class LLMSingleActionAgent extends BaseSingleActionAgent {
|
|
140
164
|
constructor(input) {
|
package/dist/agents/agent.d.ts
CHANGED
|
@@ -101,6 +101,30 @@ export interface LLMSingleActionAgentInput {
|
|
|
101
101
|
* Class representing a single action agent using a LLMChain in LangChain.
|
|
102
102
|
* Extends the BaseSingleActionAgent class and provides methods for
|
|
103
103
|
* planning agent actions based on LLMChain outputs.
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const customPromptTemplate = new CustomPromptTemplate({
|
|
107
|
+
* tools: [new Calculator()],
|
|
108
|
+
* inputVariables: ["input", "agent_scratchpad"],
|
|
109
|
+
* });
|
|
110
|
+
* const customOutputParser = new CustomOutputParser();
|
|
111
|
+
* const agent = new LLMSingleActionAgent({
|
|
112
|
+
* llmChain: new LLMChain({
|
|
113
|
+
* prompt: customPromptTemplate,
|
|
114
|
+
* llm: new ChatOpenAI({ temperature: 0 }),
|
|
115
|
+
* }),
|
|
116
|
+
* outputParser: customOutputParser,
|
|
117
|
+
* stop: ["\nObservation"],
|
|
118
|
+
* });
|
|
119
|
+
* const executor = new AgentExecutor({
|
|
120
|
+
* agent,
|
|
121
|
+
* tools: [new Calculator()],
|
|
122
|
+
* });
|
|
123
|
+
* const result = await executor.invoke({
|
|
124
|
+
* input:
|
|
125
|
+
* "Who is Olivia Wilde's boyfriend? What is his current age raised to the 0.23 power?",
|
|
126
|
+
* });
|
|
127
|
+
* ```
|
|
104
128
|
*/
|
|
105
129
|
export declare class LLMSingleActionAgent extends BaseSingleActionAgent {
|
|
106
130
|
lc_namespace: string[];
|
package/dist/agents/agent.js
CHANGED
|
@@ -128,6 +128,30 @@ export class RunnableAgent extends BaseMultiActionAgent {
|
|
|
128
128
|
* Class representing a single action agent using a LLMChain in LangChain.
|
|
129
129
|
* Extends the BaseSingleActionAgent class and provides methods for
|
|
130
130
|
* planning agent actions based on LLMChain outputs.
|
|
131
|
+
* @example
|
|
132
|
+
* ```typescript
|
|
133
|
+
* const customPromptTemplate = new CustomPromptTemplate({
|
|
134
|
+
* tools: [new Calculator()],
|
|
135
|
+
* inputVariables: ["input", "agent_scratchpad"],
|
|
136
|
+
* });
|
|
137
|
+
* const customOutputParser = new CustomOutputParser();
|
|
138
|
+
* const agent = new LLMSingleActionAgent({
|
|
139
|
+
* llmChain: new LLMChain({
|
|
140
|
+
* prompt: customPromptTemplate,
|
|
141
|
+
* llm: new ChatOpenAI({ temperature: 0 }),
|
|
142
|
+
* }),
|
|
143
|
+
* outputParser: customOutputParser,
|
|
144
|
+
* stop: ["\nObservation"],
|
|
145
|
+
* });
|
|
146
|
+
* const executor = new AgentExecutor({
|
|
147
|
+
* agent,
|
|
148
|
+
* tools: [new Calculator()],
|
|
149
|
+
* });
|
|
150
|
+
* const result = await executor.invoke({
|
|
151
|
+
* input:
|
|
152
|
+
* "Who is Olivia Wilde's boyfriend? What is his current age raised to the 0.23 power?",
|
|
153
|
+
* });
|
|
154
|
+
* ```
|
|
131
155
|
*/
|
|
132
156
|
export class LLMSingleActionAgent extends BaseSingleActionAgent {
|
|
133
157
|
constructor(input) {
|
|
@@ -9,6 +9,38 @@ exports.FINAL_ANSWER_ACTION = "Final Answer:";
|
|
|
9
9
|
* A class that extends the AgentActionOutputParser to parse the output of
|
|
10
10
|
* the ChatAgent in LangChain. It checks if the output text contains the
|
|
11
11
|
* final answer action or a JSON response, and parses it accordingly.
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const prompt = ChatPromptTemplate.fromMessages([
|
|
15
|
+
* [
|
|
16
|
+
* "ai",
|
|
17
|
+
* `{PREFIX}
|
|
18
|
+
* {FORMAT_INSTRUCTIONS}
|
|
19
|
+
* {SUFFIX}`,
|
|
20
|
+
* ],
|
|
21
|
+
* ["human", "Question: {input}"],
|
|
22
|
+
* ]);
|
|
23
|
+
* const runnableAgent = RunnableSequence.from([
|
|
24
|
+
* {
|
|
25
|
+
* input: (i: { input: string; steps: AgentStep[] }) => i.input,
|
|
26
|
+
* agent_scratchpad: (i: { input: string; steps: AgentStep[] }) =>
|
|
27
|
+
* formatLogToString(i.steps),
|
|
28
|
+
* },
|
|
29
|
+
* prompt,
|
|
30
|
+
* new OpenAI({ temperature: 0 }),
|
|
31
|
+
* new ChatAgentOutputParser(),
|
|
32
|
+
* ]);
|
|
33
|
+
*
|
|
34
|
+
* const executor = AgentExecutor.fromAgentAndTools({
|
|
35
|
+
* agent: runnableAgent,
|
|
36
|
+
* tools: [new SerpAPI(), new Calculator()],
|
|
37
|
+
* });
|
|
38
|
+
*
|
|
39
|
+
* const result = await executor.invoke({
|
|
40
|
+
* input:
|
|
41
|
+
* "Who is Olivia Wilde's boyfriend? What is his current age raised to the 0.23 power?",
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
12
44
|
*/
|
|
13
45
|
class ChatAgentOutputParser extends types_js_1.AgentActionOutputParser {
|
|
14
46
|
constructor() {
|
|
@@ -4,6 +4,38 @@ export declare const FINAL_ANSWER_ACTION = "Final Answer:";
|
|
|
4
4
|
* A class that extends the AgentActionOutputParser to parse the output of
|
|
5
5
|
* the ChatAgent in LangChain. It checks if the output text contains the
|
|
6
6
|
* final answer action or a JSON response, and parses it accordingly.
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const prompt = ChatPromptTemplate.fromMessages([
|
|
10
|
+
* [
|
|
11
|
+
* "ai",
|
|
12
|
+
* `{PREFIX}
|
|
13
|
+
* {FORMAT_INSTRUCTIONS}
|
|
14
|
+
* {SUFFIX}`,
|
|
15
|
+
* ],
|
|
16
|
+
* ["human", "Question: {input}"],
|
|
17
|
+
* ]);
|
|
18
|
+
* const runnableAgent = RunnableSequence.from([
|
|
19
|
+
* {
|
|
20
|
+
* input: (i: { input: string; steps: AgentStep[] }) => i.input,
|
|
21
|
+
* agent_scratchpad: (i: { input: string; steps: AgentStep[] }) =>
|
|
22
|
+
* formatLogToString(i.steps),
|
|
23
|
+
* },
|
|
24
|
+
* prompt,
|
|
25
|
+
* new OpenAI({ temperature: 0 }),
|
|
26
|
+
* new ChatAgentOutputParser(),
|
|
27
|
+
* ]);
|
|
28
|
+
*
|
|
29
|
+
* const executor = AgentExecutor.fromAgentAndTools({
|
|
30
|
+
* agent: runnableAgent,
|
|
31
|
+
* tools: [new SerpAPI(), new Calculator()],
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* const result = await executor.invoke({
|
|
35
|
+
* input:
|
|
36
|
+
* "Who is Olivia Wilde's boyfriend? What is his current age raised to the 0.23 power?",
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
7
39
|
*/
|
|
8
40
|
export declare class ChatAgentOutputParser extends AgentActionOutputParser {
|
|
9
41
|
lc_namespace: string[];
|
|
@@ -6,6 +6,38 @@ export const FINAL_ANSWER_ACTION = "Final Answer:";
|
|
|
6
6
|
* A class that extends the AgentActionOutputParser to parse the output of
|
|
7
7
|
* the ChatAgent in LangChain. It checks if the output text contains the
|
|
8
8
|
* final answer action or a JSON response, and parses it accordingly.
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const prompt = ChatPromptTemplate.fromMessages([
|
|
12
|
+
* [
|
|
13
|
+
* "ai",
|
|
14
|
+
* `{PREFIX}
|
|
15
|
+
* {FORMAT_INSTRUCTIONS}
|
|
16
|
+
* {SUFFIX}`,
|
|
17
|
+
* ],
|
|
18
|
+
* ["human", "Question: {input}"],
|
|
19
|
+
* ]);
|
|
20
|
+
* const runnableAgent = RunnableSequence.from([
|
|
21
|
+
* {
|
|
22
|
+
* input: (i: { input: string; steps: AgentStep[] }) => i.input,
|
|
23
|
+
* agent_scratchpad: (i: { input: string; steps: AgentStep[] }) =>
|
|
24
|
+
* formatLogToString(i.steps),
|
|
25
|
+
* },
|
|
26
|
+
* prompt,
|
|
27
|
+
* new OpenAI({ temperature: 0 }),
|
|
28
|
+
* new ChatAgentOutputParser(),
|
|
29
|
+
* ]);
|
|
30
|
+
*
|
|
31
|
+
* const executor = AgentExecutor.fromAgentAndTools({
|
|
32
|
+
* agent: runnableAgent,
|
|
33
|
+
* tools: [new SerpAPI(), new Calculator()],
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* const result = await executor.invoke({
|
|
37
|
+
* input:
|
|
38
|
+
* "Who is Olivia Wilde's boyfriend? What is his current age raised to the 0.23 power?",
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
9
41
|
*/
|
|
10
42
|
export class ChatAgentOutputParser extends AgentActionOutputParser {
|
|
11
43
|
constructor() {
|
package/dist/agents/executor.cjs
CHANGED
|
@@ -34,6 +34,20 @@ exports.ExceptionTool = ExceptionTool;
|
|
|
34
34
|
/**
|
|
35
35
|
* A chain managing an agent using tools.
|
|
36
36
|
* @augments BaseChain
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
*
|
|
40
|
+
* const executor = AgentExecutor.fromAgentAndTools({
|
|
41
|
+
* agent: async () => loadAgentFromLangchainHub(),
|
|
42
|
+
* tools: [new SerpAPI(), new Calculator()],
|
|
43
|
+
* returnIntermediateSteps: true,
|
|
44
|
+
* });
|
|
45
|
+
*
|
|
46
|
+
* const result = await executor.invoke({
|
|
47
|
+
* input: `Who is Olivia Wilde's boyfriend? What is his current age raised to the 0.23 power?`,
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* ```
|
|
37
51
|
*/
|
|
38
52
|
class AgentExecutor extends base_js_1.BaseChain {
|
|
39
53
|
static lc_name() {
|
|
@@ -38,6 +38,20 @@ export declare class ExceptionTool extends Tool {
|
|
|
38
38
|
/**
|
|
39
39
|
* A chain managing an agent using tools.
|
|
40
40
|
* @augments BaseChain
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
*
|
|
44
|
+
* const executor = AgentExecutor.fromAgentAndTools({
|
|
45
|
+
* agent: async () => loadAgentFromLangchainHub(),
|
|
46
|
+
* tools: [new SerpAPI(), new Calculator()],
|
|
47
|
+
* returnIntermediateSteps: true,
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* const result = await executor.invoke({
|
|
51
|
+
* input: `Who is Olivia Wilde's boyfriend? What is his current age raised to the 0.23 power?`,
|
|
52
|
+
* });
|
|
53
|
+
*
|
|
54
|
+
* ```
|
|
41
55
|
*/
|
|
42
56
|
export declare class AgentExecutor extends BaseChain<ChainValues, AgentExecutorOutput> {
|
|
43
57
|
static lc_name(): string;
|
package/dist/agents/executor.js
CHANGED
|
@@ -30,6 +30,20 @@ export class ExceptionTool extends Tool {
|
|
|
30
30
|
/**
|
|
31
31
|
* A chain managing an agent using tools.
|
|
32
32
|
* @augments BaseChain
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
*
|
|
36
|
+
* const executor = AgentExecutor.fromAgentAndTools({
|
|
37
|
+
* agent: async () => loadAgentFromLangchainHub(),
|
|
38
|
+
* tools: [new SerpAPI(), new Calculator()],
|
|
39
|
+
* returnIntermediateSteps: true,
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* const result = await executor.invoke({
|
|
43
|
+
* input: `Who is Olivia Wilde's boyfriend? What is his current age raised to the 0.23 power?`,
|
|
44
|
+
* });
|
|
45
|
+
*
|
|
46
|
+
* ```
|
|
33
47
|
*/
|
|
34
48
|
export class AgentExecutor extends BaseChain {
|
|
35
49
|
static lc_name() {
|
|
@@ -11,6 +11,27 @@ const prompt_js_2 = require("./prompt.cjs");
|
|
|
11
11
|
/**
|
|
12
12
|
* Agent for the MRKL chain.
|
|
13
13
|
* @augments Agent
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
*
|
|
17
|
+
* const agent = new ZeroShotAgent({
|
|
18
|
+
* llmChain: new LLMChain({
|
|
19
|
+
* llm: new ChatOpenAI({ temperature: 0 }),
|
|
20
|
+
* prompt: ZeroShotAgent.createPrompt([new SerpAPI(), new Calculator()], {
|
|
21
|
+
* prefix: `Answer the following questions as best you can, but speaking as a pirate might speak. You have access to the following tools:`,
|
|
22
|
+
* suffix: `Begin! Remember to speak as a pirate when giving your final answer. Use lots of "Args"
|
|
23
|
+
* Question: {input}
|
|
24
|
+
* {agent_scratchpad}`,
|
|
25
|
+
* inputVariables: ["input", "agent_scratchpad"],
|
|
26
|
+
* }),
|
|
27
|
+
* }),
|
|
28
|
+
* allowedTools: ["search", "calculator"],
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* const result = await agent.invoke({
|
|
32
|
+
* input: `Who is Olivia Wilde's boyfriend? What is his current age raised to the 0.23 power?`,
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
14
35
|
*/
|
|
15
36
|
class ZeroShotAgent extends agent_js_1.Agent {
|
|
16
37
|
static lc_name() {
|
|
@@ -24,6 +24,27 @@ export type ZeroShotAgentInput = Optional<AgentInput, "outputParser">;
|
|
|
24
24
|
/**
|
|
25
25
|
* Agent for the MRKL chain.
|
|
26
26
|
* @augments Agent
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
*
|
|
30
|
+
* const agent = new ZeroShotAgent({
|
|
31
|
+
* llmChain: new LLMChain({
|
|
32
|
+
* llm: new ChatOpenAI({ temperature: 0 }),
|
|
33
|
+
* prompt: ZeroShotAgent.createPrompt([new SerpAPI(), new Calculator()], {
|
|
34
|
+
* prefix: `Answer the following questions as best you can, but speaking as a pirate might speak. You have access to the following tools:`,
|
|
35
|
+
* suffix: `Begin! Remember to speak as a pirate when giving your final answer. Use lots of "Args"
|
|
36
|
+
* Question: {input}
|
|
37
|
+
* {agent_scratchpad}`,
|
|
38
|
+
* inputVariables: ["input", "agent_scratchpad"],
|
|
39
|
+
* }),
|
|
40
|
+
* }),
|
|
41
|
+
* allowedTools: ["search", "calculator"],
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* const result = await agent.invoke({
|
|
45
|
+
* input: `Who is Olivia Wilde's boyfriend? What is his current age raised to the 0.23 power?`,
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
27
48
|
*/
|
|
28
49
|
export declare class ZeroShotAgent extends Agent {
|
|
29
50
|
static lc_name(): string;
|
|
@@ -8,6 +8,27 @@ import { FORMAT_INSTRUCTIONS, PREFIX, SUFFIX } from "./prompt.js";
|
|
|
8
8
|
/**
|
|
9
9
|
* Agent for the MRKL chain.
|
|
10
10
|
* @augments Agent
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
*
|
|
14
|
+
* const agent = new ZeroShotAgent({
|
|
15
|
+
* llmChain: new LLMChain({
|
|
16
|
+
* llm: new ChatOpenAI({ temperature: 0 }),
|
|
17
|
+
* prompt: ZeroShotAgent.createPrompt([new SerpAPI(), new Calculator()], {
|
|
18
|
+
* prefix: `Answer the following questions as best you can, but speaking as a pirate might speak. You have access to the following tools:`,
|
|
19
|
+
* suffix: `Begin! Remember to speak as a pirate when giving your final answer. Use lots of "Args"
|
|
20
|
+
* Question: {input}
|
|
21
|
+
* {agent_scratchpad}`,
|
|
22
|
+
* inputVariables: ["input", "agent_scratchpad"],
|
|
23
|
+
* }),
|
|
24
|
+
* }),
|
|
25
|
+
* allowedTools: ["search", "calculator"],
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* const result = await agent.invoke({
|
|
29
|
+
* input: `Who is Olivia Wilde's boyfriend? What is his current age raised to the 0.23 power?`,
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
11
32
|
*/
|
|
12
33
|
export class ZeroShotAgent extends Agent {
|
|
13
34
|
static lc_name() {
|
|
@@ -4,6 +4,40 @@ exports.OpenAIToolsAgentOutputParser = exports.OpenAIFunctionsAgentOutputParser
|
|
|
4
4
|
const index_js_1 = require("../../schema/index.cjs");
|
|
5
5
|
const types_js_1 = require("../types.cjs");
|
|
6
6
|
const output_parser_js_1 = require("../../schema/output_parser.cjs");
|
|
7
|
+
/**
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
*
|
|
11
|
+
* const prompt = ChatPromptTemplate.fromMessages([
|
|
12
|
+
* ["ai", "You are a helpful assistant"],
|
|
13
|
+
* ["human", "{input}"],
|
|
14
|
+
* new MessagesPlaceholder("agent_scratchpad"),
|
|
15
|
+
* ]);
|
|
16
|
+
*
|
|
17
|
+
* const modelWithFunctions = new ChatOpenAI({
|
|
18
|
+
* modelName: "gpt-4",
|
|
19
|
+
* temperature: 0,
|
|
20
|
+
* }).bind({
|
|
21
|
+
* functions: tools.map((tool) => formatToOpenAIFunction(tool)),
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* const runnableAgent = RunnableSequence.from([
|
|
25
|
+
* {
|
|
26
|
+
* input: (i) => i.input,
|
|
27
|
+
* agent_scratchpad: (i) => formatAgentSteps(i.steps),
|
|
28
|
+
* },
|
|
29
|
+
* prompt,
|
|
30
|
+
* modelWithFunctions,
|
|
31
|
+
* new OpenAIFunctionsAgentOutputParser(),
|
|
32
|
+
* ]);
|
|
33
|
+
*
|
|
34
|
+
* const result = await runnableAgent.invoke({
|
|
35
|
+
* input: "What is the weather in New York?",
|
|
36
|
+
* steps: agentSteps,
|
|
37
|
+
* });
|
|
38
|
+
*
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
7
41
|
class OpenAIFunctionsAgentOutputParser extends types_js_1.AgentActionOutputParser {
|
|
8
42
|
constructor() {
|
|
9
43
|
super(...arguments);
|
|
@@ -66,6 +100,37 @@ class OpenAIFunctionsAgentOutputParser extends types_js_1.AgentActionOutputParse
|
|
|
66
100
|
}
|
|
67
101
|
}
|
|
68
102
|
exports.OpenAIFunctionsAgentOutputParser = OpenAIFunctionsAgentOutputParser;
|
|
103
|
+
/**
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
*
|
|
107
|
+
* const prompt = ChatPromptTemplate.fromMessages([
|
|
108
|
+
* ["ai", "You are a helpful assistant"],
|
|
109
|
+
* ["human", "{input}"],
|
|
110
|
+
* new MessagesPlaceholder("agent_scratchpad"),
|
|
111
|
+
* ]);
|
|
112
|
+
*
|
|
113
|
+
* const runnableAgent = RunnableSequence.from([
|
|
114
|
+
* {
|
|
115
|
+
* input: (i: { input: string; steps: ToolsAgentStep[] }) => i.input,
|
|
116
|
+
* agent_scratchpad: (i: { input: string; steps: ToolsAgentStep[] }) =>
|
|
117
|
+
* formatToOpenAIToolMessages(i.steps),
|
|
118
|
+
* },
|
|
119
|
+
* prompt,
|
|
120
|
+
* new ChatOpenAI({
|
|
121
|
+
* modelName: "gpt-3.5-turbo-1106",
|
|
122
|
+
* temperature: 0,
|
|
123
|
+
* }).bind({ tools: tools.map(formatToOpenAITool) }),
|
|
124
|
+
* new OpenAIToolsAgentOutputParser(),
|
|
125
|
+
* ]).withConfig({ runName: "OpenAIToolsAgent" });
|
|
126
|
+
*
|
|
127
|
+
* const result = await runnableAgent.invoke({
|
|
128
|
+
* input:
|
|
129
|
+
* "What is the sum of the current temperature in San Francisco, New York, and Tokyo?",
|
|
130
|
+
* });
|
|
131
|
+
*
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
69
134
|
class OpenAIToolsAgentOutputParser extends types_js_1.AgentMultiActionOutputParser {
|
|
70
135
|
constructor() {
|
|
71
136
|
super(...arguments);
|
|
@@ -6,6 +6,40 @@ import { AgentActionOutputParser, AgentMultiActionOutputParser } from "../types.
|
|
|
6
6
|
export type FunctionsAgentAction = AgentAction & {
|
|
7
7
|
messageLog?: BaseMessage[];
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
*
|
|
13
|
+
* const prompt = ChatPromptTemplate.fromMessages([
|
|
14
|
+
* ["ai", "You are a helpful assistant"],
|
|
15
|
+
* ["human", "{input}"],
|
|
16
|
+
* new MessagesPlaceholder("agent_scratchpad"),
|
|
17
|
+
* ]);
|
|
18
|
+
*
|
|
19
|
+
* const modelWithFunctions = new ChatOpenAI({
|
|
20
|
+
* modelName: "gpt-4",
|
|
21
|
+
* temperature: 0,
|
|
22
|
+
* }).bind({
|
|
23
|
+
* functions: tools.map((tool) => formatToOpenAIFunction(tool)),
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* const runnableAgent = RunnableSequence.from([
|
|
27
|
+
* {
|
|
28
|
+
* input: (i) => i.input,
|
|
29
|
+
* agent_scratchpad: (i) => formatAgentSteps(i.steps),
|
|
30
|
+
* },
|
|
31
|
+
* prompt,
|
|
32
|
+
* modelWithFunctions,
|
|
33
|
+
* new OpenAIFunctionsAgentOutputParser(),
|
|
34
|
+
* ]);
|
|
35
|
+
*
|
|
36
|
+
* const result = await runnableAgent.invoke({
|
|
37
|
+
* input: "What is the weather in New York?",
|
|
38
|
+
* steps: agentSteps,
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
9
43
|
export declare class OpenAIFunctionsAgentOutputParser extends AgentActionOutputParser {
|
|
10
44
|
lc_namespace: string[];
|
|
11
45
|
static lc_name(): string;
|
|
@@ -30,6 +64,37 @@ export type ToolsAgentAction = AgentAction & {
|
|
|
30
64
|
export type ToolsAgentStep = AgentStep & {
|
|
31
65
|
action: ToolsAgentAction;
|
|
32
66
|
};
|
|
67
|
+
/**
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
*
|
|
71
|
+
* const prompt = ChatPromptTemplate.fromMessages([
|
|
72
|
+
* ["ai", "You are a helpful assistant"],
|
|
73
|
+
* ["human", "{input}"],
|
|
74
|
+
* new MessagesPlaceholder("agent_scratchpad"),
|
|
75
|
+
* ]);
|
|
76
|
+
*
|
|
77
|
+
* const runnableAgent = RunnableSequence.from([
|
|
78
|
+
* {
|
|
79
|
+
* input: (i: { input: string; steps: ToolsAgentStep[] }) => i.input,
|
|
80
|
+
* agent_scratchpad: (i: { input: string; steps: ToolsAgentStep[] }) =>
|
|
81
|
+
* formatToOpenAIToolMessages(i.steps),
|
|
82
|
+
* },
|
|
83
|
+
* prompt,
|
|
84
|
+
* new ChatOpenAI({
|
|
85
|
+
* modelName: "gpt-3.5-turbo-1106",
|
|
86
|
+
* temperature: 0,
|
|
87
|
+
* }).bind({ tools: tools.map(formatToOpenAITool) }),
|
|
88
|
+
* new OpenAIToolsAgentOutputParser(),
|
|
89
|
+
* ]).withConfig({ runName: "OpenAIToolsAgent" });
|
|
90
|
+
*
|
|
91
|
+
* const result = await runnableAgent.invoke({
|
|
92
|
+
* input:
|
|
93
|
+
* "What is the sum of the current temperature in San Francisco, New York, and Tokyo?",
|
|
94
|
+
* });
|
|
95
|
+
*
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
33
98
|
export declare class OpenAIToolsAgentOutputParser extends AgentMultiActionOutputParser {
|
|
34
99
|
lc_namespace: string[];
|
|
35
100
|
static lc_name(): string;
|
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
import { isBaseMessage, } from "../../schema/index.js";
|
|
2
2
|
import { AgentActionOutputParser, AgentMultiActionOutputParser, } from "../types.js";
|
|
3
3
|
import { OutputParserException } from "../../schema/output_parser.js";
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
*
|
|
8
|
+
* const prompt = ChatPromptTemplate.fromMessages([
|
|
9
|
+
* ["ai", "You are a helpful assistant"],
|
|
10
|
+
* ["human", "{input}"],
|
|
11
|
+
* new MessagesPlaceholder("agent_scratchpad"),
|
|
12
|
+
* ]);
|
|
13
|
+
*
|
|
14
|
+
* const modelWithFunctions = new ChatOpenAI({
|
|
15
|
+
* modelName: "gpt-4",
|
|
16
|
+
* temperature: 0,
|
|
17
|
+
* }).bind({
|
|
18
|
+
* functions: tools.map((tool) => formatToOpenAIFunction(tool)),
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* const runnableAgent = RunnableSequence.from([
|
|
22
|
+
* {
|
|
23
|
+
* input: (i) => i.input,
|
|
24
|
+
* agent_scratchpad: (i) => formatAgentSteps(i.steps),
|
|
25
|
+
* },
|
|
26
|
+
* prompt,
|
|
27
|
+
* modelWithFunctions,
|
|
28
|
+
* new OpenAIFunctionsAgentOutputParser(),
|
|
29
|
+
* ]);
|
|
30
|
+
*
|
|
31
|
+
* const result = await runnableAgent.invoke({
|
|
32
|
+
* input: "What is the weather in New York?",
|
|
33
|
+
* steps: agentSteps,
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
4
38
|
export class OpenAIFunctionsAgentOutputParser extends AgentActionOutputParser {
|
|
5
39
|
constructor() {
|
|
6
40
|
super(...arguments);
|
|
@@ -62,6 +96,37 @@ export class OpenAIFunctionsAgentOutputParser extends AgentActionOutputParser {
|
|
|
62
96
|
throw new Error("getFormatInstructions not implemented inside OpenAIFunctionsAgentOutputParser.");
|
|
63
97
|
}
|
|
64
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
*
|
|
103
|
+
* const prompt = ChatPromptTemplate.fromMessages([
|
|
104
|
+
* ["ai", "You are a helpful assistant"],
|
|
105
|
+
* ["human", "{input}"],
|
|
106
|
+
* new MessagesPlaceholder("agent_scratchpad"),
|
|
107
|
+
* ]);
|
|
108
|
+
*
|
|
109
|
+
* const runnableAgent = RunnableSequence.from([
|
|
110
|
+
* {
|
|
111
|
+
* input: (i: { input: string; steps: ToolsAgentStep[] }) => i.input,
|
|
112
|
+
* agent_scratchpad: (i: { input: string; steps: ToolsAgentStep[] }) =>
|
|
113
|
+
* formatToOpenAIToolMessages(i.steps),
|
|
114
|
+
* },
|
|
115
|
+
* prompt,
|
|
116
|
+
* new ChatOpenAI({
|
|
117
|
+
* modelName: "gpt-3.5-turbo-1106",
|
|
118
|
+
* temperature: 0,
|
|
119
|
+
* }).bind({ tools: tools.map(formatToOpenAITool) }),
|
|
120
|
+
* new OpenAIToolsAgentOutputParser(),
|
|
121
|
+
* ]).withConfig({ runName: "OpenAIToolsAgent" });
|
|
122
|
+
*
|
|
123
|
+
* const result = await runnableAgent.invoke({
|
|
124
|
+
* input:
|
|
125
|
+
* "What is the sum of the current temperature in San Francisco, New York, and Tokyo?",
|
|
126
|
+
* });
|
|
127
|
+
*
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
65
130
|
export class OpenAIToolsAgentOutputParser extends AgentMultiActionOutputParser {
|
|
66
131
|
constructor() {
|
|
67
132
|
super(...arguments);
|
|
@@ -29,6 +29,22 @@ const FINAL_ANSWER_AND_PARSABLE_ACTION_ERROR_MESSAGE = "Parsing LLM output produ
|
|
|
29
29
|
* Thought: agent thought here
|
|
30
30
|
* Final Answer: The temperature is 100 degrees
|
|
31
31
|
* ```
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
*
|
|
35
|
+
* const runnableAgent = RunnableSequence.from([
|
|
36
|
+
* ...rest of runnable
|
|
37
|
+
* new ReActSingleInputOutputParser({ toolNames: ["SerpAPI", "Calculator"] }),
|
|
38
|
+
* ]);
|
|
39
|
+
* const agent = AgentExecutor.fromAgentAndTools({
|
|
40
|
+
* agent: runnableAgent,
|
|
41
|
+
* tools: [new SerpAPI(), new Calculator()],
|
|
42
|
+
* });
|
|
43
|
+
* const result = await agent.invoke({
|
|
44
|
+
* input: "whats the weather in pomfret?",
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* ```
|
|
32
48
|
*/
|
|
33
49
|
class ReActSingleInputOutputParser extends types_js_1.AgentActionOutputParser {
|
|
34
50
|
constructor(fields) {
|
|
@@ -23,6 +23,22 @@ import { AgentAction, AgentFinish } from "../../schema/index.js";
|
|
|
23
23
|
* Thought: agent thought here
|
|
24
24
|
* Final Answer: The temperature is 100 degrees
|
|
25
25
|
* ```
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
*
|
|
29
|
+
* const runnableAgent = RunnableSequence.from([
|
|
30
|
+
* ...rest of runnable
|
|
31
|
+
* new ReActSingleInputOutputParser({ toolNames: ["SerpAPI", "Calculator"] }),
|
|
32
|
+
* ]);
|
|
33
|
+
* const agent = AgentExecutor.fromAgentAndTools({
|
|
34
|
+
* agent: runnableAgent,
|
|
35
|
+
* tools: [new SerpAPI(), new Calculator()],
|
|
36
|
+
* });
|
|
37
|
+
* const result = await agent.invoke({
|
|
38
|
+
* input: "whats the weather in pomfret?",
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* ```
|
|
26
42
|
*/
|
|
27
43
|
export declare class ReActSingleInputOutputParser extends AgentActionOutputParser {
|
|
28
44
|
lc_namespace: string[];
|
|
@@ -26,6 +26,22 @@ const FINAL_ANSWER_AND_PARSABLE_ACTION_ERROR_MESSAGE = "Parsing LLM output produ
|
|
|
26
26
|
* Thought: agent thought here
|
|
27
27
|
* Final Answer: The temperature is 100 degrees
|
|
28
28
|
* ```
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
*
|
|
32
|
+
* const runnableAgent = RunnableSequence.from([
|
|
33
|
+
* ...rest of runnable
|
|
34
|
+
* new ReActSingleInputOutputParser({ toolNames: ["SerpAPI", "Calculator"] }),
|
|
35
|
+
* ]);
|
|
36
|
+
* const agent = AgentExecutor.fromAgentAndTools({
|
|
37
|
+
* agent: runnableAgent,
|
|
38
|
+
* tools: [new SerpAPI(), new Calculator()],
|
|
39
|
+
* });
|
|
40
|
+
* const result = await agent.invoke({
|
|
41
|
+
* input: "whats the weather in pomfret?",
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* ```
|
|
29
45
|
*/
|
|
30
46
|
export class ReActSingleInputOutputParser extends AgentActionOutputParser {
|
|
31
47
|
constructor(fields) {
|