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
|
@@ -4,6 +4,21 @@ import { BaseChatMemory } from "./chat_memory.js";
|
|
|
4
4
|
* Class that represents a conversation chat memory with a token buffer.
|
|
5
5
|
* It extends the `BaseChatMemory` class and implements the
|
|
6
6
|
* `ConversationTokenBufferMemoryInput` interface.
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const memory = new ConversationTokenBufferMemory({
|
|
10
|
+
* llm: new ChatOpenAI({}),
|
|
11
|
+
* maxTokenLimit: 10,
|
|
12
|
+
* });
|
|
13
|
+
*
|
|
14
|
+
* // Save conversation context
|
|
15
|
+
* await memory.saveContext({ input: "hi" }, { output: "whats up" });
|
|
16
|
+
* await memory.saveContext({ input: "not much you" }, { output: "not much" });
|
|
17
|
+
*
|
|
18
|
+
* // Load memory variables
|
|
19
|
+
* const result = await memory.loadMemoryVariables({});
|
|
20
|
+
* console.log(result);
|
|
21
|
+
* ```
|
|
7
22
|
*/
|
|
8
23
|
export class ConversationTokenBufferMemory extends BaseChatMemory {
|
|
9
24
|
constructor(fields) {
|
|
@@ -8,6 +8,29 @@ const chat_memory_js_1 = require("./chat_memory.cjs");
|
|
|
8
8
|
* BaseChatMemory class and implements the BufferWindowMemoryInput
|
|
9
9
|
* interface. This class is stateful and stores messages in a buffer. When
|
|
10
10
|
* called in a chain, it returns all of the messages it has stored.
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const prompt =
|
|
14
|
+
* PromptTemplate.fromTemplate(`The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.
|
|
15
|
+
* Current conversation:
|
|
16
|
+
* {chat_history}
|
|
17
|
+
* Human: {input}
|
|
18
|
+
* AI:`);
|
|
19
|
+
*
|
|
20
|
+
* const chain = new LLMChain({
|
|
21
|
+
* llm: new ChatOpenAI({ temperature: 0.9 }),
|
|
22
|
+
* prompt,
|
|
23
|
+
* memory: new BufferWindowMemory({ memoryKey: "chat_history", k: 1 }),
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* // Example of initiating a conversation with the AI
|
|
27
|
+
* const res1 = await chain.call({ input: "Hi! I'm Jim." });
|
|
28
|
+
* console.log({ res1 });
|
|
29
|
+
*
|
|
30
|
+
* // Example of following up with another question
|
|
31
|
+
* const res2 = await chain.call({ input: "What's my name?" });
|
|
32
|
+
* console.log({ res2 });
|
|
33
|
+
* ```
|
|
11
34
|
*/
|
|
12
35
|
class BufferWindowMemory extends chat_memory_js_1.BaseChatMemory {
|
|
13
36
|
constructor(fields) {
|
|
@@ -14,6 +14,29 @@ export interface BufferWindowMemoryInput extends BaseChatMemoryInput {
|
|
|
14
14
|
* BaseChatMemory class and implements the BufferWindowMemoryInput
|
|
15
15
|
* interface. This class is stateful and stores messages in a buffer. When
|
|
16
16
|
* called in a chain, it returns all of the messages it has stored.
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const prompt =
|
|
20
|
+
* PromptTemplate.fromTemplate(`The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.
|
|
21
|
+
* Current conversation:
|
|
22
|
+
* {chat_history}
|
|
23
|
+
* Human: {input}
|
|
24
|
+
* AI:`);
|
|
25
|
+
*
|
|
26
|
+
* const chain = new LLMChain({
|
|
27
|
+
* llm: new ChatOpenAI({ temperature: 0.9 }),
|
|
28
|
+
* prompt,
|
|
29
|
+
* memory: new BufferWindowMemory({ memoryKey: "chat_history", k: 1 }),
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* // Example of initiating a conversation with the AI
|
|
33
|
+
* const res1 = await chain.call({ input: "Hi! I'm Jim." });
|
|
34
|
+
* console.log({ res1 });
|
|
35
|
+
*
|
|
36
|
+
* // Example of following up with another question
|
|
37
|
+
* const res2 = await chain.call({ input: "What's my name?" });
|
|
38
|
+
* console.log({ res2 });
|
|
39
|
+
* ```
|
|
17
40
|
*/
|
|
18
41
|
export declare class BufferWindowMemory extends BaseChatMemory implements BufferWindowMemoryInput {
|
|
19
42
|
humanPrefix: string;
|
|
@@ -5,6 +5,29 @@ import { BaseChatMemory } from "./chat_memory.js";
|
|
|
5
5
|
* BaseChatMemory class and implements the BufferWindowMemoryInput
|
|
6
6
|
* interface. This class is stateful and stores messages in a buffer. When
|
|
7
7
|
* called in a chain, it returns all of the messages it has stored.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const prompt =
|
|
11
|
+
* PromptTemplate.fromTemplate(`The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.
|
|
12
|
+
* Current conversation:
|
|
13
|
+
* {chat_history}
|
|
14
|
+
* Human: {input}
|
|
15
|
+
* AI:`);
|
|
16
|
+
*
|
|
17
|
+
* const chain = new LLMChain({
|
|
18
|
+
* llm: new ChatOpenAI({ temperature: 0.9 }),
|
|
19
|
+
* prompt,
|
|
20
|
+
* memory: new BufferWindowMemory({ memoryKey: "chat_history", k: 1 }),
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* // Example of initiating a conversation with the AI
|
|
24
|
+
* const res1 = await chain.call({ input: "Hi! I'm Jim." });
|
|
25
|
+
* console.log({ res1 });
|
|
26
|
+
*
|
|
27
|
+
* // Example of following up with another question
|
|
28
|
+
* const res2 = await chain.call({ input: "What's my name?" });
|
|
29
|
+
* console.log({ res2 });
|
|
30
|
+
* ```
|
|
8
31
|
*/
|
|
9
32
|
export class BufferWindowMemory extends BaseChatMemory {
|
|
10
33
|
constructor(fields) {
|
|
@@ -11,6 +11,35 @@ const in_memory_js_1 = require("./stores/entity/in_memory.cjs");
|
|
|
11
11
|
* Class for managing entity extraction and summarization to memory in
|
|
12
12
|
* chatbot applications. Extends the BaseChatMemory class and implements
|
|
13
13
|
* the EntityMemoryInput interface.
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const memory = new EntityMemory({
|
|
17
|
+
* llm: new ChatOpenAI({ temperature: 0 }),
|
|
18
|
+
* chatHistoryKey: "history",
|
|
19
|
+
* entitiesKey: "entities",
|
|
20
|
+
* });
|
|
21
|
+
* const model = new ChatOpenAI({ temperature: 0.9 });
|
|
22
|
+
* const chain = new LLMChain({
|
|
23
|
+
* llm: model,
|
|
24
|
+
* prompt: ENTITY_MEMORY_CONVERSATION_TEMPLATE,
|
|
25
|
+
* memory,
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* const res1 = await chain.call({ input: "Hi! I'm Jim." });
|
|
29
|
+
* console.log({
|
|
30
|
+
* res1,
|
|
31
|
+
* memory: await memory.loadMemoryVariables({ input: "Who is Jim?" }),
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* const res2 = await chain.call({
|
|
35
|
+
* input: "I work in construction. What about you?",
|
|
36
|
+
* });
|
|
37
|
+
* console.log({
|
|
38
|
+
* res2,
|
|
39
|
+
* memory: await memory.loadMemoryVariables({ input: "Who is Jim?" }),
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* ```
|
|
14
43
|
*/
|
|
15
44
|
class EntityMemory extends chat_memory_js_1.BaseChatMemory {
|
|
16
45
|
constructor(fields) {
|
|
@@ -22,6 +22,35 @@ export interface EntityMemoryInput extends BaseChatMemoryInput {
|
|
|
22
22
|
* Class for managing entity extraction and summarization to memory in
|
|
23
23
|
* chatbot applications. Extends the BaseChatMemory class and implements
|
|
24
24
|
* the EntityMemoryInput interface.
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const memory = new EntityMemory({
|
|
28
|
+
* llm: new ChatOpenAI({ temperature: 0 }),
|
|
29
|
+
* chatHistoryKey: "history",
|
|
30
|
+
* entitiesKey: "entities",
|
|
31
|
+
* });
|
|
32
|
+
* const model = new ChatOpenAI({ temperature: 0.9 });
|
|
33
|
+
* const chain = new LLMChain({
|
|
34
|
+
* llm: model,
|
|
35
|
+
* prompt: ENTITY_MEMORY_CONVERSATION_TEMPLATE,
|
|
36
|
+
* memory,
|
|
37
|
+
* });
|
|
38
|
+
*
|
|
39
|
+
* const res1 = await chain.call({ input: "Hi! I'm Jim." });
|
|
40
|
+
* console.log({
|
|
41
|
+
* res1,
|
|
42
|
+
* memory: await memory.loadMemoryVariables({ input: "Who is Jim?" }),
|
|
43
|
+
* });
|
|
44
|
+
*
|
|
45
|
+
* const res2 = await chain.call({
|
|
46
|
+
* input: "I work in construction. What about you?",
|
|
47
|
+
* });
|
|
48
|
+
* console.log({
|
|
49
|
+
* res2,
|
|
50
|
+
* memory: await memory.loadMemoryVariables({ input: "Who is Jim?" }),
|
|
51
|
+
* });
|
|
52
|
+
*
|
|
53
|
+
* ```
|
|
25
54
|
*/
|
|
26
55
|
export declare class EntityMemory extends BaseChatMemory implements EntityMemoryInput {
|
|
27
56
|
private entityExtractionChain;
|
|
@@ -8,6 +8,35 @@ import { InMemoryEntityStore } from "./stores/entity/in_memory.js";
|
|
|
8
8
|
* Class for managing entity extraction and summarization to memory in
|
|
9
9
|
* chatbot applications. Extends the BaseChatMemory class and implements
|
|
10
10
|
* the EntityMemoryInput interface.
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const memory = new EntityMemory({
|
|
14
|
+
* llm: new ChatOpenAI({ temperature: 0 }),
|
|
15
|
+
* chatHistoryKey: "history",
|
|
16
|
+
* entitiesKey: "entities",
|
|
17
|
+
* });
|
|
18
|
+
* const model = new ChatOpenAI({ temperature: 0.9 });
|
|
19
|
+
* const chain = new LLMChain({
|
|
20
|
+
* llm: model,
|
|
21
|
+
* prompt: ENTITY_MEMORY_CONVERSATION_TEMPLATE,
|
|
22
|
+
* memory,
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* const res1 = await chain.call({ input: "Hi! I'm Jim." });
|
|
26
|
+
* console.log({
|
|
27
|
+
* res1,
|
|
28
|
+
* memory: await memory.loadMemoryVariables({ input: "Who is Jim?" }),
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* const res2 = await chain.call({
|
|
32
|
+
* input: "I work in construction. What about you?",
|
|
33
|
+
* });
|
|
34
|
+
* console.log({
|
|
35
|
+
* res2,
|
|
36
|
+
* memory: await memory.loadMemoryVariables({ input: "Who is Jim?" }),
|
|
37
|
+
* });
|
|
38
|
+
*
|
|
39
|
+
* ```
|
|
11
40
|
*/
|
|
12
41
|
export class EntityMemory extends BaseChatMemory {
|
|
13
42
|
constructor(fields) {
|
package/dist/memory/summary.cjs
CHANGED
|
@@ -80,6 +80,30 @@ exports.BaseConversationSummaryMemory = BaseConversationSummaryMemory;
|
|
|
80
80
|
* Class that provides a concrete implementation of the conversation
|
|
81
81
|
* memory. It includes methods for loading memory variables, saving
|
|
82
82
|
* context, and clearing the memory.
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* const memory = new ConversationSummaryMemory({
|
|
86
|
+
* memoryKey: "chat_history",
|
|
87
|
+
* llm: new ChatOpenAI({ modelName: "gpt-3.5-turbo", temperature: 0 }),
|
|
88
|
+
* });
|
|
89
|
+
*
|
|
90
|
+
* const model = new ChatOpenAI();
|
|
91
|
+
* const prompt =
|
|
92
|
+
* PromptTemplate.fromTemplate(`The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.
|
|
93
|
+
*
|
|
94
|
+
* Current conversation:
|
|
95
|
+
* {chat_history}
|
|
96
|
+
* Human: {input}
|
|
97
|
+
* AI:`);
|
|
98
|
+
* const chain = new LLMChain({ llm: model, prompt, memory });
|
|
99
|
+
*
|
|
100
|
+
* const res1 = await chain.call({ input: "Hi! I'm Jim." });
|
|
101
|
+
* console.log({ res1, memory: await memory.loadMemoryVariables({}) });
|
|
102
|
+
*
|
|
103
|
+
* const res2 = await chain.call({ input: "What's my name?" });
|
|
104
|
+
* console.log({ res2, memory: await memory.loadMemoryVariables({}) });
|
|
105
|
+
*
|
|
106
|
+
* ```
|
|
83
107
|
*/
|
|
84
108
|
class ConversationSummaryMemory extends BaseConversationSummaryMemory {
|
|
85
109
|
constructor(fields) {
|
package/dist/memory/summary.d.ts
CHANGED
|
@@ -47,6 +47,30 @@ export declare abstract class BaseConversationSummaryMemory extends BaseChatMemo
|
|
|
47
47
|
* Class that provides a concrete implementation of the conversation
|
|
48
48
|
* memory. It includes methods for loading memory variables, saving
|
|
49
49
|
* context, and clearing the memory.
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const memory = new ConversationSummaryMemory({
|
|
53
|
+
* memoryKey: "chat_history",
|
|
54
|
+
* llm: new ChatOpenAI({ modelName: "gpt-3.5-turbo", temperature: 0 }),
|
|
55
|
+
* });
|
|
56
|
+
*
|
|
57
|
+
* const model = new ChatOpenAI();
|
|
58
|
+
* const prompt =
|
|
59
|
+
* PromptTemplate.fromTemplate(`The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.
|
|
60
|
+
*
|
|
61
|
+
* Current conversation:
|
|
62
|
+
* {chat_history}
|
|
63
|
+
* Human: {input}
|
|
64
|
+
* AI:`);
|
|
65
|
+
* const chain = new LLMChain({ llm: model, prompt, memory });
|
|
66
|
+
*
|
|
67
|
+
* const res1 = await chain.call({ input: "Hi! I'm Jim." });
|
|
68
|
+
* console.log({ res1, memory: await memory.loadMemoryVariables({}) });
|
|
69
|
+
*
|
|
70
|
+
* const res2 = await chain.call({ input: "What's my name?" });
|
|
71
|
+
* console.log({ res2, memory: await memory.loadMemoryVariables({}) });
|
|
72
|
+
*
|
|
73
|
+
* ```
|
|
50
74
|
*/
|
|
51
75
|
export declare class ConversationSummaryMemory extends BaseConversationSummaryMemory {
|
|
52
76
|
buffer: string;
|
package/dist/memory/summary.js
CHANGED
|
@@ -76,6 +76,30 @@ export class BaseConversationSummaryMemory extends BaseChatMemory {
|
|
|
76
76
|
* Class that provides a concrete implementation of the conversation
|
|
77
77
|
* memory. It includes methods for loading memory variables, saving
|
|
78
78
|
* context, and clearing the memory.
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* const memory = new ConversationSummaryMemory({
|
|
82
|
+
* memoryKey: "chat_history",
|
|
83
|
+
* llm: new ChatOpenAI({ modelName: "gpt-3.5-turbo", temperature: 0 }),
|
|
84
|
+
* });
|
|
85
|
+
*
|
|
86
|
+
* const model = new ChatOpenAI();
|
|
87
|
+
* const prompt =
|
|
88
|
+
* PromptTemplate.fromTemplate(`The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.
|
|
89
|
+
*
|
|
90
|
+
* Current conversation:
|
|
91
|
+
* {chat_history}
|
|
92
|
+
* Human: {input}
|
|
93
|
+
* AI:`);
|
|
94
|
+
* const chain = new LLMChain({ llm: model, prompt, memory });
|
|
95
|
+
*
|
|
96
|
+
* const res1 = await chain.call({ input: "Hi! I'm Jim." });
|
|
97
|
+
* console.log({ res1, memory: await memory.loadMemoryVariables({}) });
|
|
98
|
+
*
|
|
99
|
+
* const res2 = await chain.call({ input: "What's my name?" });
|
|
100
|
+
* console.log({ res2, memory: await memory.loadMemoryVariables({}) });
|
|
101
|
+
*
|
|
102
|
+
* ```
|
|
79
103
|
*/
|
|
80
104
|
export class ConversationSummaryMemory extends BaseConversationSummaryMemory {
|
|
81
105
|
constructor(fields) {
|
|
@@ -9,6 +9,38 @@ const summary_js_1 = require("./summary.cjs");
|
|
|
9
9
|
* history in a LangChain application by maintaining a buffer of chat
|
|
10
10
|
* messages and providing methods to load, save, prune, and clear the
|
|
11
11
|
* memory.
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* // Initialize the memory with a specific model and token limit
|
|
15
|
+
* const memory = new ConversationSummaryBufferMemory({
|
|
16
|
+
* llm: new ChatOpenAI({ modelName: "gpt-3.5-turbo-instruct", temperature: 0 }),
|
|
17
|
+
* maxTokenLimit: 10,
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* // Save conversation context to memory
|
|
21
|
+
* await memory.saveContext({ input: "hi" }, { output: "whats up" });
|
|
22
|
+
* await memory.saveContext({ input: "not much you" }, { output: "not much" });
|
|
23
|
+
*
|
|
24
|
+
* // Load the conversation history from memory
|
|
25
|
+
* const history = await memory.loadMemoryVariables({});
|
|
26
|
+
* console.log({ history });
|
|
27
|
+
*
|
|
28
|
+
* // Create a chat prompt using the conversation history
|
|
29
|
+
* const chatPrompt = ChatPromptTemplate.fromMessages([
|
|
30
|
+
* SystemMessagePromptTemplate.fromTemplate(
|
|
31
|
+
* "The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.",
|
|
32
|
+
* ),
|
|
33
|
+
* new MessagesPlaceholder("history"),
|
|
34
|
+
* HumanMessagePromptTemplate.fromTemplate("{input}"),
|
|
35
|
+
* ]);
|
|
36
|
+
*
|
|
37
|
+
* // Initialize the conversation chain with the model, memory, and prompt
|
|
38
|
+
* const chain = new ConversationChain({
|
|
39
|
+
* llm: new ChatOpenAI({ temperature: 0.9, verbose: true }),
|
|
40
|
+
* memory: memory,
|
|
41
|
+
* prompt: chatPrompt,
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
12
44
|
*/
|
|
13
45
|
class ConversationSummaryBufferMemory extends summary_js_1.BaseConversationSummaryMemory {
|
|
14
46
|
constructor(fields) {
|
|
@@ -13,6 +13,38 @@ export interface ConversationSummaryBufferMemoryInput extends BaseConversationSu
|
|
|
13
13
|
* history in a LangChain application by maintaining a buffer of chat
|
|
14
14
|
* messages and providing methods to load, save, prune, and clear the
|
|
15
15
|
* memory.
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Initialize the memory with a specific model and token limit
|
|
19
|
+
* const memory = new ConversationSummaryBufferMemory({
|
|
20
|
+
* llm: new ChatOpenAI({ modelName: "gpt-3.5-turbo-instruct", temperature: 0 }),
|
|
21
|
+
* maxTokenLimit: 10,
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* // Save conversation context to memory
|
|
25
|
+
* await memory.saveContext({ input: "hi" }, { output: "whats up" });
|
|
26
|
+
* await memory.saveContext({ input: "not much you" }, { output: "not much" });
|
|
27
|
+
*
|
|
28
|
+
* // Load the conversation history from memory
|
|
29
|
+
* const history = await memory.loadMemoryVariables({});
|
|
30
|
+
* console.log({ history });
|
|
31
|
+
*
|
|
32
|
+
* // Create a chat prompt using the conversation history
|
|
33
|
+
* const chatPrompt = ChatPromptTemplate.fromMessages([
|
|
34
|
+
* SystemMessagePromptTemplate.fromTemplate(
|
|
35
|
+
* "The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.",
|
|
36
|
+
* ),
|
|
37
|
+
* new MessagesPlaceholder("history"),
|
|
38
|
+
* HumanMessagePromptTemplate.fromTemplate("{input}"),
|
|
39
|
+
* ]);
|
|
40
|
+
*
|
|
41
|
+
* // Initialize the conversation chain with the model, memory, and prompt
|
|
42
|
+
* const chain = new ConversationChain({
|
|
43
|
+
* llm: new ChatOpenAI({ temperature: 0.9, verbose: true }),
|
|
44
|
+
* memory: memory,
|
|
45
|
+
* prompt: chatPrompt,
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
16
48
|
*/
|
|
17
49
|
export declare class ConversationSummaryBufferMemory extends BaseConversationSummaryMemory implements ConversationSummaryBufferMemoryInput {
|
|
18
50
|
movingSummaryBuffer: string;
|
|
@@ -6,6 +6,38 @@ import { BaseConversationSummaryMemory, } from "./summary.js";
|
|
|
6
6
|
* history in a LangChain application by maintaining a buffer of chat
|
|
7
7
|
* messages and providing methods to load, save, prune, and clear the
|
|
8
8
|
* memory.
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // Initialize the memory with a specific model and token limit
|
|
12
|
+
* const memory = new ConversationSummaryBufferMemory({
|
|
13
|
+
* llm: new ChatOpenAI({ modelName: "gpt-3.5-turbo-instruct", temperature: 0 }),
|
|
14
|
+
* maxTokenLimit: 10,
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* // Save conversation context to memory
|
|
18
|
+
* await memory.saveContext({ input: "hi" }, { output: "whats up" });
|
|
19
|
+
* await memory.saveContext({ input: "not much you" }, { output: "not much" });
|
|
20
|
+
*
|
|
21
|
+
* // Load the conversation history from memory
|
|
22
|
+
* const history = await memory.loadMemoryVariables({});
|
|
23
|
+
* console.log({ history });
|
|
24
|
+
*
|
|
25
|
+
* // Create a chat prompt using the conversation history
|
|
26
|
+
* const chatPrompt = ChatPromptTemplate.fromMessages([
|
|
27
|
+
* SystemMessagePromptTemplate.fromTemplate(
|
|
28
|
+
* "The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.",
|
|
29
|
+
* ),
|
|
30
|
+
* new MessagesPlaceholder("history"),
|
|
31
|
+
* HumanMessagePromptTemplate.fromTemplate("{input}"),
|
|
32
|
+
* ]);
|
|
33
|
+
*
|
|
34
|
+
* // Initialize the conversation chain with the model, memory, and prompt
|
|
35
|
+
* const chain = new ConversationChain({
|
|
36
|
+
* llm: new ChatOpenAI({ temperature: 0.9, verbose: true }),
|
|
37
|
+
* memory: memory,
|
|
38
|
+
* prompt: chatPrompt,
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
9
41
|
*/
|
|
10
42
|
export class ConversationSummaryBufferMemory extends BaseConversationSummaryMemory {
|
|
11
43
|
constructor(fields) {
|
|
@@ -10,6 +10,30 @@ const base_js_1 = require("./base.cjs");
|
|
|
10
10
|
* documents from a vector store database, which can be useful for
|
|
11
11
|
* maintaining conversation history or other types of memory in an LLM
|
|
12
12
|
* application.
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const vectorStore = new MemoryVectorStore(new OpenAIEmbeddings());
|
|
16
|
+
* const memory = new VectorStoreRetrieverMemory({
|
|
17
|
+
* vectorStoreRetriever: vectorStore.asRetriever(1),
|
|
18
|
+
* memoryKey: "history",
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* // Saving context to memory
|
|
22
|
+
* await memory.saveContext(
|
|
23
|
+
* { input: "My favorite food is pizza" },
|
|
24
|
+
* { output: "thats good to know" },
|
|
25
|
+
* );
|
|
26
|
+
* await memory.saveContext(
|
|
27
|
+
* { input: "My favorite sport is soccer" },
|
|
28
|
+
* { output: "..." },
|
|
29
|
+
* );
|
|
30
|
+
* await memory.saveContext({ input: "I don't the Celtics" }, { output: "ok" });
|
|
31
|
+
*
|
|
32
|
+
* // Loading memory variables
|
|
33
|
+
* console.log(
|
|
34
|
+
* await memory.loadMemoryVariables({ prompt: "what sport should i watch?" }),
|
|
35
|
+
* );
|
|
36
|
+
* ```
|
|
13
37
|
*/
|
|
14
38
|
class VectorStoreRetrieverMemory extends base_js_1.BaseMemory {
|
|
15
39
|
constructor(fields) {
|
|
@@ -17,6 +17,30 @@ export interface VectorStoreRetrieverMemoryParams {
|
|
|
17
17
|
* documents from a vector store database, which can be useful for
|
|
18
18
|
* maintaining conversation history or other types of memory in an LLM
|
|
19
19
|
* application.
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const vectorStore = new MemoryVectorStore(new OpenAIEmbeddings());
|
|
23
|
+
* const memory = new VectorStoreRetrieverMemory({
|
|
24
|
+
* vectorStoreRetriever: vectorStore.asRetriever(1),
|
|
25
|
+
* memoryKey: "history",
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* // Saving context to memory
|
|
29
|
+
* await memory.saveContext(
|
|
30
|
+
* { input: "My favorite food is pizza" },
|
|
31
|
+
* { output: "thats good to know" },
|
|
32
|
+
* );
|
|
33
|
+
* await memory.saveContext(
|
|
34
|
+
* { input: "My favorite sport is soccer" },
|
|
35
|
+
* { output: "..." },
|
|
36
|
+
* );
|
|
37
|
+
* await memory.saveContext({ input: "I don't the Celtics" }, { output: "ok" });
|
|
38
|
+
*
|
|
39
|
+
* // Loading memory variables
|
|
40
|
+
* console.log(
|
|
41
|
+
* await memory.loadMemoryVariables({ prompt: "what sport should i watch?" }),
|
|
42
|
+
* );
|
|
43
|
+
* ```
|
|
20
44
|
*/
|
|
21
45
|
export declare class VectorStoreRetrieverMemory extends BaseMemory implements VectorStoreRetrieverMemoryParams {
|
|
22
46
|
vectorStoreRetriever: VectorStoreRetriever;
|
|
@@ -7,6 +7,30 @@ import { BaseMemory, getInputValue, } from "./base.js";
|
|
|
7
7
|
* documents from a vector store database, which can be useful for
|
|
8
8
|
* maintaining conversation history or other types of memory in an LLM
|
|
9
9
|
* application.
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const vectorStore = new MemoryVectorStore(new OpenAIEmbeddings());
|
|
13
|
+
* const memory = new VectorStoreRetrieverMemory({
|
|
14
|
+
* vectorStoreRetriever: vectorStore.asRetriever(1),
|
|
15
|
+
* memoryKey: "history",
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* // Saving context to memory
|
|
19
|
+
* await memory.saveContext(
|
|
20
|
+
* { input: "My favorite food is pizza" },
|
|
21
|
+
* { output: "thats good to know" },
|
|
22
|
+
* );
|
|
23
|
+
* await memory.saveContext(
|
|
24
|
+
* { input: "My favorite sport is soccer" },
|
|
25
|
+
* { output: "..." },
|
|
26
|
+
* );
|
|
27
|
+
* await memory.saveContext({ input: "I don't the Celtics" }, { output: "ok" });
|
|
28
|
+
*
|
|
29
|
+
* // Loading memory variables
|
|
30
|
+
* console.log(
|
|
31
|
+
* await memory.loadMemoryVariables({ prompt: "what sport should i watch?" }),
|
|
32
|
+
* );
|
|
33
|
+
* ```
|
|
10
34
|
*/
|
|
11
35
|
export class VectorStoreRetrieverMemory extends BaseMemory {
|
|
12
36
|
constructor(fields) {
|
package/dist/memory/zep.cjs
CHANGED
|
@@ -10,6 +10,40 @@ const index_js_1 = require("../schema/index.cjs");
|
|
|
10
10
|
* and saving the chat history, and clearing the memory when needed. It
|
|
11
11
|
* uses the ZepClient to interact with the Zep service for managing the
|
|
12
12
|
* chat session's memory.
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const sessionId = randomUUID();
|
|
16
|
+
* const zepURL = "http://your-zep-url";
|
|
17
|
+
*
|
|
18
|
+
* // Initialize ZepMemory with session ID, base URL, and API key
|
|
19
|
+
* const memory = new ZepMemory({
|
|
20
|
+
* sessionId,
|
|
21
|
+
* baseURL: zepURL,
|
|
22
|
+
* apiKey: "change_this_key",
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // Create a ChatOpenAI model instance with specific parameters
|
|
26
|
+
* const model = new ChatOpenAI({
|
|
27
|
+
* modelName: "gpt-3.5-turbo",
|
|
28
|
+
* temperature: 0,
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* // Create a ConversationChain with the model and memory
|
|
32
|
+
* const chain = new ConversationChain({ llm: model, memory });
|
|
33
|
+
*
|
|
34
|
+
* // Example of calling the chain with an input
|
|
35
|
+
* const res1 = await chain.call({ input: "Hi! I'm Jim." });
|
|
36
|
+
* console.log({ res1 });
|
|
37
|
+
*
|
|
38
|
+
* // Follow-up call to the chain to demonstrate memory usage
|
|
39
|
+
* const res2 = await chain.call({ input: "What did I just say my name was?" });
|
|
40
|
+
* console.log({ res2 });
|
|
41
|
+
*
|
|
42
|
+
* // Output the session ID and the current state of memory
|
|
43
|
+
* console.log("Session ID: ", sessionId);
|
|
44
|
+
* console.log("Memory: ", await memory.loadMemoryVariables({}));
|
|
45
|
+
*
|
|
46
|
+
* ```
|
|
13
47
|
*/
|
|
14
48
|
class ZepMemory extends chat_memory_js_1.BaseChatMemory {
|
|
15
49
|
constructor(fields) {
|
package/dist/memory/zep.d.ts
CHANGED
|
@@ -19,6 +19,40 @@ export interface ZepMemoryInput extends BaseChatMemoryInput {
|
|
|
19
19
|
* and saving the chat history, and clearing the memory when needed. It
|
|
20
20
|
* uses the ZepClient to interact with the Zep service for managing the
|
|
21
21
|
* chat session's memory.
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const sessionId = randomUUID();
|
|
25
|
+
* const zepURL = "http://your-zep-url";
|
|
26
|
+
*
|
|
27
|
+
* // Initialize ZepMemory with session ID, base URL, and API key
|
|
28
|
+
* const memory = new ZepMemory({
|
|
29
|
+
* sessionId,
|
|
30
|
+
* baseURL: zepURL,
|
|
31
|
+
* apiKey: "change_this_key",
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* // Create a ChatOpenAI model instance with specific parameters
|
|
35
|
+
* const model = new ChatOpenAI({
|
|
36
|
+
* modelName: "gpt-3.5-turbo",
|
|
37
|
+
* temperature: 0,
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* // Create a ConversationChain with the model and memory
|
|
41
|
+
* const chain = new ConversationChain({ llm: model, memory });
|
|
42
|
+
*
|
|
43
|
+
* // Example of calling the chain with an input
|
|
44
|
+
* const res1 = await chain.call({ input: "Hi! I'm Jim." });
|
|
45
|
+
* console.log({ res1 });
|
|
46
|
+
*
|
|
47
|
+
* // Follow-up call to the chain to demonstrate memory usage
|
|
48
|
+
* const res2 = await chain.call({ input: "What did I just say my name was?" });
|
|
49
|
+
* console.log({ res2 });
|
|
50
|
+
*
|
|
51
|
+
* // Output the session ID and the current state of memory
|
|
52
|
+
* console.log("Session ID: ", sessionId);
|
|
53
|
+
* console.log("Memory: ", await memory.loadMemoryVariables({}));
|
|
54
|
+
*
|
|
55
|
+
* ```
|
|
22
56
|
*/
|
|
23
57
|
export declare class ZepMemory extends BaseChatMemory implements ZepMemoryInput {
|
|
24
58
|
humanPrefix: string;
|
package/dist/memory/zep.js
CHANGED
|
@@ -7,6 +7,40 @@ import { AIMessage, ChatMessage, HumanMessage, SystemMessage, } from "../schema/
|
|
|
7
7
|
* and saving the chat history, and clearing the memory when needed. It
|
|
8
8
|
* uses the ZepClient to interact with the Zep service for managing the
|
|
9
9
|
* chat session's memory.
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const sessionId = randomUUID();
|
|
13
|
+
* const zepURL = "http://your-zep-url";
|
|
14
|
+
*
|
|
15
|
+
* // Initialize ZepMemory with session ID, base URL, and API key
|
|
16
|
+
* const memory = new ZepMemory({
|
|
17
|
+
* sessionId,
|
|
18
|
+
* baseURL: zepURL,
|
|
19
|
+
* apiKey: "change_this_key",
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* // Create a ChatOpenAI model instance with specific parameters
|
|
23
|
+
* const model = new ChatOpenAI({
|
|
24
|
+
* modelName: "gpt-3.5-turbo",
|
|
25
|
+
* temperature: 0,
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* // Create a ConversationChain with the model and memory
|
|
29
|
+
* const chain = new ConversationChain({ llm: model, memory });
|
|
30
|
+
*
|
|
31
|
+
* // Example of calling the chain with an input
|
|
32
|
+
* const res1 = await chain.call({ input: "Hi! I'm Jim." });
|
|
33
|
+
* console.log({ res1 });
|
|
34
|
+
*
|
|
35
|
+
* // Follow-up call to the chain to demonstrate memory usage
|
|
36
|
+
* const res2 = await chain.call({ input: "What did I just say my name was?" });
|
|
37
|
+
* console.log({ res2 });
|
|
38
|
+
*
|
|
39
|
+
* // Output the session ID and the current state of memory
|
|
40
|
+
* console.log("Session ID: ", sessionId);
|
|
41
|
+
* console.log("Memory: ", await memory.loadMemoryVariables({}));
|
|
42
|
+
*
|
|
43
|
+
* ```
|
|
10
44
|
*/
|
|
11
45
|
export class ZepMemory extends BaseChatMemory {
|
|
12
46
|
constructor(fields) {
|