langchain 0.0.192 → 0.0.193
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/agent.cjs +24 -0
- package/dist/agents/agent.d.ts +24 -0
- package/dist/agents/agent.js +24 -0
- package/dist/agents/chat/outputParser.cjs +32 -0
- package/dist/agents/chat/outputParser.d.ts +32 -0
- package/dist/agents/chat/outputParser.js +32 -0
- package/dist/agents/executor.cjs +14 -0
- package/dist/agents/executor.d.ts +14 -0
- package/dist/agents/executor.js +14 -0
- package/dist/agents/mrkl/index.cjs +21 -0
- package/dist/agents/mrkl/index.d.ts +21 -0
- package/dist/agents/mrkl/index.js +21 -0
- package/dist/agents/openai/output_parser.cjs +65 -0
- package/dist/agents/openai/output_parser.d.ts +65 -0
- package/dist/agents/openai/output_parser.js +65 -0
- package/dist/agents/react/output_parser.cjs +16 -0
- package/dist/agents/react/output_parser.d.ts +16 -0
- package/dist/agents/react/output_parser.js +16 -0
- package/dist/agents/structured_chat/outputParser.cjs +12 -0
- package/dist/agents/structured_chat/outputParser.d.ts +12 -0
- package/dist/agents/structured_chat/outputParser.js +12 -0
- package/dist/agents/toolkits/aws_sfn.cjs +20 -0
- package/dist/agents/toolkits/aws_sfn.d.ts +20 -0
- package/dist/agents/toolkits/aws_sfn.js +20 -0
- package/dist/agents/toolkits/json/json.cjs +8 -0
- package/dist/agents/toolkits/json/json.d.ts +8 -0
- package/dist/agents/toolkits/json/json.js +8 -0
- package/dist/agents/toolkits/openapi/openapi.cjs +18 -0
- package/dist/agents/toolkits/openapi/openapi.d.ts +18 -0
- package/dist/agents/toolkits/openapi/openapi.js +18 -0
- package/dist/agents/toolkits/sql/sql.cjs +8 -0
- package/dist/agents/toolkits/sql/sql.d.ts +8 -0
- package/dist/agents/toolkits/sql/sql.js +8 -0
- package/dist/agents/toolkits/vectorstore/vectorstore.cjs +16 -0
- package/dist/agents/toolkits/vectorstore/vectorstore.d.ts +16 -0
- package/dist/agents/toolkits/vectorstore/vectorstore.js +16 -0
- package/dist/agents/toolkits/zapier/zapier.cjs +10 -0
- package/dist/agents/toolkits/zapier/zapier.d.ts +10 -0
- package/dist/agents/toolkits/zapier/zapier.js +10 -0
- package/dist/agents/xml/output_parser.cjs +21 -0
- package/dist/agents/xml/output_parser.d.ts +21 -0
- package/dist/agents/xml/output_parser.js +21 -0
- package/dist/cache/cloudflare_kv.cjs +13 -0
- package/dist/cache/cloudflare_kv.d.ts +13 -0
- package/dist/cache/cloudflare_kv.js +13 -0
- package/dist/cache/ioredis.cjs +13 -0
- package/dist/cache/ioredis.d.ts +13 -0
- package/dist/cache/ioredis.js +13 -0
- package/dist/cache/momento.cjs +19 -0
- package/dist/cache/momento.d.ts +19 -0
- package/dist/cache/momento.js +19 -0
- package/dist/cache/redis.cjs +10 -0
- package/dist/cache/redis.d.ts +10 -0
- package/dist/cache/redis.js +10 -0
- package/dist/cache/upstash_redis.cjs +15 -0
- package/dist/cache/upstash_redis.d.ts +15 -0
- package/dist/cache/upstash_redis.js +15 -0
- package/dist/callbacks/handlers/console.cjs +10 -0
- package/dist/callbacks/handlers/console.d.ts +10 -0
- package/dist/callbacks/handlers/console.js +10 -0
- package/dist/callbacks/manager.cjs +49 -0
- package/dist/callbacks/manager.d.ts +49 -0
- package/dist/callbacks/manager.js +49 -0
- package/dist/chains/analyze_documents_chain.cjs +18 -0
- package/dist/chains/analyze_documents_chain.d.ts +18 -0
- package/dist/chains/analyze_documents_chain.js +18 -0
- package/dist/chains/constitutional_ai/constitutional_chain.cjs +21 -0
- package/dist/chains/constitutional_ai/constitutional_chain.d.ts +21 -0
- package/dist/chains/constitutional_ai/constitutional_chain.js +21 -0
- package/dist/chains/constitutional_ai/constitutional_principle.cjs +21 -0
- package/dist/chains/constitutional_ai/constitutional_principle.d.ts +21 -0
- package/dist/chains/constitutional_ai/constitutional_principle.js +21 -0
- package/dist/chains/conversation.cjs +13 -0
- package/dist/chains/conversation.d.ts +13 -0
- package/dist/chains/conversation.js +13 -0
- package/dist/chains/conversational_retrieval_chain.cjs +29 -0
- package/dist/chains/conversational_retrieval_chain.d.ts +29 -0
- package/dist/chains/conversational_retrieval_chain.js +29 -0
- package/dist/chains/graph_qa/cypher.cjs +10 -0
- package/dist/chains/graph_qa/cypher.d.ts +10 -0
- package/dist/chains/graph_qa/cypher.js +10 -0
- package/dist/chains/openai_moderation.cjs +28 -0
- package/dist/chains/openai_moderation.d.ts +28 -0
- package/dist/chains/openai_moderation.js +28 -0
- package/dist/chains/retrieval_qa.cjs +21 -0
- package/dist/chains/retrieval_qa.d.ts +21 -0
- package/dist/chains/retrieval_qa.js +21 -0
- package/dist/chains/router/multi_prompt.cjs +19 -0
- package/dist/chains/router/multi_prompt.d.ts +19 -0
- package/dist/chains/router/multi_prompt.js +19 -0
- package/dist/chains/router/multi_retrieval_qa.cjs +29 -0
- package/dist/chains/router/multi_retrieval_qa.d.ts +29 -0
- package/dist/chains/router/multi_retrieval_qa.js +29 -0
- package/dist/chains/sequential_chain.cjs +43 -0
- package/dist/chains/sequential_chain.d.ts +43 -0
- package/dist/chains/sequential_chain.js +43 -0
- package/dist/chains/sql_db/sql_db_chain.cjs +9 -0
- package/dist/chains/sql_db/sql_db_chain.d.ts +9 -0
- package/dist/chains/sql_db/sql_db_chain.js +9 -0
- package/dist/chat_models/anthropic.cjs +9 -1
- package/dist/chat_models/anthropic.d.ts +9 -1
- package/dist/chat_models/anthropic.js +9 -1
- package/dist/chat_models/baiduwenxin.cjs +20 -0
- package/dist/chat_models/baiduwenxin.d.ts +20 -0
- package/dist/chat_models/baiduwenxin.js +20 -0
- package/dist/chat_models/base.cjs +2 -0
- package/dist/chat_models/base.d.ts +1 -1
- package/dist/chat_models/base.js +2 -0
- package/dist/chat_models/bedrock/index.cjs +11 -0
- package/dist/chat_models/bedrock/index.d.ts +11 -0
- package/dist/chat_models/bedrock/index.js +11 -0
- package/dist/chat_models/bedrock/web.cjs +9 -0
- package/dist/chat_models/bedrock/web.d.ts +9 -0
- package/dist/chat_models/bedrock/web.js +9 -0
- package/dist/chat_models/cloudflare_workersai.cjs +15 -0
- package/dist/chat_models/cloudflare_workersai.d.ts +15 -0
- package/dist/chat_models/cloudflare_workersai.js +15 -0
- package/dist/chat_models/fake.cjs +16 -0
- package/dist/chat_models/fake.d.ts +16 -0
- package/dist/chat_models/fake.js +16 -0
- package/dist/chat_models/fireworks.cjs +10 -0
- package/dist/chat_models/fireworks.d.ts +10 -0
- package/dist/chat_models/fireworks.js +10 -0
- package/dist/chat_models/googlepalm.cjs +24 -0
- package/dist/chat_models/googlepalm.d.ts +24 -0
- package/dist/chat_models/googlepalm.js +24 -0
- package/dist/chat_models/googlevertexai/index.cjs +7 -0
- package/dist/chat_models/googlevertexai/index.d.ts +7 -0
- package/dist/chat_models/googlevertexai/index.js +7 -0
- package/dist/chat_models/googlevertexai/web.cjs +9 -0
- package/dist/chat_models/googlevertexai/web.d.ts +9 -0
- package/dist/chat_models/googlevertexai/web.js +9 -0
- package/dist/chat_models/iflytek_xinghuo/index.cjs +8 -0
- package/dist/chat_models/iflytek_xinghuo/index.d.ts +8 -0
- package/dist/chat_models/iflytek_xinghuo/index.js +8 -0
- package/dist/chat_models/iflytek_xinghuo/web.cjs +8 -0
- package/dist/chat_models/iflytek_xinghuo/web.d.ts +8 -0
- package/dist/chat_models/iflytek_xinghuo/web.js +8 -0
- package/dist/chat_models/llama_cpp.cjs +17 -0
- package/dist/chat_models/llama_cpp.d.ts +17 -0
- package/dist/chat_models/llama_cpp.js +17 -0
- package/dist/chat_models/minimax.cjs +27 -0
- package/dist/chat_models/minimax.d.ts +27 -0
- package/dist/chat_models/minimax.js +27 -0
- package/dist/chat_models/ollama.cjs +24 -0
- package/dist/chat_models/ollama.d.ts +24 -0
- package/dist/chat_models/ollama.js +24 -0
- package/dist/chat_models/openai.cjs +15 -0
- package/dist/chat_models/openai.d.ts +15 -0
- package/dist/chat_models/openai.js +15 -0
- package/dist/chat_models/yandex.cjs +14 -0
- package/dist/chat_models/yandex.d.ts +14 -0
- package/dist/chat_models/yandex.js +14 -0
- package/dist/document_loaders/fs/directory.cjs +14 -0
- package/dist/document_loaders/fs/directory.d.ts +14 -0
- package/dist/document_loaders/fs/directory.js +14 -0
- package/dist/document_loaders/fs/openai_whisper_audio.cjs +10 -0
- package/dist/document_loaders/fs/openai_whisper_audio.d.ts +10 -0
- package/dist/document_loaders/fs/openai_whisper_audio.js +10 -0
- package/dist/document_loaders/fs/pdf.cjs +6 -0
- package/dist/document_loaders/fs/pdf.d.ts +6 -0
- package/dist/document_loaders/fs/pdf.js +6 -0
- package/dist/document_loaders/fs/srt.cjs +6 -0
- package/dist/document_loaders/fs/srt.d.ts +6 -0
- package/dist/document_loaders/fs/srt.js +6 -0
- package/dist/document_loaders/fs/text.cjs +5 -0
- package/dist/document_loaders/fs/text.d.ts +5 -0
- package/dist/document_loaders/fs/text.js +5 -0
- package/dist/document_loaders/fs/unstructured.cjs +7 -0
- package/dist/document_loaders/fs/unstructured.d.ts +7 -0
- package/dist/document_loaders/fs/unstructured.js +7 -0
- package/dist/document_loaders/web/apify_dataset.cjs +21 -0
- package/dist/document_loaders/web/apify_dataset.d.ts +21 -0
- package/dist/document_loaders/web/apify_dataset.js +21 -0
- package/dist/document_loaders/web/assemblyai.cjs +24 -0
- package/dist/document_loaders/web/assemblyai.d.ts +24 -0
- package/dist/document_loaders/web/assemblyai.js +24 -0
- package/dist/document_loaders/web/azure_blob_storage_file.cjs +11 -0
- package/dist/document_loaders/web/azure_blob_storage_file.d.ts +11 -0
- package/dist/document_loaders/web/azure_blob_storage_file.js +11 -0
- package/dist/document_loaders/web/cheerio.cjs +6 -0
- package/dist/document_loaders/web/cheerio.d.ts +6 -0
- package/dist/document_loaders/web/cheerio.js +6 -0
- package/dist/document_loaders/web/college_confidential.cjs +6 -0
- package/dist/document_loaders/web/college_confidential.d.ts +6 -0
- package/dist/document_loaders/web/college_confidential.js +6 -0
- package/dist/document_loaders/web/confluence.cjs +11 -0
- package/dist/document_loaders/web/confluence.d.ts +11 -0
- package/dist/document_loaders/web/confluence.js +11 -0
- package/dist/document_loaders/web/figma.cjs +9 -0
- package/dist/document_loaders/web/figma.d.ts +9 -0
- package/dist/document_loaders/web/figma.js +9 -0
- package/dist/document_loaders/web/notionapi.cjs +16 -0
- package/dist/document_loaders/web/notionapi.d.ts +16 -0
- package/dist/document_loaders/web/notionapi.js +16 -0
- package/dist/document_loaders/web/notiondb.cjs +11 -1
- package/dist/document_loaders/web/notiondb.d.ts +11 -1
- package/dist/document_loaders/web/notiondb.js +11 -1
- package/dist/document_loaders/web/pdf.cjs +6 -0
- package/dist/document_loaders/web/pdf.d.ts +6 -0
- package/dist/document_loaders/web/pdf.js +6 -0
- package/dist/document_loaders/web/puppeteer.cjs +12 -0
- package/dist/document_loaders/web/puppeteer.d.ts +12 -0
- package/dist/document_loaders/web/puppeteer.js +12 -0
- package/dist/document_loaders/web/s3.cjs +17 -0
- package/dist/document_loaders/web/s3.d.ts +17 -0
- package/dist/document_loaders/web/s3.js +17 -0
- package/dist/document_loaders/web/searchapi.cjs +9 -0
- package/dist/document_loaders/web/searchapi.d.ts +9 -0
- package/dist/document_loaders/web/searchapi.js +9 -0
- package/dist/document_loaders/web/serpapi.cjs +5 -0
- package/dist/document_loaders/web/serpapi.d.ts +5 -0
- package/dist/document_loaders/web/serpapi.js +5 -0
- package/dist/document_loaders/web/sonix_audio.cjs +12 -0
- package/dist/document_loaders/web/sonix_audio.d.ts +12 -0
- package/dist/document_loaders/web/sonix_audio.js +12 -0
- package/dist/document_loaders/web/sort_xyz_blockchain.cjs +22 -0
- package/dist/document_loaders/web/sort_xyz_blockchain.d.ts +22 -0
- package/dist/document_loaders/web/sort_xyz_blockchain.js +22 -0
- package/dist/document_loaders/web/youtube.cjs +9 -0
- package/dist/document_loaders/web/youtube.d.ts +9 -0
- package/dist/document_loaders/web/youtube.js +9 -0
- package/dist/document_transformers/html_to_text.cjs +18 -0
- package/dist/document_transformers/html_to_text.d.ts +18 -0
- package/dist/document_transformers/html_to_text.js +18 -0
- package/dist/document_transformers/mozilla_readability.cjs +18 -0
- package/dist/document_transformers/mozilla_readability.d.ts +18 -0
- package/dist/document_transformers/mozilla_readability.js +18 -0
- package/dist/embeddings/bedrock.cjs +17 -0
- package/dist/embeddings/bedrock.d.ts +17 -0
- package/dist/embeddings/bedrock.js +17 -0
- package/dist/embeddings/cache_backed.cjs +37 -0
- package/dist/embeddings/cache_backed.d.ts +37 -0
- package/dist/embeddings/cache_backed.js +37 -0
- package/dist/embeddings/cohere.cjs +10 -0
- package/dist/embeddings/cohere.d.ts +10 -0
- package/dist/embeddings/cohere.js +10 -0
- package/dist/embeddings/googlepalm.cjs +17 -0
- package/dist/embeddings/googlepalm.d.ts +17 -0
- package/dist/embeddings/googlepalm.js +17 -0
- package/dist/embeddings/googlevertexai.cjs +8 -0
- package/dist/embeddings/googlevertexai.d.ts +8 -0
- package/dist/embeddings/googlevertexai.js +8 -0
- package/dist/embeddings/hf_transformers.cjs +18 -0
- package/dist/embeddings/hf_transformers.d.ts +18 -0
- package/dist/embeddings/hf_transformers.js +18 -0
- package/dist/embeddings/llama_cpp.cjs +16 -0
- package/dist/embeddings/llama_cpp.d.ts +16 -0
- package/dist/embeddings/llama_cpp.js +16 -0
- package/dist/embeddings/minimax.cjs +15 -0
- package/dist/embeddings/minimax.d.ts +15 -0
- package/dist/embeddings/minimax.js +15 -0
- package/dist/embeddings/openai.cjs +10 -0
- package/dist/embeddings/openai.d.ts +10 -0
- package/dist/embeddings/openai.js +10 -0
- package/dist/embeddings/tensorflow.cjs +16 -0
- package/dist/embeddings/tensorflow.d.ts +16 -0
- package/dist/embeddings/tensorflow.js +16 -0
- package/dist/experimental/autogpt/agent.cjs +21 -0
- package/dist/experimental/autogpt/agent.d.ts +21 -0
- package/dist/experimental/autogpt/agent.js +21 -0
- package/dist/experimental/babyagi/agent.cjs +12 -0
- package/dist/experimental/babyagi/agent.d.ts +12 -0
- package/dist/experimental/babyagi/agent.js +12 -0
- package/dist/experimental/chat_models/ollama_functions.cjs +12 -15
- package/dist/experimental/chat_models/ollama_functions.d.ts +3 -4
- package/dist/experimental/chat_models/ollama_functions.js +13 -16
- package/dist/experimental/generative_agents/generative_agent.cjs +30 -0
- package/dist/experimental/generative_agents/generative_agent.d.ts +30 -0
- package/dist/experimental/generative_agents/generative_agent.js +30 -0
- package/dist/experimental/generative_agents/generative_agent_memory.cjs +18 -0
- package/dist/experimental/generative_agents/generative_agent_memory.d.ts +18 -0
- package/dist/experimental/generative_agents/generative_agent_memory.js +18 -0
- package/dist/llms/base.cjs +3 -1
- package/dist/llms/base.d.ts +1 -1
- package/dist/llms/base.js +3 -1
- package/dist/llms/cohere.cjs +13 -0
- package/dist/llms/cohere.d.ts +13 -0
- package/dist/llms/cohere.js +13 -0
- package/dist/llms/googlevertexai/index.cjs +12 -0
- package/dist/llms/googlevertexai/index.d.ts +12 -0
- package/dist/llms/googlevertexai/index.js +12 -0
- package/dist/llms/googlevertexai/web.cjs +12 -0
- package/dist/llms/googlevertexai/web.d.ts +12 -0
- package/dist/llms/googlevertexai/web.js +12 -0
- package/dist/llms/hf.cjs +13 -0
- package/dist/llms/hf.d.ts +13 -0
- package/dist/llms/hf.js +13 -0
- package/dist/llms/ollama.cjs +19 -0
- package/dist/llms/ollama.d.ts +19 -0
- package/dist/llms/ollama.js +19 -0
- package/dist/llms/openai-chat.cjs +17 -0
- package/dist/llms/openai-chat.d.ts +17 -0
- package/dist/llms/openai-chat.js +17 -0
- package/dist/llms/openai.cjs +14 -0
- package/dist/llms/openai.d.ts +14 -0
- package/dist/llms/openai.js +14 -0
- package/dist/llms/portkey.cjs +24 -0
- package/dist/llms/portkey.d.ts +24 -0
- package/dist/llms/portkey.js +24 -0
- package/dist/llms/replicate.cjs +11 -0
- package/dist/llms/replicate.d.ts +11 -0
- package/dist/llms/replicate.js +11 -0
- package/dist/memory/buffer_memory.cjs +24 -0
- package/dist/memory/buffer_memory.d.ts +24 -0
- package/dist/memory/buffer_memory.js +24 -0
- package/dist/memory/buffer_token_memory.cjs +15 -0
- package/dist/memory/buffer_token_memory.d.ts +15 -0
- package/dist/memory/buffer_token_memory.js +15 -0
- package/dist/memory/buffer_window_memory.cjs +23 -0
- package/dist/memory/buffer_window_memory.d.ts +23 -0
- package/dist/memory/buffer_window_memory.js +23 -0
- package/dist/memory/entity_memory.cjs +29 -0
- package/dist/memory/entity_memory.d.ts +29 -0
- package/dist/memory/entity_memory.js +29 -0
- package/dist/memory/summary.cjs +24 -0
- package/dist/memory/summary.d.ts +24 -0
- package/dist/memory/summary.js +24 -0
- package/dist/memory/summary_buffer.cjs +32 -0
- package/dist/memory/summary_buffer.d.ts +32 -0
- package/dist/memory/summary_buffer.js +32 -0
- package/dist/memory/vector_store.cjs +24 -0
- package/dist/memory/vector_store.d.ts +24 -0
- package/dist/memory/vector_store.js +24 -0
- package/dist/memory/zep.cjs +34 -0
- package/dist/memory/zep.d.ts +34 -0
- package/dist/memory/zep.js +34 -0
- package/dist/prompts/chat.cjs +31 -0
- package/dist/prompts/chat.d.ts +31 -0
- package/dist/prompts/chat.js +31 -0
- package/dist/prompts/few_shot.cjs +31 -0
- package/dist/prompts/few_shot.d.ts +31 -0
- package/dist/prompts/few_shot.js +31 -0
- package/dist/prompts/pipeline.cjs +39 -0
- package/dist/prompts/pipeline.d.ts +39 -0
- package/dist/prompts/pipeline.js +39 -0
- package/dist/prompts/selectors/LengthBasedExampleSelector.cjs +36 -0
- package/dist/prompts/selectors/LengthBasedExampleSelector.d.ts +36 -0
- package/dist/prompts/selectors/LengthBasedExampleSelector.js +36 -0
- package/dist/prompts/selectors/SemanticSimilarityExampleSelector.cjs +25 -0
- package/dist/prompts/selectors/SemanticSimilarityExampleSelector.d.ts +25 -0
- package/dist/prompts/selectors/SemanticSimilarityExampleSelector.js +25 -0
- package/dist/retrievers/amazon_kendra.cjs +16 -0
- package/dist/retrievers/amazon_kendra.d.ts +16 -0
- package/dist/retrievers/amazon_kendra.js +16 -0
- package/dist/retrievers/chaindesk.cjs +11 -0
- package/dist/retrievers/chaindesk.d.ts +11 -0
- package/dist/retrievers/chaindesk.js +11 -0
- package/dist/retrievers/contextual_compression.cjs +10 -0
- package/dist/retrievers/contextual_compression.d.ts +10 -0
- package/dist/retrievers/contextual_compression.js +10 -0
- package/dist/retrievers/document_compressors/embeddings_filter.cjs +13 -0
- package/dist/retrievers/document_compressors/embeddings_filter.d.ts +13 -0
- package/dist/retrievers/document_compressors/embeddings_filter.js +13 -0
- package/dist/retrievers/document_compressors/index.cjs +26 -0
- package/dist/retrievers/document_compressors/index.d.ts +26 -0
- package/dist/retrievers/document_compressors/index.js +26 -0
- package/dist/retrievers/hyde.cjs +19 -0
- package/dist/retrievers/hyde.d.ts +19 -0
- package/dist/retrievers/hyde.js +19 -0
- package/dist/retrievers/metal.cjs +11 -0
- package/dist/retrievers/metal.d.ts +11 -0
- package/dist/retrievers/metal.js +11 -0
- package/dist/retrievers/multi_query.cjs +13 -1
- package/dist/retrievers/multi_query.d.ts +13 -0
- package/dist/retrievers/multi_query.js +13 -1
- package/dist/retrievers/multi_vector.cjs +13 -0
- package/dist/retrievers/multi_vector.d.ts +13 -0
- package/dist/retrievers/multi_vector.js +13 -0
- package/dist/retrievers/parent_document.cjs +21 -0
- package/dist/retrievers/parent_document.d.ts +21 -0
- package/dist/retrievers/parent_document.js +21 -0
- package/dist/retrievers/remote/chatgpt-plugin.cjs +10 -0
- package/dist/retrievers/remote/chatgpt-plugin.d.ts +10 -0
- package/dist/retrievers/remote/chatgpt-plugin.js +10 -0
- package/dist/retrievers/self_query/chroma.cjs +15 -0
- package/dist/retrievers/self_query/chroma.d.ts +15 -0
- package/dist/retrievers/self_query/chroma.js +15 -0
- package/dist/retrievers/self_query/functional.cjs +7 -0
- package/dist/retrievers/self_query/functional.d.ts +7 -0
- package/dist/retrievers/self_query/functional.js +7 -0
- package/dist/retrievers/self_query/index.cjs +13 -0
- package/dist/retrievers/self_query/index.d.ts +13 -0
- package/dist/retrievers/self_query/index.js +13 -0
- package/dist/retrievers/self_query/pinecone.cjs +14 -0
- package/dist/retrievers/self_query/pinecone.d.ts +14 -0
- package/dist/retrievers/self_query/pinecone.js +14 -0
- package/dist/retrievers/self_query/supabase.cjs +14 -0
- package/dist/retrievers/self_query/supabase.d.ts +14 -0
- package/dist/retrievers/self_query/supabase.js +14 -0
- package/dist/retrievers/self_query/weaviate.cjs +14 -0
- package/dist/retrievers/self_query/weaviate.d.ts +14 -0
- package/dist/retrievers/self_query/weaviate.js +14 -0
- package/dist/retrievers/time_weighted.cjs +16 -0
- package/dist/retrievers/time_weighted.d.ts +16 -0
- package/dist/retrievers/time_weighted.js +16 -0
- package/dist/retrievers/vespa.cjs +15 -0
- package/dist/retrievers/vespa.d.ts +15 -0
- package/dist/retrievers/vespa.js +15 -0
- package/dist/retrievers/zep.cjs +10 -0
- package/dist/retrievers/zep.d.ts +10 -0
- package/dist/retrievers/zep.js +10 -0
- package/dist/schema/index.d.ts +8 -6
- package/dist/schema/output_parser.cjs +15 -0
- package/dist/schema/output_parser.d.ts +15 -0
- package/dist/schema/output_parser.js +15 -0
- package/dist/schema/runnable/base.cjs +20 -0
- package/dist/schema/runnable/base.d.ts +20 -0
- package/dist/schema/runnable/base.js +20 -0
- package/dist/schema/runnable/branch.cjs +28 -0
- package/dist/schema/runnable/branch.d.ts +28 -0
- package/dist/schema/runnable/branch.js +28 -0
- package/dist/storage/file_system.cjs +21 -0
- package/dist/storage/file_system.d.ts +21 -0
- package/dist/storage/file_system.js +21 -0
- package/dist/storage/in_memory.cjs +15 -0
- package/dist/storage/in_memory.d.ts +15 -0
- package/dist/storage/in_memory.js +15 -0
- package/dist/storage/ioredis.cjs +24 -0
- package/dist/storage/ioredis.d.ts +24 -0
- package/dist/storage/ioredis.js +24 -0
- package/dist/storage/upstash_redis.cjs +19 -0
- package/dist/storage/upstash_redis.d.ts +19 -0
- package/dist/storage/upstash_redis.js +19 -0
- package/dist/storage/vercel_kv.cjs +16 -0
- package/dist/storage/vercel_kv.d.ts +16 -0
- package/dist/storage/vercel_kv.js +16 -0
- package/dist/stores/message/cassandra.cjs +25 -0
- package/dist/stores/message/cassandra.d.ts +25 -0
- package/dist/stores/message/cassandra.js +25 -0
- package/dist/stores/message/cloudflare_d1.cjs +18 -0
- package/dist/stores/message/cloudflare_d1.d.ts +18 -0
- package/dist/stores/message/cloudflare_d1.js +18 -0
- package/dist/stores/message/firestore.cjs +19 -0
- package/dist/stores/message/firestore.d.ts +19 -0
- package/dist/stores/message/firestore.js +19 -0
- package/dist/stores/message/ioredis.cjs +18 -0
- package/dist/stores/message/ioredis.d.ts +18 -0
- package/dist/stores/message/ioredis.js +18 -0
- package/dist/stores/message/momento.cjs +18 -0
- package/dist/stores/message/momento.d.ts +18 -0
- package/dist/stores/message/momento.js +18 -0
- package/dist/stores/message/mongodb.cjs +11 -0
- package/dist/stores/message/mongodb.d.ts +11 -0
- package/dist/stores/message/mongodb.js +11 -0
- package/dist/stores/message/planetscale.cjs +18 -0
- package/dist/stores/message/planetscale.d.ts +18 -0
- package/dist/stores/message/planetscale.js +18 -0
- package/dist/stores/message/redis.cjs +18 -0
- package/dist/stores/message/redis.d.ts +18 -0
- package/dist/stores/message/redis.js +18 -0
- package/dist/stores/message/xata.cjs +23 -0
- package/dist/stores/message/xata.d.ts +23 -0
- package/dist/stores/message/xata.js +23 -0
- package/dist/tools/calculator.cjs +6 -0
- package/dist/tools/calculator.d.ts +6 -0
- package/dist/tools/calculator.js +6 -0
- package/dist/tools/google_calendar/create.cjs +22 -0
- package/dist/tools/google_calendar/create.d.ts +22 -0
- package/dist/tools/google_calendar/create.js +22 -0
- package/dist/tools/google_calendar/view.cjs +20 -0
- package/dist/tools/google_calendar/view.d.ts +20 -0
- package/dist/tools/google_calendar/view.js +20 -0
- package/dist/tools/searchapi.cjs +27 -0
- package/dist/tools/searchapi.d.ts +27 -0
- package/dist/tools/searchapi.js +27 -0
- package/dist/tools/searxng_search.cjs +20 -1
- package/dist/tools/searxng_search.d.ts +20 -1
- package/dist/tools/searxng_search.js +20 -1
- package/dist/tools/webbrowser.cjs +8 -0
- package/dist/tools/webbrowser.d.ts +8 -0
- package/dist/tools/webbrowser.js +8 -0
- package/dist/tools/wikipedia_query_run.cjs +8 -0
- package/dist/tools/wikipedia_query_run.d.ts +8 -0
- package/dist/tools/wikipedia_query_run.js +8 -0
- package/dist/tools/wolframalpha.cjs +9 -0
- package/dist/tools/wolframalpha.d.ts +9 -0
- package/dist/tools/wolframalpha.js +9 -0
- package/dist/util/googlevertexai-connection.cjs +3 -9
- package/dist/util/googlevertexai-connection.js +3 -9
- package/dist/vectorstores/opensearch.cjs +2 -1
- package/dist/vectorstores/opensearch.js +2 -1
- package/dist/vectorstores/prisma.cjs +6 -0
- package/dist/vectorstores/prisma.d.ts +3 -0
- package/dist/vectorstores/prisma.js +6 -0
- package/package.json +1 -1
|
@@ -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) {
|
package/dist/prompts/chat.cjs
CHANGED
|
@@ -206,6 +206,16 @@ exports.ChatMessagePromptTemplate = ChatMessagePromptTemplate;
|
|
|
206
206
|
/**
|
|
207
207
|
* Class that represents a human message prompt template. It extends the
|
|
208
208
|
* BaseMessageStringPromptTemplate.
|
|
209
|
+
* @example
|
|
210
|
+
* ```typescript
|
|
211
|
+
* const message = HumanMessagePromptTemplate.fromTemplate("{text}");
|
|
212
|
+
* const formatted = await message.format({ text: "Hello world!" });
|
|
213
|
+
*
|
|
214
|
+
* const chatPrompt = ChatPromptTemplate.fromMessages([message]);
|
|
215
|
+
* const formattedChatPrompt = await chatPrompt.invoke({
|
|
216
|
+
* text: "Hello world!",
|
|
217
|
+
* });
|
|
218
|
+
* ```
|
|
209
219
|
*/
|
|
210
220
|
class HumanMessagePromptTemplate extends BaseMessageStringPromptTemplate {
|
|
211
221
|
static lc_name() {
|
|
@@ -238,6 +248,16 @@ exports.AIMessagePromptTemplate = AIMessagePromptTemplate;
|
|
|
238
248
|
/**
|
|
239
249
|
* Class that represents a system message prompt template. It extends the
|
|
240
250
|
* BaseMessageStringPromptTemplate.
|
|
251
|
+
* @example
|
|
252
|
+
* ```typescript
|
|
253
|
+
* const message = SystemMessagePromptTemplate.fromTemplate("{text}");
|
|
254
|
+
* const formatted = await message.format({ text: "Hello world!" });
|
|
255
|
+
*
|
|
256
|
+
* const chatPrompt = ChatPromptTemplate.fromMessages([message]);
|
|
257
|
+
* const formattedChatPrompt = await chatPrompt.invoke({
|
|
258
|
+
* text: "Hello world!",
|
|
259
|
+
* });
|
|
260
|
+
* ```
|
|
241
261
|
*/
|
|
242
262
|
class SystemMessagePromptTemplate extends BaseMessageStringPromptTemplate {
|
|
243
263
|
static lc_name() {
|
|
@@ -281,6 +301,17 @@ function _coerceMessagePromptTemplateLike(messagePromptTemplateLike) {
|
|
|
281
301
|
* Class that represents a chat prompt. It extends the
|
|
282
302
|
* BaseChatPromptTemplate and uses an array of BaseMessagePromptTemplate
|
|
283
303
|
* instances to format a series of messages for a conversation.
|
|
304
|
+
* @example
|
|
305
|
+
* ```typescript
|
|
306
|
+
* const message = SystemMessagePromptTemplate.fromTemplate("{text}");
|
|
307
|
+
* const chatPrompt = ChatPromptTemplate.fromMessages([
|
|
308
|
+
* ["ai", "You are a helpful assistant."],
|
|
309
|
+
* message,
|
|
310
|
+
* ]);
|
|
311
|
+
* const formattedChatPrompt = await chatPrompt.invoke({
|
|
312
|
+
* text: "Hello world!",
|
|
313
|
+
* });
|
|
314
|
+
* ```
|
|
284
315
|
*/
|
|
285
316
|
class ChatPromptTemplate extends BaseChatPromptTemplate {
|
|
286
317
|
static lc_name() {
|
package/dist/prompts/chat.d.ts
CHANGED
|
@@ -115,6 +115,16 @@ export declare class ChatMessagePromptTemplate<RunInput extends InputValues = an
|
|
|
115
115
|
/**
|
|
116
116
|
* Class that represents a human message prompt template. It extends the
|
|
117
117
|
* BaseMessageStringPromptTemplate.
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* const message = HumanMessagePromptTemplate.fromTemplate("{text}");
|
|
121
|
+
* const formatted = await message.format({ text: "Hello world!" });
|
|
122
|
+
*
|
|
123
|
+
* const chatPrompt = ChatPromptTemplate.fromMessages([message]);
|
|
124
|
+
* const formattedChatPrompt = await chatPrompt.invoke({
|
|
125
|
+
* text: "Hello world!",
|
|
126
|
+
* });
|
|
127
|
+
* ```
|
|
118
128
|
*/
|
|
119
129
|
export declare class HumanMessagePromptTemplate<RunInput extends InputValues = any> extends BaseMessageStringPromptTemplate<RunInput> {
|
|
120
130
|
static lc_name(): string;
|
|
@@ -133,6 +143,16 @@ export declare class AIMessagePromptTemplate<RunInput extends InputValues = any>
|
|
|
133
143
|
/**
|
|
134
144
|
* Class that represents a system message prompt template. It extends the
|
|
135
145
|
* BaseMessageStringPromptTemplate.
|
|
146
|
+
* @example
|
|
147
|
+
* ```typescript
|
|
148
|
+
* const message = SystemMessagePromptTemplate.fromTemplate("{text}");
|
|
149
|
+
* const formatted = await message.format({ text: "Hello world!" });
|
|
150
|
+
*
|
|
151
|
+
* const chatPrompt = ChatPromptTemplate.fromMessages([message]);
|
|
152
|
+
* const formattedChatPrompt = await chatPrompt.invoke({
|
|
153
|
+
* text: "Hello world!",
|
|
154
|
+
* });
|
|
155
|
+
* ```
|
|
136
156
|
*/
|
|
137
157
|
export declare class SystemMessagePromptTemplate<RunInput extends InputValues = any> extends BaseMessageStringPromptTemplate<RunInput> {
|
|
138
158
|
static lc_name(): string;
|
|
@@ -159,6 +179,17 @@ export type BaseMessagePromptTemplateLike = BaseMessagePromptTemplate | BaseMess
|
|
|
159
179
|
* Class that represents a chat prompt. It extends the
|
|
160
180
|
* BaseChatPromptTemplate and uses an array of BaseMessagePromptTemplate
|
|
161
181
|
* instances to format a series of messages for a conversation.
|
|
182
|
+
* @example
|
|
183
|
+
* ```typescript
|
|
184
|
+
* const message = SystemMessagePromptTemplate.fromTemplate("{text}");
|
|
185
|
+
* const chatPrompt = ChatPromptTemplate.fromMessages([
|
|
186
|
+
* ["ai", "You are a helpful assistant."],
|
|
187
|
+
* message,
|
|
188
|
+
* ]);
|
|
189
|
+
* const formattedChatPrompt = await chatPrompt.invoke({
|
|
190
|
+
* text: "Hello world!",
|
|
191
|
+
* });
|
|
192
|
+
* ```
|
|
162
193
|
*/
|
|
163
194
|
export declare class ChatPromptTemplate<RunInput extends InputValues = any, PartialVariableName extends string = any> extends BaseChatPromptTemplate<RunInput, PartialVariableName> implements ChatPromptTemplateInput<RunInput, PartialVariableName> {
|
|
164
195
|
static lc_name(): string;
|
package/dist/prompts/chat.js
CHANGED
|
@@ -197,6 +197,16 @@ export class ChatMessagePromptTemplate extends BaseMessageStringPromptTemplate {
|
|
|
197
197
|
/**
|
|
198
198
|
* Class that represents a human message prompt template. It extends the
|
|
199
199
|
* BaseMessageStringPromptTemplate.
|
|
200
|
+
* @example
|
|
201
|
+
* ```typescript
|
|
202
|
+
* const message = HumanMessagePromptTemplate.fromTemplate("{text}");
|
|
203
|
+
* const formatted = await message.format({ text: "Hello world!" });
|
|
204
|
+
*
|
|
205
|
+
* const chatPrompt = ChatPromptTemplate.fromMessages([message]);
|
|
206
|
+
* const formattedChatPrompt = await chatPrompt.invoke({
|
|
207
|
+
* text: "Hello world!",
|
|
208
|
+
* });
|
|
209
|
+
* ```
|
|
200
210
|
*/
|
|
201
211
|
export class HumanMessagePromptTemplate extends BaseMessageStringPromptTemplate {
|
|
202
212
|
static lc_name() {
|
|
@@ -227,6 +237,16 @@ export class AIMessagePromptTemplate extends BaseMessageStringPromptTemplate {
|
|
|
227
237
|
/**
|
|
228
238
|
* Class that represents a system message prompt template. It extends the
|
|
229
239
|
* BaseMessageStringPromptTemplate.
|
|
240
|
+
* @example
|
|
241
|
+
* ```typescript
|
|
242
|
+
* const message = SystemMessagePromptTemplate.fromTemplate("{text}");
|
|
243
|
+
* const formatted = await message.format({ text: "Hello world!" });
|
|
244
|
+
*
|
|
245
|
+
* const chatPrompt = ChatPromptTemplate.fromMessages([message]);
|
|
246
|
+
* const formattedChatPrompt = await chatPrompt.invoke({
|
|
247
|
+
* text: "Hello world!",
|
|
248
|
+
* });
|
|
249
|
+
* ```
|
|
230
250
|
*/
|
|
231
251
|
export class SystemMessagePromptTemplate extends BaseMessageStringPromptTemplate {
|
|
232
252
|
static lc_name() {
|
|
@@ -269,6 +289,17 @@ function _coerceMessagePromptTemplateLike(messagePromptTemplateLike) {
|
|
|
269
289
|
* Class that represents a chat prompt. It extends the
|
|
270
290
|
* BaseChatPromptTemplate and uses an array of BaseMessagePromptTemplate
|
|
271
291
|
* instances to format a series of messages for a conversation.
|
|
292
|
+
* @example
|
|
293
|
+
* ```typescript
|
|
294
|
+
* const message = SystemMessagePromptTemplate.fromTemplate("{text}");
|
|
295
|
+
* const chatPrompt = ChatPromptTemplate.fromMessages([
|
|
296
|
+
* ["ai", "You are a helpful assistant."],
|
|
297
|
+
* message,
|
|
298
|
+
* ]);
|
|
299
|
+
* const formattedChatPrompt = await chatPrompt.invoke({
|
|
300
|
+
* text: "Hello world!",
|
|
301
|
+
* });
|
|
302
|
+
* ```
|
|
272
303
|
*/
|
|
273
304
|
export class ChatPromptTemplate extends BaseChatPromptTemplate {
|
|
274
305
|
static lc_name() {
|
|
@@ -9,6 +9,37 @@ const chat_js_1 = require("./chat.cjs");
|
|
|
9
9
|
* Prompt template that contains few-shot examples.
|
|
10
10
|
* @augments BasePromptTemplate
|
|
11
11
|
* @augments FewShotPromptTemplateInput
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const examplePrompt = PromptTemplate.fromTemplate(
|
|
15
|
+
* "Input: {input}\nOutput: {output}",
|
|
16
|
+
* );
|
|
17
|
+
*
|
|
18
|
+
* const exampleSelector = await SemanticSimilarityExampleSelector.fromExamples(
|
|
19
|
+
* [
|
|
20
|
+
* { input: "happy", output: "sad" },
|
|
21
|
+
* { input: "tall", output: "short" },
|
|
22
|
+
* { input: "energetic", output: "lethargic" },
|
|
23
|
+
* { input: "sunny", output: "gloomy" },
|
|
24
|
+
* { input: "windy", output: "calm" },
|
|
25
|
+
* ],
|
|
26
|
+
* new OpenAIEmbeddings(),
|
|
27
|
+
* HNSWLib,
|
|
28
|
+
* { k: 1 },
|
|
29
|
+
* );
|
|
30
|
+
*
|
|
31
|
+
* const dynamicPrompt = new FewShotPromptTemplate({
|
|
32
|
+
* exampleSelector,
|
|
33
|
+
* examplePrompt,
|
|
34
|
+
* prefix: "Give the antonym of every input",
|
|
35
|
+
* suffix: "Input: {adjective}\nOutput:",
|
|
36
|
+
* inputVariables: ["adjective"],
|
|
37
|
+
* });
|
|
38
|
+
*
|
|
39
|
+
* // Format the dynamic prompt with the input 'rainy'
|
|
40
|
+
* console.log(await dynamicPrompt.format({ adjective: "rainy" }));
|
|
41
|
+
*
|
|
42
|
+
* ```
|
|
12
43
|
*/
|
|
13
44
|
class FewShotPromptTemplate extends base_js_1.BaseStringPromptTemplate {
|
|
14
45
|
constructor(input) {
|
|
@@ -48,6 +48,37 @@ export interface FewShotPromptTemplateInput extends BasePromptTemplateInput<Inpu
|
|
|
48
48
|
* Prompt template that contains few-shot examples.
|
|
49
49
|
* @augments BasePromptTemplate
|
|
50
50
|
* @augments FewShotPromptTemplateInput
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const examplePrompt = PromptTemplate.fromTemplate(
|
|
54
|
+
* "Input: {input}\nOutput: {output}",
|
|
55
|
+
* );
|
|
56
|
+
*
|
|
57
|
+
* const exampleSelector = await SemanticSimilarityExampleSelector.fromExamples(
|
|
58
|
+
* [
|
|
59
|
+
* { input: "happy", output: "sad" },
|
|
60
|
+
* { input: "tall", output: "short" },
|
|
61
|
+
* { input: "energetic", output: "lethargic" },
|
|
62
|
+
* { input: "sunny", output: "gloomy" },
|
|
63
|
+
* { input: "windy", output: "calm" },
|
|
64
|
+
* ],
|
|
65
|
+
* new OpenAIEmbeddings(),
|
|
66
|
+
* HNSWLib,
|
|
67
|
+
* { k: 1 },
|
|
68
|
+
* );
|
|
69
|
+
*
|
|
70
|
+
* const dynamicPrompt = new FewShotPromptTemplate({
|
|
71
|
+
* exampleSelector,
|
|
72
|
+
* examplePrompt,
|
|
73
|
+
* prefix: "Give the antonym of every input",
|
|
74
|
+
* suffix: "Input: {adjective}\nOutput:",
|
|
75
|
+
* inputVariables: ["adjective"],
|
|
76
|
+
* });
|
|
77
|
+
*
|
|
78
|
+
* // Format the dynamic prompt with the input 'rainy'
|
|
79
|
+
* console.log(await dynamicPrompt.format({ adjective: "rainy" }));
|
|
80
|
+
*
|
|
81
|
+
* ```
|
|
51
82
|
*/
|
|
52
83
|
export declare class FewShotPromptTemplate extends BaseStringPromptTemplate implements FewShotPromptTemplateInput {
|
|
53
84
|
lc_serializable: boolean;
|
package/dist/prompts/few_shot.js
CHANGED
|
@@ -6,6 +6,37 @@ import { BaseChatPromptTemplate } from "./chat.js";
|
|
|
6
6
|
* Prompt template that contains few-shot examples.
|
|
7
7
|
* @augments BasePromptTemplate
|
|
8
8
|
* @augments FewShotPromptTemplateInput
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const examplePrompt = PromptTemplate.fromTemplate(
|
|
12
|
+
* "Input: {input}\nOutput: {output}",
|
|
13
|
+
* );
|
|
14
|
+
*
|
|
15
|
+
* const exampleSelector = await SemanticSimilarityExampleSelector.fromExamples(
|
|
16
|
+
* [
|
|
17
|
+
* { input: "happy", output: "sad" },
|
|
18
|
+
* { input: "tall", output: "short" },
|
|
19
|
+
* { input: "energetic", output: "lethargic" },
|
|
20
|
+
* { input: "sunny", output: "gloomy" },
|
|
21
|
+
* { input: "windy", output: "calm" },
|
|
22
|
+
* ],
|
|
23
|
+
* new OpenAIEmbeddings(),
|
|
24
|
+
* HNSWLib,
|
|
25
|
+
* { k: 1 },
|
|
26
|
+
* );
|
|
27
|
+
*
|
|
28
|
+
* const dynamicPrompt = new FewShotPromptTemplate({
|
|
29
|
+
* exampleSelector,
|
|
30
|
+
* examplePrompt,
|
|
31
|
+
* prefix: "Give the antonym of every input",
|
|
32
|
+
* suffix: "Input: {adjective}\nOutput:",
|
|
33
|
+
* inputVariables: ["adjective"],
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* // Format the dynamic prompt with the input 'rainy'
|
|
37
|
+
* console.log(await dynamicPrompt.format({ adjective: "rainy" }));
|
|
38
|
+
*
|
|
39
|
+
* ```
|
|
9
40
|
*/
|
|
10
41
|
export class FewShotPromptTemplate extends BaseStringPromptTemplate {
|
|
11
42
|
constructor(input) {
|
|
@@ -8,6 +8,45 @@ const chat_js_1 = require("./chat.cjs");
|
|
|
8
8
|
* different input variables. Includes methods for formatting these
|
|
9
9
|
* prompts, extracting required input values, and handling partial
|
|
10
10
|
* prompts.
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const composedPrompt = new PipelinePromptTemplate({
|
|
14
|
+
* pipelinePrompts: [
|
|
15
|
+
* {
|
|
16
|
+
* name: "introduction",
|
|
17
|
+
* prompt: PromptTemplate.fromTemplate(`You are impersonating {person}.`),
|
|
18
|
+
* },
|
|
19
|
+
* {
|
|
20
|
+
* name: "example",
|
|
21
|
+
* prompt: PromptTemplate.fromTemplate(
|
|
22
|
+
* `Here's an example of an interaction:
|
|
23
|
+
* Q: {example_q}
|
|
24
|
+
* A: {example_a}`,
|
|
25
|
+
* ),
|
|
26
|
+
* },
|
|
27
|
+
* {
|
|
28
|
+
* name: "start",
|
|
29
|
+
* prompt: PromptTemplate.fromTemplate(
|
|
30
|
+
* `Now, do this for real!
|
|
31
|
+
* Q: {input}
|
|
32
|
+
* A:`,
|
|
33
|
+
* ),
|
|
34
|
+
* },
|
|
35
|
+
* ],
|
|
36
|
+
* finalPrompt: PromptTemplate.fromTemplate(
|
|
37
|
+
* `{introduction}
|
|
38
|
+
* {example}
|
|
39
|
+
* {start}`,
|
|
40
|
+
* ),
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* const formattedPrompt = await composedPrompt.format({
|
|
44
|
+
* person: "Elon Musk",
|
|
45
|
+
* example_q: `What's your favorite car?`,
|
|
46
|
+
* example_a: "Tesla",
|
|
47
|
+
* input: `What's your favorite social media site?`,
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
11
50
|
*/
|
|
12
51
|
class PipelinePromptTemplate extends base_js_1.BasePromptTemplate {
|
|
13
52
|
static lc_name() {
|
|
@@ -22,6 +22,45 @@ export type PipelinePromptTemplateInput<PromptTemplateType extends BasePromptTem
|
|
|
22
22
|
* different input variables. Includes methods for formatting these
|
|
23
23
|
* prompts, extracting required input values, and handling partial
|
|
24
24
|
* prompts.
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const composedPrompt = new PipelinePromptTemplate({
|
|
28
|
+
* pipelinePrompts: [
|
|
29
|
+
* {
|
|
30
|
+
* name: "introduction",
|
|
31
|
+
* prompt: PromptTemplate.fromTemplate(`You are impersonating {person}.`),
|
|
32
|
+
* },
|
|
33
|
+
* {
|
|
34
|
+
* name: "example",
|
|
35
|
+
* prompt: PromptTemplate.fromTemplate(
|
|
36
|
+
* `Here's an example of an interaction:
|
|
37
|
+
* Q: {example_q}
|
|
38
|
+
* A: {example_a}`,
|
|
39
|
+
* ),
|
|
40
|
+
* },
|
|
41
|
+
* {
|
|
42
|
+
* name: "start",
|
|
43
|
+
* prompt: PromptTemplate.fromTemplate(
|
|
44
|
+
* `Now, do this for real!
|
|
45
|
+
* Q: {input}
|
|
46
|
+
* A:`,
|
|
47
|
+
* ),
|
|
48
|
+
* },
|
|
49
|
+
* ],
|
|
50
|
+
* finalPrompt: PromptTemplate.fromTemplate(
|
|
51
|
+
* `{introduction}
|
|
52
|
+
* {example}
|
|
53
|
+
* {start}`,
|
|
54
|
+
* ),
|
|
55
|
+
* });
|
|
56
|
+
*
|
|
57
|
+
* const formattedPrompt = await composedPrompt.format({
|
|
58
|
+
* person: "Elon Musk",
|
|
59
|
+
* example_q: `What's your favorite car?`,
|
|
60
|
+
* example_a: "Tesla",
|
|
61
|
+
* input: `What's your favorite social media site?`,
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
25
64
|
*/
|
|
26
65
|
export declare class PipelinePromptTemplate<PromptTemplateType extends BasePromptTemplate> extends BasePromptTemplate {
|
|
27
66
|
static lc_name(): string;
|
package/dist/prompts/pipeline.js
CHANGED
|
@@ -5,6 +5,45 @@ import { ChatPromptTemplate } from "./chat.js";
|
|
|
5
5
|
* different input variables. Includes methods for formatting these
|
|
6
6
|
* prompts, extracting required input values, and handling partial
|
|
7
7
|
* prompts.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const composedPrompt = new PipelinePromptTemplate({
|
|
11
|
+
* pipelinePrompts: [
|
|
12
|
+
* {
|
|
13
|
+
* name: "introduction",
|
|
14
|
+
* prompt: PromptTemplate.fromTemplate(`You are impersonating {person}.`),
|
|
15
|
+
* },
|
|
16
|
+
* {
|
|
17
|
+
* name: "example",
|
|
18
|
+
* prompt: PromptTemplate.fromTemplate(
|
|
19
|
+
* `Here's an example of an interaction:
|
|
20
|
+
* Q: {example_q}
|
|
21
|
+
* A: {example_a}`,
|
|
22
|
+
* ),
|
|
23
|
+
* },
|
|
24
|
+
* {
|
|
25
|
+
* name: "start",
|
|
26
|
+
* prompt: PromptTemplate.fromTemplate(
|
|
27
|
+
* `Now, do this for real!
|
|
28
|
+
* Q: {input}
|
|
29
|
+
* A:`,
|
|
30
|
+
* ),
|
|
31
|
+
* },
|
|
32
|
+
* ],
|
|
33
|
+
* finalPrompt: PromptTemplate.fromTemplate(
|
|
34
|
+
* `{introduction}
|
|
35
|
+
* {example}
|
|
36
|
+
* {start}`,
|
|
37
|
+
* ),
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* const formattedPrompt = await composedPrompt.format({
|
|
41
|
+
* person: "Elon Musk",
|
|
42
|
+
* example_q: `What's your favorite car?`,
|
|
43
|
+
* example_a: "Tesla",
|
|
44
|
+
* input: `What's your favorite social media site?`,
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
8
47
|
*/
|
|
9
48
|
export class PipelinePromptTemplate extends BasePromptTemplate {
|
|
10
49
|
static lc_name() {
|
|
@@ -12,6 +12,42 @@ function getLengthBased(text) {
|
|
|
12
12
|
* A specialized example selector that selects examples based on their
|
|
13
13
|
* length, ensuring that the total length of the selected examples does
|
|
14
14
|
* not exceed a specified maximum length.
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const exampleSelector = new LengthBasedExampleSelector(
|
|
18
|
+
* [
|
|
19
|
+
* { input: "happy", output: "sad" },
|
|
20
|
+
* { input: "tall", output: "short" },
|
|
21
|
+
* { input: "energetic", output: "lethargic" },
|
|
22
|
+
* { input: "sunny", output: "gloomy" },
|
|
23
|
+
* { input: "windy", output: "calm" },
|
|
24
|
+
* ],
|
|
25
|
+
* {
|
|
26
|
+
* examplePrompt: new PromptTemplate({
|
|
27
|
+
* inputVariables: ["input", "output"],
|
|
28
|
+
* template: "Input: {input}\nOutput: {output}",
|
|
29
|
+
* }),
|
|
30
|
+
* maxLength: 25,
|
|
31
|
+
* },
|
|
32
|
+
* );
|
|
33
|
+
* const dynamicPrompt = new FewShotPromptTemplate({
|
|
34
|
+
* exampleSelector,
|
|
35
|
+
* examplePrompt: new PromptTemplate({
|
|
36
|
+
* inputVariables: ["input", "output"],
|
|
37
|
+
* template: "Input: {input}\nOutput: {output}",
|
|
38
|
+
* }),
|
|
39
|
+
* prefix: "Give the antonym of every input",
|
|
40
|
+
* suffix: "Input: {adjective}\nOutput:",
|
|
41
|
+
* inputVariables: ["adjective"],
|
|
42
|
+
* });
|
|
43
|
+
* console.log(dynamicPrompt.format({ adjective: "big" }));
|
|
44
|
+
* console.log(
|
|
45
|
+
* dynamicPrompt.format({
|
|
46
|
+
* adjective:
|
|
47
|
+
* "big and huge and massive and large and gigantic and tall and much much much much much bigger than everything else",
|
|
48
|
+
* }),
|
|
49
|
+
* );
|
|
50
|
+
* ```
|
|
15
51
|
*/
|
|
16
52
|
class LengthBasedExampleSelector extends base_js_1.BaseExampleSelector {
|
|
17
53
|
constructor(data) {
|
|
@@ -14,6 +14,42 @@ export interface LengthBasedExampleSelectorInput {
|
|
|
14
14
|
* A specialized example selector that selects examples based on their
|
|
15
15
|
* length, ensuring that the total length of the selected examples does
|
|
16
16
|
* not exceed a specified maximum length.
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const exampleSelector = new LengthBasedExampleSelector(
|
|
20
|
+
* [
|
|
21
|
+
* { input: "happy", output: "sad" },
|
|
22
|
+
* { input: "tall", output: "short" },
|
|
23
|
+
* { input: "energetic", output: "lethargic" },
|
|
24
|
+
* { input: "sunny", output: "gloomy" },
|
|
25
|
+
* { input: "windy", output: "calm" },
|
|
26
|
+
* ],
|
|
27
|
+
* {
|
|
28
|
+
* examplePrompt: new PromptTemplate({
|
|
29
|
+
* inputVariables: ["input", "output"],
|
|
30
|
+
* template: "Input: {input}\nOutput: {output}",
|
|
31
|
+
* }),
|
|
32
|
+
* maxLength: 25,
|
|
33
|
+
* },
|
|
34
|
+
* );
|
|
35
|
+
* const dynamicPrompt = new FewShotPromptTemplate({
|
|
36
|
+
* exampleSelector,
|
|
37
|
+
* examplePrompt: new PromptTemplate({
|
|
38
|
+
* inputVariables: ["input", "output"],
|
|
39
|
+
* template: "Input: {input}\nOutput: {output}",
|
|
40
|
+
* }),
|
|
41
|
+
* prefix: "Give the antonym of every input",
|
|
42
|
+
* suffix: "Input: {adjective}\nOutput:",
|
|
43
|
+
* inputVariables: ["adjective"],
|
|
44
|
+
* });
|
|
45
|
+
* console.log(dynamicPrompt.format({ adjective: "big" }));
|
|
46
|
+
* console.log(
|
|
47
|
+
* dynamicPrompt.format({
|
|
48
|
+
* adjective:
|
|
49
|
+
* "big and huge and massive and large and gigantic and tall and much much much much much bigger than everything else",
|
|
50
|
+
* }),
|
|
51
|
+
* );
|
|
52
|
+
* ```
|
|
17
53
|
*/
|
|
18
54
|
export declare class LengthBasedExampleSelector extends BaseExampleSelector {
|
|
19
55
|
protected examples: Example[];
|