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
|
@@ -6,6 +6,24 @@ const document_js_1 = require("../document.cjs");
|
|
|
6
6
|
const document_js_2 = require("../schema/document.cjs");
|
|
7
7
|
/**
|
|
8
8
|
* A transformer that converts HTML content to plain text.
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const loader = new CheerioWebBaseLoader("https://example.com/some-page");
|
|
12
|
+
* const docs = await loader.load();
|
|
13
|
+
*
|
|
14
|
+
* const splitter = new RecursiveCharacterTextSplitter({
|
|
15
|
+
* maxCharacterCount: 1000,
|
|
16
|
+
* });
|
|
17
|
+
* const transformer = new HtmlToTextTransformer();
|
|
18
|
+
*
|
|
19
|
+
* // The sequence of text splitting followed by HTML to text transformation
|
|
20
|
+
* const sequence = splitter.pipe(transformer);
|
|
21
|
+
*
|
|
22
|
+
* // Processing the loaded documents through the sequence
|
|
23
|
+
* const newDocuments = await sequence.invoke(docs);
|
|
24
|
+
*
|
|
25
|
+
* console.log(newDocuments);
|
|
26
|
+
* ```
|
|
9
27
|
*/
|
|
10
28
|
class HtmlToTextTransformer extends document_js_2.MappingDocumentTransformer {
|
|
11
29
|
static lc_name() {
|
|
@@ -3,6 +3,24 @@ import { Document } from "../document.js";
|
|
|
3
3
|
import { MappingDocumentTransformer } from "../schema/document.js";
|
|
4
4
|
/**
|
|
5
5
|
* A transformer that converts HTML content to plain text.
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* const loader = new CheerioWebBaseLoader("https://example.com/some-page");
|
|
9
|
+
* const docs = await loader.load();
|
|
10
|
+
*
|
|
11
|
+
* const splitter = new RecursiveCharacterTextSplitter({
|
|
12
|
+
* maxCharacterCount: 1000,
|
|
13
|
+
* });
|
|
14
|
+
* const transformer = new HtmlToTextTransformer();
|
|
15
|
+
*
|
|
16
|
+
* // The sequence of text splitting followed by HTML to text transformation
|
|
17
|
+
* const sequence = splitter.pipe(transformer);
|
|
18
|
+
*
|
|
19
|
+
* // Processing the loaded documents through the sequence
|
|
20
|
+
* const newDocuments = await sequence.invoke(docs);
|
|
21
|
+
*
|
|
22
|
+
* console.log(newDocuments);
|
|
23
|
+
* ```
|
|
6
24
|
*/
|
|
7
25
|
export declare class HtmlToTextTransformer extends MappingDocumentTransformer {
|
|
8
26
|
protected options: HtmlToTextOptions;
|
|
@@ -3,6 +3,24 @@ import { Document } from "../document.js";
|
|
|
3
3
|
import { MappingDocumentTransformer } from "../schema/document.js";
|
|
4
4
|
/**
|
|
5
5
|
* A transformer that converts HTML content to plain text.
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* const loader = new CheerioWebBaseLoader("https://example.com/some-page");
|
|
9
|
+
* const docs = await loader.load();
|
|
10
|
+
*
|
|
11
|
+
* const splitter = new RecursiveCharacterTextSplitter({
|
|
12
|
+
* maxCharacterCount: 1000,
|
|
13
|
+
* });
|
|
14
|
+
* const transformer = new HtmlToTextTransformer();
|
|
15
|
+
*
|
|
16
|
+
* // The sequence of text splitting followed by HTML to text transformation
|
|
17
|
+
* const sequence = splitter.pipe(transformer);
|
|
18
|
+
*
|
|
19
|
+
* // Processing the loaded documents through the sequence
|
|
20
|
+
* const newDocuments = await sequence.invoke(docs);
|
|
21
|
+
*
|
|
22
|
+
* console.log(newDocuments);
|
|
23
|
+
* ```
|
|
6
24
|
*/
|
|
7
25
|
export class HtmlToTextTransformer extends MappingDocumentTransformer {
|
|
8
26
|
static lc_name() {
|
|
@@ -8,6 +8,24 @@ const document_js_2 = require("../schema/document.cjs");
|
|
|
8
8
|
/**
|
|
9
9
|
* A transformer that uses the Mozilla Readability library to extract the
|
|
10
10
|
* main content from a web page.
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const loader = new CheerioWebBaseLoader("https://example.com/article");
|
|
14
|
+
* const docs = await loader.load();
|
|
15
|
+
*
|
|
16
|
+
* const splitter = new RecursiveCharacterTextSplitter({
|
|
17
|
+
* maxCharacterCount: 5000,
|
|
18
|
+
* });
|
|
19
|
+
* const transformer = new MozillaReadabilityTransformer();
|
|
20
|
+
*
|
|
21
|
+
* // The sequence processes the loaded documents through the splitter and then the transformer.
|
|
22
|
+
* const sequence = splitter.pipe(transformer);
|
|
23
|
+
*
|
|
24
|
+
* // Invoke the sequence to transform the documents into a more readable format.
|
|
25
|
+
* const newDocuments = await sequence.invoke(docs);
|
|
26
|
+
*
|
|
27
|
+
* console.log(newDocuments);
|
|
28
|
+
* ```
|
|
11
29
|
*/
|
|
12
30
|
class MozillaReadabilityTransformer extends document_js_2.MappingDocumentTransformer {
|
|
13
31
|
static lc_name() {
|
|
@@ -4,6 +4,24 @@ import { MappingDocumentTransformer } from "../schema/document.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* A transformer that uses the Mozilla Readability library to extract the
|
|
6
6
|
* main content from a web page.
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const loader = new CheerioWebBaseLoader("https://example.com/article");
|
|
10
|
+
* const docs = await loader.load();
|
|
11
|
+
*
|
|
12
|
+
* const splitter = new RecursiveCharacterTextSplitter({
|
|
13
|
+
* maxCharacterCount: 5000,
|
|
14
|
+
* });
|
|
15
|
+
* const transformer = new MozillaReadabilityTransformer();
|
|
16
|
+
*
|
|
17
|
+
* // The sequence processes the loaded documents through the splitter and then the transformer.
|
|
18
|
+
* const sequence = splitter.pipe(transformer);
|
|
19
|
+
*
|
|
20
|
+
* // Invoke the sequence to transform the documents into a more readable format.
|
|
21
|
+
* const newDocuments = await sequence.invoke(docs);
|
|
22
|
+
*
|
|
23
|
+
* console.log(newDocuments);
|
|
24
|
+
* ```
|
|
7
25
|
*/
|
|
8
26
|
export declare class MozillaReadabilityTransformer extends MappingDocumentTransformer {
|
|
9
27
|
protected options: Options;
|
|
@@ -5,6 +5,24 @@ import { MappingDocumentTransformer } from "../schema/document.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* A transformer that uses the Mozilla Readability library to extract the
|
|
7
7
|
* main content from a web page.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const loader = new CheerioWebBaseLoader("https://example.com/article");
|
|
11
|
+
* const docs = await loader.load();
|
|
12
|
+
*
|
|
13
|
+
* const splitter = new RecursiveCharacterTextSplitter({
|
|
14
|
+
* maxCharacterCount: 5000,
|
|
15
|
+
* });
|
|
16
|
+
* const transformer = new MozillaReadabilityTransformer();
|
|
17
|
+
*
|
|
18
|
+
* // The sequence processes the loaded documents through the splitter and then the transformer.
|
|
19
|
+
* const sequence = splitter.pipe(transformer);
|
|
20
|
+
*
|
|
21
|
+
* // Invoke the sequence to transform the documents into a more readable format.
|
|
22
|
+
* const newDocuments = await sequence.invoke(docs);
|
|
23
|
+
*
|
|
24
|
+
* console.log(newDocuments);
|
|
25
|
+
* ```
|
|
8
26
|
*/
|
|
9
27
|
export class MozillaReadabilityTransformer extends MappingDocumentTransformer {
|
|
10
28
|
static lc_name() {
|
|
@@ -6,6 +6,23 @@ const base_js_1 = require("./base.cjs");
|
|
|
6
6
|
/**
|
|
7
7
|
* Class that extends the Embeddings class and provides methods for
|
|
8
8
|
* generating embeddings using the Bedrock API.
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const embeddings = new BedrockEmbeddings({
|
|
12
|
+
* region: "your-aws-region",
|
|
13
|
+
* credentials: {
|
|
14
|
+
* accessKeyId: "your-access-key-id",
|
|
15
|
+
* secretAccessKey: "your-secret-access-key",
|
|
16
|
+
* },
|
|
17
|
+
* model: "amazon.titan-embed-text-v1",
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* // Embed a query and log the result
|
|
21
|
+
* const res = await embeddings.embedQuery(
|
|
22
|
+
* "What would be a good company name for a company that makes colorful socks?"
|
|
23
|
+
* );
|
|
24
|
+
* console.log({ res });
|
|
25
|
+
* ```
|
|
9
26
|
*/
|
|
10
27
|
class BedrockEmbeddings extends base_js_1.Embeddings {
|
|
11
28
|
constructor(fields) {
|
|
@@ -22,6 +22,23 @@ export interface BedrockEmbeddingsParams extends EmbeddingsParams {
|
|
|
22
22
|
/**
|
|
23
23
|
* Class that extends the Embeddings class and provides methods for
|
|
24
24
|
* generating embeddings using the Bedrock API.
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const embeddings = new BedrockEmbeddings({
|
|
28
|
+
* region: "your-aws-region",
|
|
29
|
+
* credentials: {
|
|
30
|
+
* accessKeyId: "your-access-key-id",
|
|
31
|
+
* secretAccessKey: "your-secret-access-key",
|
|
32
|
+
* },
|
|
33
|
+
* model: "amazon.titan-embed-text-v1",
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* // Embed a query and log the result
|
|
37
|
+
* const res = await embeddings.embedQuery(
|
|
38
|
+
* "What would be a good company name for a company that makes colorful socks?"
|
|
39
|
+
* );
|
|
40
|
+
* console.log({ res });
|
|
41
|
+
* ```
|
|
25
42
|
*/
|
|
26
43
|
export declare class BedrockEmbeddings extends Embeddings implements BedrockEmbeddingsParams {
|
|
27
44
|
model: string;
|
|
@@ -3,6 +3,23 @@ import { Embeddings } from "./base.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* Class that extends the Embeddings class and provides methods for
|
|
5
5
|
* generating embeddings using the Bedrock API.
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* const embeddings = new BedrockEmbeddings({
|
|
9
|
+
* region: "your-aws-region",
|
|
10
|
+
* credentials: {
|
|
11
|
+
* accessKeyId: "your-access-key-id",
|
|
12
|
+
* secretAccessKey: "your-secret-access-key",
|
|
13
|
+
* },
|
|
14
|
+
* model: "amazon.titan-embed-text-v1",
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* // Embed a query and log the result
|
|
18
|
+
* const res = await embeddings.embedQuery(
|
|
19
|
+
* "What would be a good company name for a company that makes colorful socks?"
|
|
20
|
+
* );
|
|
21
|
+
* console.log({ res });
|
|
22
|
+
* ```
|
|
6
23
|
*/
|
|
7
24
|
export class BedrockEmbeddings extends Embeddings {
|
|
8
25
|
constructor(fields) {
|
|
@@ -13,6 +13,43 @@ const base_js_1 = require("./base.cjs");
|
|
|
13
13
|
*
|
|
14
14
|
* If need be, the interface can be extended to accept other implementations
|
|
15
15
|
* of the value serializer and deserializer, as well as the key encoder.
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const underlyingEmbeddings = new OpenAIEmbeddings();
|
|
19
|
+
*
|
|
20
|
+
* const cacheBackedEmbeddings = CacheBackedEmbeddings.fromBytesStore(
|
|
21
|
+
* underlyingEmbeddings,
|
|
22
|
+
* new ConvexKVStore({ ctx }),
|
|
23
|
+
* {
|
|
24
|
+
* namespace: underlyingEmbeddings.modelName,
|
|
25
|
+
* },
|
|
26
|
+
* );
|
|
27
|
+
*
|
|
28
|
+
* const loader = new TextLoader("./state_of_the_union.txt");
|
|
29
|
+
* const rawDocuments = await loader.load();
|
|
30
|
+
* const splitter = new RecursiveCharacterTextSplitter({
|
|
31
|
+
* chunkSize: 1000,
|
|
32
|
+
* chunkOverlap: 0,
|
|
33
|
+
* });
|
|
34
|
+
* const documents = await splitter.splitDocuments(rawDocuments);
|
|
35
|
+
*
|
|
36
|
+
* let time = Date.now();
|
|
37
|
+
* const vectorstore = await ConvexVectorStore.fromDocuments(
|
|
38
|
+
* documents,
|
|
39
|
+
* cacheBackedEmbeddings,
|
|
40
|
+
* { ctx },
|
|
41
|
+
* );
|
|
42
|
+
* console.log(`Initial creation time: ${Date.now() - time}ms`);
|
|
43
|
+
*
|
|
44
|
+
* time = Date.now();
|
|
45
|
+
* const vectorstore2 = await ConvexVectorStore.fromDocuments(
|
|
46
|
+
* documents,
|
|
47
|
+
* cacheBackedEmbeddings,
|
|
48
|
+
* { ctx },
|
|
49
|
+
* );
|
|
50
|
+
* console.log(`Cached creation time: ${Date.now() - time}ms`);
|
|
51
|
+
*
|
|
52
|
+
* ```
|
|
16
53
|
*/
|
|
17
54
|
class CacheBackedEmbeddings extends base_js_1.Embeddings {
|
|
18
55
|
constructor(fields) {
|
|
@@ -18,6 +18,43 @@ export interface CacheBackedEmbeddingsFields extends AsyncCallerParams {
|
|
|
18
18
|
*
|
|
19
19
|
* If need be, the interface can be extended to accept other implementations
|
|
20
20
|
* of the value serializer and deserializer, as well as the key encoder.
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const underlyingEmbeddings = new OpenAIEmbeddings();
|
|
24
|
+
*
|
|
25
|
+
* const cacheBackedEmbeddings = CacheBackedEmbeddings.fromBytesStore(
|
|
26
|
+
* underlyingEmbeddings,
|
|
27
|
+
* new ConvexKVStore({ ctx }),
|
|
28
|
+
* {
|
|
29
|
+
* namespace: underlyingEmbeddings.modelName,
|
|
30
|
+
* },
|
|
31
|
+
* );
|
|
32
|
+
*
|
|
33
|
+
* const loader = new TextLoader("./state_of_the_union.txt");
|
|
34
|
+
* const rawDocuments = await loader.load();
|
|
35
|
+
* const splitter = new RecursiveCharacterTextSplitter({
|
|
36
|
+
* chunkSize: 1000,
|
|
37
|
+
* chunkOverlap: 0,
|
|
38
|
+
* });
|
|
39
|
+
* const documents = await splitter.splitDocuments(rawDocuments);
|
|
40
|
+
*
|
|
41
|
+
* let time = Date.now();
|
|
42
|
+
* const vectorstore = await ConvexVectorStore.fromDocuments(
|
|
43
|
+
* documents,
|
|
44
|
+
* cacheBackedEmbeddings,
|
|
45
|
+
* { ctx },
|
|
46
|
+
* );
|
|
47
|
+
* console.log(`Initial creation time: ${Date.now() - time}ms`);
|
|
48
|
+
*
|
|
49
|
+
* time = Date.now();
|
|
50
|
+
* const vectorstore2 = await ConvexVectorStore.fromDocuments(
|
|
51
|
+
* documents,
|
|
52
|
+
* cacheBackedEmbeddings,
|
|
53
|
+
* { ctx },
|
|
54
|
+
* );
|
|
55
|
+
* console.log(`Cached creation time: ${Date.now() - time}ms`);
|
|
56
|
+
*
|
|
57
|
+
* ```
|
|
21
58
|
*/
|
|
22
59
|
export declare class CacheBackedEmbeddings extends Embeddings {
|
|
23
60
|
protected underlyingEmbeddings: Embeddings;
|
|
@@ -10,6 +10,43 @@ import { Embeddings } from "./base.js";
|
|
|
10
10
|
*
|
|
11
11
|
* If need be, the interface can be extended to accept other implementations
|
|
12
12
|
* of the value serializer and deserializer, as well as the key encoder.
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const underlyingEmbeddings = new OpenAIEmbeddings();
|
|
16
|
+
*
|
|
17
|
+
* const cacheBackedEmbeddings = CacheBackedEmbeddings.fromBytesStore(
|
|
18
|
+
* underlyingEmbeddings,
|
|
19
|
+
* new ConvexKVStore({ ctx }),
|
|
20
|
+
* {
|
|
21
|
+
* namespace: underlyingEmbeddings.modelName,
|
|
22
|
+
* },
|
|
23
|
+
* );
|
|
24
|
+
*
|
|
25
|
+
* const loader = new TextLoader("./state_of_the_union.txt");
|
|
26
|
+
* const rawDocuments = await loader.load();
|
|
27
|
+
* const splitter = new RecursiveCharacterTextSplitter({
|
|
28
|
+
* chunkSize: 1000,
|
|
29
|
+
* chunkOverlap: 0,
|
|
30
|
+
* });
|
|
31
|
+
* const documents = await splitter.splitDocuments(rawDocuments);
|
|
32
|
+
*
|
|
33
|
+
* let time = Date.now();
|
|
34
|
+
* const vectorstore = await ConvexVectorStore.fromDocuments(
|
|
35
|
+
* documents,
|
|
36
|
+
* cacheBackedEmbeddings,
|
|
37
|
+
* { ctx },
|
|
38
|
+
* );
|
|
39
|
+
* console.log(`Initial creation time: ${Date.now() - time}ms`);
|
|
40
|
+
*
|
|
41
|
+
* time = Date.now();
|
|
42
|
+
* const vectorstore2 = await ConvexVectorStore.fromDocuments(
|
|
43
|
+
* documents,
|
|
44
|
+
* cacheBackedEmbeddings,
|
|
45
|
+
* { ctx },
|
|
46
|
+
* );
|
|
47
|
+
* console.log(`Cached creation time: ${Date.now() - time}ms`);
|
|
48
|
+
*
|
|
49
|
+
* ```
|
|
13
50
|
*/
|
|
14
51
|
export class CacheBackedEmbeddings extends Embeddings {
|
|
15
52
|
constructor(fields) {
|
|
@@ -6,6 +6,16 @@ const env_js_1 = require("../util/env.cjs");
|
|
|
6
6
|
const base_js_1 = require("./base.cjs");
|
|
7
7
|
/**
|
|
8
8
|
* A class for generating embeddings using the Cohere API.
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // Embed a query using the CohereEmbeddings class
|
|
12
|
+
* const model = new ChatOpenAI();
|
|
13
|
+
* const res = await model.embedQuery(
|
|
14
|
+
* "What would be a good company name for a company that makes colorful socks?",
|
|
15
|
+
* );
|
|
16
|
+
* console.log({ res });
|
|
17
|
+
*
|
|
18
|
+
* ```
|
|
9
19
|
*/
|
|
10
20
|
class CohereEmbeddings extends base_js_1.Embeddings {
|
|
11
21
|
/**
|
|
@@ -13,6 +13,16 @@ export interface CohereEmbeddingsParams extends EmbeddingsParams {
|
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* A class for generating embeddings using the Cohere API.
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Embed a query using the CohereEmbeddings class
|
|
19
|
+
* const model = new ChatOpenAI();
|
|
20
|
+
* const res = await model.embedQuery(
|
|
21
|
+
* "What would be a good company name for a company that makes colorful socks?",
|
|
22
|
+
* );
|
|
23
|
+
* console.log({ res });
|
|
24
|
+
*
|
|
25
|
+
* ```
|
|
16
26
|
*/
|
|
17
27
|
export declare class CohereEmbeddings extends Embeddings implements CohereEmbeddingsParams {
|
|
18
28
|
modelName: string;
|
|
@@ -3,6 +3,16 @@ import { getEnvironmentVariable } from "../util/env.js";
|
|
|
3
3
|
import { Embeddings } from "./base.js";
|
|
4
4
|
/**
|
|
5
5
|
* A class for generating embeddings using the Cohere API.
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // Embed a query using the CohereEmbeddings class
|
|
9
|
+
* const model = new ChatOpenAI();
|
|
10
|
+
* const res = await model.embedQuery(
|
|
11
|
+
* "What would be a good company name for a company that makes colorful socks?",
|
|
12
|
+
* );
|
|
13
|
+
* console.log({ res });
|
|
14
|
+
*
|
|
15
|
+
* ```
|
|
6
16
|
*/
|
|
7
17
|
export class CohereEmbeddings extends Embeddings {
|
|
8
18
|
/**
|
|
@@ -8,6 +8,23 @@ const env_js_1 = require("../util/env.cjs");
|
|
|
8
8
|
/**
|
|
9
9
|
* Class that extends the Embeddings class and provides methods for
|
|
10
10
|
* generating embeddings using the Google Palm API.
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const model = new GooglePaLMEmbeddings({
|
|
14
|
+
* apiKey: "<YOUR API KEY>",
|
|
15
|
+
* modelName: "models/embedding-gecko-001",
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* // Embed a single query
|
|
19
|
+
* const res = await model.embedQuery(
|
|
20
|
+
* "What would be a good company name for a company that makes colorful socks?"
|
|
21
|
+
* );
|
|
22
|
+
* console.log({ res });
|
|
23
|
+
*
|
|
24
|
+
* // Embed multiple documents
|
|
25
|
+
* const documentRes = await model.embedDocuments(["Hello world", "Bye bye"]);
|
|
26
|
+
* console.log({ documentRes });
|
|
27
|
+
* ```
|
|
11
28
|
*/
|
|
12
29
|
class GooglePaLMEmbeddings extends base_js_1.Embeddings {
|
|
13
30
|
constructor(fields) {
|
|
@@ -18,6 +18,23 @@ export interface GooglePaLMEmbeddingsParams extends EmbeddingsParams {
|
|
|
18
18
|
/**
|
|
19
19
|
* Class that extends the Embeddings class and provides methods for
|
|
20
20
|
* generating embeddings using the Google Palm API.
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const model = new GooglePaLMEmbeddings({
|
|
24
|
+
* apiKey: "<YOUR API KEY>",
|
|
25
|
+
* modelName: "models/embedding-gecko-001",
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* // Embed a single query
|
|
29
|
+
* const res = await model.embedQuery(
|
|
30
|
+
* "What would be a good company name for a company that makes colorful socks?"
|
|
31
|
+
* );
|
|
32
|
+
* console.log({ res });
|
|
33
|
+
*
|
|
34
|
+
* // Embed multiple documents
|
|
35
|
+
* const documentRes = await model.embedDocuments(["Hello world", "Bye bye"]);
|
|
36
|
+
* console.log({ documentRes });
|
|
37
|
+
* ```
|
|
21
38
|
*/
|
|
22
39
|
export declare class GooglePaLMEmbeddings extends Embeddings implements GooglePaLMEmbeddingsParams {
|
|
23
40
|
apiKey?: string;
|
|
@@ -5,6 +5,23 @@ import { getEnvironmentVariable } from "../util/env.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* Class that extends the Embeddings class and provides methods for
|
|
7
7
|
* generating embeddings using the Google Palm API.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const model = new GooglePaLMEmbeddings({
|
|
11
|
+
* apiKey: "<YOUR API KEY>",
|
|
12
|
+
* modelName: "models/embedding-gecko-001",
|
|
13
|
+
* });
|
|
14
|
+
*
|
|
15
|
+
* // Embed a single query
|
|
16
|
+
* const res = await model.embedQuery(
|
|
17
|
+
* "What would be a good company name for a company that makes colorful socks?"
|
|
18
|
+
* );
|
|
19
|
+
* console.log({ res });
|
|
20
|
+
*
|
|
21
|
+
* // Embed multiple documents
|
|
22
|
+
* const documentRes = await model.embedDocuments(["Hello world", "Bye bye"]);
|
|
23
|
+
* console.log({ documentRes });
|
|
24
|
+
* ```
|
|
8
25
|
*/
|
|
9
26
|
export class GooglePaLMEmbeddings extends Embeddings {
|
|
10
27
|
constructor(fields) {
|
|
@@ -18,6 +18,14 @@ const chunk_js_1 = require("../util/chunk.cjs");
|
|
|
18
18
|
* - The `GOOGLE_APPLICATION_CREDENTIALS` environment variable is set to the
|
|
19
19
|
* path of a credentials file for a service account permitted to the
|
|
20
20
|
* Google Cloud project using Vertex AI.
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const model = new GoogleVertexAIEmbeddings();
|
|
24
|
+
* const res = await model.embedQuery(
|
|
25
|
+
* "What would be a good company name for a company that makes colorful socks?"
|
|
26
|
+
* );
|
|
27
|
+
* console.log({ res });
|
|
28
|
+
* ```
|
|
21
29
|
*/
|
|
22
30
|
class GoogleVertexAIEmbeddings extends base_js_1.Embeddings {
|
|
23
31
|
constructor(fields) {
|
|
@@ -21,6 +21,14 @@ export interface GoogleVertexAIEmbeddingsParams extends EmbeddingsParams, Google
|
|
|
21
21
|
* - The `GOOGLE_APPLICATION_CREDENTIALS` environment variable is set to the
|
|
22
22
|
* path of a credentials file for a service account permitted to the
|
|
23
23
|
* Google Cloud project using Vertex AI.
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const model = new GoogleVertexAIEmbeddings();
|
|
27
|
+
* const res = await model.embedQuery(
|
|
28
|
+
* "What would be a good company name for a company that makes colorful socks?"
|
|
29
|
+
* );
|
|
30
|
+
* console.log({ res });
|
|
31
|
+
* ```
|
|
24
32
|
*/
|
|
25
33
|
export declare class GoogleVertexAIEmbeddings extends Embeddings implements GoogleVertexAIEmbeddingsParams {
|
|
26
34
|
model: string;
|
|
@@ -15,6 +15,14 @@ import { chunkArray } from "../util/chunk.js";
|
|
|
15
15
|
* - The `GOOGLE_APPLICATION_CREDENTIALS` environment variable is set to the
|
|
16
16
|
* path of a credentials file for a service account permitted to the
|
|
17
17
|
* Google Cloud project using Vertex AI.
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const model = new GoogleVertexAIEmbeddings();
|
|
21
|
+
* const res = await model.embedQuery(
|
|
22
|
+
* "What would be a good company name for a company that makes colorful socks?"
|
|
23
|
+
* );
|
|
24
|
+
* console.log({ res });
|
|
25
|
+
* ```
|
|
18
26
|
*/
|
|
19
27
|
export class GoogleVertexAIEmbeddings extends Embeddings {
|
|
20
28
|
constructor(fields) {
|
|
@@ -4,6 +4,24 @@ exports.HuggingFaceTransformersEmbeddings = void 0;
|
|
|
4
4
|
const transformers_1 = require("@xenova/transformers");
|
|
5
5
|
const chunk_js_1 = require("../util/chunk.cjs");
|
|
6
6
|
const base_js_1 = require("./base.cjs");
|
|
7
|
+
/**
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const model = new HuggingFaceTransformersEmbeddings({
|
|
11
|
+
* modelName: "Xenova/all-MiniLM-L6-v2",
|
|
12
|
+
* });
|
|
13
|
+
*
|
|
14
|
+
* // Embed a single query
|
|
15
|
+
* const res = await model.embedQuery(
|
|
16
|
+
* "What would be a good company name for a company that makes colorful socks?"
|
|
17
|
+
* );
|
|
18
|
+
* console.log({ res });
|
|
19
|
+
*
|
|
20
|
+
* // Embed multiple documents
|
|
21
|
+
* const documentRes = await model.embedDocuments(["Hello world", "Bye bye"]);
|
|
22
|
+
* console.log({ documentRes });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
7
25
|
class HuggingFaceTransformersEmbeddings extends base_js_1.Embeddings {
|
|
8
26
|
constructor(fields) {
|
|
9
27
|
super(fields ?? {});
|
|
@@ -16,6 +16,24 @@ export interface HuggingFaceTransformersEmbeddingsParams extends EmbeddingsParam
|
|
|
16
16
|
*/
|
|
17
17
|
stripNewLines?: boolean;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const model = new HuggingFaceTransformersEmbeddings({
|
|
23
|
+
* modelName: "Xenova/all-MiniLM-L6-v2",
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* // Embed a single query
|
|
27
|
+
* const res = await model.embedQuery(
|
|
28
|
+
* "What would be a good company name for a company that makes colorful socks?"
|
|
29
|
+
* );
|
|
30
|
+
* console.log({ res });
|
|
31
|
+
*
|
|
32
|
+
* // Embed multiple documents
|
|
33
|
+
* const documentRes = await model.embedDocuments(["Hello world", "Bye bye"]);
|
|
34
|
+
* console.log({ documentRes });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
19
37
|
export declare class HuggingFaceTransformersEmbeddings extends Embeddings implements HuggingFaceTransformersEmbeddingsParams {
|
|
20
38
|
modelName: string;
|
|
21
39
|
batchSize: number;
|
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import { pipeline } from "@xenova/transformers";
|
|
2
2
|
import { chunkArray } from "../util/chunk.js";
|
|
3
3
|
import { Embeddings } from "./base.js";
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* const model = new HuggingFaceTransformersEmbeddings({
|
|
8
|
+
* modelName: "Xenova/all-MiniLM-L6-v2",
|
|
9
|
+
* });
|
|
10
|
+
*
|
|
11
|
+
* // Embed a single query
|
|
12
|
+
* const res = await model.embedQuery(
|
|
13
|
+
* "What would be a good company name for a company that makes colorful socks?"
|
|
14
|
+
* );
|
|
15
|
+
* console.log({ res });
|
|
16
|
+
*
|
|
17
|
+
* // Embed multiple documents
|
|
18
|
+
* const documentRes = await model.embedDocuments(["Hello world", "Bye bye"]);
|
|
19
|
+
* console.log({ documentRes });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
4
22
|
export class HuggingFaceTransformersEmbeddings extends Embeddings {
|
|
5
23
|
constructor(fields) {
|
|
6
24
|
super(fields ?? {});
|
|
@@ -3,6 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.LlamaCppEmbeddings = void 0;
|
|
4
4
|
const llama_cpp_js_1 = require("../util/llama_cpp.cjs");
|
|
5
5
|
const base_js_1 = require("./base.cjs");
|
|
6
|
+
/**
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* // Initialize LlamaCppEmbeddings with the path to the model file
|
|
10
|
+
* const embeddings = new LlamaCppEmbeddings({
|
|
11
|
+
* modelPath: "/Replace/with/path/to/your/model/gguf-llama2-q4_0.bin",
|
|
12
|
+
* });
|
|
13
|
+
*
|
|
14
|
+
* // Embed a query string using the Llama embeddings
|
|
15
|
+
* const res = embeddings.embedQuery("Hello Llama!");
|
|
16
|
+
*
|
|
17
|
+
* // Output the resulting embeddings
|
|
18
|
+
* console.log(res);
|
|
19
|
+
*
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
6
22
|
class LlamaCppEmbeddings extends base_js_1.Embeddings {
|
|
7
23
|
constructor(inputs) {
|
|
8
24
|
super(inputs);
|
|
@@ -7,6 +7,22 @@ import { Embeddings, EmbeddingsParams } from "./base.js";
|
|
|
7
7
|
*/
|
|
8
8
|
export interface LlamaCppEmbeddingsParams extends LlamaBaseCppInputs, EmbeddingsParams {
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Initialize LlamaCppEmbeddings with the path to the model file
|
|
14
|
+
* const embeddings = new LlamaCppEmbeddings({
|
|
15
|
+
* modelPath: "/Replace/with/path/to/your/model/gguf-llama2-q4_0.bin",
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* // Embed a query string using the Llama embeddings
|
|
19
|
+
* const res = embeddings.embedQuery("Hello Llama!");
|
|
20
|
+
*
|
|
21
|
+
* // Output the resulting embeddings
|
|
22
|
+
* console.log(res);
|
|
23
|
+
*
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
10
26
|
export declare class LlamaCppEmbeddings extends Embeddings {
|
|
11
27
|
_model: LlamaModel;
|
|
12
28
|
_context: LlamaContext;
|