langchain 0.0.192 → 0.0.194
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/agent.cjs +24 -0
- package/dist/agents/agent.d.ts +24 -0
- package/dist/agents/agent.js +24 -0
- package/dist/agents/chat/outputParser.cjs +32 -0
- package/dist/agents/chat/outputParser.d.ts +32 -0
- package/dist/agents/chat/outputParser.js +32 -0
- package/dist/agents/executor.cjs +14 -0
- package/dist/agents/executor.d.ts +14 -0
- package/dist/agents/executor.js +14 -0
- package/dist/agents/mrkl/index.cjs +21 -0
- package/dist/agents/mrkl/index.d.ts +21 -0
- package/dist/agents/mrkl/index.js +21 -0
- package/dist/agents/openai/output_parser.cjs +65 -0
- package/dist/agents/openai/output_parser.d.ts +65 -0
- package/dist/agents/openai/output_parser.js +65 -0
- package/dist/agents/react/output_parser.cjs +16 -0
- package/dist/agents/react/output_parser.d.ts +16 -0
- package/dist/agents/react/output_parser.js +16 -0
- package/dist/agents/structured_chat/outputParser.cjs +12 -0
- package/dist/agents/structured_chat/outputParser.d.ts +12 -0
- package/dist/agents/structured_chat/outputParser.js +12 -0
- package/dist/agents/toolkits/aws_sfn.cjs +20 -0
- package/dist/agents/toolkits/aws_sfn.d.ts +20 -0
- package/dist/agents/toolkits/aws_sfn.js +20 -0
- package/dist/agents/toolkits/json/json.cjs +8 -0
- package/dist/agents/toolkits/json/json.d.ts +8 -0
- package/dist/agents/toolkits/json/json.js +8 -0
- package/dist/agents/toolkits/openapi/openapi.cjs +18 -0
- package/dist/agents/toolkits/openapi/openapi.d.ts +18 -0
- package/dist/agents/toolkits/openapi/openapi.js +18 -0
- package/dist/agents/toolkits/sql/sql.cjs +8 -0
- package/dist/agents/toolkits/sql/sql.d.ts +8 -0
- package/dist/agents/toolkits/sql/sql.js +8 -0
- package/dist/agents/toolkits/vectorstore/vectorstore.cjs +16 -0
- package/dist/agents/toolkits/vectorstore/vectorstore.d.ts +16 -0
- package/dist/agents/toolkits/vectorstore/vectorstore.js +16 -0
- package/dist/agents/toolkits/zapier/zapier.cjs +10 -0
- package/dist/agents/toolkits/zapier/zapier.d.ts +10 -0
- package/dist/agents/toolkits/zapier/zapier.js +10 -0
- package/dist/agents/xml/output_parser.cjs +21 -0
- package/dist/agents/xml/output_parser.d.ts +21 -0
- package/dist/agents/xml/output_parser.js +21 -0
- package/dist/cache/cloudflare_kv.cjs +13 -0
- package/dist/cache/cloudflare_kv.d.ts +13 -0
- package/dist/cache/cloudflare_kv.js +13 -0
- package/dist/cache/ioredis.cjs +13 -0
- package/dist/cache/ioredis.d.ts +13 -0
- package/dist/cache/ioredis.js +13 -0
- package/dist/cache/momento.cjs +19 -0
- package/dist/cache/momento.d.ts +19 -0
- package/dist/cache/momento.js +19 -0
- package/dist/cache/redis.cjs +10 -0
- package/dist/cache/redis.d.ts +10 -0
- package/dist/cache/redis.js +10 -0
- package/dist/cache/upstash_redis.cjs +15 -0
- package/dist/cache/upstash_redis.d.ts +15 -0
- package/dist/cache/upstash_redis.js +15 -0
- package/dist/callbacks/handlers/console.cjs +10 -0
- package/dist/callbacks/handlers/console.d.ts +10 -0
- package/dist/callbacks/handlers/console.js +10 -0
- package/dist/callbacks/manager.cjs +49 -0
- package/dist/callbacks/manager.d.ts +49 -0
- package/dist/callbacks/manager.js +49 -0
- package/dist/chains/analyze_documents_chain.cjs +18 -0
- package/dist/chains/analyze_documents_chain.d.ts +18 -0
- package/dist/chains/analyze_documents_chain.js +18 -0
- package/dist/chains/constitutional_ai/constitutional_chain.cjs +21 -0
- package/dist/chains/constitutional_ai/constitutional_chain.d.ts +21 -0
- package/dist/chains/constitutional_ai/constitutional_chain.js +21 -0
- package/dist/chains/constitutional_ai/constitutional_principle.cjs +21 -0
- package/dist/chains/constitutional_ai/constitutional_principle.d.ts +21 -0
- package/dist/chains/constitutional_ai/constitutional_principle.js +21 -0
- package/dist/chains/conversation.cjs +13 -0
- package/dist/chains/conversation.d.ts +13 -0
- package/dist/chains/conversation.js +13 -0
- package/dist/chains/conversational_retrieval_chain.cjs +29 -0
- package/dist/chains/conversational_retrieval_chain.d.ts +29 -0
- package/dist/chains/conversational_retrieval_chain.js +29 -0
- package/dist/chains/graph_qa/cypher.cjs +10 -0
- package/dist/chains/graph_qa/cypher.d.ts +10 -0
- package/dist/chains/graph_qa/cypher.js +10 -0
- package/dist/chains/openai_moderation.cjs +28 -0
- package/dist/chains/openai_moderation.d.ts +28 -0
- package/dist/chains/openai_moderation.js +28 -0
- package/dist/chains/retrieval_qa.cjs +21 -0
- package/dist/chains/retrieval_qa.d.ts +21 -0
- package/dist/chains/retrieval_qa.js +21 -0
- package/dist/chains/router/multi_prompt.cjs +19 -0
- package/dist/chains/router/multi_prompt.d.ts +19 -0
- package/dist/chains/router/multi_prompt.js +19 -0
- package/dist/chains/router/multi_retrieval_qa.cjs +29 -0
- package/dist/chains/router/multi_retrieval_qa.d.ts +29 -0
- package/dist/chains/router/multi_retrieval_qa.js +29 -0
- package/dist/chains/sequential_chain.cjs +43 -0
- package/dist/chains/sequential_chain.d.ts +43 -0
- package/dist/chains/sequential_chain.js +43 -0
- package/dist/chains/sql_db/sql_db_chain.cjs +9 -0
- package/dist/chains/sql_db/sql_db_chain.d.ts +9 -0
- package/dist/chains/sql_db/sql_db_chain.js +9 -0
- package/dist/chat_models/anthropic.cjs +9 -1
- package/dist/chat_models/anthropic.d.ts +9 -1
- package/dist/chat_models/anthropic.js +9 -1
- package/dist/chat_models/baiduwenxin.cjs +20 -0
- package/dist/chat_models/baiduwenxin.d.ts +20 -0
- package/dist/chat_models/baiduwenxin.js +20 -0
- package/dist/chat_models/base.cjs +2 -0
- package/dist/chat_models/base.d.ts +1 -1
- package/dist/chat_models/base.js +2 -0
- package/dist/chat_models/bedrock/index.cjs +11 -0
- package/dist/chat_models/bedrock/index.d.ts +11 -0
- package/dist/chat_models/bedrock/index.js +11 -0
- package/dist/chat_models/bedrock/web.cjs +9 -0
- package/dist/chat_models/bedrock/web.d.ts +9 -0
- package/dist/chat_models/bedrock/web.js +9 -0
- package/dist/chat_models/cloudflare_workersai.cjs +15 -0
- package/dist/chat_models/cloudflare_workersai.d.ts +15 -0
- package/dist/chat_models/cloudflare_workersai.js +15 -0
- package/dist/chat_models/fake.cjs +16 -0
- package/dist/chat_models/fake.d.ts +16 -0
- package/dist/chat_models/fake.js +16 -0
- package/dist/chat_models/fireworks.cjs +10 -0
- package/dist/chat_models/fireworks.d.ts +10 -0
- package/dist/chat_models/fireworks.js +10 -0
- package/dist/chat_models/googlepalm.cjs +24 -0
- package/dist/chat_models/googlepalm.d.ts +24 -0
- package/dist/chat_models/googlepalm.js +24 -0
- package/dist/chat_models/googlevertexai/index.cjs +7 -0
- package/dist/chat_models/googlevertexai/index.d.ts +7 -0
- package/dist/chat_models/googlevertexai/index.js +7 -0
- package/dist/chat_models/googlevertexai/web.cjs +9 -0
- package/dist/chat_models/googlevertexai/web.d.ts +9 -0
- package/dist/chat_models/googlevertexai/web.js +9 -0
- package/dist/chat_models/iflytek_xinghuo/index.cjs +8 -0
- package/dist/chat_models/iflytek_xinghuo/index.d.ts +8 -0
- package/dist/chat_models/iflytek_xinghuo/index.js +8 -0
- package/dist/chat_models/iflytek_xinghuo/web.cjs +8 -0
- package/dist/chat_models/iflytek_xinghuo/web.d.ts +8 -0
- package/dist/chat_models/iflytek_xinghuo/web.js +8 -0
- package/dist/chat_models/llama_cpp.cjs +17 -0
- package/dist/chat_models/llama_cpp.d.ts +17 -0
- package/dist/chat_models/llama_cpp.js +17 -0
- package/dist/chat_models/minimax.cjs +27 -0
- package/dist/chat_models/minimax.d.ts +27 -0
- package/dist/chat_models/minimax.js +27 -0
- package/dist/chat_models/ollama.cjs +24 -0
- package/dist/chat_models/ollama.d.ts +24 -0
- package/dist/chat_models/ollama.js +24 -0
- package/dist/chat_models/openai.cjs +15 -0
- package/dist/chat_models/openai.d.ts +15 -0
- package/dist/chat_models/openai.js +15 -0
- package/dist/chat_models/yandex.cjs +14 -0
- package/dist/chat_models/yandex.d.ts +14 -0
- package/dist/chat_models/yandex.js +14 -0
- package/dist/document_loaders/fs/directory.cjs +14 -0
- package/dist/document_loaders/fs/directory.d.ts +14 -0
- package/dist/document_loaders/fs/directory.js +14 -0
- package/dist/document_loaders/fs/openai_whisper_audio.cjs +10 -0
- package/dist/document_loaders/fs/openai_whisper_audio.d.ts +10 -0
- package/dist/document_loaders/fs/openai_whisper_audio.js +10 -0
- package/dist/document_loaders/fs/pdf.cjs +6 -0
- package/dist/document_loaders/fs/pdf.d.ts +6 -0
- package/dist/document_loaders/fs/pdf.js +6 -0
- package/dist/document_loaders/fs/srt.cjs +6 -0
- package/dist/document_loaders/fs/srt.d.ts +6 -0
- package/dist/document_loaders/fs/srt.js +6 -0
- package/dist/document_loaders/fs/text.cjs +5 -0
- package/dist/document_loaders/fs/text.d.ts +5 -0
- package/dist/document_loaders/fs/text.js +5 -0
- package/dist/document_loaders/fs/unstructured.cjs +7 -0
- package/dist/document_loaders/fs/unstructured.d.ts +7 -0
- package/dist/document_loaders/fs/unstructured.js +7 -0
- package/dist/document_loaders/web/apify_dataset.cjs +21 -0
- package/dist/document_loaders/web/apify_dataset.d.ts +21 -0
- package/dist/document_loaders/web/apify_dataset.js +21 -0
- package/dist/document_loaders/web/assemblyai.cjs +24 -0
- package/dist/document_loaders/web/assemblyai.d.ts +24 -0
- package/dist/document_loaders/web/assemblyai.js +24 -0
- package/dist/document_loaders/web/azure_blob_storage_file.cjs +11 -0
- package/dist/document_loaders/web/azure_blob_storage_file.d.ts +11 -0
- package/dist/document_loaders/web/azure_blob_storage_file.js +11 -0
- package/dist/document_loaders/web/cheerio.cjs +6 -0
- package/dist/document_loaders/web/cheerio.d.ts +6 -0
- package/dist/document_loaders/web/cheerio.js +6 -0
- package/dist/document_loaders/web/college_confidential.cjs +6 -0
- package/dist/document_loaders/web/college_confidential.d.ts +6 -0
- package/dist/document_loaders/web/college_confidential.js +6 -0
- package/dist/document_loaders/web/confluence.cjs +11 -0
- package/dist/document_loaders/web/confluence.d.ts +11 -0
- package/dist/document_loaders/web/confluence.js +11 -0
- package/dist/document_loaders/web/figma.cjs +9 -0
- package/dist/document_loaders/web/figma.d.ts +9 -0
- package/dist/document_loaders/web/figma.js +9 -0
- package/dist/document_loaders/web/notionapi.cjs +16 -0
- package/dist/document_loaders/web/notionapi.d.ts +16 -0
- package/dist/document_loaders/web/notionapi.js +16 -0
- package/dist/document_loaders/web/notiondb.cjs +11 -1
- package/dist/document_loaders/web/notiondb.d.ts +11 -1
- package/dist/document_loaders/web/notiondb.js +11 -1
- package/dist/document_loaders/web/pdf.cjs +6 -0
- package/dist/document_loaders/web/pdf.d.ts +6 -0
- package/dist/document_loaders/web/pdf.js +6 -0
- package/dist/document_loaders/web/puppeteer.cjs +12 -0
- package/dist/document_loaders/web/puppeteer.d.ts +12 -0
- package/dist/document_loaders/web/puppeteer.js +12 -0
- package/dist/document_loaders/web/s3.cjs +17 -0
- package/dist/document_loaders/web/s3.d.ts +17 -0
- package/dist/document_loaders/web/s3.js +17 -0
- package/dist/document_loaders/web/searchapi.cjs +9 -0
- package/dist/document_loaders/web/searchapi.d.ts +9 -0
- package/dist/document_loaders/web/searchapi.js +9 -0
- package/dist/document_loaders/web/serpapi.cjs +5 -0
- package/dist/document_loaders/web/serpapi.d.ts +5 -0
- package/dist/document_loaders/web/serpapi.js +5 -0
- package/dist/document_loaders/web/sonix_audio.cjs +12 -0
- package/dist/document_loaders/web/sonix_audio.d.ts +12 -0
- package/dist/document_loaders/web/sonix_audio.js +12 -0
- package/dist/document_loaders/web/sort_xyz_blockchain.cjs +22 -0
- package/dist/document_loaders/web/sort_xyz_blockchain.d.ts +22 -0
- package/dist/document_loaders/web/sort_xyz_blockchain.js +22 -0
- package/dist/document_loaders/web/youtube.cjs +9 -0
- package/dist/document_loaders/web/youtube.d.ts +9 -0
- package/dist/document_loaders/web/youtube.js +9 -0
- package/dist/document_transformers/html_to_text.cjs +18 -0
- package/dist/document_transformers/html_to_text.d.ts +18 -0
- package/dist/document_transformers/html_to_text.js +18 -0
- package/dist/document_transformers/mozilla_readability.cjs +18 -0
- package/dist/document_transformers/mozilla_readability.d.ts +18 -0
- package/dist/document_transformers/mozilla_readability.js +18 -0
- package/dist/embeddings/bedrock.cjs +17 -0
- package/dist/embeddings/bedrock.d.ts +17 -0
- package/dist/embeddings/bedrock.js +17 -0
- package/dist/embeddings/cache_backed.cjs +37 -0
- package/dist/embeddings/cache_backed.d.ts +37 -0
- package/dist/embeddings/cache_backed.js +37 -0
- package/dist/embeddings/cohere.cjs +10 -0
- package/dist/embeddings/cohere.d.ts +10 -0
- package/dist/embeddings/cohere.js +10 -0
- package/dist/embeddings/googlepalm.cjs +17 -0
- package/dist/embeddings/googlepalm.d.ts +17 -0
- package/dist/embeddings/googlepalm.js +17 -0
- package/dist/embeddings/googlevertexai.cjs +8 -0
- package/dist/embeddings/googlevertexai.d.ts +8 -0
- package/dist/embeddings/googlevertexai.js +8 -0
- package/dist/embeddings/hf_transformers.cjs +18 -0
- package/dist/embeddings/hf_transformers.d.ts +18 -0
- package/dist/embeddings/hf_transformers.js +18 -0
- package/dist/embeddings/llama_cpp.cjs +16 -0
- package/dist/embeddings/llama_cpp.d.ts +16 -0
- package/dist/embeddings/llama_cpp.js +16 -0
- package/dist/embeddings/minimax.cjs +15 -0
- package/dist/embeddings/minimax.d.ts +15 -0
- package/dist/embeddings/minimax.js +15 -0
- package/dist/embeddings/openai.cjs +10 -0
- package/dist/embeddings/openai.d.ts +10 -0
- package/dist/embeddings/openai.js +10 -0
- package/dist/embeddings/tensorflow.cjs +16 -0
- package/dist/embeddings/tensorflow.d.ts +16 -0
- package/dist/embeddings/tensorflow.js +16 -0
- package/dist/experimental/autogpt/agent.cjs +21 -0
- package/dist/experimental/autogpt/agent.d.ts +21 -0
- package/dist/experimental/autogpt/agent.js +21 -0
- package/dist/experimental/babyagi/agent.cjs +12 -0
- package/dist/experimental/babyagi/agent.d.ts +12 -0
- package/dist/experimental/babyagi/agent.js +12 -0
- package/dist/experimental/chat_models/ollama_functions.cjs +12 -15
- package/dist/experimental/chat_models/ollama_functions.d.ts +3 -4
- package/dist/experimental/chat_models/ollama_functions.js +13 -16
- package/dist/experimental/generative_agents/generative_agent.cjs +30 -0
- package/dist/experimental/generative_agents/generative_agent.d.ts +30 -0
- package/dist/experimental/generative_agents/generative_agent.js +30 -0
- package/dist/experimental/generative_agents/generative_agent_memory.cjs +18 -0
- package/dist/experimental/generative_agents/generative_agent_memory.d.ts +18 -0
- package/dist/experimental/generative_agents/generative_agent_memory.js +18 -0
- package/dist/llms/base.cjs +3 -1
- package/dist/llms/base.d.ts +1 -1
- package/dist/llms/base.js +3 -1
- package/dist/llms/cohere.cjs +13 -0
- package/dist/llms/cohere.d.ts +13 -0
- package/dist/llms/cohere.js +13 -0
- package/dist/llms/googlevertexai/index.cjs +12 -0
- package/dist/llms/googlevertexai/index.d.ts +12 -0
- package/dist/llms/googlevertexai/index.js +12 -0
- package/dist/llms/googlevertexai/web.cjs +12 -0
- package/dist/llms/googlevertexai/web.d.ts +12 -0
- package/dist/llms/googlevertexai/web.js +12 -0
- package/dist/llms/hf.cjs +13 -0
- package/dist/llms/hf.d.ts +13 -0
- package/dist/llms/hf.js +13 -0
- package/dist/llms/ollama.cjs +19 -0
- package/dist/llms/ollama.d.ts +19 -0
- package/dist/llms/ollama.js +19 -0
- package/dist/llms/openai-chat.cjs +17 -0
- package/dist/llms/openai-chat.d.ts +17 -0
- package/dist/llms/openai-chat.js +17 -0
- package/dist/llms/openai.cjs +14 -0
- package/dist/llms/openai.d.ts +14 -0
- package/dist/llms/openai.js +14 -0
- package/dist/llms/portkey.cjs +24 -0
- package/dist/llms/portkey.d.ts +24 -0
- package/dist/llms/portkey.js +24 -0
- package/dist/llms/replicate.cjs +11 -0
- package/dist/llms/replicate.d.ts +11 -0
- package/dist/llms/replicate.js +11 -0
- package/dist/memory/buffer_memory.cjs +24 -0
- package/dist/memory/buffer_memory.d.ts +24 -0
- package/dist/memory/buffer_memory.js +24 -0
- package/dist/memory/buffer_token_memory.cjs +15 -0
- package/dist/memory/buffer_token_memory.d.ts +15 -0
- package/dist/memory/buffer_token_memory.js +15 -0
- package/dist/memory/buffer_window_memory.cjs +23 -0
- package/dist/memory/buffer_window_memory.d.ts +23 -0
- package/dist/memory/buffer_window_memory.js +23 -0
- package/dist/memory/entity_memory.cjs +29 -0
- package/dist/memory/entity_memory.d.ts +29 -0
- package/dist/memory/entity_memory.js +29 -0
- package/dist/memory/summary.cjs +24 -0
- package/dist/memory/summary.d.ts +24 -0
- package/dist/memory/summary.js +24 -0
- package/dist/memory/summary_buffer.cjs +32 -0
- package/dist/memory/summary_buffer.d.ts +32 -0
- package/dist/memory/summary_buffer.js +32 -0
- package/dist/memory/vector_store.cjs +24 -0
- package/dist/memory/vector_store.d.ts +24 -0
- package/dist/memory/vector_store.js +24 -0
- package/dist/memory/zep.cjs +34 -0
- package/dist/memory/zep.d.ts +34 -0
- package/dist/memory/zep.js +34 -0
- package/dist/prompts/chat.cjs +31 -0
- package/dist/prompts/chat.d.ts +31 -0
- package/dist/prompts/chat.js +31 -0
- package/dist/prompts/few_shot.cjs +31 -0
- package/dist/prompts/few_shot.d.ts +31 -0
- package/dist/prompts/few_shot.js +31 -0
- package/dist/prompts/pipeline.cjs +39 -0
- package/dist/prompts/pipeline.d.ts +39 -0
- package/dist/prompts/pipeline.js +39 -0
- package/dist/prompts/selectors/LengthBasedExampleSelector.cjs +36 -0
- package/dist/prompts/selectors/LengthBasedExampleSelector.d.ts +36 -0
- package/dist/prompts/selectors/LengthBasedExampleSelector.js +36 -0
- package/dist/prompts/selectors/SemanticSimilarityExampleSelector.cjs +25 -0
- package/dist/prompts/selectors/SemanticSimilarityExampleSelector.d.ts +25 -0
- package/dist/prompts/selectors/SemanticSimilarityExampleSelector.js +25 -0
- package/dist/retrievers/amazon_kendra.cjs +16 -0
- package/dist/retrievers/amazon_kendra.d.ts +16 -0
- package/dist/retrievers/amazon_kendra.js +16 -0
- package/dist/retrievers/chaindesk.cjs +11 -0
- package/dist/retrievers/chaindesk.d.ts +11 -0
- package/dist/retrievers/chaindesk.js +11 -0
- package/dist/retrievers/contextual_compression.cjs +10 -0
- package/dist/retrievers/contextual_compression.d.ts +10 -0
- package/dist/retrievers/contextual_compression.js +10 -0
- package/dist/retrievers/document_compressors/embeddings_filter.cjs +13 -0
- package/dist/retrievers/document_compressors/embeddings_filter.d.ts +13 -0
- package/dist/retrievers/document_compressors/embeddings_filter.js +13 -0
- package/dist/retrievers/document_compressors/index.cjs +26 -0
- package/dist/retrievers/document_compressors/index.d.ts +26 -0
- package/dist/retrievers/document_compressors/index.js +26 -0
- package/dist/retrievers/hyde.cjs +19 -0
- package/dist/retrievers/hyde.d.ts +19 -0
- package/dist/retrievers/hyde.js +19 -0
- package/dist/retrievers/metal.cjs +11 -0
- package/dist/retrievers/metal.d.ts +11 -0
- package/dist/retrievers/metal.js +11 -0
- package/dist/retrievers/multi_query.cjs +13 -1
- package/dist/retrievers/multi_query.d.ts +13 -0
- package/dist/retrievers/multi_query.js +13 -1
- package/dist/retrievers/multi_vector.cjs +13 -0
- package/dist/retrievers/multi_vector.d.ts +13 -0
- package/dist/retrievers/multi_vector.js +13 -0
- package/dist/retrievers/parent_document.cjs +21 -0
- package/dist/retrievers/parent_document.d.ts +21 -0
- package/dist/retrievers/parent_document.js +21 -0
- package/dist/retrievers/remote/chatgpt-plugin.cjs +10 -0
- package/dist/retrievers/remote/chatgpt-plugin.d.ts +10 -0
- package/dist/retrievers/remote/chatgpt-plugin.js +10 -0
- package/dist/retrievers/self_query/chroma.cjs +15 -0
- package/dist/retrievers/self_query/chroma.d.ts +15 -0
- package/dist/retrievers/self_query/chroma.js +15 -0
- package/dist/retrievers/self_query/functional.cjs +7 -0
- package/dist/retrievers/self_query/functional.d.ts +7 -0
- package/dist/retrievers/self_query/functional.js +7 -0
- package/dist/retrievers/self_query/index.cjs +13 -0
- package/dist/retrievers/self_query/index.d.ts +13 -0
- package/dist/retrievers/self_query/index.js +13 -0
- package/dist/retrievers/self_query/pinecone.cjs +14 -0
- package/dist/retrievers/self_query/pinecone.d.ts +14 -0
- package/dist/retrievers/self_query/pinecone.js +14 -0
- package/dist/retrievers/self_query/supabase.cjs +14 -0
- package/dist/retrievers/self_query/supabase.d.ts +14 -0
- package/dist/retrievers/self_query/supabase.js +14 -0
- package/dist/retrievers/self_query/weaviate.cjs +14 -0
- package/dist/retrievers/self_query/weaviate.d.ts +14 -0
- package/dist/retrievers/self_query/weaviate.js +14 -0
- package/dist/retrievers/time_weighted.cjs +16 -0
- package/dist/retrievers/time_weighted.d.ts +16 -0
- package/dist/retrievers/time_weighted.js +16 -0
- package/dist/retrievers/vespa.cjs +15 -0
- package/dist/retrievers/vespa.d.ts +15 -0
- package/dist/retrievers/vespa.js +15 -0
- package/dist/retrievers/zep.cjs +10 -0
- package/dist/retrievers/zep.d.ts +10 -0
- package/dist/retrievers/zep.js +10 -0
- package/dist/schema/index.d.ts +8 -6
- package/dist/schema/output_parser.cjs +15 -0
- package/dist/schema/output_parser.d.ts +15 -0
- package/dist/schema/output_parser.js +15 -0
- package/dist/schema/runnable/base.cjs +20 -0
- package/dist/schema/runnable/base.d.ts +20 -0
- package/dist/schema/runnable/base.js +20 -0
- package/dist/schema/runnable/branch.cjs +28 -0
- package/dist/schema/runnable/branch.d.ts +28 -0
- package/dist/schema/runnable/branch.js +28 -0
- package/dist/storage/file_system.cjs +21 -0
- package/dist/storage/file_system.d.ts +21 -0
- package/dist/storage/file_system.js +21 -0
- package/dist/storage/in_memory.cjs +15 -0
- package/dist/storage/in_memory.d.ts +15 -0
- package/dist/storage/in_memory.js +15 -0
- package/dist/storage/ioredis.cjs +24 -0
- package/dist/storage/ioredis.d.ts +24 -0
- package/dist/storage/ioredis.js +24 -0
- package/dist/storage/upstash_redis.cjs +19 -0
- package/dist/storage/upstash_redis.d.ts +19 -0
- package/dist/storage/upstash_redis.js +19 -0
- package/dist/storage/vercel_kv.cjs +16 -0
- package/dist/storage/vercel_kv.d.ts +16 -0
- package/dist/storage/vercel_kv.js +16 -0
- package/dist/stores/message/cassandra.cjs +25 -0
- package/dist/stores/message/cassandra.d.ts +25 -0
- package/dist/stores/message/cassandra.js +25 -0
- package/dist/stores/message/cloudflare_d1.cjs +18 -0
- package/dist/stores/message/cloudflare_d1.d.ts +18 -0
- package/dist/stores/message/cloudflare_d1.js +18 -0
- package/dist/stores/message/firestore.cjs +19 -0
- package/dist/stores/message/firestore.d.ts +19 -0
- package/dist/stores/message/firestore.js +19 -0
- package/dist/stores/message/ioredis.cjs +18 -0
- package/dist/stores/message/ioredis.d.ts +18 -0
- package/dist/stores/message/ioredis.js +18 -0
- package/dist/stores/message/momento.cjs +18 -0
- package/dist/stores/message/momento.d.ts +18 -0
- package/dist/stores/message/momento.js +18 -0
- package/dist/stores/message/mongodb.cjs +11 -0
- package/dist/stores/message/mongodb.d.ts +11 -0
- package/dist/stores/message/mongodb.js +11 -0
- package/dist/stores/message/planetscale.cjs +18 -0
- package/dist/stores/message/planetscale.d.ts +18 -0
- package/dist/stores/message/planetscale.js +18 -0
- package/dist/stores/message/redis.cjs +18 -0
- package/dist/stores/message/redis.d.ts +18 -0
- package/dist/stores/message/redis.js +18 -0
- package/dist/stores/message/xata.cjs +23 -0
- package/dist/stores/message/xata.d.ts +23 -0
- package/dist/stores/message/xata.js +23 -0
- package/dist/tools/calculator.cjs +6 -0
- package/dist/tools/calculator.d.ts +6 -0
- package/dist/tools/calculator.js +6 -0
- package/dist/tools/google_calendar/create.cjs +22 -0
- package/dist/tools/google_calendar/create.d.ts +22 -0
- package/dist/tools/google_calendar/create.js +22 -0
- package/dist/tools/google_calendar/view.cjs +20 -0
- package/dist/tools/google_calendar/view.d.ts +20 -0
- package/dist/tools/google_calendar/view.js +20 -0
- package/dist/tools/searchapi.cjs +27 -0
- package/dist/tools/searchapi.d.ts +27 -0
- package/dist/tools/searchapi.js +27 -0
- package/dist/tools/searxng_search.cjs +20 -1
- package/dist/tools/searxng_search.d.ts +20 -1
- package/dist/tools/searxng_search.js +20 -1
- package/dist/tools/webbrowser.cjs +8 -0
- package/dist/tools/webbrowser.d.ts +8 -0
- package/dist/tools/webbrowser.js +8 -0
- package/dist/tools/wikipedia_query_run.cjs +8 -0
- package/dist/tools/wikipedia_query_run.d.ts +8 -0
- package/dist/tools/wikipedia_query_run.js +8 -0
- package/dist/tools/wolframalpha.cjs +9 -0
- package/dist/tools/wolframalpha.d.ts +9 -0
- package/dist/tools/wolframalpha.js +9 -0
- package/dist/util/googlevertexai-connection.cjs +3 -9
- package/dist/util/googlevertexai-connection.js +3 -9
- package/dist/vectorstores/opensearch.cjs +2 -1
- package/dist/vectorstores/opensearch.js +2 -1
- package/dist/vectorstores/prisma.cjs +6 -0
- package/dist/vectorstores/prisma.d.ts +3 -0
- package/dist/vectorstores/prisma.js +6 -0
- package/package.json +2 -2
|
@@ -45,6 +45,18 @@ export interface StructuredChatOutputParserArgs {
|
|
|
45
45
|
* and `OutputFixingParser` classes. It extends the
|
|
46
46
|
* `AgentActionOutputParser` class and allows for retrying the output
|
|
47
47
|
* parsing using the `OutputFixingParser` if it is provided.
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const outputParser = new StructuredChatOutputParserWithRetries.fromLLM(
|
|
51
|
+
* new ChatOpenAI({ temperature: 0 }),
|
|
52
|
+
* {
|
|
53
|
+
* toolNames: ["calculator", "random-number-generator"],
|
|
54
|
+
* },
|
|
55
|
+
* );
|
|
56
|
+
* const result = await outputParser.parse(
|
|
57
|
+
* "What is a random number between 5 and 10 raised to the second power?"
|
|
58
|
+
* );
|
|
59
|
+
* ```
|
|
48
60
|
*/
|
|
49
61
|
export declare class StructuredChatOutputParserWithRetries extends AgentActionOutputParser {
|
|
50
62
|
lc_namespace: string[];
|
|
@@ -68,6 +68,18 @@ export class StructuredChatOutputParser extends AgentActionOutputParser {
|
|
|
68
68
|
* and `OutputFixingParser` classes. It extends the
|
|
69
69
|
* `AgentActionOutputParser` class and allows for retrying the output
|
|
70
70
|
* parsing using the `OutputFixingParser` if it is provided.
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* const outputParser = new StructuredChatOutputParserWithRetries.fromLLM(
|
|
74
|
+
* new ChatOpenAI({ temperature: 0 }),
|
|
75
|
+
* {
|
|
76
|
+
* toolNames: ["calculator", "random-number-generator"],
|
|
77
|
+
* },
|
|
78
|
+
* );
|
|
79
|
+
* const result = await outputParser.parse(
|
|
80
|
+
* "What is a random number between 5 and 10 raised to the second power?"
|
|
81
|
+
* );
|
|
82
|
+
* ```
|
|
71
83
|
*/
|
|
72
84
|
export class StructuredChatOutputParserWithRetries extends AgentActionOutputParser {
|
|
73
85
|
constructor(fields) {
|
|
@@ -23,6 +23,26 @@ Thought: I should look at state machines within AWS Step Functions to see what a
|
|
|
23
23
|
* Class representing a toolkit for interacting with AWS Step Functions.
|
|
24
24
|
* It initializes the AWS Step Functions tools and provides them as tools
|
|
25
25
|
* for the agent.
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
*
|
|
29
|
+
* const toolkit = new AWSSfnToolkit({
|
|
30
|
+
* name: "onboard-new-client-workflow",
|
|
31
|
+
* description:
|
|
32
|
+
* "Onboard new client workflow. Can also be used to get status of any executing workflow or state machine.",
|
|
33
|
+
* stateMachineArn:
|
|
34
|
+
* "arn:aws:states:us-east-1:1234567890:stateMachine:my-state-machine",
|
|
35
|
+
* region: "<your Sfn's region>",
|
|
36
|
+
* accessKeyId: "<your access key id>",
|
|
37
|
+
* secretAccessKey: "<your secret access key>",
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
*
|
|
41
|
+
* const result = await toolkit.invoke({
|
|
42
|
+
* input: "Onboard john doe (john@example.com) as a new client.",
|
|
43
|
+
* });
|
|
44
|
+
*
|
|
45
|
+
* ```
|
|
26
46
|
*/
|
|
27
47
|
class AWSSfnToolkit extends base_js_1.Toolkit {
|
|
28
48
|
constructor(args) {
|
|
@@ -23,6 +23,26 @@ export interface AWSSfnToolkitArgs {
|
|
|
23
23
|
* Class representing a toolkit for interacting with AWS Step Functions.
|
|
24
24
|
* It initializes the AWS Step Functions tools and provides them as tools
|
|
25
25
|
* for the agent.
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
*
|
|
29
|
+
* const toolkit = new AWSSfnToolkit({
|
|
30
|
+
* name: "onboard-new-client-workflow",
|
|
31
|
+
* description:
|
|
32
|
+
* "Onboard new client workflow. Can also be used to get status of any executing workflow or state machine.",
|
|
33
|
+
* stateMachineArn:
|
|
34
|
+
* "arn:aws:states:us-east-1:1234567890:stateMachine:my-state-machine",
|
|
35
|
+
* region: "<your Sfn's region>",
|
|
36
|
+
* accessKeyId: "<your access key id>",
|
|
37
|
+
* secretAccessKey: "<your secret access key>",
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
*
|
|
41
|
+
* const result = await toolkit.invoke({
|
|
42
|
+
* input: "Onboard john doe (john@example.com) as a new client.",
|
|
43
|
+
* });
|
|
44
|
+
*
|
|
45
|
+
* ```
|
|
26
46
|
*/
|
|
27
47
|
export declare class AWSSfnToolkit extends Toolkit {
|
|
28
48
|
tools: Tool[];
|
|
@@ -20,6 +20,26 @@ Thought: I should look at state machines within AWS Step Functions to see what a
|
|
|
20
20
|
* Class representing a toolkit for interacting with AWS Step Functions.
|
|
21
21
|
* It initializes the AWS Step Functions tools and provides them as tools
|
|
22
22
|
* for the agent.
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
*
|
|
26
|
+
* const toolkit = new AWSSfnToolkit({
|
|
27
|
+
* name: "onboard-new-client-workflow",
|
|
28
|
+
* description:
|
|
29
|
+
* "Onboard new client workflow. Can also be used to get status of any executing workflow or state machine.",
|
|
30
|
+
* stateMachineArn:
|
|
31
|
+
* "arn:aws:states:us-east-1:1234567890:stateMachine:my-state-machine",
|
|
32
|
+
* region: "<your Sfn's region>",
|
|
33
|
+
* accessKeyId: "<your access key id>",
|
|
34
|
+
* secretAccessKey: "<your secret access key>",
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
*
|
|
38
|
+
* const result = await toolkit.invoke({
|
|
39
|
+
* input: "Onboard john doe (john@example.com) as a new client.",
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* ```
|
|
23
43
|
*/
|
|
24
44
|
export class AWSSfnToolkit extends Toolkit {
|
|
25
45
|
constructor(args) {
|
|
@@ -10,6 +10,14 @@ const executor_js_1 = require("../../executor.cjs");
|
|
|
10
10
|
/**
|
|
11
11
|
* Represents a toolkit for working with JSON data. It initializes the
|
|
12
12
|
* JSON tools based on the provided JSON specification.
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const toolkit = new JsonToolkit(new JsonSpec());
|
|
16
|
+
* const executor = createJsonAgent(model, toolkit);
|
|
17
|
+
* const result = await executor.invoke({
|
|
18
|
+
* input: 'What are the required parameters in the request body to the /completions endpoint?'
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
13
21
|
*/
|
|
14
22
|
class JsonToolkit extends base_js_1.Toolkit {
|
|
15
23
|
constructor(jsonSpec) {
|
|
@@ -7,6 +7,14 @@ import { AgentExecutor } from "../../executor.js";
|
|
|
7
7
|
/**
|
|
8
8
|
* Represents a toolkit for working with JSON data. It initializes the
|
|
9
9
|
* JSON tools based on the provided JSON specification.
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const toolkit = new JsonToolkit(new JsonSpec());
|
|
13
|
+
* const executor = createJsonAgent(model, toolkit);
|
|
14
|
+
* const result = await executor.invoke({
|
|
15
|
+
* input: 'What are the required parameters in the request body to the /completions endpoint?'
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
10
18
|
*/
|
|
11
19
|
export declare class JsonToolkit extends Toolkit {
|
|
12
20
|
jsonSpec: JsonSpec;
|
|
@@ -7,6 +7,14 @@ import { AgentExecutor } from "../../executor.js";
|
|
|
7
7
|
/**
|
|
8
8
|
* Represents a toolkit for working with JSON data. It initializes the
|
|
9
9
|
* JSON tools based on the provided JSON specification.
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const toolkit = new JsonToolkit(new JsonSpec());
|
|
13
|
+
* const executor = createJsonAgent(model, toolkit);
|
|
14
|
+
* const result = await executor.invoke({
|
|
15
|
+
* input: 'What are the required parameters in the request body to the /completions endpoint?'
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
10
18
|
*/
|
|
11
19
|
export class JsonToolkit extends Toolkit {
|
|
12
20
|
constructor(jsonSpec) {
|
|
@@ -31,6 +31,24 @@ exports.RequestsToolkit = RequestsToolkit;
|
|
|
31
31
|
* exploring JSON data. It creates a JSON agent using the `JsonToolkit`
|
|
32
32
|
* and the provided language model, and adds the JSON explorer tool to the
|
|
33
33
|
* toolkit.
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const toolkit = new OpenApiToolkit(
|
|
37
|
+
* new JsonSpec({
|
|
38
|
+
* }),
|
|
39
|
+
* new ChatOpenAI({ temperature: 0 }),
|
|
40
|
+
* {
|
|
41
|
+
* "Content-Type": "application/json",
|
|
42
|
+
* Authorization: `Bearer ${process.env.OPENAI_API_KEY}`,
|
|
43
|
+
* },
|
|
44
|
+
* );
|
|
45
|
+
*
|
|
46
|
+
* const result = await toolkit.invoke({
|
|
47
|
+
* input:
|
|
48
|
+
* "Make a POST request to openai /completions. The prompt should be 'tell me a joke.'",
|
|
49
|
+
* });
|
|
50
|
+
* console.log(`Got output ${result.output}`);
|
|
51
|
+
* ```
|
|
34
52
|
*/
|
|
35
53
|
class OpenApiToolkit extends RequestsToolkit {
|
|
36
54
|
constructor(jsonSpec, llm, headers) {
|
|
@@ -18,6 +18,24 @@ export declare class RequestsToolkit extends Toolkit {
|
|
|
18
18
|
* exploring JSON data. It creates a JSON agent using the `JsonToolkit`
|
|
19
19
|
* and the provided language model, and adds the JSON explorer tool to the
|
|
20
20
|
* toolkit.
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const toolkit = new OpenApiToolkit(
|
|
24
|
+
* new JsonSpec({
|
|
25
|
+
* }),
|
|
26
|
+
* new ChatOpenAI({ temperature: 0 }),
|
|
27
|
+
* {
|
|
28
|
+
* "Content-Type": "application/json",
|
|
29
|
+
* Authorization: `Bearer ${process.env.OPENAI_API_KEY}`,
|
|
30
|
+
* },
|
|
31
|
+
* );
|
|
32
|
+
*
|
|
33
|
+
* const result = await toolkit.invoke({
|
|
34
|
+
* input:
|
|
35
|
+
* "Make a POST request to openai /completions. The prompt should be 'tell me a joke.'",
|
|
36
|
+
* });
|
|
37
|
+
* console.log(`Got output ${result.output}`);
|
|
38
|
+
* ```
|
|
21
39
|
*/
|
|
22
40
|
export declare class OpenApiToolkit extends RequestsToolkit {
|
|
23
41
|
constructor(jsonSpec: JsonSpec, llm: BaseLanguageModel, headers?: Headers);
|
|
@@ -27,6 +27,24 @@ export class RequestsToolkit extends Toolkit {
|
|
|
27
27
|
* exploring JSON data. It creates a JSON agent using the `JsonToolkit`
|
|
28
28
|
* and the provided language model, and adds the JSON explorer tool to the
|
|
29
29
|
* toolkit.
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const toolkit = new OpenApiToolkit(
|
|
33
|
+
* new JsonSpec({
|
|
34
|
+
* }),
|
|
35
|
+
* new ChatOpenAI({ temperature: 0 }),
|
|
36
|
+
* {
|
|
37
|
+
* "Content-Type": "application/json",
|
|
38
|
+
* Authorization: `Bearer ${process.env.OPENAI_API_KEY}`,
|
|
39
|
+
* },
|
|
40
|
+
* );
|
|
41
|
+
*
|
|
42
|
+
* const result = await toolkit.invoke({
|
|
43
|
+
* input:
|
|
44
|
+
* "Make a POST request to openai /completions. The prompt should be 'tell me a joke.'",
|
|
45
|
+
* });
|
|
46
|
+
* console.log(`Got output ${result.output}`);
|
|
47
|
+
* ```
|
|
30
48
|
*/
|
|
31
49
|
export class OpenApiToolkit extends RequestsToolkit {
|
|
32
50
|
constructor(jsonSpec, llm, headers) {
|
|
@@ -11,6 +11,14 @@ const executor_js_1 = require("../../executor.cjs");
|
|
|
11
11
|
/**
|
|
12
12
|
* Class that represents a toolkit for working with SQL databases. It
|
|
13
13
|
* initializes SQL tools based on the provided SQL database.
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const model = new ChatOpenAI({});
|
|
17
|
+
* const toolkit = new SqlToolkit(sqlDb, model);
|
|
18
|
+
* const executor = createSqlAgent(model, toolkit);
|
|
19
|
+
* const result = await executor.invoke({ input: 'List the total sales per country. Which country's customers spent the most?' });
|
|
20
|
+
* console.log(`Got output ${result.output}`);
|
|
21
|
+
* ```
|
|
14
22
|
*/
|
|
15
23
|
class SqlToolkit extends base_js_1.Toolkit {
|
|
16
24
|
constructor(db, llm) {
|
|
@@ -15,6 +15,14 @@ export interface SqlCreatePromptArgs extends ZeroShotCreatePromptArgs {
|
|
|
15
15
|
/**
|
|
16
16
|
* Class that represents a toolkit for working with SQL databases. It
|
|
17
17
|
* initializes SQL tools based on the provided SQL database.
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const model = new ChatOpenAI({});
|
|
21
|
+
* const toolkit = new SqlToolkit(sqlDb, model);
|
|
22
|
+
* const executor = createSqlAgent(model, toolkit);
|
|
23
|
+
* const result = await executor.invoke({ input: 'List the total sales per country. Which country's customers spent the most?' });
|
|
24
|
+
* console.log(`Got output ${result.output}`);
|
|
25
|
+
* ```
|
|
18
26
|
*/
|
|
19
27
|
export declare class SqlToolkit extends Toolkit {
|
|
20
28
|
tools: Tool[];
|
|
@@ -8,6 +8,14 @@ import { AgentExecutor } from "../../executor.js";
|
|
|
8
8
|
/**
|
|
9
9
|
* Class that represents a toolkit for working with SQL databases. It
|
|
10
10
|
* initializes SQL tools based on the provided SQL database.
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const model = new ChatOpenAI({});
|
|
14
|
+
* const toolkit = new SqlToolkit(sqlDb, model);
|
|
15
|
+
* const executor = createSqlAgent(model, toolkit);
|
|
16
|
+
* const result = await executor.invoke({ input: 'List the total sales per country. Which country's customers spent the most?' });
|
|
17
|
+
* console.log(`Got output ${result.output}`);
|
|
18
|
+
* ```
|
|
11
19
|
*/
|
|
12
20
|
export class SqlToolkit extends Toolkit {
|
|
13
21
|
constructor(db, llm) {
|
|
@@ -12,6 +12,22 @@ const executor_js_1 = require("../../executor.cjs");
|
|
|
12
12
|
* Class representing a toolkit for working with a single vector store. It
|
|
13
13
|
* initializes the vector store QA tool based on the provided vector store
|
|
14
14
|
* information and language model.
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const toolkit = new VectorStoreToolkit(
|
|
18
|
+
* {
|
|
19
|
+
* name: "state_of_union_address",
|
|
20
|
+
* description: "the most recent state of the Union address",
|
|
21
|
+
* vectorStore: new HNSWLib(),
|
|
22
|
+
* },
|
|
23
|
+
* new ChatOpenAI({ temperature: 0 }),
|
|
24
|
+
* );
|
|
25
|
+
* const result = await toolkit.invoke({
|
|
26
|
+
* input:
|
|
27
|
+
* "What did biden say about Ketanji Brown Jackson in the state of the union address?",
|
|
28
|
+
* });
|
|
29
|
+
* console.log(`Got output ${result.output}`);
|
|
30
|
+
* ```
|
|
15
31
|
*/
|
|
16
32
|
class VectorStoreToolkit extends base_js_1.Toolkit {
|
|
17
33
|
constructor(vectorStoreInfo, llm) {
|
|
@@ -17,6 +17,22 @@ export interface VectorStoreInfo {
|
|
|
17
17
|
* Class representing a toolkit for working with a single vector store. It
|
|
18
18
|
* initializes the vector store QA tool based on the provided vector store
|
|
19
19
|
* information and language model.
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const toolkit = new VectorStoreToolkit(
|
|
23
|
+
* {
|
|
24
|
+
* name: "state_of_union_address",
|
|
25
|
+
* description: "the most recent state of the Union address",
|
|
26
|
+
* vectorStore: new HNSWLib(),
|
|
27
|
+
* },
|
|
28
|
+
* new ChatOpenAI({ temperature: 0 }),
|
|
29
|
+
* );
|
|
30
|
+
* const result = await toolkit.invoke({
|
|
31
|
+
* input:
|
|
32
|
+
* "What did biden say about Ketanji Brown Jackson in the state of the union address?",
|
|
33
|
+
* });
|
|
34
|
+
* console.log(`Got output ${result.output}`);
|
|
35
|
+
* ```
|
|
20
36
|
*/
|
|
21
37
|
export declare class VectorStoreToolkit extends Toolkit {
|
|
22
38
|
tools: Tool[];
|
|
@@ -9,6 +9,22 @@ import { AgentExecutor } from "../../executor.js";
|
|
|
9
9
|
* Class representing a toolkit for working with a single vector store. It
|
|
10
10
|
* initializes the vector store QA tool based on the provided vector store
|
|
11
11
|
* information and language model.
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const toolkit = new VectorStoreToolkit(
|
|
15
|
+
* {
|
|
16
|
+
* name: "state_of_union_address",
|
|
17
|
+
* description: "the most recent state of the Union address",
|
|
18
|
+
* vectorStore: new HNSWLib(),
|
|
19
|
+
* },
|
|
20
|
+
* new ChatOpenAI({ temperature: 0 }),
|
|
21
|
+
* );
|
|
22
|
+
* const result = await toolkit.invoke({
|
|
23
|
+
* input:
|
|
24
|
+
* "What did biden say about Ketanji Brown Jackson in the state of the union address?",
|
|
25
|
+
* });
|
|
26
|
+
* console.log(`Got output ${result.output}`);
|
|
27
|
+
* ```
|
|
12
28
|
*/
|
|
13
29
|
export class VectorStoreToolkit extends Toolkit {
|
|
14
30
|
constructor(vectorStoreInfo, llm) {
|
|
@@ -6,6 +6,16 @@ const zapier_js_1 = require("../../../tools/zapier.cjs");
|
|
|
6
6
|
/**
|
|
7
7
|
* Represents a toolkit for working with Zapier actions. It extends the
|
|
8
8
|
* Toolkit class and provides functionality for managing Zapier tools.
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const toolkit = await ZapierToolKit.fromZapierNLAWrapper(
|
|
12
|
+
* new ZapierNLAWrapper(),
|
|
13
|
+
* );
|
|
14
|
+
* const result = await toolkit.invoke({
|
|
15
|
+
* input:
|
|
16
|
+
* "Summarize the last email I received regarding Silicon Valley Bank. Send the summary to the #test-zapier Slack channel.",
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
9
19
|
*/
|
|
10
20
|
class ZapierToolKit extends base_js_1.Toolkit {
|
|
11
21
|
constructor() {
|
|
@@ -4,6 +4,16 @@ import { ZapierNLAWrapper } from "../../../tools/zapier.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* Represents a toolkit for working with Zapier actions. It extends the
|
|
6
6
|
* Toolkit class and provides functionality for managing Zapier tools.
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const toolkit = await ZapierToolKit.fromZapierNLAWrapper(
|
|
10
|
+
* new ZapierNLAWrapper(),
|
|
11
|
+
* );
|
|
12
|
+
* const result = await toolkit.invoke({
|
|
13
|
+
* input:
|
|
14
|
+
* "Summarize the last email I received regarding Silicon Valley Bank. Send the summary to the #test-zapier Slack channel.",
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
7
17
|
*/
|
|
8
18
|
export declare class ZapierToolKit extends Toolkit {
|
|
9
19
|
tools: Tool[];
|
|
@@ -3,6 +3,16 @@ import { ZapierNLARunAction } from "../../../tools/zapier.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* Represents a toolkit for working with Zapier actions. It extends the
|
|
5
5
|
* Toolkit class and provides functionality for managing Zapier tools.
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* const toolkit = await ZapierToolKit.fromZapierNLAWrapper(
|
|
9
|
+
* new ZapierNLAWrapper(),
|
|
10
|
+
* );
|
|
11
|
+
* const result = await toolkit.invoke({
|
|
12
|
+
* input:
|
|
13
|
+
* "Summarize the last email I received regarding Silicon Valley Bank. Send the summary to the #test-zapier Slack channel.",
|
|
14
|
+
* });
|
|
15
|
+
* ```
|
|
6
16
|
*/
|
|
7
17
|
export class ZapierToolKit extends Toolkit {
|
|
8
18
|
constructor() {
|
|
@@ -3,6 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.XMLAgentOutputParser = void 0;
|
|
4
4
|
const output_parser_js_1 = require("../../schema/output_parser.cjs");
|
|
5
5
|
const types_js_1 = require("../types.cjs");
|
|
6
|
+
/**
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const prompt = ChatPromptTemplate.fromMessages([
|
|
10
|
+
* HumanMessagePromptTemplate.fromTemplate(AGENT_INSTRUCTIONS),
|
|
11
|
+
* new MessagesPlaceholder("agent_scratchpad"),
|
|
12
|
+
* ]);
|
|
13
|
+
* const runnableAgent = RunnableSequence.from([
|
|
14
|
+
* ...rest of runnable
|
|
15
|
+
* prompt,
|
|
16
|
+
* new ChatAnthropic({ modelName: "claude-2", temperature: 0 }).bind({
|
|
17
|
+
* stop: ["</tool_input>", "</final_answer>"],
|
|
18
|
+
* }),
|
|
19
|
+
* new XMLAgentOutputParser(),
|
|
20
|
+
* ]);
|
|
21
|
+
* const result = await executor.invoke({
|
|
22
|
+
* input: "What is the weather in Honolulu?",
|
|
23
|
+
* tools: [],
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
6
27
|
class XMLAgentOutputParser extends types_js_1.AgentActionOutputParser {
|
|
7
28
|
constructor() {
|
|
8
29
|
super(...arguments);
|
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
import { AgentAction, AgentFinish } from "../../schema/index.js";
|
|
2
2
|
import { AgentActionOutputParser } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* const prompt = ChatPromptTemplate.fromMessages([
|
|
7
|
+
* HumanMessagePromptTemplate.fromTemplate(AGENT_INSTRUCTIONS),
|
|
8
|
+
* new MessagesPlaceholder("agent_scratchpad"),
|
|
9
|
+
* ]);
|
|
10
|
+
* const runnableAgent = RunnableSequence.from([
|
|
11
|
+
* ...rest of runnable
|
|
12
|
+
* prompt,
|
|
13
|
+
* new ChatAnthropic({ modelName: "claude-2", temperature: 0 }).bind({
|
|
14
|
+
* stop: ["</tool_input>", "</final_answer>"],
|
|
15
|
+
* }),
|
|
16
|
+
* new XMLAgentOutputParser(),
|
|
17
|
+
* ]);
|
|
18
|
+
* const result = await executor.invoke({
|
|
19
|
+
* input: "What is the weather in Honolulu?",
|
|
20
|
+
* tools: [],
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
3
24
|
export declare class XMLAgentOutputParser extends AgentActionOutputParser {
|
|
4
25
|
lc_namespace: string[];
|
|
5
26
|
static lc_name(): string;
|
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
import { OutputParserException } from "../../schema/output_parser.js";
|
|
2
2
|
import { AgentActionOutputParser } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* const prompt = ChatPromptTemplate.fromMessages([
|
|
7
|
+
* HumanMessagePromptTemplate.fromTemplate(AGENT_INSTRUCTIONS),
|
|
8
|
+
* new MessagesPlaceholder("agent_scratchpad"),
|
|
9
|
+
* ]);
|
|
10
|
+
* const runnableAgent = RunnableSequence.from([
|
|
11
|
+
* ...rest of runnable
|
|
12
|
+
* prompt,
|
|
13
|
+
* new ChatAnthropic({ modelName: "claude-2", temperature: 0 }).bind({
|
|
14
|
+
* stop: ["</tool_input>", "</final_answer>"],
|
|
15
|
+
* }),
|
|
16
|
+
* new XMLAgentOutputParser(),
|
|
17
|
+
* ]);
|
|
18
|
+
* const result = await executor.invoke({
|
|
19
|
+
* input: "What is the weather in Honolulu?",
|
|
20
|
+
* tools: [],
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
3
24
|
export class XMLAgentOutputParser extends AgentActionOutputParser {
|
|
4
25
|
constructor() {
|
|
5
26
|
super(...arguments);
|
|
@@ -7,6 +7,19 @@ const base_js_1 = require("./base.cjs");
|
|
|
7
7
|
* Represents a specific implementation of a caching mechanism using Cloudflare KV
|
|
8
8
|
* as the underlying storage system. It extends the `BaseCache` class and
|
|
9
9
|
* overrides its methods to provide the Cloudflare KV-specific logic.
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* // Example of using OpenAI with Cloudflare KV as cache in a Cloudflare Worker
|
|
13
|
+
* const cache = new CloudflareKVCache(env.KV_NAMESPACE);
|
|
14
|
+
* const model = new ChatAnthropic({
|
|
15
|
+
* cache,
|
|
16
|
+
* });
|
|
17
|
+
* const response = await model.invoke("How are you today?");
|
|
18
|
+
* return new Response(JSON.stringify(response), {
|
|
19
|
+
* headers: { "content-type": "application/json" },
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* ```
|
|
10
23
|
*/
|
|
11
24
|
class CloudflareKVCache extends index_js_1.BaseCache {
|
|
12
25
|
constructor(binding) {
|
|
@@ -4,6 +4,19 @@ import { BaseCache, Generation } from "../schema/index.js";
|
|
|
4
4
|
* Represents a specific implementation of a caching mechanism using Cloudflare KV
|
|
5
5
|
* as the underlying storage system. It extends the `BaseCache` class and
|
|
6
6
|
* overrides its methods to provide the Cloudflare KV-specific logic.
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* // Example of using OpenAI with Cloudflare KV as cache in a Cloudflare Worker
|
|
10
|
+
* const cache = new CloudflareKVCache(env.KV_NAMESPACE);
|
|
11
|
+
* const model = new ChatAnthropic({
|
|
12
|
+
* cache,
|
|
13
|
+
* });
|
|
14
|
+
* const response = await model.invoke("How are you today?");
|
|
15
|
+
* return new Response(JSON.stringify(response), {
|
|
16
|
+
* headers: { "content-type": "application/json" },
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* ```
|
|
7
20
|
*/
|
|
8
21
|
export declare class CloudflareKVCache extends BaseCache {
|
|
9
22
|
private binding;
|
|
@@ -4,6 +4,19 @@ import { getCacheKey, serializeGeneration, deserializeStoredGeneration, } from "
|
|
|
4
4
|
* Represents a specific implementation of a caching mechanism using Cloudflare KV
|
|
5
5
|
* as the underlying storage system. It extends the `BaseCache` class and
|
|
6
6
|
* overrides its methods to provide the Cloudflare KV-specific logic.
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* // Example of using OpenAI with Cloudflare KV as cache in a Cloudflare Worker
|
|
10
|
+
* const cache = new CloudflareKVCache(env.KV_NAMESPACE);
|
|
11
|
+
* const model = new ChatAnthropic({
|
|
12
|
+
* cache,
|
|
13
|
+
* });
|
|
14
|
+
* const response = await model.invoke("How are you today?");
|
|
15
|
+
* return new Response(JSON.stringify(response), {
|
|
16
|
+
* headers: { "content-type": "application/json" },
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* ```
|
|
7
20
|
*/
|
|
8
21
|
export class CloudflareKVCache extends BaseCache {
|
|
9
22
|
constructor(binding) {
|
package/dist/cache/ioredis.cjs
CHANGED
|
@@ -5,6 +5,19 @@ const index_js_1 = require("../schema/index.cjs");
|
|
|
5
5
|
const base_js_1 = require("./base.cjs");
|
|
6
6
|
/**
|
|
7
7
|
* Cache LLM results using Redis.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const model = new ChatOpenAI({
|
|
11
|
+
* cache: new RedisCache(new Redis(), { ttl: 60 }),
|
|
12
|
+
* });
|
|
13
|
+
*
|
|
14
|
+
* // Invoke the model with a prompt
|
|
15
|
+
* const response = await model.invoke("Do something random!");
|
|
16
|
+
* console.log(response);
|
|
17
|
+
*
|
|
18
|
+
* // Remember to disconnect the Redis client when done
|
|
19
|
+
* await redisClient.disconnect();
|
|
20
|
+
* ```
|
|
8
21
|
*/
|
|
9
22
|
class RedisCache extends index_js_1.BaseCache {
|
|
10
23
|
constructor(redisClient, config) {
|
package/dist/cache/ioredis.d.ts
CHANGED
|
@@ -2,6 +2,19 @@ import { Redis } from "ioredis";
|
|
|
2
2
|
import { BaseCache, Generation } from "../schema/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Cache LLM results using Redis.
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* const model = new ChatOpenAI({
|
|
8
|
+
* cache: new RedisCache(new Redis(), { ttl: 60 }),
|
|
9
|
+
* });
|
|
10
|
+
*
|
|
11
|
+
* // Invoke the model with a prompt
|
|
12
|
+
* const response = await model.invoke("Do something random!");
|
|
13
|
+
* console.log(response);
|
|
14
|
+
*
|
|
15
|
+
* // Remember to disconnect the Redis client when done
|
|
16
|
+
* await redisClient.disconnect();
|
|
17
|
+
* ```
|
|
5
18
|
*/
|
|
6
19
|
export declare class RedisCache extends BaseCache {
|
|
7
20
|
protected redisClient: Redis;
|
package/dist/cache/ioredis.js
CHANGED
|
@@ -2,6 +2,19 @@ import { BaseCache } from "../schema/index.js";
|
|
|
2
2
|
import { serializeGeneration, deserializeStoredGeneration, getCacheKey, } from "./base.js";
|
|
3
3
|
/**
|
|
4
4
|
* Cache LLM results using Redis.
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* const model = new ChatOpenAI({
|
|
8
|
+
* cache: new RedisCache(new Redis(), { ttl: 60 }),
|
|
9
|
+
* });
|
|
10
|
+
*
|
|
11
|
+
* // Invoke the model with a prompt
|
|
12
|
+
* const response = await model.invoke("Do something random!");
|
|
13
|
+
* console.log(response);
|
|
14
|
+
*
|
|
15
|
+
* // Remember to disconnect the Redis client when done
|
|
16
|
+
* await redisClient.disconnect();
|
|
17
|
+
* ```
|
|
5
18
|
*/
|
|
6
19
|
export class RedisCache extends BaseCache {
|
|
7
20
|
constructor(redisClient, config) {
|
package/dist/cache/momento.cjs
CHANGED
|
@@ -9,6 +9,25 @@ const momento_js_1 = require("../util/momento.cjs");
|
|
|
9
9
|
/**
|
|
10
10
|
* A cache that uses Momento as the backing store.
|
|
11
11
|
* See https://gomomento.com.
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const cache = new MomentoCache({
|
|
15
|
+
* client: new CacheClient({
|
|
16
|
+
* configuration: Configurations.Laptop.v1(),
|
|
17
|
+
* credentialProvider: CredentialProvider.fromEnvironmentVariable({
|
|
18
|
+
* environmentVariableName: "MOMENTO_API_KEY",
|
|
19
|
+
* }),
|
|
20
|
+
* defaultTtlSeconds: 60 * 60 * 24, // Cache TTL set to 24 hours.
|
|
21
|
+
* }),
|
|
22
|
+
* cacheName: "langchain",
|
|
23
|
+
* });
|
|
24
|
+
* // Initialize the OpenAI model with Momento cache for caching responses
|
|
25
|
+
* const model = new ChatOpenAI({
|
|
26
|
+
* cache,
|
|
27
|
+
* });
|
|
28
|
+
* await model.invoke("How are you today?");
|
|
29
|
+
* const cachedValues = await cache.lookup("How are you today?", "llmKey");
|
|
30
|
+
* ```
|
|
12
31
|
*/
|
|
13
32
|
class MomentoCache extends index_js_1.BaseCache {
|
|
14
33
|
constructor(props) {
|