@langchain/classic 1.0.39 → 1.0.41
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/CHANGELOG.md +14 -0
- package/dist/agents/agent.cjs +1 -1
- package/dist/agents/agent.cjs.map +1 -1
- package/dist/agents/agent.d.cts +1 -2
- package/dist/agents/agent.d.cts.map +1 -1
- package/dist/agents/agent.d.ts +1 -2
- package/dist/agents/agent.d.ts.map +1 -1
- package/dist/agents/agent.js +1 -1
- package/dist/agents/agent.js.map +1 -1
- package/dist/agents/chat/index.cjs +8 -7
- package/dist/agents/chat/index.cjs.map +1 -1
- package/dist/agents/chat/index.d.cts +0 -1
- package/dist/agents/chat/index.d.cts.map +1 -1
- package/dist/agents/chat/index.d.ts +0 -1
- package/dist/agents/chat/index.d.ts.map +1 -1
- package/dist/agents/chat/index.js +8 -6
- package/dist/agents/chat/index.js.map +1 -1
- package/dist/agents/chat/outputParser.cjs +1 -1
- package/dist/agents/chat/outputParser.cjs.map +1 -1
- package/dist/agents/chat/outputParser.d.cts +0 -1
- package/dist/agents/chat/outputParser.d.cts.map +1 -1
- package/dist/agents/chat/outputParser.d.ts +0 -1
- package/dist/agents/chat/outputParser.d.ts.map +1 -1
- package/dist/agents/chat/outputParser.js +1 -1
- package/dist/agents/chat/outputParser.js.map +1 -1
- package/dist/agents/chat_convo/index.cjs +9 -9
- package/dist/agents/chat_convo/index.cjs.map +1 -1
- package/dist/agents/chat_convo/index.d.cts +0 -1
- package/dist/agents/chat_convo/index.d.cts.map +1 -1
- package/dist/agents/chat_convo/index.d.ts +0 -1
- package/dist/agents/chat_convo/index.d.ts.map +1 -1
- package/dist/agents/chat_convo/index.js +9 -8
- package/dist/agents/chat_convo/index.js.map +1 -1
- package/dist/agents/chat_convo/outputParser.cjs +2 -2
- package/dist/agents/chat_convo/outputParser.cjs.map +1 -1
- package/dist/agents/chat_convo/outputParser.d.cts +0 -1
- package/dist/agents/chat_convo/outputParser.d.cts.map +1 -1
- package/dist/agents/chat_convo/outputParser.d.ts +0 -1
- package/dist/agents/chat_convo/outputParser.d.ts.map +1 -1
- package/dist/agents/chat_convo/outputParser.js +2 -1
- package/dist/agents/chat_convo/outputParser.js.map +1 -1
- package/dist/agents/executor.cjs +2 -1
- package/dist/agents/executor.cjs.map +1 -1
- package/dist/agents/executor.d.cts +10 -10
- package/dist/agents/executor.d.cts.map +1 -1
- package/dist/agents/executor.d.ts +10 -10
- package/dist/agents/executor.d.ts.map +1 -1
- package/dist/agents/executor.js +1 -1
- package/dist/agents/executor.js.map +1 -1
- package/dist/agents/format_scratchpad/log.cjs.map +1 -1
- package/dist/agents/format_scratchpad/log.d.cts +0 -1
- package/dist/agents/format_scratchpad/log.d.cts.map +1 -1
- package/dist/agents/format_scratchpad/log.d.ts +0 -1
- package/dist/agents/format_scratchpad/log.d.ts.map +1 -1
- package/dist/agents/format_scratchpad/log.js.map +1 -1
- package/dist/agents/format_scratchpad/log_to_message.cjs.map +1 -1
- package/dist/agents/format_scratchpad/log_to_message.d.cts +0 -1
- package/dist/agents/format_scratchpad/log_to_message.d.cts.map +1 -1
- package/dist/agents/format_scratchpad/log_to_message.d.ts +0 -1
- package/dist/agents/format_scratchpad/log_to_message.d.ts.map +1 -1
- package/dist/agents/format_scratchpad/log_to_message.js.map +1 -1
- package/dist/agents/format_scratchpad/openai_functions.cjs.map +1 -1
- package/dist/agents/format_scratchpad/openai_functions.d.cts +0 -1
- package/dist/agents/format_scratchpad/openai_functions.d.cts.map +1 -1
- package/dist/agents/format_scratchpad/openai_functions.d.ts +0 -1
- package/dist/agents/format_scratchpad/openai_functions.d.ts.map +1 -1
- package/dist/agents/format_scratchpad/openai_functions.js.map +1 -1
- package/dist/agents/format_scratchpad/tool_calling.cjs +1 -1
- package/dist/agents/format_scratchpad/tool_calling.cjs.map +1 -1
- package/dist/agents/format_scratchpad/tool_calling.d.cts +0 -1
- package/dist/agents/format_scratchpad/tool_calling.d.cts.map +1 -1
- package/dist/agents/format_scratchpad/tool_calling.d.ts +0 -1
- package/dist/agents/format_scratchpad/tool_calling.d.ts.map +1 -1
- package/dist/agents/format_scratchpad/tool_calling.js +1 -1
- package/dist/agents/format_scratchpad/tool_calling.js.map +1 -1
- package/dist/agents/format_scratchpad/xml.cjs.map +1 -1
- package/dist/agents/format_scratchpad/xml.d.cts +0 -1
- package/dist/agents/format_scratchpad/xml.d.cts.map +1 -1
- package/dist/agents/format_scratchpad/xml.d.ts +0 -1
- package/dist/agents/format_scratchpad/xml.d.ts.map +1 -1
- package/dist/agents/format_scratchpad/xml.js.map +1 -1
- package/dist/agents/helpers.cjs.map +1 -1
- package/dist/agents/helpers.js.map +1 -1
- package/dist/agents/index.d.cts +1 -0
- package/dist/agents/index.d.ts +1 -0
- package/dist/agents/initialize.cjs.map +1 -1
- package/dist/agents/initialize.d.cts +0 -1
- package/dist/agents/initialize.d.cts.map +1 -1
- package/dist/agents/initialize.d.ts +0 -1
- package/dist/agents/initialize.d.ts.map +1 -1
- package/dist/agents/initialize.js.map +1 -1
- package/dist/agents/load.cjs +1 -1
- package/dist/agents/load.cjs.map +1 -1
- package/dist/agents/load.d.cts +0 -1
- package/dist/agents/load.d.cts.map +1 -1
- package/dist/agents/load.d.ts +0 -1
- package/dist/agents/load.d.ts.map +1 -1
- package/dist/agents/load.js +1 -1
- package/dist/agents/load.js.map +1 -1
- package/dist/agents/mrkl/index.cjs +6 -6
- package/dist/agents/mrkl/index.cjs.map +1 -1
- package/dist/agents/mrkl/index.d.cts +0 -1
- package/dist/agents/mrkl/index.d.cts.map +1 -1
- package/dist/agents/mrkl/index.d.ts +0 -1
- package/dist/agents/mrkl/index.d.ts.map +1 -1
- package/dist/agents/mrkl/index.js +6 -5
- package/dist/agents/mrkl/index.js.map +1 -1
- package/dist/agents/mrkl/outputParser.cjs +3 -1
- package/dist/agents/mrkl/outputParser.cjs.map +1 -1
- package/dist/agents/mrkl/outputParser.d.cts +1 -2
- package/dist/agents/mrkl/outputParser.d.cts.map +1 -1
- package/dist/agents/mrkl/outputParser.d.ts +1 -2
- package/dist/agents/mrkl/outputParser.d.ts.map +1 -1
- package/dist/agents/mrkl/outputParser.js +3 -1
- package/dist/agents/mrkl/outputParser.js.map +1 -1
- package/dist/agents/openai/output_parser.d.cts +1 -1
- package/dist/agents/openai/output_parser.d.ts +1 -1
- package/dist/agents/openai_functions/index.cjs +6 -6
- package/dist/agents/openai_functions/index.cjs.map +1 -1
- package/dist/agents/openai_functions/index.d.cts +6 -9
- package/dist/agents/openai_functions/index.d.cts.map +1 -1
- package/dist/agents/openai_functions/index.d.ts +6 -9
- package/dist/agents/openai_functions/index.d.ts.map +1 -1
- package/dist/agents/openai_functions/index.js +6 -5
- package/dist/agents/openai_functions/index.js.map +1 -1
- package/dist/agents/openai_functions/output_parser.cjs +0 -1
- package/dist/agents/openai_functions/output_parser.cjs.map +1 -1
- package/dist/agents/openai_functions/output_parser.d.cts +0 -1
- package/dist/agents/openai_functions/output_parser.d.cts.map +1 -1
- package/dist/agents/openai_functions/output_parser.d.ts +0 -1
- package/dist/agents/openai_functions/output_parser.d.ts.map +1 -1
- package/dist/agents/openai_functions/output_parser.js.map +1 -1
- package/dist/agents/openai_tools/index.cjs +1 -1
- package/dist/agents/openai_tools/index.cjs.map +1 -1
- package/dist/agents/openai_tools/index.d.cts +7 -12
- package/dist/agents/openai_tools/index.d.cts.map +1 -1
- package/dist/agents/openai_tools/index.d.ts +7 -12
- package/dist/agents/openai_tools/index.d.ts.map +1 -1
- package/dist/agents/openai_tools/index.js +1 -1
- package/dist/agents/openai_tools/index.js.map +1 -1
- package/dist/agents/openai_tools/output_parser.cjs +0 -1
- package/dist/agents/openai_tools/output_parser.cjs.map +1 -1
- package/dist/agents/openai_tools/output_parser.d.cts +1 -2
- package/dist/agents/openai_tools/output_parser.d.cts.map +1 -1
- package/dist/agents/openai_tools/output_parser.d.ts +1 -2
- package/dist/agents/openai_tools/output_parser.d.ts.map +1 -1
- package/dist/agents/openai_tools/output_parser.js.map +1 -1
- package/dist/agents/react/index.cjs +0 -1
- package/dist/agents/react/index.cjs.map +1 -1
- package/dist/agents/react/index.d.cts +5 -10
- package/dist/agents/react/index.d.cts.map +1 -1
- package/dist/agents/react/index.d.ts +5 -10
- package/dist/agents/react/index.d.ts.map +1 -1
- package/dist/agents/react/index.js.map +1 -1
- package/dist/agents/react/output_parser.cjs.map +1 -1
- package/dist/agents/react/output_parser.d.cts +0 -1
- package/dist/agents/react/output_parser.d.cts.map +1 -1
- package/dist/agents/react/output_parser.d.ts +0 -1
- package/dist/agents/react/output_parser.d.ts.map +1 -1
- package/dist/agents/react/output_parser.js.map +1 -1
- package/dist/agents/structured_chat/index.cjs +6 -6
- package/dist/agents/structured_chat/index.cjs.map +1 -1
- package/dist/agents/structured_chat/index.d.cts +5 -10
- package/dist/agents/structured_chat/index.d.cts.map +1 -1
- package/dist/agents/structured_chat/index.d.ts +5 -10
- package/dist/agents/structured_chat/index.d.ts.map +1 -1
- package/dist/agents/structured_chat/index.js +6 -5
- package/dist/agents/structured_chat/index.js.map +1 -1
- package/dist/agents/structured_chat/outputParser.cjs +2 -2
- package/dist/agents/structured_chat/outputParser.cjs.map +1 -1
- package/dist/agents/structured_chat/outputParser.d.cts +0 -1
- package/dist/agents/structured_chat/outputParser.d.cts.map +1 -1
- package/dist/agents/structured_chat/outputParser.d.ts +0 -1
- package/dist/agents/structured_chat/outputParser.d.ts.map +1 -1
- package/dist/agents/structured_chat/outputParser.js +2 -1
- package/dist/agents/structured_chat/outputParser.js.map +1 -1
- package/dist/agents/tool_calling/index.cjs +0 -1
- package/dist/agents/tool_calling/index.cjs.map +1 -1
- package/dist/agents/tool_calling/index.d.cts +6 -11
- package/dist/agents/tool_calling/index.d.cts.map +1 -1
- package/dist/agents/tool_calling/index.d.ts +6 -11
- package/dist/agents/tool_calling/index.d.ts.map +1 -1
- package/dist/agents/tool_calling/index.js.map +1 -1
- package/dist/agents/tool_calling/output_parser.cjs +1 -1
- package/dist/agents/tool_calling/output_parser.cjs.map +1 -1
- package/dist/agents/tool_calling/output_parser.d.cts +1 -1
- package/dist/agents/tool_calling/output_parser.d.cts.map +1 -1
- package/dist/agents/tool_calling/output_parser.d.ts +1 -1
- package/dist/agents/tool_calling/output_parser.d.ts.map +1 -1
- package/dist/agents/tool_calling/output_parser.js +1 -1
- package/dist/agents/tool_calling/output_parser.js.map +1 -1
- package/dist/agents/toolkits/base.cjs +0 -1
- package/dist/agents/toolkits/conversational_retrieval/openai_functions.cjs.map +1 -1
- package/dist/agents/toolkits/conversational_retrieval/openai_functions.d.cts +0 -1
- package/dist/agents/toolkits/conversational_retrieval/openai_functions.d.cts.map +1 -1
- package/dist/agents/toolkits/conversational_retrieval/openai_functions.d.ts +0 -1
- package/dist/agents/toolkits/conversational_retrieval/openai_functions.d.ts.map +1 -1
- package/dist/agents/toolkits/conversational_retrieval/openai_functions.js.map +1 -1
- package/dist/agents/toolkits/conversational_retrieval/token_buffer_memory.cjs +0 -1
- package/dist/agents/toolkits/conversational_retrieval/token_buffer_memory.cjs.map +1 -1
- package/dist/agents/toolkits/conversational_retrieval/token_buffer_memory.d.cts +2 -4
- package/dist/agents/toolkits/conversational_retrieval/token_buffer_memory.d.cts.map +1 -1
- package/dist/agents/toolkits/conversational_retrieval/token_buffer_memory.d.ts +2 -4
- package/dist/agents/toolkits/conversational_retrieval/token_buffer_memory.d.ts.map +1 -1
- package/dist/agents/toolkits/conversational_retrieval/token_buffer_memory.js.map +1 -1
- package/dist/agents/toolkits/conversational_retrieval/tool.cjs +0 -1
- package/dist/agents/toolkits/conversational_retrieval/tool.cjs.map +1 -1
- package/dist/agents/toolkits/conversational_retrieval/tool.d.cts +0 -1
- package/dist/agents/toolkits/conversational_retrieval/tool.d.cts.map +1 -1
- package/dist/agents/toolkits/conversational_retrieval/tool.d.ts +0 -1
- package/dist/agents/toolkits/conversational_retrieval/tool.d.ts.map +1 -1
- package/dist/agents/toolkits/conversational_retrieval/tool.js.map +1 -1
- package/dist/agents/toolkits/json/json.cjs +1 -1
- package/dist/agents/toolkits/json/json.cjs.map +1 -1
- package/dist/agents/toolkits/json/json.d.cts +0 -1
- package/dist/agents/toolkits/json/json.d.cts.map +1 -1
- package/dist/agents/toolkits/json/json.d.ts +0 -1
- package/dist/agents/toolkits/json/json.d.ts.map +1 -1
- package/dist/agents/toolkits/json/json.js +1 -0
- package/dist/agents/toolkits/json/json.js.map +1 -1
- package/dist/agents/toolkits/openapi/openapi.cjs +0 -1
- package/dist/agents/toolkits/openapi/openapi.cjs.map +1 -1
- package/dist/agents/toolkits/openapi/openapi.d.cts +0 -1
- package/dist/agents/toolkits/openapi/openapi.d.cts.map +1 -1
- package/dist/agents/toolkits/openapi/openapi.d.ts +0 -1
- package/dist/agents/toolkits/openapi/openapi.d.ts.map +1 -1
- package/dist/agents/toolkits/openapi/openapi.js.map +1 -1
- package/dist/agents/toolkits/sql/prompt.d.cts.map +1 -1
- package/dist/agents/toolkits/sql/prompt.d.ts.map +1 -1
- package/dist/agents/toolkits/sql/sql.cjs +0 -1
- package/dist/agents/toolkits/sql/sql.cjs.map +1 -1
- package/dist/agents/toolkits/sql/sql.d.cts +0 -1
- package/dist/agents/toolkits/sql/sql.d.cts.map +1 -1
- package/dist/agents/toolkits/sql/sql.d.ts +0 -1
- package/dist/agents/toolkits/sql/sql.d.ts.map +1 -1
- package/dist/agents/toolkits/sql/sql.js.map +1 -1
- package/dist/agents/toolkits/vectorstore/vectorstore.cjs +0 -1
- package/dist/agents/toolkits/vectorstore/vectorstore.cjs.map +1 -1
- package/dist/agents/toolkits/vectorstore/vectorstore.d.cts +0 -1
- package/dist/agents/toolkits/vectorstore/vectorstore.d.cts.map +1 -1
- package/dist/agents/toolkits/vectorstore/vectorstore.d.ts +0 -1
- package/dist/agents/toolkits/vectorstore/vectorstore.d.ts.map +1 -1
- package/dist/agents/toolkits/vectorstore/vectorstore.js.map +1 -1
- package/dist/agents/types.cjs +0 -1
- package/dist/agents/types.cjs.map +1 -1
- package/dist/agents/types.d.cts +1 -2
- package/dist/agents/types.d.cts.map +1 -1
- package/dist/agents/types.d.ts +1 -2
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/types.js.map +1 -1
- package/dist/agents/xml/index.cjs +6 -6
- package/dist/agents/xml/index.cjs.map +1 -1
- package/dist/agents/xml/index.d.cts +4 -8
- package/dist/agents/xml/index.d.cts.map +1 -1
- package/dist/agents/xml/index.d.ts +4 -8
- package/dist/agents/xml/index.d.ts.map +1 -1
- package/dist/agents/xml/index.js +6 -5
- package/dist/agents/xml/index.js.map +1 -1
- package/dist/agents/xml/output_parser.cjs.map +1 -1
- package/dist/agents/xml/output_parser.d.cts +0 -1
- package/dist/agents/xml/output_parser.d.cts.map +1 -1
- package/dist/agents/xml/output_parser.d.ts +0 -1
- package/dist/agents/xml/output_parser.d.ts.map +1 -1
- package/dist/agents/xml/output_parser.js.map +1 -1
- package/dist/cache/file_system.cjs.map +1 -1
- package/dist/cache/file_system.d.cts +0 -1
- package/dist/cache/file_system.d.cts.map +1 -1
- package/dist/cache/file_system.d.ts +0 -1
- package/dist/cache/file_system.d.ts.map +1 -1
- package/dist/cache/file_system.js.map +1 -1
- package/dist/callbacks/handlers/console.d.cts +0 -3
- package/dist/callbacks/handlers/console.d.ts +0 -3
- package/dist/callbacks/handlers/run_collector.d.cts +0 -3
- package/dist/callbacks/handlers/run_collector.d.ts +0 -3
- package/dist/callbacks/handlers/tracer.d.cts +0 -3
- package/dist/callbacks/handlers/tracer.d.ts +0 -3
- package/dist/callbacks/handlers/tracer_langchain.d.cts +0 -3
- package/dist/callbacks/handlers/tracer_langchain.d.ts +0 -3
- package/dist/callbacks/promises.d.cts +0 -3
- package/dist/callbacks/promises.d.ts +0 -3
- package/dist/chains/analyze_documents_chain.cjs +0 -1
- package/dist/chains/analyze_documents_chain.cjs.map +1 -1
- package/dist/chains/analyze_documents_chain.d.cts +1 -2
- package/dist/chains/analyze_documents_chain.d.cts.map +1 -1
- package/dist/chains/analyze_documents_chain.d.ts +1 -2
- package/dist/chains/analyze_documents_chain.d.ts.map +1 -1
- package/dist/chains/analyze_documents_chain.js.map +1 -1
- package/dist/chains/api/api_chain.cjs.map +1 -1
- package/dist/chains/api/api_chain.d.cts +0 -1
- package/dist/chains/api/api_chain.d.cts.map +1 -1
- package/dist/chains/api/api_chain.d.ts +0 -1
- package/dist/chains/api/api_chain.d.ts.map +1 -1
- package/dist/chains/api/api_chain.js.map +1 -1
- package/dist/chains/api/prompts.cjs +4 -3
- package/dist/chains/api/prompts.cjs.map +1 -1
- package/dist/chains/api/prompts.js +12 -11
- package/dist/chains/api/prompts.js.map +1 -1
- package/dist/chains/base.cjs +0 -1
- package/dist/chains/base.cjs.map +1 -1
- package/dist/chains/base.d.cts +7 -8
- package/dist/chains/base.d.cts.map +1 -1
- package/dist/chains/base.d.ts +7 -8
- package/dist/chains/base.d.ts.map +1 -1
- package/dist/chains/base.js.map +1 -1
- package/dist/chains/chat_vector_db_chain.cjs +0 -1
- package/dist/chains/chat_vector_db_chain.cjs.map +1 -1
- package/dist/chains/chat_vector_db_chain.d.cts +1 -2
- package/dist/chains/chat_vector_db_chain.d.cts.map +1 -1
- package/dist/chains/chat_vector_db_chain.d.ts +1 -2
- package/dist/chains/chat_vector_db_chain.d.ts.map +1 -1
- package/dist/chains/chat_vector_db_chain.js.map +1 -1
- package/dist/chains/combine_docs_chain.cjs +1 -2
- package/dist/chains/combine_docs_chain.cjs.map +1 -1
- package/dist/chains/combine_docs_chain.d.cts +1 -3
- package/dist/chains/combine_docs_chain.d.cts.map +1 -1
- package/dist/chains/combine_docs_chain.d.ts +1 -3
- package/dist/chains/combine_docs_chain.d.ts.map +1 -1
- package/dist/chains/combine_docs_chain.js +1 -1
- package/dist/chains/combine_docs_chain.js.map +1 -1
- package/dist/chains/combine_documents/base.cjs +1 -2
- package/dist/chains/combine_documents/base.cjs.map +1 -1
- package/dist/chains/combine_documents/base.js +1 -1
- package/dist/chains/combine_documents/base.js.map +1 -1
- package/dist/chains/combine_documents/reduce.cjs.map +1 -1
- package/dist/chains/combine_documents/reduce.d.cts +0 -1
- package/dist/chains/combine_documents/reduce.d.cts.map +1 -1
- package/dist/chains/combine_documents/reduce.d.ts +0 -1
- package/dist/chains/combine_documents/reduce.d.ts.map +1 -1
- package/dist/chains/combine_documents/reduce.js.map +1 -1
- package/dist/chains/combine_documents/stuff.cjs +0 -1
- package/dist/chains/combine_documents/stuff.cjs.map +1 -1
- package/dist/chains/combine_documents/stuff.d.cts +1 -8
- package/dist/chains/combine_documents/stuff.d.cts.map +1 -1
- package/dist/chains/combine_documents/stuff.d.ts +1 -8
- package/dist/chains/combine_documents/stuff.d.ts.map +1 -1
- package/dist/chains/combine_documents/stuff.js.map +1 -1
- package/dist/chains/constitutional_ai/constitutional_chain.cjs.map +1 -1
- package/dist/chains/constitutional_ai/constitutional_chain.d.cts +0 -1
- package/dist/chains/constitutional_ai/constitutional_chain.d.cts.map +1 -1
- package/dist/chains/constitutional_ai/constitutional_chain.d.ts +0 -1
- package/dist/chains/constitutional_ai/constitutional_chain.d.ts.map +1 -1
- package/dist/chains/constitutional_ai/constitutional_chain.js.map +1 -1
- package/dist/chains/constitutional_ai/constitutional_principle.cjs +54 -54
- package/dist/chains/constitutional_ai/constitutional_principle.cjs.map +1 -1
- package/dist/chains/constitutional_ai/constitutional_principle.d.cts +1 -6
- package/dist/chains/constitutional_ai/constitutional_principle.d.cts.map +1 -1
- package/dist/chains/constitutional_ai/constitutional_principle.d.ts +1 -6
- package/dist/chains/constitutional_ai/constitutional_principle.d.ts.map +1 -1
- package/dist/chains/constitutional_ai/constitutional_principle.js +54 -54
- package/dist/chains/constitutional_ai/constitutional_principle.js.map +1 -1
- package/dist/chains/constitutional_ai/constitutional_prompts.cjs +5 -4
- package/dist/chains/constitutional_ai/constitutional_prompts.cjs.map +1 -1
- package/dist/chains/constitutional_ai/constitutional_prompts.js +4 -4
- package/dist/chains/constitutional_ai/constitutional_prompts.js.map +1 -1
- package/dist/chains/conversation.cjs +0 -1
- package/dist/chains/conversation.cjs.map +1 -1
- package/dist/chains/conversation.d.cts +1 -7
- package/dist/chains/conversation.d.cts.map +1 -1
- package/dist/chains/conversation.d.ts +1 -7
- package/dist/chains/conversation.d.ts.map +1 -1
- package/dist/chains/conversation.js.map +1 -1
- package/dist/chains/conversational_retrieval_chain.cjs +0 -1
- package/dist/chains/conversational_retrieval_chain.cjs.map +1 -1
- package/dist/chains/conversational_retrieval_chain.d.cts +5 -4
- package/dist/chains/conversational_retrieval_chain.d.cts.map +1 -1
- package/dist/chains/conversational_retrieval_chain.d.ts +5 -4
- package/dist/chains/conversational_retrieval_chain.d.ts.map +1 -1
- package/dist/chains/conversational_retrieval_chain.js.map +1 -1
- package/dist/chains/graph_qa/cypher.cjs +5 -4
- package/dist/chains/graph_qa/cypher.cjs.map +1 -1
- package/dist/chains/graph_qa/cypher.d.cts +0 -1
- package/dist/chains/graph_qa/cypher.d.cts.map +1 -1
- package/dist/chains/graph_qa/cypher.d.ts +0 -1
- package/dist/chains/graph_qa/cypher.d.ts.map +1 -1
- package/dist/chains/graph_qa/cypher.js +5 -4
- package/dist/chains/graph_qa/cypher.js.map +1 -1
- package/dist/chains/graph_qa/prompts.cjs +2 -3
- package/dist/chains/graph_qa/prompts.cjs.map +1 -1
- package/dist/chains/graph_qa/prompts.js +2 -2
- package/dist/chains/graph_qa/prompts.js.map +1 -1
- package/dist/chains/history_aware_retriever.cjs.map +1 -1
- package/dist/chains/history_aware_retriever.d.cts +1 -6
- package/dist/chains/history_aware_retriever.d.cts.map +1 -1
- package/dist/chains/history_aware_retriever.d.ts +1 -6
- package/dist/chains/history_aware_retriever.d.ts.map +1 -1
- package/dist/chains/history_aware_retriever.js.map +1 -1
- package/dist/chains/llm_chain.cjs +0 -1
- package/dist/chains/llm_chain.cjs.map +1 -1
- package/dist/chains/llm_chain.d.cts +0 -1
- package/dist/chains/llm_chain.d.cts.map +1 -1
- package/dist/chains/llm_chain.d.ts +0 -1
- package/dist/chains/llm_chain.d.ts.map +1 -1
- package/dist/chains/llm_chain.js.map +1 -1
- package/dist/chains/load.cjs +1 -1
- package/dist/chains/load.cjs.map +1 -1
- package/dist/chains/load.d.cts +0 -1
- package/dist/chains/load.d.cts.map +1 -1
- package/dist/chains/load.d.ts +0 -1
- package/dist/chains/load.d.ts.map +1 -1
- package/dist/chains/load.js +1 -1
- package/dist/chains/load.js.map +1 -1
- package/dist/chains/openai_functions/base.cjs +0 -1
- package/dist/chains/openai_functions/base.cjs.map +1 -1
- package/dist/chains/openai_functions/base.d.cts +6 -4
- package/dist/chains/openai_functions/base.d.cts.map +1 -1
- package/dist/chains/openai_functions/base.d.ts +6 -4
- package/dist/chains/openai_functions/base.d.ts.map +1 -1
- package/dist/chains/openai_functions/base.js.map +1 -1
- package/dist/chains/openai_functions/extraction.cjs +0 -1
- package/dist/chains/openai_functions/extraction.cjs.map +1 -1
- package/dist/chains/openai_functions/extraction.d.cts +0 -1
- package/dist/chains/openai_functions/extraction.d.cts.map +1 -1
- package/dist/chains/openai_functions/extraction.d.ts +0 -1
- package/dist/chains/openai_functions/extraction.d.ts.map +1 -1
- package/dist/chains/openai_functions/extraction.js.map +1 -1
- package/dist/chains/openai_functions/openapi.cjs +1 -1
- package/dist/chains/openai_functions/openapi.cjs.map +1 -1
- package/dist/chains/openai_functions/openapi.d.cts +0 -7
- package/dist/chains/openai_functions/openapi.d.cts.map +1 -1
- package/dist/chains/openai_functions/openapi.d.ts +0 -7
- package/dist/chains/openai_functions/openapi.d.ts.map +1 -1
- package/dist/chains/openai_functions/openapi.js +1 -1
- package/dist/chains/openai_functions/openapi.js.map +1 -1
- package/dist/chains/openai_functions/tagging.cjs +0 -1
- package/dist/chains/openai_functions/tagging.cjs.map +1 -1
- package/dist/chains/openai_functions/tagging.d.cts +0 -1
- package/dist/chains/openai_functions/tagging.d.cts.map +1 -1
- package/dist/chains/openai_functions/tagging.d.ts +0 -1
- package/dist/chains/openai_functions/tagging.d.ts.map +1 -1
- package/dist/chains/openai_functions/tagging.js.map +1 -1
- package/dist/chains/openai_moderation.cjs +0 -1
- package/dist/chains/openai_moderation.cjs.map +1 -1
- package/dist/chains/openai_moderation.d.cts +0 -1
- package/dist/chains/openai_moderation.d.cts.map +1 -1
- package/dist/chains/openai_moderation.d.ts +0 -1
- package/dist/chains/openai_moderation.d.ts.map +1 -1
- package/dist/chains/openai_moderation.js.map +1 -1
- package/dist/chains/query_constructor/index.cjs +6 -3
- package/dist/chains/query_constructor/index.cjs.map +1 -1
- package/dist/chains/query_constructor/index.d.cts +1 -5
- package/dist/chains/query_constructor/index.d.cts.map +1 -1
- package/dist/chains/query_constructor/index.d.ts +1 -5
- package/dist/chains/query_constructor/index.d.ts.map +1 -1
- package/dist/chains/query_constructor/index.js +6 -3
- package/dist/chains/query_constructor/index.js.map +1 -1
- package/dist/chains/query_constructor/parser.cjs +2 -1
- package/dist/chains/query_constructor/parser.cjs.map +1 -1
- package/dist/chains/query_constructor/parser.d.cts +0 -1
- package/dist/chains/query_constructor/parser.d.cts.map +1 -1
- package/dist/chains/query_constructor/parser.d.ts +0 -1
- package/dist/chains/query_constructor/parser.d.ts.map +1 -1
- package/dist/chains/query_constructor/parser.js +2 -0
- package/dist/chains/query_constructor/parser.js.map +1 -1
- package/dist/chains/query_constructor/prompt.cjs +28 -22
- package/dist/chains/query_constructor/prompt.cjs.map +1 -1
- package/dist/chains/query_constructor/prompt.d.cts +0 -1
- package/dist/chains/query_constructor/prompt.d.cts.map +1 -1
- package/dist/chains/query_constructor/prompt.d.ts +0 -1
- package/dist/chains/query_constructor/prompt.d.ts.map +1 -1
- package/dist/chains/query_constructor/prompt.js +25 -22
- package/dist/chains/query_constructor/prompt.js.map +1 -1
- package/dist/chains/question_answering/load.cjs.map +1 -1
- package/dist/chains/question_answering/load.d.cts +0 -1
- package/dist/chains/question_answering/load.d.cts.map +1 -1
- package/dist/chains/question_answering/load.d.ts +0 -1
- package/dist/chains/question_answering/load.d.ts.map +1 -1
- package/dist/chains/question_answering/load.js.map +1 -1
- package/dist/chains/question_answering/map_reduce_prompts.cjs +12 -11
- package/dist/chains/question_answering/map_reduce_prompts.cjs.map +1 -1
- package/dist/chains/question_answering/map_reduce_prompts.js +9 -9
- package/dist/chains/question_answering/map_reduce_prompts.js.map +1 -1
- package/dist/chains/question_answering/refine_prompts.cjs +30 -22
- package/dist/chains/question_answering/refine_prompts.cjs.map +1 -1
- package/dist/chains/question_answering/refine_prompts.js +25 -20
- package/dist/chains/question_answering/refine_prompts.js.map +1 -1
- package/dist/chains/question_answering/stuff_prompts.cjs +6 -6
- package/dist/chains/question_answering/stuff_prompts.cjs.map +1 -1
- package/dist/chains/question_answering/stuff_prompts.js +5 -5
- package/dist/chains/question_answering/stuff_prompts.js.map +1 -1
- package/dist/chains/retrieval.cjs.map +1 -1
- package/dist/chains/retrieval.d.cts +1 -5
- package/dist/chains/retrieval.d.cts.map +1 -1
- package/dist/chains/retrieval.d.ts +1 -5
- package/dist/chains/retrieval.d.ts.map +1 -1
- package/dist/chains/retrieval.js.map +1 -1
- package/dist/chains/retrieval_qa.cjs.map +1 -1
- package/dist/chains/retrieval_qa.d.cts +1 -2
- package/dist/chains/retrieval_qa.d.cts.map +1 -1
- package/dist/chains/retrieval_qa.d.ts +1 -2
- package/dist/chains/retrieval_qa.d.ts.map +1 -1
- package/dist/chains/retrieval_qa.js.map +1 -1
- package/dist/chains/router/llm_router.cjs.map +1 -1
- package/dist/chains/router/llm_router.d.cts +0 -1
- package/dist/chains/router/llm_router.d.cts.map +1 -1
- package/dist/chains/router/llm_router.d.ts +0 -1
- package/dist/chains/router/llm_router.d.ts.map +1 -1
- package/dist/chains/router/llm_router.js.map +1 -1
- package/dist/chains/router/multi_prompt.cjs +0 -1
- package/dist/chains/router/multi_prompt.cjs.map +1 -1
- package/dist/chains/router/multi_prompt.d.cts +1 -10
- package/dist/chains/router/multi_prompt.d.cts.map +1 -1
- package/dist/chains/router/multi_prompt.d.ts +1 -10
- package/dist/chains/router/multi_prompt.d.ts.map +1 -1
- package/dist/chains/router/multi_prompt.js.map +1 -1
- package/dist/chains/router/multi_retrieval_qa.cjs +0 -1
- package/dist/chains/router/multi_retrieval_qa.cjs.map +1 -1
- package/dist/chains/router/multi_retrieval_qa.d.cts +2 -11
- package/dist/chains/router/multi_retrieval_qa.d.cts.map +1 -1
- package/dist/chains/router/multi_retrieval_qa.d.ts +2 -11
- package/dist/chains/router/multi_retrieval_qa.d.ts.map +1 -1
- package/dist/chains/router/multi_retrieval_qa.js.map +1 -1
- package/dist/chains/router/multi_route.cjs.map +1 -1
- package/dist/chains/router/multi_route.d.cts +1 -2
- package/dist/chains/router/multi_route.d.cts.map +1 -1
- package/dist/chains/router/multi_route.d.ts +1 -2
- package/dist/chains/router/multi_route.d.ts.map +1 -1
- package/dist/chains/router/multi_route.js.map +1 -1
- package/dist/chains/router/utils.cjs.map +1 -1
- package/dist/chains/router/utils.js.map +1 -1
- package/dist/chains/sequential_chain.cjs.map +1 -1
- package/dist/chains/sequential_chain.d.cts +0 -4
- package/dist/chains/sequential_chain.d.cts.map +1 -1
- package/dist/chains/sequential_chain.d.ts +0 -4
- package/dist/chains/sequential_chain.d.ts.map +1 -1
- package/dist/chains/sequential_chain.js.map +1 -1
- package/dist/chains/serde.d.cts +1 -2
- package/dist/chains/serde.d.cts.map +1 -1
- package/dist/chains/serde.d.ts +1 -2
- package/dist/chains/serde.d.ts.map +1 -1
- package/dist/chains/sql_db/sql_db_chain.cjs +1 -2
- package/dist/chains/sql_db/sql_db_chain.cjs.map +1 -1
- package/dist/chains/sql_db/sql_db_chain.d.cts +9 -8
- package/dist/chains/sql_db/sql_db_chain.d.cts.map +1 -1
- package/dist/chains/sql_db/sql_db_chain.d.ts +9 -8
- package/dist/chains/sql_db/sql_db_chain.d.ts.map +1 -1
- package/dist/chains/sql_db/sql_db_chain.js +1 -1
- package/dist/chains/sql_db/sql_db_chain.js.map +1 -1
- package/dist/chains/sql_db/sql_db_prompt.cjs +7 -8
- package/dist/chains/sql_db/sql_db_prompt.cjs.map +1 -1
- package/dist/chains/sql_db/sql_db_prompt.d.cts +0 -1
- package/dist/chains/sql_db/sql_db_prompt.d.cts.map +1 -1
- package/dist/chains/sql_db/sql_db_prompt.d.ts +0 -1
- package/dist/chains/sql_db/sql_db_prompt.d.ts.map +1 -1
- package/dist/chains/sql_db/sql_db_prompt.js +7 -7
- package/dist/chains/sql_db/sql_db_prompt.js.map +1 -1
- package/dist/chains/summarization/load.cjs.map +1 -1
- package/dist/chains/summarization/load.d.cts +0 -1
- package/dist/chains/summarization/load.d.cts.map +1 -1
- package/dist/chains/summarization/load.d.ts +0 -1
- package/dist/chains/summarization/load.d.ts.map +1 -1
- package/dist/chains/summarization/load.js.map +1 -1
- package/dist/chains/summarization/refine_prompts.cjs +1 -2
- package/dist/chains/summarization/refine_prompts.cjs.map +1 -1
- package/dist/chains/summarization/refine_prompts.js +1 -1
- package/dist/chains/summarization/refine_prompts.js.map +1 -1
- package/dist/chains/summarization/stuff_prompts.cjs +1 -2
- package/dist/chains/summarization/stuff_prompts.cjs.map +1 -1
- package/dist/chains/summarization/stuff_prompts.js +1 -1
- package/dist/chains/summarization/stuff_prompts.js.map +1 -1
- package/dist/chains/transform.cjs.map +1 -1
- package/dist/chains/transform.d.cts +0 -1
- package/dist/chains/transform.d.cts.map +1 -1
- package/dist/chains/transform.d.ts +0 -1
- package/dist/chains/transform.d.ts.map +1 -1
- package/dist/chains/transform.js.map +1 -1
- package/dist/chains/vector_db_qa.cjs.map +1 -1
- package/dist/chains/vector_db_qa.d.cts +1 -2
- package/dist/chains/vector_db_qa.d.cts.map +1 -1
- package/dist/chains/vector_db_qa.d.ts +1 -2
- package/dist/chains/vector_db_qa.d.ts.map +1 -1
- package/dist/chains/vector_db_qa.js.map +1 -1
- package/dist/chat_models/universal.cjs.map +1 -1
- package/dist/chat_models/universal.d.cts +0 -1
- package/dist/chat_models/universal.d.cts.map +1 -1
- package/dist/chat_models/universal.d.ts +0 -1
- package/dist/chat_models/universal.d.ts.map +1 -1
- package/dist/chat_models/universal.js.map +1 -1
- package/dist/document_loaders/fs/buffer.cjs +1 -0
- package/dist/document_loaders/fs/buffer.cjs.map +1 -1
- package/dist/document_loaders/fs/buffer.d.cts +0 -1
- package/dist/document_loaders/fs/buffer.d.cts.map +1 -1
- package/dist/document_loaders/fs/buffer.d.ts +0 -1
- package/dist/document_loaders/fs/buffer.d.ts.map +1 -1
- package/dist/document_loaders/fs/buffer.js +1 -0
- package/dist/document_loaders/fs/buffer.js.map +1 -1
- package/dist/document_loaders/fs/directory.cjs +4 -0
- package/dist/document_loaders/fs/directory.cjs.map +1 -1
- package/dist/document_loaders/fs/directory.d.cts +0 -1
- package/dist/document_loaders/fs/directory.d.cts.map +1 -1
- package/dist/document_loaders/fs/directory.d.ts +0 -1
- package/dist/document_loaders/fs/directory.d.ts.map +1 -1
- package/dist/document_loaders/fs/directory.js +4 -0
- package/dist/document_loaders/fs/directory.js.map +1 -1
- package/dist/document_loaders/fs/json.cjs +1 -0
- package/dist/document_loaders/fs/json.cjs.map +1 -1
- package/dist/document_loaders/fs/json.d.cts +0 -1
- package/dist/document_loaders/fs/json.d.cts.map +1 -1
- package/dist/document_loaders/fs/json.d.ts +0 -1
- package/dist/document_loaders/fs/json.d.ts.map +1 -1
- package/dist/document_loaders/fs/json.js +1 -0
- package/dist/document_loaders/fs/json.js.map +1 -1
- package/dist/document_loaders/fs/multi_file.cjs +3 -0
- package/dist/document_loaders/fs/multi_file.cjs.map +1 -1
- package/dist/document_loaders/fs/multi_file.d.cts +0 -1
- package/dist/document_loaders/fs/multi_file.d.cts.map +1 -1
- package/dist/document_loaders/fs/multi_file.d.ts +0 -1
- package/dist/document_loaders/fs/multi_file.d.ts.map +1 -1
- package/dist/document_loaders/fs/multi_file.js +3 -0
- package/dist/document_loaders/fs/multi_file.js.map +1 -1
- package/dist/document_loaders/fs/text.cjs +1 -0
- package/dist/document_loaders/fs/text.cjs.map +1 -1
- package/dist/document_loaders/fs/text.d.cts +0 -1
- package/dist/document_loaders/fs/text.d.cts.map +1 -1
- package/dist/document_loaders/fs/text.d.ts +0 -1
- package/dist/document_loaders/fs/text.d.ts.map +1 -1
- package/dist/document_loaders/fs/text.js +1 -0
- package/dist/document_loaders/fs/text.js.map +1 -1
- package/dist/document_transformers/openai_functions.cjs.map +1 -1
- package/dist/document_transformers/openai_functions.d.cts +1 -1
- package/dist/document_transformers/openai_functions.d.cts.map +1 -1
- package/dist/document_transformers/openai_functions.d.ts +1 -1
- package/dist/document_transformers/openai_functions.d.ts.map +1 -1
- package/dist/document_transformers/openai_functions.js.map +1 -1
- package/dist/embeddings/cache_backed.cjs.map +1 -1
- package/dist/embeddings/cache_backed.d.cts +0 -1
- package/dist/embeddings/cache_backed.d.cts.map +1 -1
- package/dist/embeddings/cache_backed.d.ts +0 -1
- package/dist/embeddings/cache_backed.d.ts.map +1 -1
- package/dist/embeddings/cache_backed.js.map +1 -1
- package/dist/evaluation/agents/index.cjs +3 -1
- package/dist/evaluation/agents/index.d.cts +2 -1
- package/dist/evaluation/agents/index.d.ts +2 -1
- package/dist/evaluation/agents/index.js +2 -2
- package/dist/evaluation/agents/prompt.cjs +10 -11
- package/dist/evaluation/agents/prompt.cjs.map +1 -1
- package/dist/evaluation/agents/prompt.js +10 -10
- package/dist/evaluation/agents/prompt.js.map +1 -1
- package/dist/evaluation/agents/trajectory.cjs +0 -1
- package/dist/evaluation/agents/trajectory.cjs.map +1 -1
- package/dist/evaluation/agents/trajectory.d.cts +1 -3
- package/dist/evaluation/agents/trajectory.d.cts.map +1 -1
- package/dist/evaluation/agents/trajectory.d.ts +1 -3
- package/dist/evaluation/agents/trajectory.d.ts.map +1 -1
- package/dist/evaluation/agents/trajectory.js.map +1 -1
- package/dist/evaluation/base.cjs +2 -0
- package/dist/evaluation/base.cjs.map +1 -1
- package/dist/evaluation/base.d.cts +2 -2
- package/dist/evaluation/base.d.cts.map +1 -1
- package/dist/evaluation/base.d.ts +2 -2
- package/dist/evaluation/base.d.ts.map +1 -1
- package/dist/evaluation/base.js +1 -1
- package/dist/evaluation/base.js.map +1 -1
- package/dist/evaluation/comparison/index.cjs +4 -1
- package/dist/evaluation/comparison/index.d.cts +2 -1
- package/dist/evaluation/comparison/index.d.ts +2 -1
- package/dist/evaluation/comparison/index.js +2 -2
- package/dist/evaluation/comparison/pairwise.cjs +2 -3
- package/dist/evaluation/comparison/pairwise.cjs.map +1 -1
- package/dist/evaluation/comparison/pairwise.d.cts +2 -4
- package/dist/evaluation/comparison/pairwise.d.cts.map +1 -1
- package/dist/evaluation/comparison/pairwise.d.ts +2 -4
- package/dist/evaluation/comparison/pairwise.d.ts.map +1 -1
- package/dist/evaluation/comparison/pairwise.js +2 -2
- package/dist/evaluation/comparison/pairwise.js.map +1 -1
- package/dist/evaluation/comparison/prompt.cjs +2 -3
- package/dist/evaluation/comparison/prompt.cjs.map +1 -1
- package/dist/evaluation/comparison/prompt.js +2 -2
- package/dist/evaluation/comparison/prompt.js.map +1 -1
- package/dist/evaluation/criteria/criteria.cjs +2 -3
- package/dist/evaluation/criteria/criteria.cjs.map +1 -1
- package/dist/evaluation/criteria/criteria.d.cts +3 -9
- package/dist/evaluation/criteria/criteria.d.cts.map +1 -1
- package/dist/evaluation/criteria/criteria.d.ts +3 -9
- package/dist/evaluation/criteria/criteria.d.ts.map +1 -1
- package/dist/evaluation/criteria/criteria.js +2 -2
- package/dist/evaluation/criteria/criteria.js.map +1 -1
- package/dist/evaluation/criteria/index.cjs +4 -1
- package/dist/evaluation/criteria/index.d.cts +2 -1
- package/dist/evaluation/criteria/index.d.ts +2 -1
- package/dist/evaluation/criteria/index.js +2 -2
- package/dist/evaluation/criteria/prompt.cjs +2 -3
- package/dist/evaluation/criteria/prompt.cjs.map +1 -1
- package/dist/evaluation/criteria/prompt.js +2 -2
- package/dist/evaluation/criteria/prompt.js.map +1 -1
- package/dist/evaluation/embedding_distance/base.cjs.map +1 -1
- package/dist/evaluation/embedding_distance/base.d.cts +0 -1
- package/dist/evaluation/embedding_distance/base.d.cts.map +1 -1
- package/dist/evaluation/embedding_distance/base.d.ts +0 -1
- package/dist/evaluation/embedding_distance/base.d.ts.map +1 -1
- package/dist/evaluation/embedding_distance/base.js.map +1 -1
- package/dist/evaluation/embedding_distance/index.cjs +5 -1
- package/dist/evaluation/embedding_distance/index.d.cts +2 -1
- package/dist/evaluation/embedding_distance/index.d.ts +2 -1
- package/dist/evaluation/embedding_distance/index.js +2 -2
- package/dist/evaluation/index.d.cts +5 -0
- package/dist/evaluation/index.d.ts +5 -0
- package/dist/evaluation/loader.cjs +0 -1
- package/dist/evaluation/loader.cjs.map +1 -1
- package/dist/evaluation/loader.d.cts +2 -1
- package/dist/evaluation/loader.d.cts.map +1 -1
- package/dist/evaluation/loader.d.ts +2 -1
- package/dist/evaluation/loader.d.ts.map +1 -1
- package/dist/evaluation/loader.js.map +1 -1
- package/dist/evaluation/qa/eval_chain.cjs +3 -2
- package/dist/evaluation/qa/eval_chain.cjs.map +1 -1
- package/dist/evaluation/qa/eval_chain.d.cts +1 -2
- package/dist/evaluation/qa/eval_chain.d.cts.map +1 -1
- package/dist/evaluation/qa/eval_chain.d.ts +1 -2
- package/dist/evaluation/qa/eval_chain.d.ts.map +1 -1
- package/dist/evaluation/qa/eval_chain.js +3 -2
- package/dist/evaluation/qa/eval_chain.js.map +1 -1
- package/dist/evaluation/qa/index.cjs +2 -1
- package/dist/evaluation/qa/index.d.cts +2 -1
- package/dist/evaluation/qa/index.d.ts +2 -1
- package/dist/evaluation/qa/index.js +2 -2
- package/dist/evaluation/qa/prompt.cjs +1 -2
- package/dist/evaluation/qa/prompt.cjs.map +1 -1
- package/dist/evaluation/qa/prompt.js +1 -1
- package/dist/evaluation/qa/prompt.js.map +1 -1
- package/dist/evaluation/types.d.cts +0 -1
- package/dist/evaluation/types.d.cts.map +1 -1
- package/dist/evaluation/types.d.ts +0 -1
- package/dist/evaluation/types.d.ts.map +1 -1
- package/dist/experimental/autogpt/agent.cjs +11 -11
- package/dist/experimental/autogpt/agent.cjs.map +1 -1
- package/dist/experimental/autogpt/agent.d.cts +2 -17
- package/dist/experimental/autogpt/agent.d.cts.map +1 -1
- package/dist/experimental/autogpt/agent.d.ts +2 -17
- package/dist/experimental/autogpt/agent.d.ts.map +1 -1
- package/dist/experimental/autogpt/agent.js +11 -10
- package/dist/experimental/autogpt/agent.js.map +1 -1
- package/dist/experimental/autogpt/output_parser.cjs +0 -1
- package/dist/experimental/autogpt/output_parser.cjs.map +1 -1
- package/dist/experimental/autogpt/output_parser.d.cts +0 -1
- package/dist/experimental/autogpt/output_parser.d.cts.map +1 -1
- package/dist/experimental/autogpt/output_parser.d.ts +0 -1
- package/dist/experimental/autogpt/output_parser.d.ts.map +1 -1
- package/dist/experimental/autogpt/output_parser.js.map +1 -1
- package/dist/experimental/autogpt/prompt.cjs +0 -1
- package/dist/experimental/autogpt/prompt.cjs.map +1 -1
- package/dist/experimental/autogpt/prompt.d.cts +2 -9
- package/dist/experimental/autogpt/prompt.d.cts.map +1 -1
- package/dist/experimental/autogpt/prompt.d.ts +2 -9
- package/dist/experimental/autogpt/prompt.d.ts.map +1 -1
- package/dist/experimental/autogpt/prompt.js.map +1 -1
- package/dist/experimental/autogpt/prompt_generator.cjs +1 -1
- package/dist/experimental/autogpt/prompt_generator.cjs.map +1 -1
- package/dist/experimental/autogpt/prompt_generator.js +1 -1
- package/dist/experimental/autogpt/prompt_generator.js.map +1 -1
- package/dist/experimental/autogpt/schema.d.cts +0 -1
- package/dist/experimental/autogpt/schema.d.cts.map +1 -1
- package/dist/experimental/autogpt/schema.d.ts +0 -1
- package/dist/experimental/autogpt/schema.d.ts.map +1 -1
- package/dist/experimental/babyagi/agent.cjs +12 -11
- package/dist/experimental/babyagi/agent.cjs.map +1 -1
- package/dist/experimental/babyagi/agent.d.cts +3 -22
- package/dist/experimental/babyagi/agent.d.cts.map +1 -1
- package/dist/experimental/babyagi/agent.d.ts +3 -22
- package/dist/experimental/babyagi/agent.d.ts.map +1 -1
- package/dist/experimental/babyagi/agent.js +12 -10
- package/dist/experimental/babyagi/agent.js.map +1 -1
- package/dist/experimental/babyagi/task_creation.cjs +10 -10
- package/dist/experimental/babyagi/task_creation.cjs.map +1 -1
- package/dist/experimental/babyagi/task_creation.d.cts +0 -1
- package/dist/experimental/babyagi/task_creation.d.cts.map +1 -1
- package/dist/experimental/babyagi/task_creation.d.ts +0 -1
- package/dist/experimental/babyagi/task_creation.d.ts.map +1 -1
- package/dist/experimental/babyagi/task_creation.js +10 -9
- package/dist/experimental/babyagi/task_creation.js.map +1 -1
- package/dist/experimental/babyagi/task_execution.cjs +9 -9
- package/dist/experimental/babyagi/task_execution.cjs.map +1 -1
- package/dist/experimental/babyagi/task_execution.d.cts +0 -1
- package/dist/experimental/babyagi/task_execution.d.cts.map +1 -1
- package/dist/experimental/babyagi/task_execution.d.ts +0 -1
- package/dist/experimental/babyagi/task_execution.d.ts.map +1 -1
- package/dist/experimental/babyagi/task_execution.js +9 -8
- package/dist/experimental/babyagi/task_execution.js.map +1 -1
- package/dist/experimental/babyagi/task_prioritization.cjs +9 -9
- package/dist/experimental/babyagi/task_prioritization.cjs.map +1 -1
- package/dist/experimental/babyagi/task_prioritization.d.cts +0 -1
- package/dist/experimental/babyagi/task_prioritization.d.cts.map +1 -1
- package/dist/experimental/babyagi/task_prioritization.d.ts +0 -1
- package/dist/experimental/babyagi/task_prioritization.d.ts.map +1 -1
- package/dist/experimental/babyagi/task_prioritization.js +9 -8
- package/dist/experimental/babyagi/task_prioritization.js.map +1 -1
- package/dist/experimental/chains/violation_of_expectations/types.cjs.map +1 -1
- package/dist/experimental/chains/violation_of_expectations/types.d.cts +0 -1
- package/dist/experimental/chains/violation_of_expectations/types.d.cts.map +1 -1
- package/dist/experimental/chains/violation_of_expectations/types.d.ts +0 -1
- package/dist/experimental/chains/violation_of_expectations/types.d.ts.map +1 -1
- package/dist/experimental/chains/violation_of_expectations/types.js.map +1 -1
- package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_chain.cjs +0 -1
- package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_chain.cjs.map +1 -1
- package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_chain.d.cts +53 -1
- package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_chain.d.cts.map +1 -1
- package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_chain.d.ts +53 -1
- package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_chain.d.ts.map +1 -1
- package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_chain.js.map +1 -1
- package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_prompt.cjs +4 -5
- package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_prompt.cjs.map +1 -1
- package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_prompt.js +4 -4
- package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_prompt.js.map +1 -1
- package/dist/experimental/generative_agents/generative_agent.cjs +0 -1
- package/dist/experimental/generative_agents/generative_agent.cjs.map +1 -1
- package/dist/experimental/generative_agents/generative_agent.d.cts +1 -2
- package/dist/experimental/generative_agents/generative_agent.d.cts.map +1 -1
- package/dist/experimental/generative_agents/generative_agent.d.ts +1 -2
- package/dist/experimental/generative_agents/generative_agent.d.ts.map +1 -1
- package/dist/experimental/generative_agents/generative_agent.js.map +1 -1
- package/dist/experimental/generative_agents/generative_agent_memory.cjs +0 -1
- package/dist/experimental/generative_agents/generative_agent_memory.cjs.map +1 -1
- package/dist/experimental/generative_agents/generative_agent_memory.d.cts +1 -2
- package/dist/experimental/generative_agents/generative_agent_memory.d.cts.map +1 -1
- package/dist/experimental/generative_agents/generative_agent_memory.d.ts +1 -2
- package/dist/experimental/generative_agents/generative_agent_memory.d.ts.map +1 -1
- package/dist/experimental/generative_agents/generative_agent_memory.js.map +1 -1
- package/dist/experimental/masking/parser.cjs.map +1 -1
- package/dist/experimental/masking/parser.d.cts +0 -1
- package/dist/experimental/masking/parser.d.cts.map +1 -1
- package/dist/experimental/masking/parser.d.ts +0 -1
- package/dist/experimental/masking/parser.d.ts.map +1 -1
- package/dist/experimental/masking/parser.js.map +1 -1
- package/dist/experimental/masking/regex_masking_transformer.cjs.map +1 -1
- package/dist/experimental/masking/regex_masking_transformer.d.cts +0 -1
- package/dist/experimental/masking/regex_masking_transformer.d.cts.map +1 -1
- package/dist/experimental/masking/regex_masking_transformer.d.ts +0 -1
- package/dist/experimental/masking/regex_masking_transformer.d.ts.map +1 -1
- package/dist/experimental/masking/regex_masking_transformer.js.map +1 -1
- package/dist/experimental/masking/transformer.cjs.map +1 -1
- package/dist/experimental/masking/transformer.d.cts.map +1 -1
- package/dist/experimental/masking/transformer.d.ts.map +1 -1
- package/dist/experimental/masking/transformer.js.map +1 -1
- package/dist/experimental/masking/types.d.cts +0 -1
- package/dist/experimental/masking/types.d.cts.map +1 -1
- package/dist/experimental/masking/types.d.ts +0 -1
- package/dist/experimental/masking/types.d.ts.map +1 -1
- package/dist/experimental/openai_assistant/index.cjs.map +1 -1
- package/dist/experimental/openai_assistant/index.d.cts +2 -18
- package/dist/experimental/openai_assistant/index.d.cts.map +1 -1
- package/dist/experimental/openai_assistant/index.d.ts +2 -18
- package/dist/experimental/openai_assistant/index.d.ts.map +1 -1
- package/dist/experimental/openai_assistant/index.js.map +1 -1
- package/dist/experimental/openai_assistant/schema.d.cts +0 -1
- package/dist/experimental/openai_assistant/schema.d.cts.map +1 -1
- package/dist/experimental/openai_assistant/schema.d.ts +0 -1
- package/dist/experimental/openai_assistant/schema.d.ts.map +1 -1
- package/dist/experimental/openai_files/index.cjs.map +1 -1
- package/dist/experimental/openai_files/index.d.cts +4 -18
- package/dist/experimental/openai_files/index.d.cts.map +1 -1
- package/dist/experimental/openai_files/index.d.ts +4 -18
- package/dist/experimental/openai_files/index.d.ts.map +1 -1
- package/dist/experimental/openai_files/index.js.map +1 -1
- package/dist/experimental/plan_and_execute/agent_executor.cjs +1 -0
- package/dist/experimental/plan_and_execute/agent_executor.cjs.map +1 -1
- package/dist/experimental/plan_and_execute/agent_executor.d.cts +4 -16
- package/dist/experimental/plan_and_execute/agent_executor.d.cts.map +1 -1
- package/dist/experimental/plan_and_execute/agent_executor.d.ts +4 -16
- package/dist/experimental/plan_and_execute/agent_executor.d.ts.map +1 -1
- package/dist/experimental/plan_and_execute/agent_executor.js +1 -1
- package/dist/experimental/plan_and_execute/agent_executor.js.map +1 -1
- package/dist/experimental/plan_and_execute/base.cjs +3 -0
- package/dist/experimental/plan_and_execute/base.cjs.map +1 -1
- package/dist/experimental/plan_and_execute/base.d.cts +0 -1
- package/dist/experimental/plan_and_execute/base.d.cts.map +1 -1
- package/dist/experimental/plan_and_execute/base.d.ts +0 -1
- package/dist/experimental/plan_and_execute/base.d.ts.map +1 -1
- package/dist/experimental/plan_and_execute/base.js +3 -0
- package/dist/experimental/plan_and_execute/base.js.map +1 -1
- package/dist/experimental/plan_and_execute/outputParser.cjs +0 -1
- package/dist/experimental/plan_and_execute/outputParser.cjs.map +1 -1
- package/dist/experimental/plan_and_execute/outputParser.d.cts +0 -1
- package/dist/experimental/plan_and_execute/outputParser.d.cts.map +1 -1
- package/dist/experimental/plan_and_execute/outputParser.d.ts +0 -1
- package/dist/experimental/plan_and_execute/outputParser.d.ts.map +1 -1
- package/dist/experimental/plan_and_execute/outputParser.js.map +1 -1
- package/dist/experimental/plan_and_execute/prompt.cjs +1 -2
- package/dist/experimental/plan_and_execute/prompt.cjs.map +1 -1
- package/dist/experimental/plan_and_execute/prompt.js +1 -1
- package/dist/experimental/plan_and_execute/prompt.js.map +1 -1
- package/dist/experimental/prompts/custom_format.cjs.map +1 -1
- package/dist/experimental/prompts/custom_format.d.cts +1 -5
- package/dist/experimental/prompts/custom_format.d.cts.map +1 -1
- package/dist/experimental/prompts/custom_format.d.ts +1 -5
- package/dist/experimental/prompts/custom_format.d.ts.map +1 -1
- package/dist/experimental/prompts/custom_format.js.map +1 -1
- package/dist/experimental/prompts/handlebars.cjs.map +1 -1
- package/dist/experimental/prompts/handlebars.d.cts +0 -1
- package/dist/experimental/prompts/handlebars.d.cts.map +1 -1
- package/dist/experimental/prompts/handlebars.d.ts +0 -1
- package/dist/experimental/prompts/handlebars.d.ts.map +1 -1
- package/dist/experimental/prompts/handlebars.js.map +1 -1
- package/dist/hub/base.cjs.map +1 -1
- package/dist/hub/base.d.cts +5 -2
- package/dist/hub/base.d.cts.map +1 -1
- package/dist/hub/base.d.ts +5 -2
- package/dist/hub/base.d.ts.map +1 -1
- package/dist/hub/base.js.map +1 -1
- package/dist/hub/index.cjs.map +1 -1
- package/dist/hub/index.d.cts +0 -1
- package/dist/hub/index.d.cts.map +1 -1
- package/dist/hub/index.d.ts +0 -1
- package/dist/hub/index.d.ts.map +1 -1
- package/dist/hub/index.js.map +1 -1
- package/dist/hub/node.cjs.map +1 -1
- package/dist/hub/node.d.cts +0 -1
- package/dist/hub/node.d.cts.map +1 -1
- package/dist/hub/node.d.ts +0 -1
- package/dist/hub/node.d.ts.map +1 -1
- package/dist/hub/node.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/load/import_constants.cjs.map +1 -1
- package/dist/load/import_constants.js.map +1 -1
- package/dist/load/import_map.cjs +547 -0
- package/dist/load/import_map.cjs.map +1 -1
- package/dist/load/import_map.js +1 -1
- package/dist/load/import_map.js.map +1 -1
- package/dist/load/import_type.d.cts.map +1 -1
- package/dist/load/import_type.d.ts.map +1 -1
- package/dist/load/index.cjs +0 -1
- package/dist/load/index.cjs.map +1 -1
- package/dist/load/index.d.cts +0 -1
- package/dist/load/index.d.cts.map +1 -1
- package/dist/load/index.d.ts +0 -1
- package/dist/load/index.d.ts.map +1 -1
- package/dist/load/index.js.map +1 -1
- package/dist/load/map_keys.d.cts.map +1 -1
- package/dist/load/map_keys.d.ts.map +1 -1
- package/dist/memory/buffer_memory.cjs +0 -1
- package/dist/memory/buffer_memory.cjs.map +1 -1
- package/dist/memory/buffer_memory.d.cts +0 -1
- package/dist/memory/buffer_memory.d.cts.map +1 -1
- package/dist/memory/buffer_memory.d.ts +0 -1
- package/dist/memory/buffer_memory.d.ts.map +1 -1
- package/dist/memory/buffer_memory.js.map +1 -1
- package/dist/memory/buffer_token_memory.cjs +0 -1
- package/dist/memory/buffer_token_memory.cjs.map +1 -1
- package/dist/memory/buffer_token_memory.d.cts +0 -1
- package/dist/memory/buffer_token_memory.d.cts.map +1 -1
- package/dist/memory/buffer_token_memory.d.ts +0 -1
- package/dist/memory/buffer_token_memory.d.ts.map +1 -1
- package/dist/memory/buffer_token_memory.js.map +1 -1
- package/dist/memory/buffer_window_memory.cjs +0 -1
- package/dist/memory/buffer_window_memory.cjs.map +1 -1
- package/dist/memory/buffer_window_memory.d.cts +0 -1
- package/dist/memory/buffer_window_memory.d.cts.map +1 -1
- package/dist/memory/buffer_window_memory.d.ts +0 -1
- package/dist/memory/buffer_window_memory.d.ts.map +1 -1
- package/dist/memory/buffer_window_memory.js.map +1 -1
- package/dist/memory/chat_memory.cjs.map +1 -1
- package/dist/memory/chat_memory.d.cts +0 -1
- package/dist/memory/chat_memory.d.cts.map +1 -1
- package/dist/memory/chat_memory.d.ts +0 -1
- package/dist/memory/chat_memory.d.ts.map +1 -1
- package/dist/memory/chat_memory.js.map +1 -1
- package/dist/memory/combined_memory.cjs.map +1 -1
- package/dist/memory/combined_memory.d.cts +0 -1
- package/dist/memory/combined_memory.d.cts.map +1 -1
- package/dist/memory/combined_memory.d.ts +0 -1
- package/dist/memory/combined_memory.d.ts.map +1 -1
- package/dist/memory/combined_memory.js.map +1 -1
- package/dist/memory/entity_memory.cjs +0 -1
- package/dist/memory/entity_memory.cjs.map +1 -1
- package/dist/memory/entity_memory.d.cts +1 -2
- package/dist/memory/entity_memory.d.cts.map +1 -1
- package/dist/memory/entity_memory.d.ts +1 -2
- package/dist/memory/entity_memory.d.ts.map +1 -1
- package/dist/memory/entity_memory.js.map +1 -1
- package/dist/memory/prompt.cjs +28 -23
- package/dist/memory/prompt.cjs.map +1 -1
- package/dist/memory/prompt.d.cts +0 -1
- package/dist/memory/prompt.d.cts.map +1 -1
- package/dist/memory/prompt.d.ts +0 -1
- package/dist/memory/prompt.d.ts.map +1 -1
- package/dist/memory/prompt.js +26 -23
- package/dist/memory/prompt.js.map +1 -1
- package/dist/memory/stores/entity/base.cjs +0 -1
- package/dist/memory/stores/entity/base.cjs.map +1 -1
- package/dist/memory/stores/entity/base.d.cts +0 -1
- package/dist/memory/stores/entity/base.d.cts.map +1 -1
- package/dist/memory/stores/entity/base.d.ts +0 -1
- package/dist/memory/stores/entity/base.d.ts.map +1 -1
- package/dist/memory/stores/entity/base.js.map +1 -1
- package/dist/memory/stores/entity/in_memory.cjs.map +1 -1
- package/dist/memory/stores/entity/in_memory.js.map +1 -1
- package/dist/memory/summary.cjs +0 -1
- package/dist/memory/summary.cjs.map +1 -1
- package/dist/memory/summary.d.cts +0 -1
- package/dist/memory/summary.d.cts.map +1 -1
- package/dist/memory/summary.d.ts +0 -1
- package/dist/memory/summary.d.ts.map +1 -1
- package/dist/memory/summary.js.map +1 -1
- package/dist/memory/summary_buffer.cjs +0 -1
- package/dist/memory/summary_buffer.cjs.map +1 -1
- package/dist/memory/summary_buffer.d.cts +0 -1
- package/dist/memory/summary_buffer.d.cts.map +1 -1
- package/dist/memory/summary_buffer.d.ts +0 -1
- package/dist/memory/summary_buffer.d.ts.map +1 -1
- package/dist/memory/summary_buffer.js.map +1 -1
- package/dist/memory/vector_store.cjs +0 -1
- package/dist/memory/vector_store.cjs.map +1 -1
- package/dist/memory/vector_store.d.cts +0 -1
- package/dist/memory/vector_store.d.cts.map +1 -1
- package/dist/memory/vector_store.d.ts +0 -1
- package/dist/memory/vector_store.d.ts.map +1 -1
- package/dist/memory/vector_store.js.map +1 -1
- package/dist/output_parsers/combining.cjs +0 -1
- package/dist/output_parsers/combining.cjs.map +1 -1
- package/dist/output_parsers/combining.d.cts +1 -2
- package/dist/output_parsers/combining.d.cts.map +1 -1
- package/dist/output_parsers/combining.d.ts +1 -2
- package/dist/output_parsers/combining.d.ts.map +1 -1
- package/dist/output_parsers/combining.js.map +1 -1
- package/dist/output_parsers/datetime.cjs +0 -1
- package/dist/output_parsers/datetime.cjs.map +1 -1
- package/dist/output_parsers/datetime.d.cts +0 -1
- package/dist/output_parsers/datetime.d.cts.map +1 -1
- package/dist/output_parsers/datetime.d.ts +0 -1
- package/dist/output_parsers/datetime.d.ts.map +1 -1
- package/dist/output_parsers/datetime.js.map +1 -1
- package/dist/output_parsers/expression.cjs.map +1 -1
- package/dist/output_parsers/expression.d.cts +0 -1
- package/dist/output_parsers/expression.d.cts.map +1 -1
- package/dist/output_parsers/expression.d.ts +0 -1
- package/dist/output_parsers/expression.d.ts.map +1 -1
- package/dist/output_parsers/expression.js.map +1 -1
- package/dist/output_parsers/expression_type_handlers/array_literal_expression_handler.cjs.map +1 -1
- package/dist/output_parsers/expression_type_handlers/array_literal_expression_handler.js.map +1 -1
- package/dist/output_parsers/expression_type_handlers/base.cjs +1 -0
- package/dist/output_parsers/expression_type_handlers/base.cjs.map +1 -1
- package/dist/output_parsers/expression_type_handlers/base.d.cts +0 -1
- package/dist/output_parsers/expression_type_handlers/base.d.cts.map +1 -1
- package/dist/output_parsers/expression_type_handlers/base.d.ts +0 -1
- package/dist/output_parsers/expression_type_handlers/base.d.ts.map +1 -1
- package/dist/output_parsers/expression_type_handlers/base.js +1 -0
- package/dist/output_parsers/expression_type_handlers/base.js.map +1 -1
- package/dist/output_parsers/expression_type_handlers/boolean_literal_handler.cjs.map +1 -1
- package/dist/output_parsers/expression_type_handlers/boolean_literal_handler.js.map +1 -1
- package/dist/output_parsers/expression_type_handlers/call_expression_handler.cjs.map +1 -1
- package/dist/output_parsers/expression_type_handlers/call_expression_handler.js.map +1 -1
- package/dist/output_parsers/expression_type_handlers/factory.cjs.map +1 -1
- package/dist/output_parsers/expression_type_handlers/factory.d.cts +0 -1
- package/dist/output_parsers/expression_type_handlers/factory.d.cts.map +1 -1
- package/dist/output_parsers/expression_type_handlers/factory.d.ts +0 -1
- package/dist/output_parsers/expression_type_handlers/factory.d.ts.map +1 -1
- package/dist/output_parsers/expression_type_handlers/factory.js.map +1 -1
- package/dist/output_parsers/expression_type_handlers/identifier_handler.cjs.map +1 -1
- package/dist/output_parsers/expression_type_handlers/identifier_handler.js.map +1 -1
- package/dist/output_parsers/expression_type_handlers/member_expression_handler.cjs.map +1 -1
- package/dist/output_parsers/expression_type_handlers/member_expression_handler.js.map +1 -1
- package/dist/output_parsers/expression_type_handlers/numeric_literal_handler.cjs.map +1 -1
- package/dist/output_parsers/expression_type_handlers/numeric_literal_handler.js.map +1 -1
- package/dist/output_parsers/expression_type_handlers/object_literal_expression_handler.cjs.map +1 -1
- package/dist/output_parsers/expression_type_handlers/object_literal_expression_handler.js.map +1 -1
- package/dist/output_parsers/expression_type_handlers/property_assignment_handler.cjs.map +1 -1
- package/dist/output_parsers/expression_type_handlers/property_assignment_handler.js.map +1 -1
- package/dist/output_parsers/expression_type_handlers/string_literal_handler.cjs.map +1 -1
- package/dist/output_parsers/expression_type_handlers/string_literal_handler.js.map +1 -1
- package/dist/output_parsers/expression_type_handlers/types.d.cts.map +1 -1
- package/dist/output_parsers/expression_type_handlers/types.d.ts.map +1 -1
- package/dist/output_parsers/fix.cjs +5 -5
- package/dist/output_parsers/fix.cjs.map +1 -1
- package/dist/output_parsers/fix.d.cts +1 -5
- package/dist/output_parsers/fix.d.cts.map +1 -1
- package/dist/output_parsers/fix.d.ts +1 -5
- package/dist/output_parsers/fix.d.ts.map +1 -1
- package/dist/output_parsers/fix.js +5 -4
- package/dist/output_parsers/fix.js.map +1 -1
- package/dist/output_parsers/http_response.cjs +0 -1
- package/dist/output_parsers/http_response.cjs.map +1 -1
- package/dist/output_parsers/http_response.d.cts +0 -1
- package/dist/output_parsers/http_response.d.cts.map +1 -1
- package/dist/output_parsers/http_response.d.ts +0 -1
- package/dist/output_parsers/http_response.d.ts.map +1 -1
- package/dist/output_parsers/http_response.js.map +1 -1
- package/dist/output_parsers/noop.cjs +0 -1
- package/dist/output_parsers/noop.cjs.map +1 -1
- package/dist/output_parsers/noop.js.map +1 -1
- package/dist/output_parsers/openai_functions.cjs +0 -1
- package/dist/output_parsers/openai_functions.cjs.map +1 -1
- package/dist/output_parsers/openai_functions.d.cts +0 -1
- package/dist/output_parsers/openai_functions.d.cts.map +1 -1
- package/dist/output_parsers/openai_functions.d.ts +0 -1
- package/dist/output_parsers/openai_functions.d.ts.map +1 -1
- package/dist/output_parsers/openai_functions.js.map +1 -1
- package/dist/output_parsers/openai_tools.cjs +0 -1
- package/dist/output_parsers/openai_tools.cjs.map +1 -1
- package/dist/output_parsers/openai_tools.d.cts +8 -5
- package/dist/output_parsers/openai_tools.d.cts.map +1 -1
- package/dist/output_parsers/openai_tools.d.ts +8 -5
- package/dist/output_parsers/openai_tools.d.ts.map +1 -1
- package/dist/output_parsers/openai_tools.js.map +1 -1
- package/dist/output_parsers/prompts.cjs +6 -3
- package/dist/output_parsers/prompts.cjs.map +1 -1
- package/dist/output_parsers/prompts.js +5 -3
- package/dist/output_parsers/prompts.js.map +1 -1
- package/dist/output_parsers/regex.cjs +0 -1
- package/dist/output_parsers/regex.cjs.map +1 -1
- package/dist/output_parsers/regex.d.cts +1 -2
- package/dist/output_parsers/regex.d.cts.map +1 -1
- package/dist/output_parsers/regex.d.ts +1 -2
- package/dist/output_parsers/regex.d.ts.map +1 -1
- package/dist/output_parsers/regex.js.map +1 -1
- package/dist/output_parsers/router.cjs +0 -1
- package/dist/output_parsers/router.cjs.map +1 -1
- package/dist/output_parsers/router.d.cts +0 -1
- package/dist/output_parsers/router.d.cts.map +1 -1
- package/dist/output_parsers/router.d.ts +0 -1
- package/dist/output_parsers/router.d.ts.map +1 -1
- package/dist/output_parsers/router.js.map +1 -1
- package/dist/output_parsers/structured.cjs +1 -1
- package/dist/output_parsers/structured.cjs.map +1 -1
- package/dist/output_parsers/structured.d.cts +3 -7
- package/dist/output_parsers/structured.d.cts.map +1 -1
- package/dist/output_parsers/structured.d.ts +3 -7
- package/dist/output_parsers/structured.d.ts.map +1 -1
- package/dist/output_parsers/structured.js +1 -0
- package/dist/output_parsers/structured.js.map +1 -1
- package/dist/retrievers/contextual_compression.cjs.map +1 -1
- package/dist/retrievers/contextual_compression.d.cts +0 -1
- package/dist/retrievers/contextual_compression.d.cts.map +1 -1
- package/dist/retrievers/contextual_compression.d.ts +0 -1
- package/dist/retrievers/contextual_compression.d.ts.map +1 -1
- package/dist/retrievers/contextual_compression.js.map +1 -1
- package/dist/retrievers/document_compressors/chain_extract.cjs +5 -4
- package/dist/retrievers/document_compressors/chain_extract.cjs.map +1 -1
- package/dist/retrievers/document_compressors/chain_extract.d.cts +1 -5
- package/dist/retrievers/document_compressors/chain_extract.d.cts.map +1 -1
- package/dist/retrievers/document_compressors/chain_extract.d.ts +1 -5
- package/dist/retrievers/document_compressors/chain_extract.d.ts.map +1 -1
- package/dist/retrievers/document_compressors/chain_extract.js +5 -4
- package/dist/retrievers/document_compressors/chain_extract.js.map +1 -1
- package/dist/retrievers/document_compressors/embeddings_filter.cjs.map +1 -1
- package/dist/retrievers/document_compressors/embeddings_filter.d.cts +0 -1
- package/dist/retrievers/document_compressors/embeddings_filter.d.cts.map +1 -1
- package/dist/retrievers/document_compressors/embeddings_filter.d.ts +0 -1
- package/dist/retrievers/document_compressors/embeddings_filter.d.ts.map +1 -1
- package/dist/retrievers/document_compressors/embeddings_filter.js.map +1 -1
- package/dist/retrievers/document_compressors/index.cjs.map +1 -1
- package/dist/retrievers/document_compressors/index.d.cts +0 -1
- package/dist/retrievers/document_compressors/index.d.cts.map +1 -1
- package/dist/retrievers/document_compressors/index.d.ts +0 -1
- package/dist/retrievers/document_compressors/index.d.ts.map +1 -1
- package/dist/retrievers/document_compressors/index.js.map +1 -1
- package/dist/retrievers/ensemble.cjs.map +1 -1
- package/dist/retrievers/ensemble.d.cts +0 -1
- package/dist/retrievers/ensemble.d.cts.map +1 -1
- package/dist/retrievers/ensemble.d.ts +0 -1
- package/dist/retrievers/ensemble.d.ts.map +1 -1
- package/dist/retrievers/ensemble.js.map +1 -1
- package/dist/retrievers/hyde.cjs.map +1 -1
- package/dist/retrievers/hyde.d.cts +0 -1
- package/dist/retrievers/hyde.d.cts.map +1 -1
- package/dist/retrievers/hyde.d.ts +0 -1
- package/dist/retrievers/hyde.d.ts.map +1 -1
- package/dist/retrievers/hyde.js.map +1 -1
- package/dist/retrievers/matryoshka_retriever.cjs.map +1 -1
- package/dist/retrievers/matryoshka_retriever.d.cts +0 -1
- package/dist/retrievers/matryoshka_retriever.d.cts.map +1 -1
- package/dist/retrievers/matryoshka_retriever.d.ts +0 -1
- package/dist/retrievers/matryoshka_retriever.d.ts.map +1 -1
- package/dist/retrievers/matryoshka_retriever.js.map +1 -1
- package/dist/retrievers/multi_query.cjs +1 -1
- package/dist/retrievers/multi_query.cjs.map +1 -1
- package/dist/retrievers/multi_query.d.cts +0 -1
- package/dist/retrievers/multi_query.d.cts.map +1 -1
- package/dist/retrievers/multi_query.d.ts +0 -1
- package/dist/retrievers/multi_query.d.ts.map +1 -1
- package/dist/retrievers/multi_query.js +1 -1
- package/dist/retrievers/multi_query.js.map +1 -1
- package/dist/retrievers/multi_vector.cjs.map +1 -1
- package/dist/retrievers/multi_vector.d.cts +0 -1
- package/dist/retrievers/multi_vector.d.cts.map +1 -1
- package/dist/retrievers/multi_vector.d.ts +0 -1
- package/dist/retrievers/multi_vector.d.ts.map +1 -1
- package/dist/retrievers/multi_vector.js.map +1 -1
- package/dist/retrievers/parent_document.cjs.map +1 -1
- package/dist/retrievers/parent_document.d.cts +0 -1
- package/dist/retrievers/parent_document.d.cts.map +1 -1
- package/dist/retrievers/parent_document.d.ts +0 -1
- package/dist/retrievers/parent_document.d.ts.map +1 -1
- package/dist/retrievers/parent_document.js.map +1 -1
- package/dist/retrievers/score_threshold.cjs.map +1 -1
- package/dist/retrievers/score_threshold.d.cts +0 -1
- package/dist/retrievers/score_threshold.d.cts.map +1 -1
- package/dist/retrievers/score_threshold.d.ts +0 -1
- package/dist/retrievers/score_threshold.d.ts.map +1 -1
- package/dist/retrievers/score_threshold.js.map +1 -1
- package/dist/retrievers/self_query/index.cjs.map +1 -1
- package/dist/retrievers/self_query/index.d.cts +0 -1
- package/dist/retrievers/self_query/index.d.cts.map +1 -1
- package/dist/retrievers/self_query/index.d.ts +0 -1
- package/dist/retrievers/self_query/index.d.ts.map +1 -1
- package/dist/retrievers/self_query/index.js.map +1 -1
- package/dist/retrievers/time_weighted.cjs.map +1 -1
- package/dist/retrievers/time_weighted.d.cts +5 -1
- package/dist/retrievers/time_weighted.d.cts.map +1 -1
- package/dist/retrievers/time_weighted.d.ts +5 -1
- package/dist/retrievers/time_weighted.d.ts.map +1 -1
- package/dist/retrievers/time_weighted.js.map +1 -1
- package/dist/schema/prompt_template.cjs.map +1 -1
- package/dist/schema/prompt_template.d.cts +0 -1
- package/dist/schema/prompt_template.d.cts.map +1 -1
- package/dist/schema/prompt_template.d.ts +0 -1
- package/dist/schema/prompt_template.d.ts.map +1 -1
- package/dist/schema/prompt_template.js.map +1 -1
- package/dist/schema/query_constructor.cjs +3 -0
- package/dist/schema/query_constructor.cjs.map +1 -1
- package/dist/schema/query_constructor.d.cts.map +1 -1
- package/dist/schema/query_constructor.d.ts.map +1 -1
- package/dist/schema/query_constructor.js +3 -0
- package/dist/schema/query_constructor.js.map +1 -1
- package/dist/smith/config.cjs.map +1 -1
- package/dist/smith/config.d.cts +2 -7
- package/dist/smith/config.d.cts.map +1 -1
- package/dist/smith/config.d.ts +2 -7
- package/dist/smith/config.d.ts.map +1 -1
- package/dist/smith/config.js.map +1 -1
- package/dist/smith/name_generation.cjs.map +1 -1
- package/dist/smith/name_generation.js.map +1 -1
- package/dist/smith/progress.cjs.map +1 -1
- package/dist/smith/progress.js.map +1 -1
- package/dist/smith/runner_utils.cjs +11 -8
- package/dist/smith/runner_utils.cjs.map +1 -1
- package/dist/smith/runner_utils.d.cts +1 -2
- package/dist/smith/runner_utils.d.cts.map +1 -1
- package/dist/smith/runner_utils.d.ts +1 -2
- package/dist/smith/runner_utils.d.ts.map +1 -1
- package/dist/smith/runner_utils.js +11 -7
- package/dist/smith/runner_utils.js.map +1 -1
- package/dist/sql_db.cjs.map +1 -1
- package/dist/sql_db.d.cts +1 -3
- package/dist/sql_db.d.cts.map +1 -1
- package/dist/sql_db.d.ts +1 -3
- package/dist/sql_db.d.ts.map +1 -1
- package/dist/sql_db.js.map +1 -1
- package/dist/storage/encoder_backed.cjs.map +1 -1
- package/dist/storage/encoder_backed.d.cts +0 -1
- package/dist/storage/encoder_backed.d.cts.map +1 -1
- package/dist/storage/encoder_backed.d.ts +0 -1
- package/dist/storage/encoder_backed.d.ts.map +1 -1
- package/dist/storage/encoder_backed.js.map +1 -1
- package/dist/storage/file_system.cjs.map +1 -1
- package/dist/storage/file_system.d.cts +20 -1
- package/dist/storage/file_system.d.cts.map +1 -1
- package/dist/storage/file_system.d.ts +20 -1
- package/dist/storage/file_system.d.ts.map +1 -1
- package/dist/storage/file_system.js.map +1 -1
- package/dist/stores/doc/base.cjs.map +1 -1
- package/dist/stores/doc/base.d.cts +0 -1
- package/dist/stores/doc/base.d.cts.map +1 -1
- package/dist/stores/doc/base.d.ts +0 -1
- package/dist/stores/doc/base.d.ts.map +1 -1
- package/dist/stores/doc/base.js.map +1 -1
- package/dist/stores/doc/in_memory.cjs.map +1 -1
- package/dist/stores/doc/in_memory.d.cts +0 -1
- package/dist/stores/doc/in_memory.d.cts.map +1 -1
- package/dist/stores/doc/in_memory.d.ts +0 -1
- package/dist/stores/doc/in_memory.d.ts.map +1 -1
- package/dist/stores/doc/in_memory.js.map +1 -1
- package/dist/stores/file/base.cjs +0 -1
- package/dist/stores/file/base.cjs.map +1 -1
- package/dist/stores/file/base.d.cts +0 -1
- package/dist/stores/file/base.d.cts.map +1 -1
- package/dist/stores/file/base.d.ts +0 -1
- package/dist/stores/file/base.d.ts.map +1 -1
- package/dist/stores/file/base.js.map +1 -1
- package/dist/stores/file/in_memory.cjs.map +1 -1
- package/dist/stores/file/in_memory.d.cts +0 -1
- package/dist/stores/file/in_memory.d.cts.map +1 -1
- package/dist/stores/file/in_memory.d.ts +0 -1
- package/dist/stores/file/in_memory.d.ts.map +1 -1
- package/dist/stores/file/in_memory.js.map +1 -1
- package/dist/stores/file/node.cjs +1 -0
- package/dist/stores/file/node.cjs.map +1 -1
- package/dist/stores/file/node.d.cts +0 -1
- package/dist/stores/file/node.d.cts.map +1 -1
- package/dist/stores/file/node.d.ts +0 -1
- package/dist/stores/file/node.d.ts.map +1 -1
- package/dist/stores/file/node.js +1 -0
- package/dist/stores/file/node.js.map +1 -1
- package/dist/text_splitter.d.cts +0 -3
- package/dist/text_splitter.d.ts +0 -3
- package/dist/tools/chain.cjs.map +1 -1
- package/dist/tools/chain.d.cts +1 -5
- package/dist/tools/chain.d.cts.map +1 -1
- package/dist/tools/chain.d.ts +1 -5
- package/dist/tools/chain.d.ts.map +1 -1
- package/dist/tools/chain.js.map +1 -1
- package/dist/tools/fs.cjs +0 -1
- package/dist/tools/fs.cjs.map +1 -1
- package/dist/tools/fs.d.cts +4 -15
- package/dist/tools/fs.d.cts.map +1 -1
- package/dist/tools/fs.d.ts +4 -15
- package/dist/tools/fs.d.ts.map +1 -1
- package/dist/tools/fs.js.map +1 -1
- package/dist/tools/json.cjs +1 -0
- package/dist/tools/json.cjs.map +1 -1
- package/dist/tools/json.d.cts +1 -2
- package/dist/tools/json.d.cts.map +1 -1
- package/dist/tools/json.d.ts +1 -2
- package/dist/tools/json.d.ts.map +1 -1
- package/dist/tools/json.js +1 -0
- package/dist/tools/json.js.map +1 -1
- package/dist/tools/render.cjs.map +1 -1
- package/dist/tools/render.d.cts +0 -1
- package/dist/tools/render.d.cts.map +1 -1
- package/dist/tools/render.d.ts +0 -1
- package/dist/tools/render.d.ts.map +1 -1
- package/dist/tools/render.js.map +1 -1
- package/dist/tools/requests.cjs +2 -1
- package/dist/tools/requests.cjs.map +1 -1
- package/dist/tools/requests.d.cts +3 -8
- package/dist/tools/requests.d.cts.map +1 -1
- package/dist/tools/requests.d.ts +3 -8
- package/dist/tools/requests.d.ts.map +1 -1
- package/dist/tools/requests.js +2 -0
- package/dist/tools/requests.js.map +1 -1
- package/dist/tools/retriever.cjs.map +1 -1
- package/dist/tools/retriever.d.cts +0 -1
- package/dist/tools/retriever.d.cts.map +1 -1
- package/dist/tools/retriever.d.ts +0 -1
- package/dist/tools/retriever.d.ts.map +1 -1
- package/dist/tools/retriever.js.map +1 -1
- package/dist/tools/sql.cjs.map +1 -1
- package/dist/tools/sql.d.cts +0 -1
- package/dist/tools/sql.d.cts.map +1 -1
- package/dist/tools/sql.d.ts +0 -1
- package/dist/tools/sql.d.ts.map +1 -1
- package/dist/tools/sql.js.map +1 -1
- package/dist/tools/vectorstore.cjs +0 -1
- package/dist/tools/vectorstore.cjs.map +1 -1
- package/dist/tools/vectorstore.d.cts +0 -1
- package/dist/tools/vectorstore.d.cts.map +1 -1
- package/dist/tools/vectorstore.d.ts +0 -1
- package/dist/tools/vectorstore.d.ts.map +1 -1
- package/dist/tools/vectorstore.js.map +1 -1
- package/dist/tools/webbrowser.cjs +2 -1
- package/dist/tools/webbrowser.cjs.map +1 -1
- package/dist/tools/webbrowser.d.cts +1 -8
- package/dist/tools/webbrowser.d.cts.map +1 -1
- package/dist/tools/webbrowser.d.ts +1 -8
- package/dist/tools/webbrowser.d.ts.map +1 -1
- package/dist/tools/webbrowser.js +2 -1
- package/dist/tools/webbrowser.js.map +1 -1
- package/dist/types/expression-parser.d.cts +1 -1
- package/dist/types/expression-parser.d.cts.map +1 -1
- package/dist/types/expression-parser.d.ts +1 -1
- package/dist/types/expression-parser.d.ts.map +1 -1
- package/dist/types/type-utils.d.cts.map +1 -1
- package/dist/types/type-utils.d.ts.map +1 -1
- package/dist/util/document.cjs.map +1 -1
- package/dist/util/document.d.cts +0 -1
- package/dist/util/document.d.cts.map +1 -1
- package/dist/util/document.d.ts +0 -1
- package/dist/util/document.d.ts.map +1 -1
- package/dist/util/document.js.map +1 -1
- package/dist/util/env.cjs +0 -1
- package/dist/util/extname.cjs.map +1 -1
- package/dist/util/extname.js.map +1 -1
- package/dist/util/hub.cjs +0 -1
- package/dist/util/hub.cjs.map +1 -1
- package/dist/util/hub.js.map +1 -1
- package/dist/util/is-network-error/index.cjs +1 -1
- package/dist/util/is-network-error/index.cjs.map +1 -1
- package/dist/util/is-network-error/index.js +1 -1
- package/dist/util/is-network-error/index.js.map +1 -1
- package/dist/util/load.cjs.map +1 -1
- package/dist/util/load.d.cts.map +1 -1
- package/dist/util/load.d.ts.map +1 -1
- package/dist/util/load.js.map +1 -1
- package/dist/util/ml-distance/distances.cjs.map +1 -1
- package/dist/util/ml-distance/distances.js.map +1 -1
- package/dist/util/ml-distance/similarities.cjs.map +1 -1
- package/dist/util/ml-distance/similarities.d.cts.map +1 -1
- package/dist/util/ml-distance/similarities.d.ts.map +1 -1
- package/dist/util/ml-distance/similarities.js.map +1 -1
- package/dist/util/ml-distance-euclidean/euclidean.cjs +1 -0
- package/dist/util/ml-distance-euclidean/euclidean.cjs.map +1 -1
- package/dist/util/ml-distance-euclidean/euclidean.js +1 -1
- package/dist/util/ml-distance-euclidean/euclidean.js.map +1 -1
- package/dist/util/openapi.cjs +1 -0
- package/dist/util/openapi.cjs.map +1 -1
- package/dist/util/openapi.d.cts +0 -1
- package/dist/util/openapi.d.cts.map +1 -1
- package/dist/util/openapi.d.ts +0 -1
- package/dist/util/openapi.d.ts.map +1 -1
- package/dist/util/openapi.js +1 -0
- package/dist/util/openapi.js.map +1 -1
- package/dist/util/p-retry/index.cjs +1 -0
- package/dist/util/p-retry/index.cjs.map +1 -1
- package/dist/util/p-retry/index.js +1 -1
- package/dist/util/p-retry/index.js.map +1 -1
- package/dist/util/parse.cjs +1 -0
- package/dist/util/parse.cjs.map +1 -1
- package/dist/util/parse.js +1 -1
- package/dist/util/parse.js.map +1 -1
- package/dist/util/set.cjs.map +1 -1
- package/dist/util/set.js.map +1 -1
- package/dist/util/sql_utils.cjs +12 -6
- package/dist/util/sql_utils.cjs.map +1 -1
- package/dist/util/sql_utils.d.cts +1 -2
- package/dist/util/sql_utils.d.cts.map +1 -1
- package/dist/util/sql_utils.d.ts +1 -2
- package/dist/util/sql_utils.d.ts.map +1 -1
- package/dist/util/sql_utils.js +12 -6
- package/dist/util/sql_utils.js.map +1 -1
- package/dist/util/time.cjs.map +1 -1
- package/dist/util/time.d.cts.map +1 -1
- package/dist/util/time.d.ts.map +1 -1
- package/dist/util/time.js.map +1 -1
- package/dist/vectorstores/memory.cjs.map +1 -1
- package/dist/vectorstores/memory.d.cts +1 -5
- package/dist/vectorstores/memory.d.cts.map +1 -1
- package/dist/vectorstores/memory.d.ts +1 -5
- package/dist/vectorstores/memory.d.ts.map +1 -1
- package/dist/vectorstores/memory.js.map +1 -1
- package/package.json +30 -30
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity_memory.d.cts","names":[],"sources":["../../src/memory/entity_memory.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"entity_memory.d.cts","names":[],"sources":["../../src/memory/entity_memory.ts"],"mappings":";;;;;;;;;UAsBiB,0BAA0B;EACzC,KAAK;EACL;EACA;EACA,yBAAyB;EACzB,4BAA4B;EAC5B;EACA;EACA;EACA;EACA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsCH,qBAAqB,0BAA0B;UAClD;UAEA;EAER,aAAa;EAEb;EAEA;EAEA;EAEA,KAAK;EAEL;EAEA;EAEA;EAEA,YAAY,QAAQ;MAyBhB;MAKA;;;;;;EAUE,oBAAoB,QAAQ,cAAc,QAAQ;;;;;;;;EA0ClD,YAAY,QAAQ,aAAa,SAAS,eAAe;;;;;EAmCzD,SAAK"}
|
|
@@ -3,7 +3,6 @@ import { BaseEntityStore } from "./stores/entity/base.js";
|
|
|
3
3
|
import { PromptTemplate } from "@langchain/core/prompts";
|
|
4
4
|
import { BaseLanguageModelInterface } from "@langchain/core/language_models/base";
|
|
5
5
|
import { InputValues, MemoryVariables, OutputValues } from "@langchain/core/memory";
|
|
6
|
-
|
|
7
6
|
//#region src/memory/entity_memory.d.ts
|
|
8
7
|
/**
|
|
9
8
|
* Interface for the input parameters required by the EntityMemory class.
|
|
@@ -89,5 +88,5 @@ declare class EntityMemory extends BaseChatMemory implements EntityMemoryInput {
|
|
|
89
88
|
clear(): Promise<void>;
|
|
90
89
|
}
|
|
91
90
|
//#endregion
|
|
92
|
-
export { EntityMemory };
|
|
91
|
+
export { EntityMemory, EntityMemoryInput };
|
|
93
92
|
//# sourceMappingURL=entity_memory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity_memory.d.ts","names":[],"sources":["../../src/memory/entity_memory.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"entity_memory.d.ts","names":[],"sources":["../../src/memory/entity_memory.ts"],"mappings":";;;;;;;;;UAsBiB,0BAA0B;EACzC,KAAK;EACL;EACA;EACA,yBAAyB;EACzB,4BAA4B;EAC5B;EACA;EACA;EACA;EACA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsCH,qBAAqB,0BAA0B;UAClD;UAEA;EAER,aAAa;EAEb;EAEA;EAEA;EAEA,KAAK;EAEL;EAEA;EAEA;EAEA,YAAY,QAAQ;MAyBhB;MAKA;;;;;;EAUE,oBAAoB,QAAQ,cAAc,QAAQ;;;;;;;;EA0ClD,YAAY,QAAQ,aAAa,SAAS,eAAe;;;;;EAmCzD,SAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity_memory.js","names":[],"sources":["../../src/memory/entity_memory.ts"],"sourcesContent":["import type { BaseLanguageModelInterface } from \"@langchain/core/language_models/base\";\nimport { PromptTemplate } from \"@langchain/core/prompts\";\n\nimport {\n InputValues,\n MemoryVariables,\n OutputValues,\n getPromptInputKey,\n} from \"@langchain/core/memory\";\nimport { getBufferString } from \"@langchain/core/messages\";\nimport { InMemoryEntityStore } from \"./stores/entity/in_memory.js\";\nimport { LLMChain } from \"../chains/llm_chain.js\";\nimport {\n ENTITY_EXTRACTION_PROMPT,\n ENTITY_SUMMARIZATION_PROMPT,\n} from \"./prompt.js\";\nimport { BaseEntityStore } from \"./stores/entity/base.js\";\nimport { BaseChatMemory, BaseChatMemoryInput } from \"./chat_memory.js\";\n\n/**\n * Interface for the input parameters required by the EntityMemory class.\n */\nexport interface EntityMemoryInput extends BaseChatMemoryInput {\n llm: BaseLanguageModelInterface;\n humanPrefix?: string;\n aiPrefix?: string;\n entityExtractionPrompt?: PromptTemplate;\n entitySummarizationPrompt?: PromptTemplate;\n entityCache?: string[];\n k?: number;\n chatHistoryKey?: string;\n entitiesKey?: string;\n entityStore?: BaseEntityStore;\n}\n\n// Entity extractor & summarizer to memory.\n/**\n * Class for managing entity extraction and summarization to memory in\n * chatbot applications. Extends the BaseChatMemory class and implements\n * the EntityMemoryInput interface.\n * @example\n * ```typescript\n * const memory = new EntityMemory({\n * llm: new ChatOpenAI({ model: \"gpt-4o-mini\", temperature: 0 }),\n * chatHistoryKey: \"history\",\n * entitiesKey: \"entities\",\n * });\n * const model = new ChatOpenAI({ model: \"gpt-4o-mini\", temperature: 0.9 });\n * const chain = new LLMChain({\n * llm: model,\n * prompt: ENTITY_MEMORY_CONVERSATION_TEMPLATE,\n * memory,\n * });\n *\n * const res1 = await chain.call({ input: \"Hi! I'm Jim.\" });\n * console.log({\n * res1,\n * memory: await memory.loadMemoryVariables({ input: \"Who is Jim?\" }),\n * });\n *\n * const res2 = await chain.call({\n * input: \"I work in construction. What about you?\",\n * });\n * console.log({\n * res2,\n * memory: await memory.loadMemoryVariables({ input: \"Who is Jim?\" }),\n * });\n *\n * ```\n */\nexport class EntityMemory extends BaseChatMemory implements EntityMemoryInput {\n private entityExtractionChain: LLMChain;\n\n private entitySummarizationChain: LLMChain;\n\n entityStore: BaseEntityStore;\n\n entityCache: string[] = [];\n\n k = 3;\n\n chatHistoryKey = \"history\";\n\n llm: BaseLanguageModelInterface;\n\n entitiesKey = \"entities\";\n\n humanPrefix?: string;\n\n aiPrefix?: string;\n\n constructor(fields: EntityMemoryInput) {\n super({\n chatHistory: fields.chatHistory,\n returnMessages: fields.returnMessages ?? false,\n inputKey: fields.inputKey,\n outputKey: fields.outputKey,\n });\n this.llm = fields.llm;\n this.humanPrefix = fields.humanPrefix;\n this.aiPrefix = fields.aiPrefix;\n this.chatHistoryKey = fields.chatHistoryKey ?? this.chatHistoryKey;\n this.entitiesKey = fields.entitiesKey ?? this.entitiesKey;\n this.entityExtractionChain = new LLMChain({\n llm: this.llm,\n prompt: fields.entityExtractionPrompt ?? ENTITY_EXTRACTION_PROMPT,\n });\n this.entitySummarizationChain = new LLMChain({\n llm: this.llm,\n prompt: fields.entitySummarizationPrompt ?? ENTITY_SUMMARIZATION_PROMPT,\n });\n this.entityStore = fields.entityStore ?? new InMemoryEntityStore();\n this.entityCache = fields.entityCache ?? this.entityCache;\n this.k = fields.k ?? this.k;\n }\n\n get memoryKeys() {\n return [this.chatHistoryKey];\n }\n\n // Will always return list of memory variables.\n get memoryVariables(): string[] {\n return [this.entitiesKey, this.chatHistoryKey];\n }\n\n // Return history buffer.\n /**\n * Method to load memory variables and perform entity extraction.\n * @param inputs Input values for the method.\n * @returns Promise resolving to an object containing memory variables.\n */\n async loadMemoryVariables(inputs: InputValues): Promise<MemoryVariables> {\n const promptInputKey =\n this.inputKey ?? getPromptInputKey(inputs, this.memoryVariables);\n const messages = await this.chatHistory.getMessages();\n const serializedMessages = getBufferString(\n messages.slice(-this.k * 2),\n this.humanPrefix,\n this.aiPrefix\n );\n const output = await this.entityExtractionChain.predict({\n history: serializedMessages,\n input: inputs[promptInputKey],\n });\n const entities: string[] =\n output.trim() === \"NONE\" ? [] : output.split(\",\").map((w) => w.trim());\n const entitySummaries: { [key: string]: string | undefined } = {};\n\n for (const entity of entities) {\n entitySummaries[entity] = await this.entityStore.get(\n entity,\n \"No current information known.\"\n );\n }\n this.entityCache = [...entities];\n const buffer = this.returnMessages\n ? messages.slice(-this.k * 2)\n : serializedMessages;\n\n return {\n [this.chatHistoryKey]: buffer,\n [this.entitiesKey]: entitySummaries,\n };\n }\n\n // Save context from this conversation to buffer.\n /**\n * Method to save the context from a conversation to a buffer and perform\n * entity summarization.\n * @param inputs Input values for the method.\n * @param outputs Output values from the method.\n * @returns Promise resolving to void.\n */\n async saveContext(inputs: InputValues, outputs: OutputValues): Promise<void> {\n await super.saveContext(inputs, outputs);\n\n const promptInputKey =\n this.inputKey ?? getPromptInputKey(inputs, this.memoryVariables);\n const messages = await this.chatHistory.getMessages();\n const serializedMessages = getBufferString(\n messages.slice(-this.k * 2),\n this.humanPrefix,\n this.aiPrefix\n );\n const inputData = inputs[promptInputKey];\n\n for (const entity of this.entityCache) {\n const existingSummary = await this.entityStore.get(\n entity,\n \"No current information known.\"\n );\n const output = await this.entitySummarizationChain.predict({\n summary: existingSummary,\n entity,\n history: serializedMessages,\n input: inputData,\n });\n if (output.trim() !== \"UNCHANGED\") {\n await this.entityStore.set(entity, output.trim());\n }\n }\n }\n\n // Clear memory contents.\n /**\n * Method to clear the memory contents.\n * @returns Promise resolving to void.\n */\n async clear() {\n await super.clear();\n await this.entityStore.clear();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsEA,IAAa,eAAb,cAAkC,eAA4C;CAC5E;CAEA;CAEA;CAEA,cAAwB,
|
|
1
|
+
{"version":3,"file":"entity_memory.js","names":[],"sources":["../../src/memory/entity_memory.ts"],"sourcesContent":["import type { BaseLanguageModelInterface } from \"@langchain/core/language_models/base\";\nimport { PromptTemplate } from \"@langchain/core/prompts\";\n\nimport {\n InputValues,\n MemoryVariables,\n OutputValues,\n getPromptInputKey,\n} from \"@langchain/core/memory\";\nimport { getBufferString } from \"@langchain/core/messages\";\nimport { InMemoryEntityStore } from \"./stores/entity/in_memory.js\";\nimport { LLMChain } from \"../chains/llm_chain.js\";\nimport {\n ENTITY_EXTRACTION_PROMPT,\n ENTITY_SUMMARIZATION_PROMPT,\n} from \"./prompt.js\";\nimport { BaseEntityStore } from \"./stores/entity/base.js\";\nimport { BaseChatMemory, BaseChatMemoryInput } from \"./chat_memory.js\";\n\n/**\n * Interface for the input parameters required by the EntityMemory class.\n */\nexport interface EntityMemoryInput extends BaseChatMemoryInput {\n llm: BaseLanguageModelInterface;\n humanPrefix?: string;\n aiPrefix?: string;\n entityExtractionPrompt?: PromptTemplate;\n entitySummarizationPrompt?: PromptTemplate;\n entityCache?: string[];\n k?: number;\n chatHistoryKey?: string;\n entitiesKey?: string;\n entityStore?: BaseEntityStore;\n}\n\n// Entity extractor & summarizer to memory.\n/**\n * Class for managing entity extraction and summarization to memory in\n * chatbot applications. Extends the BaseChatMemory class and implements\n * the EntityMemoryInput interface.\n * @example\n * ```typescript\n * const memory = new EntityMemory({\n * llm: new ChatOpenAI({ model: \"gpt-4o-mini\", temperature: 0 }),\n * chatHistoryKey: \"history\",\n * entitiesKey: \"entities\",\n * });\n * const model = new ChatOpenAI({ model: \"gpt-4o-mini\", temperature: 0.9 });\n * const chain = new LLMChain({\n * llm: model,\n * prompt: ENTITY_MEMORY_CONVERSATION_TEMPLATE,\n * memory,\n * });\n *\n * const res1 = await chain.call({ input: \"Hi! I'm Jim.\" });\n * console.log({\n * res1,\n * memory: await memory.loadMemoryVariables({ input: \"Who is Jim?\" }),\n * });\n *\n * const res2 = await chain.call({\n * input: \"I work in construction. What about you?\",\n * });\n * console.log({\n * res2,\n * memory: await memory.loadMemoryVariables({ input: \"Who is Jim?\" }),\n * });\n *\n * ```\n */\nexport class EntityMemory extends BaseChatMemory implements EntityMemoryInput {\n private entityExtractionChain: LLMChain;\n\n private entitySummarizationChain: LLMChain;\n\n entityStore: BaseEntityStore;\n\n entityCache: string[] = [];\n\n k = 3;\n\n chatHistoryKey = \"history\";\n\n llm: BaseLanguageModelInterface;\n\n entitiesKey = \"entities\";\n\n humanPrefix?: string;\n\n aiPrefix?: string;\n\n constructor(fields: EntityMemoryInput) {\n super({\n chatHistory: fields.chatHistory,\n returnMessages: fields.returnMessages ?? false,\n inputKey: fields.inputKey,\n outputKey: fields.outputKey,\n });\n this.llm = fields.llm;\n this.humanPrefix = fields.humanPrefix;\n this.aiPrefix = fields.aiPrefix;\n this.chatHistoryKey = fields.chatHistoryKey ?? this.chatHistoryKey;\n this.entitiesKey = fields.entitiesKey ?? this.entitiesKey;\n this.entityExtractionChain = new LLMChain({\n llm: this.llm,\n prompt: fields.entityExtractionPrompt ?? ENTITY_EXTRACTION_PROMPT,\n });\n this.entitySummarizationChain = new LLMChain({\n llm: this.llm,\n prompt: fields.entitySummarizationPrompt ?? ENTITY_SUMMARIZATION_PROMPT,\n });\n this.entityStore = fields.entityStore ?? new InMemoryEntityStore();\n this.entityCache = fields.entityCache ?? this.entityCache;\n this.k = fields.k ?? this.k;\n }\n\n get memoryKeys() {\n return [this.chatHistoryKey];\n }\n\n // Will always return list of memory variables.\n get memoryVariables(): string[] {\n return [this.entitiesKey, this.chatHistoryKey];\n }\n\n // Return history buffer.\n /**\n * Method to load memory variables and perform entity extraction.\n * @param inputs Input values for the method.\n * @returns Promise resolving to an object containing memory variables.\n */\n async loadMemoryVariables(inputs: InputValues): Promise<MemoryVariables> {\n const promptInputKey =\n this.inputKey ?? getPromptInputKey(inputs, this.memoryVariables);\n const messages = await this.chatHistory.getMessages();\n const serializedMessages = getBufferString(\n messages.slice(-this.k * 2),\n this.humanPrefix,\n this.aiPrefix\n );\n const output = await this.entityExtractionChain.predict({\n history: serializedMessages,\n input: inputs[promptInputKey],\n });\n const entities: string[] =\n output.trim() === \"NONE\" ? [] : output.split(\",\").map((w) => w.trim());\n const entitySummaries: { [key: string]: string | undefined } = {};\n\n for (const entity of entities) {\n entitySummaries[entity] = await this.entityStore.get(\n entity,\n \"No current information known.\"\n );\n }\n this.entityCache = [...entities];\n const buffer = this.returnMessages\n ? messages.slice(-this.k * 2)\n : serializedMessages;\n\n return {\n [this.chatHistoryKey]: buffer,\n [this.entitiesKey]: entitySummaries,\n };\n }\n\n // Save context from this conversation to buffer.\n /**\n * Method to save the context from a conversation to a buffer and perform\n * entity summarization.\n * @param inputs Input values for the method.\n * @param outputs Output values from the method.\n * @returns Promise resolving to void.\n */\n async saveContext(inputs: InputValues, outputs: OutputValues): Promise<void> {\n await super.saveContext(inputs, outputs);\n\n const promptInputKey =\n this.inputKey ?? getPromptInputKey(inputs, this.memoryVariables);\n const messages = await this.chatHistory.getMessages();\n const serializedMessages = getBufferString(\n messages.slice(-this.k * 2),\n this.humanPrefix,\n this.aiPrefix\n );\n const inputData = inputs[promptInputKey];\n\n for (const entity of this.entityCache) {\n const existingSummary = await this.entityStore.get(\n entity,\n \"No current information known.\"\n );\n const output = await this.entitySummarizationChain.predict({\n summary: existingSummary,\n entity,\n history: serializedMessages,\n input: inputData,\n });\n if (output.trim() !== \"UNCHANGED\") {\n await this.entityStore.set(entity, output.trim());\n }\n }\n }\n\n // Clear memory contents.\n /**\n * Method to clear the memory contents.\n * @returns Promise resolving to void.\n */\n async clear() {\n await super.clear();\n await this.entityStore.clear();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsEA,IAAa,eAAb,cAAkC,eAA4C;CAC5E;CAEA;CAEA;CAEA,cAAwB,CAAC;CAEzB,IAAI;CAEJ,iBAAiB;CAEjB;CAEA,cAAc;CAEd;CAEA;CAEA,YAAY,QAA2B;EACrC,MAAM;GACJ,aAAa,OAAO;GACpB,gBAAgB,OAAO,kBAAkB;GACzC,UAAU,OAAO;GACjB,WAAW,OAAO;EACpB,CAAC;EACD,KAAK,MAAM,OAAO;EAClB,KAAK,cAAc,OAAO;EAC1B,KAAK,WAAW,OAAO;EACvB,KAAK,iBAAiB,OAAO,kBAAkB,KAAK;EACpD,KAAK,cAAc,OAAO,eAAe,KAAK;EAC9C,KAAK,wBAAwB,IAAI,SAAS;GACxC,KAAK,KAAK;GACV,QAAQ,OAAO,0BAA0B;EAC3C,CAAC;EACD,KAAK,2BAA2B,IAAI,SAAS;GAC3C,KAAK,KAAK;GACV,QAAQ,OAAO,6BAA6B;EAC9C,CAAC;EACD,KAAK,cAAc,OAAO,eAAe,IAAI,oBAAoB;EACjE,KAAK,cAAc,OAAO,eAAe,KAAK;EAC9C,KAAK,IAAI,OAAO,KAAK,KAAK;CAC5B;CAEA,IAAI,aAAa;EACf,OAAO,CAAC,KAAK,cAAc;CAC7B;CAGA,IAAI,kBAA4B;EAC9B,OAAO,CAAC,KAAK,aAAa,KAAK,cAAc;CAC/C;;;;;;CAQA,MAAM,oBAAoB,QAA+C;EACvE,MAAM,iBACJ,KAAK,YAAY,kBAAkB,QAAQ,KAAK,eAAe;EACjE,MAAM,WAAW,MAAM,KAAK,YAAY,YAAY;EACpD,MAAM,qBAAqB,gBACzB,SAAS,MAAM,CAAC,KAAK,IAAI,CAAC,GAC1B,KAAK,aACL,KAAK,QACP;EACA,MAAM,SAAS,MAAM,KAAK,sBAAsB,QAAQ;GACtD,SAAS;GACT,OAAO,OAAO;EAChB,CAAC;EACD,MAAM,WACJ,OAAO,KAAK,MAAM,SAAS,CAAC,IAAI,OAAO,MAAM,GAAG,CAAC,CAAC,KAAK,MAAM,EAAE,KAAK,CAAC;EACvE,MAAM,kBAAyD,CAAC;EAEhE,KAAK,MAAM,UAAU,UACnB,gBAAgB,UAAU,MAAM,KAAK,YAAY,IAC/C,QACA,+BACF;EAEF,KAAK,cAAc,CAAC,GAAG,QAAQ;EAC/B,MAAM,SAAS,KAAK,iBAChB,SAAS,MAAM,CAAC,KAAK,IAAI,CAAC,IAC1B;EAEJ,OAAO;IACJ,KAAK,iBAAiB;IACtB,KAAK,cAAc;EACtB;CACF;;;;;;;;CAUA,MAAM,YAAY,QAAqB,SAAsC;EAC3E,MAAM,MAAM,YAAY,QAAQ,OAAO;EAEvC,MAAM,iBACJ,KAAK,YAAY,kBAAkB,QAAQ,KAAK,eAAe;EAEjE,MAAM,qBAAqB,iBACzB,MAFqB,KAAK,YAAY,YAAY,EAAA,CAEzC,MAAM,CAAC,KAAK,IAAI,CAAC,GAC1B,KAAK,aACL,KAAK,QACP;EACA,MAAM,YAAY,OAAO;EAEzB,KAAK,MAAM,UAAU,KAAK,aAAa;GACrC,MAAM,kBAAkB,MAAM,KAAK,YAAY,IAC7C,QACA,+BACF;GACA,MAAM,SAAS,MAAM,KAAK,yBAAyB,QAAQ;IACzD,SAAS;IACT;IACA,SAAS;IACT,OAAO;GACT,CAAC;GACD,IAAI,OAAO,KAAK,MAAM,aACpB,MAAM,KAAK,YAAY,IAAI,QAAQ,OAAO,KAAK,CAAC;EAEpD;CACF;;;;;CAOA,MAAM,QAAQ;EACZ,MAAM,MAAM,MAAM;EAClB,MAAM,KAAK,YAAY,MAAM;CAC/B;AACF"}
|
package/dist/memory/prompt.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
require("../_virtual/_rolldown/runtime.cjs");
|
|
2
1
|
let _langchain_core_prompts = require("@langchain/core/prompts");
|
|
3
|
-
const SUMMARY_PROMPT =
|
|
2
|
+
const SUMMARY_PROMPT = /*#__PURE__*/ new _langchain_core_prompts.PromptTemplate({
|
|
4
3
|
inputVariables: ["summary", "new_lines"],
|
|
5
4
|
template: `Progressively summarize the lines of conversation provided, adding onto the previous summary returning a new summary.
|
|
6
5
|
|
|
@@ -24,13 +23,7 @@ New lines of conversation:
|
|
|
24
23
|
|
|
25
24
|
New summary:`
|
|
26
25
|
});
|
|
27
|
-
const
|
|
28
|
-
inputVariables: [
|
|
29
|
-
"entities",
|
|
30
|
-
"history",
|
|
31
|
-
"input"
|
|
32
|
-
],
|
|
33
|
-
template: `You are an assistant to a human, powered by a large language model trained by OpenAI.
|
|
26
|
+
const _DEFAULT_ENTITY_MEMORY_CONVERSATION_TEMPLATE = `You are an assistant to a human, powered by a large language model trained by OpenAI.
|
|
34
27
|
|
|
35
28
|
You are designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, you are able to generate human-like text based on the input you receive, allowing you to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.
|
|
36
29
|
|
|
@@ -45,11 +38,16 @@ Current conversation:
|
|
|
45
38
|
{history}
|
|
46
39
|
Last line:
|
|
47
40
|
Human: {input}
|
|
48
|
-
You
|
|
41
|
+
You:`;
|
|
42
|
+
const ENTITY_MEMORY_CONVERSATION_TEMPLATE = /*#__PURE__*/ new _langchain_core_prompts.PromptTemplate({
|
|
43
|
+
inputVariables: [
|
|
44
|
+
"entities",
|
|
45
|
+
"history",
|
|
46
|
+
"input"
|
|
47
|
+
],
|
|
48
|
+
template: _DEFAULT_ENTITY_MEMORY_CONVERSATION_TEMPLATE
|
|
49
49
|
});
|
|
50
|
-
const
|
|
51
|
-
inputVariables: ["history", "input"],
|
|
52
|
-
template: `You are an AI assistant reading the transcript of a conversation between an AI and a human. Extract all of the proper nouns from the last line of conversation. As a guideline, a proper noun is generally capitalized. You should definitely extract all names and places.
|
|
50
|
+
const _DEFAULT_ENTITY_EXTRACTION_TEMPLATE = `You are an AI assistant reading the transcript of a conversation between an AI and a human. Extract all of the proper nouns from the last line of conversation. As a guideline, a proper noun is generally capitalized. You should definitely extract all names and places.
|
|
53
51
|
|
|
54
52
|
The conversation history is provided just in case of a coreference (e.g. "What do you know about him" where "him" is defined in a previous line) -- ignore items mentioned there that are not in the last line.
|
|
55
53
|
|
|
@@ -82,16 +80,12 @@ Conversation history (for reference only):
|
|
|
82
80
|
Last line of conversation (for extraction):
|
|
83
81
|
Human: {input}
|
|
84
82
|
|
|
85
|
-
Output
|
|
83
|
+
Output:`;
|
|
84
|
+
const ENTITY_EXTRACTION_PROMPT = /*#__PURE__*/ new _langchain_core_prompts.PromptTemplate({
|
|
85
|
+
inputVariables: ["history", "input"],
|
|
86
|
+
template: _DEFAULT_ENTITY_EXTRACTION_TEMPLATE
|
|
86
87
|
});
|
|
87
|
-
const
|
|
88
|
-
inputVariables: [
|
|
89
|
-
"entity",
|
|
90
|
-
"summary",
|
|
91
|
-
"history",
|
|
92
|
-
"input"
|
|
93
|
-
],
|
|
94
|
-
template: `You are an AI assistant helping a human keep track of facts about relevant people, places, and concepts in their life. Update and add to the summary of the provided entity in the "Entity" section based on the last line of your conversation with the human. If you are writing the summary for the first time, return a single sentence.
|
|
88
|
+
const _DEFAULT_ENTITY_SUMMARIZATION_TEMPLATE = `You are an AI assistant helping a human keep track of facts about relevant people, places, and concepts in their life. Update and add to the summary of the provided entity in the "Entity" section based on the last line of your conversation with the human. If you are writing the summary for the first time, return a single sentence.
|
|
95
89
|
The update should only include facts that are relayed in the last line of conversation about the provided entity, and should only contain facts about the provided entity.
|
|
96
90
|
|
|
97
91
|
If there is no new information about the provided entity or the information is not worth noting (not an important or relevant fact to remember long-term), output the exact string "UNCHANGED" below.
|
|
@@ -107,12 +101,23 @@ Existing summary of {entity}:
|
|
|
107
101
|
|
|
108
102
|
Last line of conversation:
|
|
109
103
|
Human: {input}
|
|
110
|
-
Updated summary (or the exact string "UNCHANGED" if there is no new information about {entity} above)
|
|
104
|
+
Updated summary (or the exact string "UNCHANGED" if there is no new information about {entity} above):`;
|
|
105
|
+
const ENTITY_SUMMARIZATION_PROMPT = /*#__PURE__*/ new _langchain_core_prompts.PromptTemplate({
|
|
106
|
+
inputVariables: [
|
|
107
|
+
"entity",
|
|
108
|
+
"summary",
|
|
109
|
+
"history",
|
|
110
|
+
"input"
|
|
111
|
+
],
|
|
112
|
+
template: _DEFAULT_ENTITY_SUMMARIZATION_TEMPLATE
|
|
111
113
|
});
|
|
112
114
|
//#endregion
|
|
113
115
|
exports.ENTITY_EXTRACTION_PROMPT = ENTITY_EXTRACTION_PROMPT;
|
|
114
116
|
exports.ENTITY_MEMORY_CONVERSATION_TEMPLATE = ENTITY_MEMORY_CONVERSATION_TEMPLATE;
|
|
115
117
|
exports.ENTITY_SUMMARIZATION_PROMPT = ENTITY_SUMMARIZATION_PROMPT;
|
|
116
118
|
exports.SUMMARY_PROMPT = SUMMARY_PROMPT;
|
|
119
|
+
exports._DEFAULT_ENTITY_EXTRACTION_TEMPLATE = _DEFAULT_ENTITY_EXTRACTION_TEMPLATE;
|
|
120
|
+
exports._DEFAULT_ENTITY_MEMORY_CONVERSATION_TEMPLATE = _DEFAULT_ENTITY_MEMORY_CONVERSATION_TEMPLATE;
|
|
121
|
+
exports._DEFAULT_ENTITY_SUMMARIZATION_TEMPLATE = _DEFAULT_ENTITY_SUMMARIZATION_TEMPLATE;
|
|
117
122
|
|
|
118
123
|
//# sourceMappingURL=prompt.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.cjs","names":["PromptTemplate"],"sources":["../../src/memory/prompt.ts"],"sourcesContent":["import { PromptTemplate } from \"@langchain/core/prompts\";\n\nconst _DEFAULT_SUMMARIZER_TEMPLATE = `Progressively summarize the lines of conversation provided, adding onto the previous summary returning a new summary.\n\nEXAMPLE\nCurrent summary:\nThe human asks what the AI thinks of artificial intelligence. The AI thinks artificial intelligence is a force for good.\n\nNew lines of conversation:\nHuman: Why do you think artificial intelligence is a force for good?\nAI: Because artificial intelligence will help humans reach their full potential.\n\nNew summary:\nThe human asks what the AI thinks of artificial intelligence. The AI thinks artificial intelligence is a force for good because it will help humans reach their full potential.\nEND OF EXAMPLE\n\nCurrent summary:\n{summary}\n\nNew lines of conversation:\n{new_lines}\n\nNew summary:`;\n\nexport const SUMMARY_PROMPT = /*#__PURE__*/ new PromptTemplate({\n inputVariables: [\"summary\", \"new_lines\"],\n template: _DEFAULT_SUMMARIZER_TEMPLATE,\n});\n\nexport const _DEFAULT_ENTITY_MEMORY_CONVERSATION_TEMPLATE = `You are an assistant to a human, powered by a large language model trained by OpenAI.\n\nYou are designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, you are able to generate human-like text based on the input you receive, allowing you to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n\nYou are constantly learning and improving, and your capabilities are constantly evolving. You are able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. You have access to some personalized information provided by the human in the Context section below. Additionally, you are able to generate your own text based on the input you receive, allowing you to engage in discussions and provide explanations and descriptions on a wide range of topics.\n\nOverall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.\n\nContext:\n{entities}\n\nCurrent conversation:\n{history}\nLast line:\nHuman: {input}\nYou:`;\n\nexport const ENTITY_MEMORY_CONVERSATION_TEMPLATE =\n /*#__PURE__*/ new PromptTemplate({\n inputVariables: [\"entities\", \"history\", \"input\"],\n template: _DEFAULT_ENTITY_MEMORY_CONVERSATION_TEMPLATE,\n });\n\nexport const _DEFAULT_ENTITY_EXTRACTION_TEMPLATE = `You are an AI assistant reading the transcript of a conversation between an AI and a human. Extract all of the proper nouns from the last line of conversation. As a guideline, a proper noun is generally capitalized. You should definitely extract all names and places.\n\nThe conversation history is provided just in case of a coreference (e.g. \"What do you know about him\" where \"him\" is defined in a previous line) -- ignore items mentioned there that are not in the last line.\n\nReturn the output as a single comma-separated list, or NONE if there is nothing of note to return (e.g. the user is just issuing a greeting or having a simple conversation).\n\nEXAMPLE\nConversation history:\nPerson #1: my name is Jacob. how's it going today?\nAI: \"It's going great! How about you?\"\nPerson #1: good! busy working on Langchain. lots to do.\nAI: \"That sounds like a lot of work! What kind of things are you doing to make Langchain better?\"\nLast line:\nPerson #1: i'm trying to improve Langchain's interfaces, the UX, its integrations with various products the user might want ... a lot of stuff.\nOutput: Jacob,Langchain\nEND OF EXAMPLE\n\nEXAMPLE\nConversation history:\nPerson #1: how's it going today?\nAI: \"It's going great! How about you?\"\nPerson #1: good! busy working on Langchain. lots to do.\nAI: \"That sounds like a lot of work! What kind of things are you doing to make Langchain better?\"\nLast line:\nPerson #1: i'm trying to improve Langchain's interfaces, the UX, its integrations with various products the user might want ... a lot of stuff. I'm working with Person #2.\nOutput: Langchain, Person #2\nEND OF EXAMPLE\n\nConversation history (for reference only):\n{history}\nLast line of conversation (for extraction):\nHuman: {input}\n\nOutput:`;\n\nexport const ENTITY_EXTRACTION_PROMPT = /*#__PURE__*/ new PromptTemplate({\n inputVariables: [\"history\", \"input\"],\n template: _DEFAULT_ENTITY_EXTRACTION_TEMPLATE,\n});\n\nexport const _DEFAULT_ENTITY_SUMMARIZATION_TEMPLATE = `You are an AI assistant helping a human keep track of facts about relevant people, places, and concepts in their life. Update and add to the summary of the provided entity in the \"Entity\" section based on the last line of your conversation with the human. If you are writing the summary for the first time, return a single sentence.\nThe update should only include facts that are relayed in the last line of conversation about the provided entity, and should only contain facts about the provided entity.\n\nIf there is no new information about the provided entity or the information is not worth noting (not an important or relevant fact to remember long-term), output the exact string \"UNCHANGED\" below.\n\nFull conversation history (for context):\n{history}\n\nEntity to summarize:\n{entity}\n\nExisting summary of {entity}:\n{summary}\n\nLast line of conversation:\nHuman: {input}\nUpdated summary (or the exact string \"UNCHANGED\" if there is no new information about {entity} above):`;\n\nexport const ENTITY_SUMMARIZATION_PROMPT = /*#__PURE__*/ new PromptTemplate({\n inputVariables: [\"entity\", \"summary\", \"history\", \"input\"],\n template: _DEFAULT_ENTITY_SUMMARIZATION_TEMPLATE,\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"prompt.cjs","names":["PromptTemplate"],"sources":["../../src/memory/prompt.ts"],"sourcesContent":["import { PromptTemplate } from \"@langchain/core/prompts\";\n\nconst _DEFAULT_SUMMARIZER_TEMPLATE = `Progressively summarize the lines of conversation provided, adding onto the previous summary returning a new summary.\n\nEXAMPLE\nCurrent summary:\nThe human asks what the AI thinks of artificial intelligence. The AI thinks artificial intelligence is a force for good.\n\nNew lines of conversation:\nHuman: Why do you think artificial intelligence is a force for good?\nAI: Because artificial intelligence will help humans reach their full potential.\n\nNew summary:\nThe human asks what the AI thinks of artificial intelligence. The AI thinks artificial intelligence is a force for good because it will help humans reach their full potential.\nEND OF EXAMPLE\n\nCurrent summary:\n{summary}\n\nNew lines of conversation:\n{new_lines}\n\nNew summary:`;\n\nexport const SUMMARY_PROMPT = /*#__PURE__*/ new PromptTemplate({\n inputVariables: [\"summary\", \"new_lines\"],\n template: _DEFAULT_SUMMARIZER_TEMPLATE,\n});\n\nexport const _DEFAULT_ENTITY_MEMORY_CONVERSATION_TEMPLATE = `You are an assistant to a human, powered by a large language model trained by OpenAI.\n\nYou are designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, you are able to generate human-like text based on the input you receive, allowing you to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n\nYou are constantly learning and improving, and your capabilities are constantly evolving. You are able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. You have access to some personalized information provided by the human in the Context section below. Additionally, you are able to generate your own text based on the input you receive, allowing you to engage in discussions and provide explanations and descriptions on a wide range of topics.\n\nOverall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.\n\nContext:\n{entities}\n\nCurrent conversation:\n{history}\nLast line:\nHuman: {input}\nYou:`;\n\nexport const ENTITY_MEMORY_CONVERSATION_TEMPLATE =\n /*#__PURE__*/ new PromptTemplate({\n inputVariables: [\"entities\", \"history\", \"input\"],\n template: _DEFAULT_ENTITY_MEMORY_CONVERSATION_TEMPLATE,\n });\n\nexport const _DEFAULT_ENTITY_EXTRACTION_TEMPLATE = `You are an AI assistant reading the transcript of a conversation between an AI and a human. Extract all of the proper nouns from the last line of conversation. As a guideline, a proper noun is generally capitalized. You should definitely extract all names and places.\n\nThe conversation history is provided just in case of a coreference (e.g. \"What do you know about him\" where \"him\" is defined in a previous line) -- ignore items mentioned there that are not in the last line.\n\nReturn the output as a single comma-separated list, or NONE if there is nothing of note to return (e.g. the user is just issuing a greeting or having a simple conversation).\n\nEXAMPLE\nConversation history:\nPerson #1: my name is Jacob. how's it going today?\nAI: \"It's going great! How about you?\"\nPerson #1: good! busy working on Langchain. lots to do.\nAI: \"That sounds like a lot of work! What kind of things are you doing to make Langchain better?\"\nLast line:\nPerson #1: i'm trying to improve Langchain's interfaces, the UX, its integrations with various products the user might want ... a lot of stuff.\nOutput: Jacob,Langchain\nEND OF EXAMPLE\n\nEXAMPLE\nConversation history:\nPerson #1: how's it going today?\nAI: \"It's going great! How about you?\"\nPerson #1: good! busy working on Langchain. lots to do.\nAI: \"That sounds like a lot of work! What kind of things are you doing to make Langchain better?\"\nLast line:\nPerson #1: i'm trying to improve Langchain's interfaces, the UX, its integrations with various products the user might want ... a lot of stuff. I'm working with Person #2.\nOutput: Langchain, Person #2\nEND OF EXAMPLE\n\nConversation history (for reference only):\n{history}\nLast line of conversation (for extraction):\nHuman: {input}\n\nOutput:`;\n\nexport const ENTITY_EXTRACTION_PROMPT = /*#__PURE__*/ new PromptTemplate({\n inputVariables: [\"history\", \"input\"],\n template: _DEFAULT_ENTITY_EXTRACTION_TEMPLATE,\n});\n\nexport const _DEFAULT_ENTITY_SUMMARIZATION_TEMPLATE = `You are an AI assistant helping a human keep track of facts about relevant people, places, and concepts in their life. Update and add to the summary of the provided entity in the \"Entity\" section based on the last line of your conversation with the human. If you are writing the summary for the first time, return a single sentence.\nThe update should only include facts that are relayed in the last line of conversation about the provided entity, and should only contain facts about the provided entity.\n\nIf there is no new information about the provided entity or the information is not worth noting (not an important or relevant fact to remember long-term), output the exact string \"UNCHANGED\" below.\n\nFull conversation history (for context):\n{history}\n\nEntity to summarize:\n{entity}\n\nExisting summary of {entity}:\n{summary}\n\nLast line of conversation:\nHuman: {input}\nUpdated summary (or the exact string \"UNCHANGED\" if there is no new information about {entity} above):`;\n\nexport const ENTITY_SUMMARIZATION_PROMPT = /*#__PURE__*/ new PromptTemplate({\n inputVariables: [\"entity\", \"summary\", \"history\", \"input\"],\n template: _DEFAULT_ENTITY_SUMMARIZATION_TEMPLATE,\n});\n"],"mappings":";AAwBA,MAAa,+BAA+B,IAAIA,wBAAAA,eAAe;CAC7D,gBAAgB,CAAC,WAAW,WAAW;CACvC,UAAU;;;;;;;;;;;;;;;;;;;;;AACZ,CAAC;AAED,MAAa,+CAA+C;;;;;;;;;;;;;;;;AAiB5D,MAAa,oDACG,IAAIA,wBAAAA,eAAe;CAC/B,gBAAgB;EAAC;EAAY;EAAW;CAAO;CAC/C,UAAU;AACZ,CAAC;AAEH,MAAa,sCAAsC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCnD,MAAa,yCAAyC,IAAIA,wBAAAA,eAAe;CACvE,gBAAgB,CAAC,WAAW,OAAO;CACnC,UAAU;AACZ,CAAC;AAED,MAAa,yCAAyC;;;;;;;;;;;;;;;;;AAkBtD,MAAa,4CAA4C,IAAIA,wBAAAA,eAAe;CAC1E,gBAAgB;EAAC;EAAU;EAAW;EAAW;CAAO;CACxD,UAAU;AACZ,CAAC"}
|
package/dist/memory/prompt.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.d.cts","names":[],"sources":["../../src/memory/prompt.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"prompt.d.cts","names":[],"sources":["../../src/memory/prompt.ts"],"mappings":";;cA8Ca,qCAAmC"}
|
package/dist/memory/prompt.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.d.ts","names":[],"sources":["../../src/memory/prompt.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","names":[],"sources":["../../src/memory/prompt.ts"],"mappings":";;cA8Ca,qCAAmC"}
|
package/dist/memory/prompt.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PromptTemplate } from "@langchain/core/prompts";
|
|
2
|
-
const SUMMARY_PROMPT =
|
|
2
|
+
const SUMMARY_PROMPT = /*#__PURE__*/ new PromptTemplate({
|
|
3
3
|
inputVariables: ["summary", "new_lines"],
|
|
4
4
|
template: `Progressively summarize the lines of conversation provided, adding onto the previous summary returning a new summary.
|
|
5
5
|
|
|
@@ -23,13 +23,7 @@ New lines of conversation:
|
|
|
23
23
|
|
|
24
24
|
New summary:`
|
|
25
25
|
});
|
|
26
|
-
const
|
|
27
|
-
inputVariables: [
|
|
28
|
-
"entities",
|
|
29
|
-
"history",
|
|
30
|
-
"input"
|
|
31
|
-
],
|
|
32
|
-
template: `You are an assistant to a human, powered by a large language model trained by OpenAI.
|
|
26
|
+
const _DEFAULT_ENTITY_MEMORY_CONVERSATION_TEMPLATE = `You are an assistant to a human, powered by a large language model trained by OpenAI.
|
|
33
27
|
|
|
34
28
|
You are designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, you are able to generate human-like text based on the input you receive, allowing you to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.
|
|
35
29
|
|
|
@@ -44,11 +38,16 @@ Current conversation:
|
|
|
44
38
|
{history}
|
|
45
39
|
Last line:
|
|
46
40
|
Human: {input}
|
|
47
|
-
You
|
|
41
|
+
You:`;
|
|
42
|
+
const ENTITY_MEMORY_CONVERSATION_TEMPLATE = /*#__PURE__*/ new PromptTemplate({
|
|
43
|
+
inputVariables: [
|
|
44
|
+
"entities",
|
|
45
|
+
"history",
|
|
46
|
+
"input"
|
|
47
|
+
],
|
|
48
|
+
template: _DEFAULT_ENTITY_MEMORY_CONVERSATION_TEMPLATE
|
|
48
49
|
});
|
|
49
|
-
const
|
|
50
|
-
inputVariables: ["history", "input"],
|
|
51
|
-
template: `You are an AI assistant reading the transcript of a conversation between an AI and a human. Extract all of the proper nouns from the last line of conversation. As a guideline, a proper noun is generally capitalized. You should definitely extract all names and places.
|
|
50
|
+
const _DEFAULT_ENTITY_EXTRACTION_TEMPLATE = `You are an AI assistant reading the transcript of a conversation between an AI and a human. Extract all of the proper nouns from the last line of conversation. As a guideline, a proper noun is generally capitalized. You should definitely extract all names and places.
|
|
52
51
|
|
|
53
52
|
The conversation history is provided just in case of a coreference (e.g. "What do you know about him" where "him" is defined in a previous line) -- ignore items mentioned there that are not in the last line.
|
|
54
53
|
|
|
@@ -81,16 +80,12 @@ Conversation history (for reference only):
|
|
|
81
80
|
Last line of conversation (for extraction):
|
|
82
81
|
Human: {input}
|
|
83
82
|
|
|
84
|
-
Output
|
|
83
|
+
Output:`;
|
|
84
|
+
const ENTITY_EXTRACTION_PROMPT = /*#__PURE__*/ new PromptTemplate({
|
|
85
|
+
inputVariables: ["history", "input"],
|
|
86
|
+
template: _DEFAULT_ENTITY_EXTRACTION_TEMPLATE
|
|
85
87
|
});
|
|
86
|
-
const
|
|
87
|
-
inputVariables: [
|
|
88
|
-
"entity",
|
|
89
|
-
"summary",
|
|
90
|
-
"history",
|
|
91
|
-
"input"
|
|
92
|
-
],
|
|
93
|
-
template: `You are an AI assistant helping a human keep track of facts about relevant people, places, and concepts in their life. Update and add to the summary of the provided entity in the "Entity" section based on the last line of your conversation with the human. If you are writing the summary for the first time, return a single sentence.
|
|
88
|
+
const _DEFAULT_ENTITY_SUMMARIZATION_TEMPLATE = `You are an AI assistant helping a human keep track of facts about relevant people, places, and concepts in their life. Update and add to the summary of the provided entity in the "Entity" section based on the last line of your conversation with the human. If you are writing the summary for the first time, return a single sentence.
|
|
94
89
|
The update should only include facts that are relayed in the last line of conversation about the provided entity, and should only contain facts about the provided entity.
|
|
95
90
|
|
|
96
91
|
If there is no new information about the provided entity or the information is not worth noting (not an important or relevant fact to remember long-term), output the exact string "UNCHANGED" below.
|
|
@@ -106,9 +101,17 @@ Existing summary of {entity}:
|
|
|
106
101
|
|
|
107
102
|
Last line of conversation:
|
|
108
103
|
Human: {input}
|
|
109
|
-
Updated summary (or the exact string "UNCHANGED" if there is no new information about {entity} above)
|
|
104
|
+
Updated summary (or the exact string "UNCHANGED" if there is no new information about {entity} above):`;
|
|
105
|
+
const ENTITY_SUMMARIZATION_PROMPT = /*#__PURE__*/ new PromptTemplate({
|
|
106
|
+
inputVariables: [
|
|
107
|
+
"entity",
|
|
108
|
+
"summary",
|
|
109
|
+
"history",
|
|
110
|
+
"input"
|
|
111
|
+
],
|
|
112
|
+
template: _DEFAULT_ENTITY_SUMMARIZATION_TEMPLATE
|
|
110
113
|
});
|
|
111
114
|
//#endregion
|
|
112
|
-
export { ENTITY_EXTRACTION_PROMPT, ENTITY_MEMORY_CONVERSATION_TEMPLATE, ENTITY_SUMMARIZATION_PROMPT, SUMMARY_PROMPT };
|
|
115
|
+
export { ENTITY_EXTRACTION_PROMPT, ENTITY_MEMORY_CONVERSATION_TEMPLATE, ENTITY_SUMMARIZATION_PROMPT, SUMMARY_PROMPT, _DEFAULT_ENTITY_EXTRACTION_TEMPLATE, _DEFAULT_ENTITY_MEMORY_CONVERSATION_TEMPLATE, _DEFAULT_ENTITY_SUMMARIZATION_TEMPLATE };
|
|
113
116
|
|
|
114
117
|
//# sourceMappingURL=prompt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.js","names":[],"sources":["../../src/memory/prompt.ts"],"sourcesContent":["import { PromptTemplate } from \"@langchain/core/prompts\";\n\nconst _DEFAULT_SUMMARIZER_TEMPLATE = `Progressively summarize the lines of conversation provided, adding onto the previous summary returning a new summary.\n\nEXAMPLE\nCurrent summary:\nThe human asks what the AI thinks of artificial intelligence. The AI thinks artificial intelligence is a force for good.\n\nNew lines of conversation:\nHuman: Why do you think artificial intelligence is a force for good?\nAI: Because artificial intelligence will help humans reach their full potential.\n\nNew summary:\nThe human asks what the AI thinks of artificial intelligence. The AI thinks artificial intelligence is a force for good because it will help humans reach their full potential.\nEND OF EXAMPLE\n\nCurrent summary:\n{summary}\n\nNew lines of conversation:\n{new_lines}\n\nNew summary:`;\n\nexport const SUMMARY_PROMPT = /*#__PURE__*/ new PromptTemplate({\n inputVariables: [\"summary\", \"new_lines\"],\n template: _DEFAULT_SUMMARIZER_TEMPLATE,\n});\n\nexport const _DEFAULT_ENTITY_MEMORY_CONVERSATION_TEMPLATE = `You are an assistant to a human, powered by a large language model trained by OpenAI.\n\nYou are designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, you are able to generate human-like text based on the input you receive, allowing you to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n\nYou are constantly learning and improving, and your capabilities are constantly evolving. You are able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. You have access to some personalized information provided by the human in the Context section below. Additionally, you are able to generate your own text based on the input you receive, allowing you to engage in discussions and provide explanations and descriptions on a wide range of topics.\n\nOverall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.\n\nContext:\n{entities}\n\nCurrent conversation:\n{history}\nLast line:\nHuman: {input}\nYou:`;\n\nexport const ENTITY_MEMORY_CONVERSATION_TEMPLATE =\n /*#__PURE__*/ new PromptTemplate({\n inputVariables: [\"entities\", \"history\", \"input\"],\n template: _DEFAULT_ENTITY_MEMORY_CONVERSATION_TEMPLATE,\n });\n\nexport const _DEFAULT_ENTITY_EXTRACTION_TEMPLATE = `You are an AI assistant reading the transcript of a conversation between an AI and a human. Extract all of the proper nouns from the last line of conversation. As a guideline, a proper noun is generally capitalized. You should definitely extract all names and places.\n\nThe conversation history is provided just in case of a coreference (e.g. \"What do you know about him\" where \"him\" is defined in a previous line) -- ignore items mentioned there that are not in the last line.\n\nReturn the output as a single comma-separated list, or NONE if there is nothing of note to return (e.g. the user is just issuing a greeting or having a simple conversation).\n\nEXAMPLE\nConversation history:\nPerson #1: my name is Jacob. how's it going today?\nAI: \"It's going great! How about you?\"\nPerson #1: good! busy working on Langchain. lots to do.\nAI: \"That sounds like a lot of work! What kind of things are you doing to make Langchain better?\"\nLast line:\nPerson #1: i'm trying to improve Langchain's interfaces, the UX, its integrations with various products the user might want ... a lot of stuff.\nOutput: Jacob,Langchain\nEND OF EXAMPLE\n\nEXAMPLE\nConversation history:\nPerson #1: how's it going today?\nAI: \"It's going great! How about you?\"\nPerson #1: good! busy working on Langchain. lots to do.\nAI: \"That sounds like a lot of work! What kind of things are you doing to make Langchain better?\"\nLast line:\nPerson #1: i'm trying to improve Langchain's interfaces, the UX, its integrations with various products the user might want ... a lot of stuff. I'm working with Person #2.\nOutput: Langchain, Person #2\nEND OF EXAMPLE\n\nConversation history (for reference only):\n{history}\nLast line of conversation (for extraction):\nHuman: {input}\n\nOutput:`;\n\nexport const ENTITY_EXTRACTION_PROMPT = /*#__PURE__*/ new PromptTemplate({\n inputVariables: [\"history\", \"input\"],\n template: _DEFAULT_ENTITY_EXTRACTION_TEMPLATE,\n});\n\nexport const _DEFAULT_ENTITY_SUMMARIZATION_TEMPLATE = `You are an AI assistant helping a human keep track of facts about relevant people, places, and concepts in their life. Update and add to the summary of the provided entity in the \"Entity\" section based on the last line of your conversation with the human. If you are writing the summary for the first time, return a single sentence.\nThe update should only include facts that are relayed in the last line of conversation about the provided entity, and should only contain facts about the provided entity.\n\nIf there is no new information about the provided entity or the information is not worth noting (not an important or relevant fact to remember long-term), output the exact string \"UNCHANGED\" below.\n\nFull conversation history (for context):\n{history}\n\nEntity to summarize:\n{entity}\n\nExisting summary of {entity}:\n{summary}\n\nLast line of conversation:\nHuman: {input}\nUpdated summary (or the exact string \"UNCHANGED\" if there is no new information about {entity} above):`;\n\nexport const ENTITY_SUMMARIZATION_PROMPT = /*#__PURE__*/ new PromptTemplate({\n inputVariables: [\"entity\", \"summary\", \"history\", \"input\"],\n template: _DEFAULT_ENTITY_SUMMARIZATION_TEMPLATE,\n});\n"],"mappings":";AAwBA,MAAa
|
|
1
|
+
{"version":3,"file":"prompt.js","names":[],"sources":["../../src/memory/prompt.ts"],"sourcesContent":["import { PromptTemplate } from \"@langchain/core/prompts\";\n\nconst _DEFAULT_SUMMARIZER_TEMPLATE = `Progressively summarize the lines of conversation provided, adding onto the previous summary returning a new summary.\n\nEXAMPLE\nCurrent summary:\nThe human asks what the AI thinks of artificial intelligence. The AI thinks artificial intelligence is a force for good.\n\nNew lines of conversation:\nHuman: Why do you think artificial intelligence is a force for good?\nAI: Because artificial intelligence will help humans reach their full potential.\n\nNew summary:\nThe human asks what the AI thinks of artificial intelligence. The AI thinks artificial intelligence is a force for good because it will help humans reach their full potential.\nEND OF EXAMPLE\n\nCurrent summary:\n{summary}\n\nNew lines of conversation:\n{new_lines}\n\nNew summary:`;\n\nexport const SUMMARY_PROMPT = /*#__PURE__*/ new PromptTemplate({\n inputVariables: [\"summary\", \"new_lines\"],\n template: _DEFAULT_SUMMARIZER_TEMPLATE,\n});\n\nexport const _DEFAULT_ENTITY_MEMORY_CONVERSATION_TEMPLATE = `You are an assistant to a human, powered by a large language model trained by OpenAI.\n\nYou are designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, you are able to generate human-like text based on the input you receive, allowing you to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n\nYou are constantly learning and improving, and your capabilities are constantly evolving. You are able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. You have access to some personalized information provided by the human in the Context section below. Additionally, you are able to generate your own text based on the input you receive, allowing you to engage in discussions and provide explanations and descriptions on a wide range of topics.\n\nOverall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.\n\nContext:\n{entities}\n\nCurrent conversation:\n{history}\nLast line:\nHuman: {input}\nYou:`;\n\nexport const ENTITY_MEMORY_CONVERSATION_TEMPLATE =\n /*#__PURE__*/ new PromptTemplate({\n inputVariables: [\"entities\", \"history\", \"input\"],\n template: _DEFAULT_ENTITY_MEMORY_CONVERSATION_TEMPLATE,\n });\n\nexport const _DEFAULT_ENTITY_EXTRACTION_TEMPLATE = `You are an AI assistant reading the transcript of a conversation between an AI and a human. Extract all of the proper nouns from the last line of conversation. As a guideline, a proper noun is generally capitalized. You should definitely extract all names and places.\n\nThe conversation history is provided just in case of a coreference (e.g. \"What do you know about him\" where \"him\" is defined in a previous line) -- ignore items mentioned there that are not in the last line.\n\nReturn the output as a single comma-separated list, or NONE if there is nothing of note to return (e.g. the user is just issuing a greeting or having a simple conversation).\n\nEXAMPLE\nConversation history:\nPerson #1: my name is Jacob. how's it going today?\nAI: \"It's going great! How about you?\"\nPerson #1: good! busy working on Langchain. lots to do.\nAI: \"That sounds like a lot of work! What kind of things are you doing to make Langchain better?\"\nLast line:\nPerson #1: i'm trying to improve Langchain's interfaces, the UX, its integrations with various products the user might want ... a lot of stuff.\nOutput: Jacob,Langchain\nEND OF EXAMPLE\n\nEXAMPLE\nConversation history:\nPerson #1: how's it going today?\nAI: \"It's going great! How about you?\"\nPerson #1: good! busy working on Langchain. lots to do.\nAI: \"That sounds like a lot of work! What kind of things are you doing to make Langchain better?\"\nLast line:\nPerson #1: i'm trying to improve Langchain's interfaces, the UX, its integrations with various products the user might want ... a lot of stuff. I'm working with Person #2.\nOutput: Langchain, Person #2\nEND OF EXAMPLE\n\nConversation history (for reference only):\n{history}\nLast line of conversation (for extraction):\nHuman: {input}\n\nOutput:`;\n\nexport const ENTITY_EXTRACTION_PROMPT = /*#__PURE__*/ new PromptTemplate({\n inputVariables: [\"history\", \"input\"],\n template: _DEFAULT_ENTITY_EXTRACTION_TEMPLATE,\n});\n\nexport const _DEFAULT_ENTITY_SUMMARIZATION_TEMPLATE = `You are an AI assistant helping a human keep track of facts about relevant people, places, and concepts in their life. Update and add to the summary of the provided entity in the \"Entity\" section based on the last line of your conversation with the human. If you are writing the summary for the first time, return a single sentence.\nThe update should only include facts that are relayed in the last line of conversation about the provided entity, and should only contain facts about the provided entity.\n\nIf there is no new information about the provided entity or the information is not worth noting (not an important or relevant fact to remember long-term), output the exact string \"UNCHANGED\" below.\n\nFull conversation history (for context):\n{history}\n\nEntity to summarize:\n{entity}\n\nExisting summary of {entity}:\n{summary}\n\nLast line of conversation:\nHuman: {input}\nUpdated summary (or the exact string \"UNCHANGED\" if there is no new information about {entity} above):`;\n\nexport const ENTITY_SUMMARIZATION_PROMPT = /*#__PURE__*/ new PromptTemplate({\n inputVariables: [\"entity\", \"summary\", \"history\", \"input\"],\n template: _DEFAULT_ENTITY_SUMMARIZATION_TEMPLATE,\n});\n"],"mappings":";AAwBA,MAAa,+BAA+B,IAAI,eAAe;CAC7D,gBAAgB,CAAC,WAAW,WAAW;CACvC,UAAU;;;;;;;;;;;;;;;;;;;;;AACZ,CAAC;AAED,MAAa,+CAA+C;;;;;;;;;;;;;;;;AAiB5D,MAAa,oDACG,IAAI,eAAe;CAC/B,gBAAgB;EAAC;EAAY;EAAW;CAAO;CAC/C,UAAU;AACZ,CAAC;AAEH,MAAa,sCAAsC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCnD,MAAa,yCAAyC,IAAI,eAAe;CACvE,gBAAgB,CAAC,WAAW,OAAO;CACnC,UAAU;AACZ,CAAC;AAED,MAAa,yCAAyC;;;;;;;;;;;;;;;;;AAkBtD,MAAa,4CAA4C,IAAI,eAAe;CAC1E,gBAAgB;EAAC;EAAU;EAAW;EAAW;CAAO;CACxD,UAAU;AACZ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.cjs","names":["Serializable"],"sources":["../../../../src/memory/stores/entity/base.ts"],"sourcesContent":["import { Serializable } from \"@langchain/core/load/serializable\";\n\n/**\n * Base class for all entity stores. All entity stores should extend this\n * class.\n */\nexport abstract class BaseEntityStore extends Serializable {\n abstract get(key: string, defaultValue?: string): Promise<string | undefined>;\n\n abstract set(key: string, value?: string): Promise<void>;\n\n abstract delete(key: string): Promise<void>;\n\n abstract exists(key: string): Promise<boolean>;\n\n abstract clear(): Promise<void>;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"base.cjs","names":["Serializable"],"sources":["../../../../src/memory/stores/entity/base.ts"],"sourcesContent":["import { Serializable } from \"@langchain/core/load/serializable\";\n\n/**\n * Base class for all entity stores. All entity stores should extend this\n * class.\n */\nexport abstract class BaseEntityStore extends Serializable {\n abstract get(key: string, defaultValue?: string): Promise<string | undefined>;\n\n abstract set(key: string, value?: string): Promise<void>;\n\n abstract delete(key: string): Promise<void>;\n\n abstract exists(key: string): Promise<boolean>;\n\n abstract clear(): Promise<void>;\n}\n"],"mappings":";;;;;;AAMA,IAAsB,kBAAtB,cAA8CA,kCAAAA,aAAa,CAU3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.cts","names":[],"sources":["../../../../src/memory/stores/entity/base.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"base.d.cts","names":[],"sources":["../../../../src/memory/stores/entity/base.ts"],"mappings":";;;;;;uBAMsB,wBAAwB;WACnC,IAAI,aAAa,wBAAwB;WAEzC,IAAI,aAAa,iBAAiB;WAElC,OAAO,cAAc;WAErB,OAAO,cAAc;WAErB,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","names":[],"sources":["../../../../src/memory/stores/entity/base.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"base.d.ts","names":[],"sources":["../../../../src/memory/stores/entity/base.ts"],"mappings":";;;;;;uBAMsB,wBAAwB;WACnC,IAAI,aAAa,wBAAwB;WAEzC,IAAI,aAAa,iBAAiB;WAElC,OAAO,cAAc;WAErB,OAAO,cAAc;WAErB,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","names":[],"sources":["../../../../src/memory/stores/entity/base.ts"],"sourcesContent":["import { Serializable } from \"@langchain/core/load/serializable\";\n\n/**\n * Base class for all entity stores. All entity stores should extend this\n * class.\n */\nexport abstract class BaseEntityStore extends Serializable {\n abstract get(key: string, defaultValue?: string): Promise<string | undefined>;\n\n abstract set(key: string, value?: string): Promise<void>;\n\n abstract delete(key: string): Promise<void>;\n\n abstract exists(key: string): Promise<boolean>;\n\n abstract clear(): Promise<void>;\n}\n"],"mappings":";;;;;;AAMA,IAAsB,kBAAtB,cAA8C,aAAa"}
|
|
1
|
+
{"version":3,"file":"base.js","names":[],"sources":["../../../../src/memory/stores/entity/base.ts"],"sourcesContent":["import { Serializable } from \"@langchain/core/load/serializable\";\n\n/**\n * Base class for all entity stores. All entity stores should extend this\n * class.\n */\nexport abstract class BaseEntityStore extends Serializable {\n abstract get(key: string, defaultValue?: string): Promise<string | undefined>;\n\n abstract set(key: string, value?: string): Promise<void>;\n\n abstract delete(key: string): Promise<void>;\n\n abstract exists(key: string): Promise<boolean>;\n\n abstract clear(): Promise<void>;\n}\n"],"mappings":";;;;;;AAMA,IAAsB,kBAAtB,cAA8C,aAAa,CAU3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in_memory.cjs","names":["BaseEntityStore"],"sources":["../../../../src/memory/stores/entity/in_memory.ts"],"sourcesContent":["import { BaseEntityStore } from \"./base.js\";\n\n/**\n * An entity store that keeps data in memory. It extends from the\n * `BaseEntityStore` class and is used to store and manage entities.\n */\nexport class InMemoryEntityStore extends BaseEntityStore {\n lc_namespace = [\"langchain\", \"stores\", \"entity\", \"in_memory\"];\n\n private store: Record<string, string | undefined>;\n\n constructor() {\n super();\n this.store = Object.create(null);\n }\n\n /**\n * Retrieves the value associated with the given key from the store. If\n * the key does not exist in the store, it returns the provided default\n * value.\n * @param key The key to retrieve the value for.\n * @param defaultValue The default value to return if the key does not exist in the store.\n * @returns The value associated with the key, or the default value if the key does not exist in the store.\n */\n async get(\n key: string,\n defaultValue: string | undefined\n ): Promise<string | undefined> {\n return key in this.store ? this.store[key] : defaultValue;\n }\n\n /**\n * Sets the value associated with the given key in the store.\n * @param key The key to set the value for.\n * @param value The value to set.\n */\n async set(key: string, value: string | undefined): Promise<void> {\n this.store[key] = value;\n }\n\n /**\n * Removes the key and its associated value from the store.\n * @param key The key to remove.\n */\n async delete(key: string): Promise<void> {\n delete this.store[key];\n }\n\n /**\n * Checks if a key exists in the store.\n * @param key The key to check.\n * @returns A boolean indicating whether the key exists in the store.\n */\n async exists(key: string): Promise<boolean> {\n return key in this.store;\n }\n\n /**\n * Removes all keys and their associated values from the store.\n */\n async clear(): Promise<void> {\n this.store = Object.create(null);\n }\n}\n"],"mappings":";;;;;;AAMA,IAAa,sBAAb,cAAyCA,aAAAA,gBAAgB;CACvD,eAAe;EAAC;EAAa;EAAU;EAAU;
|
|
1
|
+
{"version":3,"file":"in_memory.cjs","names":["BaseEntityStore"],"sources":["../../../../src/memory/stores/entity/in_memory.ts"],"sourcesContent":["import { BaseEntityStore } from \"./base.js\";\n\n/**\n * An entity store that keeps data in memory. It extends from the\n * `BaseEntityStore` class and is used to store and manage entities.\n */\nexport class InMemoryEntityStore extends BaseEntityStore {\n lc_namespace = [\"langchain\", \"stores\", \"entity\", \"in_memory\"];\n\n private store: Record<string, string | undefined>;\n\n constructor() {\n super();\n this.store = Object.create(null);\n }\n\n /**\n * Retrieves the value associated with the given key from the store. If\n * the key does not exist in the store, it returns the provided default\n * value.\n * @param key The key to retrieve the value for.\n * @param defaultValue The default value to return if the key does not exist in the store.\n * @returns The value associated with the key, or the default value if the key does not exist in the store.\n */\n async get(\n key: string,\n defaultValue: string | undefined\n ): Promise<string | undefined> {\n return key in this.store ? this.store[key] : defaultValue;\n }\n\n /**\n * Sets the value associated with the given key in the store.\n * @param key The key to set the value for.\n * @param value The value to set.\n */\n async set(key: string, value: string | undefined): Promise<void> {\n this.store[key] = value;\n }\n\n /**\n * Removes the key and its associated value from the store.\n * @param key The key to remove.\n */\n async delete(key: string): Promise<void> {\n delete this.store[key];\n }\n\n /**\n * Checks if a key exists in the store.\n * @param key The key to check.\n * @returns A boolean indicating whether the key exists in the store.\n */\n async exists(key: string): Promise<boolean> {\n return key in this.store;\n }\n\n /**\n * Removes all keys and their associated values from the store.\n */\n async clear(): Promise<void> {\n this.store = Object.create(null);\n }\n}\n"],"mappings":";;;;;;AAMA,IAAa,sBAAb,cAAyCA,aAAAA,gBAAgB;CACvD,eAAe;EAAC;EAAa;EAAU;EAAU;CAAW;CAE5D;CAEA,cAAc;EACZ,MAAM;EACN,KAAK,QAAQ,OAAO,OAAO,IAAI;CACjC;;;;;;;;;CAUA,MAAM,IACJ,KACA,cAC6B;EAC7B,OAAO,OAAO,KAAK,QAAQ,KAAK,MAAM,OAAO;CAC/C;;;;;;CAOA,MAAM,IAAI,KAAa,OAA0C;EAC/D,KAAK,MAAM,OAAO;CACpB;;;;;CAMA,MAAM,OAAO,KAA4B;EACvC,OAAO,KAAK,MAAM;CACpB;;;;;;CAOA,MAAM,OAAO,KAA+B;EAC1C,OAAO,OAAO,KAAK;CACrB;;;;CAKA,MAAM,QAAuB;EAC3B,KAAK,QAAQ,OAAO,OAAO,IAAI;CACjC;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in_memory.js","names":[],"sources":["../../../../src/memory/stores/entity/in_memory.ts"],"sourcesContent":["import { BaseEntityStore } from \"./base.js\";\n\n/**\n * An entity store that keeps data in memory. It extends from the\n * `BaseEntityStore` class and is used to store and manage entities.\n */\nexport class InMemoryEntityStore extends BaseEntityStore {\n lc_namespace = [\"langchain\", \"stores\", \"entity\", \"in_memory\"];\n\n private store: Record<string, string | undefined>;\n\n constructor() {\n super();\n this.store = Object.create(null);\n }\n\n /**\n * Retrieves the value associated with the given key from the store. If\n * the key does not exist in the store, it returns the provided default\n * value.\n * @param key The key to retrieve the value for.\n * @param defaultValue The default value to return if the key does not exist in the store.\n * @returns The value associated with the key, or the default value if the key does not exist in the store.\n */\n async get(\n key: string,\n defaultValue: string | undefined\n ): Promise<string | undefined> {\n return key in this.store ? this.store[key] : defaultValue;\n }\n\n /**\n * Sets the value associated with the given key in the store.\n * @param key The key to set the value for.\n * @param value The value to set.\n */\n async set(key: string, value: string | undefined): Promise<void> {\n this.store[key] = value;\n }\n\n /**\n * Removes the key and its associated value from the store.\n * @param key The key to remove.\n */\n async delete(key: string): Promise<void> {\n delete this.store[key];\n }\n\n /**\n * Checks if a key exists in the store.\n * @param key The key to check.\n * @returns A boolean indicating whether the key exists in the store.\n */\n async exists(key: string): Promise<boolean> {\n return key in this.store;\n }\n\n /**\n * Removes all keys and their associated values from the store.\n */\n async clear(): Promise<void> {\n this.store = Object.create(null);\n }\n}\n"],"mappings":";;;;;;AAMA,IAAa,sBAAb,cAAyC,gBAAgB;CACvD,eAAe;EAAC;EAAa;EAAU;EAAU;
|
|
1
|
+
{"version":3,"file":"in_memory.js","names":[],"sources":["../../../../src/memory/stores/entity/in_memory.ts"],"sourcesContent":["import { BaseEntityStore } from \"./base.js\";\n\n/**\n * An entity store that keeps data in memory. It extends from the\n * `BaseEntityStore` class and is used to store and manage entities.\n */\nexport class InMemoryEntityStore extends BaseEntityStore {\n lc_namespace = [\"langchain\", \"stores\", \"entity\", \"in_memory\"];\n\n private store: Record<string, string | undefined>;\n\n constructor() {\n super();\n this.store = Object.create(null);\n }\n\n /**\n * Retrieves the value associated with the given key from the store. If\n * the key does not exist in the store, it returns the provided default\n * value.\n * @param key The key to retrieve the value for.\n * @param defaultValue The default value to return if the key does not exist in the store.\n * @returns The value associated with the key, or the default value if the key does not exist in the store.\n */\n async get(\n key: string,\n defaultValue: string | undefined\n ): Promise<string | undefined> {\n return key in this.store ? this.store[key] : defaultValue;\n }\n\n /**\n * Sets the value associated with the given key in the store.\n * @param key The key to set the value for.\n * @param value The value to set.\n */\n async set(key: string, value: string | undefined): Promise<void> {\n this.store[key] = value;\n }\n\n /**\n * Removes the key and its associated value from the store.\n * @param key The key to remove.\n */\n async delete(key: string): Promise<void> {\n delete this.store[key];\n }\n\n /**\n * Checks if a key exists in the store.\n * @param key The key to check.\n * @returns A boolean indicating whether the key exists in the store.\n */\n async exists(key: string): Promise<boolean> {\n return key in this.store;\n }\n\n /**\n * Removes all keys and their associated values from the store.\n */\n async clear(): Promise<void> {\n this.store = Object.create(null);\n }\n}\n"],"mappings":";;;;;;AAMA,IAAa,sBAAb,cAAyC,gBAAgB;CACvD,eAAe;EAAC;EAAa;EAAU;EAAU;CAAW;CAE5D;CAEA,cAAc;EACZ,MAAM;EACN,KAAK,QAAQ,OAAO,OAAO,IAAI;CACjC;;;;;;;;;CAUA,MAAM,IACJ,KACA,cAC6B;EAC7B,OAAO,OAAO,KAAK,QAAQ,KAAK,MAAM,OAAO;CAC/C;;;;;;CAOA,MAAM,IAAI,KAAa,OAA0C;EAC/D,KAAK,MAAM,OAAO;CACpB;;;;;CAMA,MAAM,OAAO,KAA4B;EACvC,OAAO,KAAK,MAAM;CACpB;;;;;;CAOA,MAAM,OAAO,KAA+B;EAC1C,OAAO,OAAO,KAAK;CACrB;;;;CAKA,MAAM,QAAuB;EAC3B,KAAK,QAAQ,OAAO,OAAO,IAAI;CACjC;AACF"}
|
package/dist/memory/summary.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summary.cjs","names":["BaseChatMemory","SUMMARY_PROMPT","SystemMessage","LLMChain"],"sources":["../../src/memory/summary.ts"],"sourcesContent":["import type { BaseLanguageModelInterface } from \"@langchain/core/language_models/base\";\nimport {\n BaseMessage,\n SystemMessage,\n getBufferString,\n} from \"@langchain/core/messages\";\nimport { BasePromptTemplate } from \"@langchain/core/prompts\";\nimport {\n InputValues,\n MemoryVariables,\n OutputValues,\n} from \"@langchain/core/memory\";\nimport { LLMChain } from \"../chains/llm_chain.js\";\nimport { SUMMARY_PROMPT } from \"./prompt.js\";\nimport { BaseChatMemory, BaseChatMemoryInput } from \"./chat_memory.js\";\n\n/**\n * Interface for the input parameters of the ConversationSummaryMemory\n * class.\n */\nexport interface ConversationSummaryMemoryInput extends BaseConversationSummaryMemoryInput {}\n\n/**\n * Interface for the input parameters of the BaseConversationSummaryMemory\n * class.\n */\nexport interface BaseConversationSummaryMemoryInput extends BaseChatMemoryInput {\n llm: BaseLanguageModelInterface;\n memoryKey?: string;\n humanPrefix?: string;\n aiPrefix?: string;\n prompt?: BasePromptTemplate;\n summaryChatMessageClass?: new (content: string) => BaseMessage;\n}\n\n/**\n * Abstract class that provides a structure for storing and managing the\n * memory of a conversation. It includes methods for predicting a new\n * summary for the conversation given the existing messages and summary.\n */\nexport abstract class BaseConversationSummaryMemory extends BaseChatMemory {\n memoryKey = \"history\";\n\n humanPrefix = \"Human\";\n\n aiPrefix = \"AI\";\n\n llm: BaseLanguageModelInterface;\n\n prompt: BasePromptTemplate = SUMMARY_PROMPT;\n\n summaryChatMessageClass: new (content: string) => BaseMessage = SystemMessage;\n\n constructor(fields: BaseConversationSummaryMemoryInput) {\n const {\n returnMessages,\n inputKey,\n outputKey,\n chatHistory,\n humanPrefix,\n aiPrefix,\n llm,\n prompt,\n summaryChatMessageClass,\n } = fields;\n\n super({ returnMessages, inputKey, outputKey, chatHistory });\n\n this.memoryKey = fields?.memoryKey ?? this.memoryKey;\n this.humanPrefix = humanPrefix ?? this.humanPrefix;\n this.aiPrefix = aiPrefix ?? this.aiPrefix;\n this.llm = llm;\n this.prompt = prompt ?? this.prompt;\n this.summaryChatMessageClass =\n summaryChatMessageClass ?? this.summaryChatMessageClass;\n }\n\n /**\n * Predicts a new summary for the conversation given the existing messages\n * and summary.\n * @param messages Existing messages in the conversation.\n * @param existingSummary Current summary of the conversation.\n * @returns A promise that resolves to a new summary string.\n */\n async predictNewSummary(\n messages: BaseMessage[],\n existingSummary: string\n ): Promise<string> {\n const newLines = getBufferString(messages, this.humanPrefix, this.aiPrefix);\n const chain = new LLMChain({ llm: this.llm, prompt: this.prompt });\n return await chain.predict({\n summary: existingSummary,\n new_lines: newLines,\n });\n }\n}\n\n/**\n * Class that provides a concrete implementation of the conversation\n * memory. It includes methods for loading memory variables, saving\n * context, and clearing the memory.\n * @example\n * ```typescript\n * const memory = new ConversationSummaryMemory({\n * memoryKey: \"chat_history\",\n * llm: new ChatOpenAI({ model: \"gpt-3.5-turbo\", temperature: 0 }),\n * });\n *\n * const model = new ChatOpenAI({ model: \"gpt-4o-mini\" });\n * const prompt =\n * PromptTemplate.fromTemplate(`The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.\n *\n * Current conversation:\n * {chat_history}\n * Human: {input}\n * AI:`);\n * const chain = new LLMChain({ llm: model, prompt, memory });\n *\n * const res1 = await chain.call({ input: \"Hi! I'm Jim.\" });\n * console.log({ res1, memory: await memory.loadMemoryVariables({}) });\n *\n * const res2 = await chain.call({ input: \"What's my name?\" });\n * console.log({ res2, memory: await memory.loadMemoryVariables({}) });\n *\n * ```\n */\nexport class ConversationSummaryMemory extends BaseConversationSummaryMemory {\n buffer = \"\";\n\n constructor(fields: ConversationSummaryMemoryInput) {\n super(fields);\n }\n\n get memoryKeys() {\n return [this.memoryKey];\n }\n\n /**\n * Loads the memory variables for the conversation memory.\n * @returns A promise that resolves to an object containing the memory variables.\n */\n async loadMemoryVariables(_: InputValues): Promise<MemoryVariables> {\n if (this.returnMessages) {\n const result = {\n [this.memoryKey]: [new this.summaryChatMessageClass(this.buffer)],\n };\n return result;\n }\n const result = { [this.memoryKey]: this.buffer };\n return result;\n }\n\n /**\n * Saves the context of the conversation memory.\n * @param inputValues Input values for the conversation.\n * @param outputValues Output values from the conversation.\n * @returns A promise that resolves when the context has been saved.\n */\n async saveContext(\n inputValues: InputValues,\n outputValues: OutputValues\n ): Promise<void> {\n await super.saveContext(inputValues, outputValues);\n const messages = await this.chatHistory.getMessages();\n this.buffer = await this.predictNewSummary(messages.slice(-2), this.buffer);\n }\n\n /**\n * Clears the conversation memory.\n * @returns A promise that resolves when the memory has been cleared.\n */\n async clear() {\n await super.clear();\n this.buffer = \"\";\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"summary.cjs","names":["BaseChatMemory","SUMMARY_PROMPT","SystemMessage","LLMChain"],"sources":["../../src/memory/summary.ts"],"sourcesContent":["import type { BaseLanguageModelInterface } from \"@langchain/core/language_models/base\";\nimport {\n BaseMessage,\n SystemMessage,\n getBufferString,\n} from \"@langchain/core/messages\";\nimport { BasePromptTemplate } from \"@langchain/core/prompts\";\nimport {\n InputValues,\n MemoryVariables,\n OutputValues,\n} from \"@langchain/core/memory\";\nimport { LLMChain } from \"../chains/llm_chain.js\";\nimport { SUMMARY_PROMPT } from \"./prompt.js\";\nimport { BaseChatMemory, BaseChatMemoryInput } from \"./chat_memory.js\";\n\n/**\n * Interface for the input parameters of the ConversationSummaryMemory\n * class.\n */\nexport interface ConversationSummaryMemoryInput extends BaseConversationSummaryMemoryInput {}\n\n/**\n * Interface for the input parameters of the BaseConversationSummaryMemory\n * class.\n */\nexport interface BaseConversationSummaryMemoryInput extends BaseChatMemoryInput {\n llm: BaseLanguageModelInterface;\n memoryKey?: string;\n humanPrefix?: string;\n aiPrefix?: string;\n prompt?: BasePromptTemplate;\n summaryChatMessageClass?: new (content: string) => BaseMessage;\n}\n\n/**\n * Abstract class that provides a structure for storing and managing the\n * memory of a conversation. It includes methods for predicting a new\n * summary for the conversation given the existing messages and summary.\n */\nexport abstract class BaseConversationSummaryMemory extends BaseChatMemory {\n memoryKey = \"history\";\n\n humanPrefix = \"Human\";\n\n aiPrefix = \"AI\";\n\n llm: BaseLanguageModelInterface;\n\n prompt: BasePromptTemplate = SUMMARY_PROMPT;\n\n summaryChatMessageClass: new (content: string) => BaseMessage = SystemMessage;\n\n constructor(fields: BaseConversationSummaryMemoryInput) {\n const {\n returnMessages,\n inputKey,\n outputKey,\n chatHistory,\n humanPrefix,\n aiPrefix,\n llm,\n prompt,\n summaryChatMessageClass,\n } = fields;\n\n super({ returnMessages, inputKey, outputKey, chatHistory });\n\n this.memoryKey = fields?.memoryKey ?? this.memoryKey;\n this.humanPrefix = humanPrefix ?? this.humanPrefix;\n this.aiPrefix = aiPrefix ?? this.aiPrefix;\n this.llm = llm;\n this.prompt = prompt ?? this.prompt;\n this.summaryChatMessageClass =\n summaryChatMessageClass ?? this.summaryChatMessageClass;\n }\n\n /**\n * Predicts a new summary for the conversation given the existing messages\n * and summary.\n * @param messages Existing messages in the conversation.\n * @param existingSummary Current summary of the conversation.\n * @returns A promise that resolves to a new summary string.\n */\n async predictNewSummary(\n messages: BaseMessage[],\n existingSummary: string\n ): Promise<string> {\n const newLines = getBufferString(messages, this.humanPrefix, this.aiPrefix);\n const chain = new LLMChain({ llm: this.llm, prompt: this.prompt });\n return await chain.predict({\n summary: existingSummary,\n new_lines: newLines,\n });\n }\n}\n\n/**\n * Class that provides a concrete implementation of the conversation\n * memory. It includes methods for loading memory variables, saving\n * context, and clearing the memory.\n * @example\n * ```typescript\n * const memory = new ConversationSummaryMemory({\n * memoryKey: \"chat_history\",\n * llm: new ChatOpenAI({ model: \"gpt-3.5-turbo\", temperature: 0 }),\n * });\n *\n * const model = new ChatOpenAI({ model: \"gpt-4o-mini\" });\n * const prompt =\n * PromptTemplate.fromTemplate(`The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.\n *\n * Current conversation:\n * {chat_history}\n * Human: {input}\n * AI:`);\n * const chain = new LLMChain({ llm: model, prompt, memory });\n *\n * const res1 = await chain.call({ input: \"Hi! I'm Jim.\" });\n * console.log({ res1, memory: await memory.loadMemoryVariables({}) });\n *\n * const res2 = await chain.call({ input: \"What's my name?\" });\n * console.log({ res2, memory: await memory.loadMemoryVariables({}) });\n *\n * ```\n */\nexport class ConversationSummaryMemory extends BaseConversationSummaryMemory {\n buffer = \"\";\n\n constructor(fields: ConversationSummaryMemoryInput) {\n super(fields);\n }\n\n get memoryKeys() {\n return [this.memoryKey];\n }\n\n /**\n * Loads the memory variables for the conversation memory.\n * @returns A promise that resolves to an object containing the memory variables.\n */\n async loadMemoryVariables(_: InputValues): Promise<MemoryVariables> {\n if (this.returnMessages) {\n const result = {\n [this.memoryKey]: [new this.summaryChatMessageClass(this.buffer)],\n };\n return result;\n }\n const result = { [this.memoryKey]: this.buffer };\n return result;\n }\n\n /**\n * Saves the context of the conversation memory.\n * @param inputValues Input values for the conversation.\n * @param outputValues Output values from the conversation.\n * @returns A promise that resolves when the context has been saved.\n */\n async saveContext(\n inputValues: InputValues,\n outputValues: OutputValues\n ): Promise<void> {\n await super.saveContext(inputValues, outputValues);\n const messages = await this.chatHistory.getMessages();\n this.buffer = await this.predictNewSummary(messages.slice(-2), this.buffer);\n }\n\n /**\n * Clears the conversation memory.\n * @returns A promise that resolves when the memory has been cleared.\n */\n async clear() {\n await super.clear();\n this.buffer = \"\";\n }\n}\n"],"mappings":";;;;;;;;;;AAwCA,IAAsB,gCAAtB,cAA4DA,2BAAAA,eAAe;CACzE,YAAY;CAEZ,cAAc;CAEd,WAAW;CAEX;CAEA,SAA6BC,eAAAA;CAE7B,0BAAgEC,yBAAAA;CAEhE,YAAY,QAA4C;EACtD,MAAM,EACJ,gBACA,UACA,WACA,aACA,aACA,UACA,KACA,QACA,4BACE;EAEJ,MAAM;GAAE;GAAgB;GAAU;GAAW;EAAY,CAAC;EAE1D,KAAK,YAAY,QAAQ,aAAa,KAAK;EAC3C,KAAK,cAAc,eAAe,KAAK;EACvC,KAAK,WAAW,YAAY,KAAK;EACjC,KAAK,MAAM;EACX,KAAK,SAAS,UAAU,KAAK;EAC7B,KAAK,0BACH,2BAA2B,KAAK;CACpC;;;;;;;;CASA,MAAM,kBACJ,UACA,iBACiB;EACjB,MAAM,YAAA,GAAA,yBAAA,gBAAA,CAA2B,UAAU,KAAK,aAAa,KAAK,QAAQ;EAE1E,OAAO,MAAM,IADKC,kBAAAA,SAAS;GAAE,KAAK,KAAK;GAAK,QAAQ,KAAK;EAAO,CAC/C,CAAC,CAAC,QAAQ;GACzB,SAAS;GACT,WAAW;EACb,CAAC;CACH;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,IAAa,4BAAb,cAA+C,8BAA8B;CAC3E,SAAS;CAET,YAAY,QAAwC;EAClD,MAAM,MAAM;CACd;CAEA,IAAI,aAAa;EACf,OAAO,CAAC,KAAK,SAAS;CACxB;;;;;CAMA,MAAM,oBAAoB,GAA0C;EAClE,IAAI,KAAK,gBAIP,OAAO,GAFJ,KAAK,YAAY,CAAC,IAAI,KAAK,wBAAwB,KAAK,MAAM,CAAC,EAEtD;EAGd,OAAO,GADW,KAAK,YAAY,KAAK,OAC5B;CACd;;;;;;;CAQA,MAAM,YACJ,aACA,cACe;EACf,MAAM,MAAM,YAAY,aAAa,YAAY;EACjD,MAAM,WAAW,MAAM,KAAK,YAAY,YAAY;EACpD,KAAK,SAAS,MAAM,KAAK,kBAAkB,SAAS,MAAM,EAAE,GAAG,KAAK,MAAM;CAC5E;;;;;CAMA,MAAM,QAAQ;EACZ,MAAM,MAAM,MAAM;EAClB,KAAK,SAAS;CAChB;AACF"}
|
|
@@ -3,7 +3,6 @@ import { BaseMessage } from "@langchain/core/messages";
|
|
|
3
3
|
import { BasePromptTemplate } from "@langchain/core/prompts";
|
|
4
4
|
import { BaseLanguageModelInterface } from "@langchain/core/language_models/base";
|
|
5
5
|
import { InputValues, MemoryVariables, OutputValues } from "@langchain/core/memory";
|
|
6
|
-
|
|
7
6
|
//#region src/memory/summary.d.ts
|
|
8
7
|
/**
|
|
9
8
|
* Interface for the input parameters of the ConversationSummaryMemory
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summary.d.cts","names":[],"sources":["../../src/memory/summary.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"summary.d.cts","names":[],"sources":["../../src/memory/summary.ts"],"mappings":";;;;;;;;;;UAoBiB,uCAAuC;;;;;UAMvC,2CAA2C;EAC1D,KAAK;EACL;EACA;EACA;EACA,SAAS;EACT,+BAA+B,oBAAoB;;;;;;;uBAQ/B,sCAAsC;EAC1D;EAEA;EAEA;EAEA,KAAK;EAEL,QAAQ;EAER,8BAA8B,oBAAoB;EAElD,YAAY,QAAQ;;;;;;;;EA+Bd,kBACJ,UAAU,eACV,0BACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAuCQ,kCAAkC;EAC7C;EAEA,YAAY,QAAQ;MAIhB;;;;;EAQE,oBAAoB,GAAG,cAAc,QAAQ;;;;;;;EAiB7C,YACJ,aAAa,aACb,cAAc,eACb;;;;;EAUG,SAAK"}
|
package/dist/memory/summary.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { BaseMessage } from "@langchain/core/messages";
|
|
|
3
3
|
import { BasePromptTemplate } from "@langchain/core/prompts";
|
|
4
4
|
import { BaseLanguageModelInterface } from "@langchain/core/language_models/base";
|
|
5
5
|
import { InputValues, MemoryVariables, OutputValues } from "@langchain/core/memory";
|
|
6
|
-
|
|
7
6
|
//#region src/memory/summary.d.ts
|
|
8
7
|
/**
|
|
9
8
|
* Interface for the input parameters of the ConversationSummaryMemory
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summary.d.ts","names":[],"sources":["../../src/memory/summary.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"summary.d.ts","names":[],"sources":["../../src/memory/summary.ts"],"mappings":";;;;;;;;;;UAoBiB,uCAAuC;;;;;UAMvC,2CAA2C;EAC1D,KAAK;EACL;EACA;EACA;EACA,SAAS;EACT,+BAA+B,oBAAoB;;;;;;;uBAQ/B,sCAAsC;EAC1D;EAEA;EAEA;EAEA,KAAK;EAEL,QAAQ;EAER,8BAA8B,oBAAoB;EAElD,YAAY,QAAQ;;;;;;;;EA+Bd,kBACJ,UAAU,eACV,0BACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAuCQ,kCAAkC;EAC7C;EAEA,YAAY,QAAQ;MAIhB;;;;;EAQE,oBAAoB,GAAG,cAAc,QAAQ;;;;;;;EAiB7C,YACJ,aAAa,aACb,cAAc,eACb;;;;;EAUG,SAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summary.js","names":[],"sources":["../../src/memory/summary.ts"],"sourcesContent":["import type { BaseLanguageModelInterface } from \"@langchain/core/language_models/base\";\nimport {\n BaseMessage,\n SystemMessage,\n getBufferString,\n} from \"@langchain/core/messages\";\nimport { BasePromptTemplate } from \"@langchain/core/prompts\";\nimport {\n InputValues,\n MemoryVariables,\n OutputValues,\n} from \"@langchain/core/memory\";\nimport { LLMChain } from \"../chains/llm_chain.js\";\nimport { SUMMARY_PROMPT } from \"./prompt.js\";\nimport { BaseChatMemory, BaseChatMemoryInput } from \"./chat_memory.js\";\n\n/**\n * Interface for the input parameters of the ConversationSummaryMemory\n * class.\n */\nexport interface ConversationSummaryMemoryInput extends BaseConversationSummaryMemoryInput {}\n\n/**\n * Interface for the input parameters of the BaseConversationSummaryMemory\n * class.\n */\nexport interface BaseConversationSummaryMemoryInput extends BaseChatMemoryInput {\n llm: BaseLanguageModelInterface;\n memoryKey?: string;\n humanPrefix?: string;\n aiPrefix?: string;\n prompt?: BasePromptTemplate;\n summaryChatMessageClass?: new (content: string) => BaseMessage;\n}\n\n/**\n * Abstract class that provides a structure for storing and managing the\n * memory of a conversation. It includes methods for predicting a new\n * summary for the conversation given the existing messages and summary.\n */\nexport abstract class BaseConversationSummaryMemory extends BaseChatMemory {\n memoryKey = \"history\";\n\n humanPrefix = \"Human\";\n\n aiPrefix = \"AI\";\n\n llm: BaseLanguageModelInterface;\n\n prompt: BasePromptTemplate = SUMMARY_PROMPT;\n\n summaryChatMessageClass: new (content: string) => BaseMessage = SystemMessage;\n\n constructor(fields: BaseConversationSummaryMemoryInput) {\n const {\n returnMessages,\n inputKey,\n outputKey,\n chatHistory,\n humanPrefix,\n aiPrefix,\n llm,\n prompt,\n summaryChatMessageClass,\n } = fields;\n\n super({ returnMessages, inputKey, outputKey, chatHistory });\n\n this.memoryKey = fields?.memoryKey ?? this.memoryKey;\n this.humanPrefix = humanPrefix ?? this.humanPrefix;\n this.aiPrefix = aiPrefix ?? this.aiPrefix;\n this.llm = llm;\n this.prompt = prompt ?? this.prompt;\n this.summaryChatMessageClass =\n summaryChatMessageClass ?? this.summaryChatMessageClass;\n }\n\n /**\n * Predicts a new summary for the conversation given the existing messages\n * and summary.\n * @param messages Existing messages in the conversation.\n * @param existingSummary Current summary of the conversation.\n * @returns A promise that resolves to a new summary string.\n */\n async predictNewSummary(\n messages: BaseMessage[],\n existingSummary: string\n ): Promise<string> {\n const newLines = getBufferString(messages, this.humanPrefix, this.aiPrefix);\n const chain = new LLMChain({ llm: this.llm, prompt: this.prompt });\n return await chain.predict({\n summary: existingSummary,\n new_lines: newLines,\n });\n }\n}\n\n/**\n * Class that provides a concrete implementation of the conversation\n * memory. It includes methods for loading memory variables, saving\n * context, and clearing the memory.\n * @example\n * ```typescript\n * const memory = new ConversationSummaryMemory({\n * memoryKey: \"chat_history\",\n * llm: new ChatOpenAI({ model: \"gpt-3.5-turbo\", temperature: 0 }),\n * });\n *\n * const model = new ChatOpenAI({ model: \"gpt-4o-mini\" });\n * const prompt =\n * PromptTemplate.fromTemplate(`The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.\n *\n * Current conversation:\n * {chat_history}\n * Human: {input}\n * AI:`);\n * const chain = new LLMChain({ llm: model, prompt, memory });\n *\n * const res1 = await chain.call({ input: \"Hi! I'm Jim.\" });\n * console.log({ res1, memory: await memory.loadMemoryVariables({}) });\n *\n * const res2 = await chain.call({ input: \"What's my name?\" });\n * console.log({ res2, memory: await memory.loadMemoryVariables({}) });\n *\n * ```\n */\nexport class ConversationSummaryMemory extends BaseConversationSummaryMemory {\n buffer = \"\";\n\n constructor(fields: ConversationSummaryMemoryInput) {\n super(fields);\n }\n\n get memoryKeys() {\n return [this.memoryKey];\n }\n\n /**\n * Loads the memory variables for the conversation memory.\n * @returns A promise that resolves to an object containing the memory variables.\n */\n async loadMemoryVariables(_: InputValues): Promise<MemoryVariables> {\n if (this.returnMessages) {\n const result = {\n [this.memoryKey]: [new this.summaryChatMessageClass(this.buffer)],\n };\n return result;\n }\n const result = { [this.memoryKey]: this.buffer };\n return result;\n }\n\n /**\n * Saves the context of the conversation memory.\n * @param inputValues Input values for the conversation.\n * @param outputValues Output values from the conversation.\n * @returns A promise that resolves when the context has been saved.\n */\n async saveContext(\n inputValues: InputValues,\n outputValues: OutputValues\n ): Promise<void> {\n await super.saveContext(inputValues, outputValues);\n const messages = await this.chatHistory.getMessages();\n this.buffer = await this.predictNewSummary(messages.slice(-2), this.buffer);\n }\n\n /**\n * Clears the conversation memory.\n * @returns A promise that resolves when the memory has been cleared.\n */\n async clear() {\n await super.clear();\n this.buffer = \"\";\n }\n}\n"],"mappings":";;;;;;;;;;AAwCA,IAAsB,gCAAtB,cAA4D,eAAe;CACzE,YAAY;CAEZ,cAAc;CAEd,WAAW;CAEX;CAEA,SAA6B;CAE7B,0BAAgE;CAEhE,YAAY,QAA4C;EACtD,MAAM,EACJ,gBACA,UACA,WACA,aACA,aACA,UACA,KACA,QACA,4BACE;
|
|
1
|
+
{"version":3,"file":"summary.js","names":[],"sources":["../../src/memory/summary.ts"],"sourcesContent":["import type { BaseLanguageModelInterface } from \"@langchain/core/language_models/base\";\nimport {\n BaseMessage,\n SystemMessage,\n getBufferString,\n} from \"@langchain/core/messages\";\nimport { BasePromptTemplate } from \"@langchain/core/prompts\";\nimport {\n InputValues,\n MemoryVariables,\n OutputValues,\n} from \"@langchain/core/memory\";\nimport { LLMChain } from \"../chains/llm_chain.js\";\nimport { SUMMARY_PROMPT } from \"./prompt.js\";\nimport { BaseChatMemory, BaseChatMemoryInput } from \"./chat_memory.js\";\n\n/**\n * Interface for the input parameters of the ConversationSummaryMemory\n * class.\n */\nexport interface ConversationSummaryMemoryInput extends BaseConversationSummaryMemoryInput {}\n\n/**\n * Interface for the input parameters of the BaseConversationSummaryMemory\n * class.\n */\nexport interface BaseConversationSummaryMemoryInput extends BaseChatMemoryInput {\n llm: BaseLanguageModelInterface;\n memoryKey?: string;\n humanPrefix?: string;\n aiPrefix?: string;\n prompt?: BasePromptTemplate;\n summaryChatMessageClass?: new (content: string) => BaseMessage;\n}\n\n/**\n * Abstract class that provides a structure for storing and managing the\n * memory of a conversation. It includes methods for predicting a new\n * summary for the conversation given the existing messages and summary.\n */\nexport abstract class BaseConversationSummaryMemory extends BaseChatMemory {\n memoryKey = \"history\";\n\n humanPrefix = \"Human\";\n\n aiPrefix = \"AI\";\n\n llm: BaseLanguageModelInterface;\n\n prompt: BasePromptTemplate = SUMMARY_PROMPT;\n\n summaryChatMessageClass: new (content: string) => BaseMessage = SystemMessage;\n\n constructor(fields: BaseConversationSummaryMemoryInput) {\n const {\n returnMessages,\n inputKey,\n outputKey,\n chatHistory,\n humanPrefix,\n aiPrefix,\n llm,\n prompt,\n summaryChatMessageClass,\n } = fields;\n\n super({ returnMessages, inputKey, outputKey, chatHistory });\n\n this.memoryKey = fields?.memoryKey ?? this.memoryKey;\n this.humanPrefix = humanPrefix ?? this.humanPrefix;\n this.aiPrefix = aiPrefix ?? this.aiPrefix;\n this.llm = llm;\n this.prompt = prompt ?? this.prompt;\n this.summaryChatMessageClass =\n summaryChatMessageClass ?? this.summaryChatMessageClass;\n }\n\n /**\n * Predicts a new summary for the conversation given the existing messages\n * and summary.\n * @param messages Existing messages in the conversation.\n * @param existingSummary Current summary of the conversation.\n * @returns A promise that resolves to a new summary string.\n */\n async predictNewSummary(\n messages: BaseMessage[],\n existingSummary: string\n ): Promise<string> {\n const newLines = getBufferString(messages, this.humanPrefix, this.aiPrefix);\n const chain = new LLMChain({ llm: this.llm, prompt: this.prompt });\n return await chain.predict({\n summary: existingSummary,\n new_lines: newLines,\n });\n }\n}\n\n/**\n * Class that provides a concrete implementation of the conversation\n * memory. It includes methods for loading memory variables, saving\n * context, and clearing the memory.\n * @example\n * ```typescript\n * const memory = new ConversationSummaryMemory({\n * memoryKey: \"chat_history\",\n * llm: new ChatOpenAI({ model: \"gpt-3.5-turbo\", temperature: 0 }),\n * });\n *\n * const model = new ChatOpenAI({ model: \"gpt-4o-mini\" });\n * const prompt =\n * PromptTemplate.fromTemplate(`The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.\n *\n * Current conversation:\n * {chat_history}\n * Human: {input}\n * AI:`);\n * const chain = new LLMChain({ llm: model, prompt, memory });\n *\n * const res1 = await chain.call({ input: \"Hi! I'm Jim.\" });\n * console.log({ res1, memory: await memory.loadMemoryVariables({}) });\n *\n * const res2 = await chain.call({ input: \"What's my name?\" });\n * console.log({ res2, memory: await memory.loadMemoryVariables({}) });\n *\n * ```\n */\nexport class ConversationSummaryMemory extends BaseConversationSummaryMemory {\n buffer = \"\";\n\n constructor(fields: ConversationSummaryMemoryInput) {\n super(fields);\n }\n\n get memoryKeys() {\n return [this.memoryKey];\n }\n\n /**\n * Loads the memory variables for the conversation memory.\n * @returns A promise that resolves to an object containing the memory variables.\n */\n async loadMemoryVariables(_: InputValues): Promise<MemoryVariables> {\n if (this.returnMessages) {\n const result = {\n [this.memoryKey]: [new this.summaryChatMessageClass(this.buffer)],\n };\n return result;\n }\n const result = { [this.memoryKey]: this.buffer };\n return result;\n }\n\n /**\n * Saves the context of the conversation memory.\n * @param inputValues Input values for the conversation.\n * @param outputValues Output values from the conversation.\n * @returns A promise that resolves when the context has been saved.\n */\n async saveContext(\n inputValues: InputValues,\n outputValues: OutputValues\n ): Promise<void> {\n await super.saveContext(inputValues, outputValues);\n const messages = await this.chatHistory.getMessages();\n this.buffer = await this.predictNewSummary(messages.slice(-2), this.buffer);\n }\n\n /**\n * Clears the conversation memory.\n * @returns A promise that resolves when the memory has been cleared.\n */\n async clear() {\n await super.clear();\n this.buffer = \"\";\n }\n}\n"],"mappings":";;;;;;;;;;AAwCA,IAAsB,gCAAtB,cAA4D,eAAe;CACzE,YAAY;CAEZ,cAAc;CAEd,WAAW;CAEX;CAEA,SAA6B;CAE7B,0BAAgE;CAEhE,YAAY,QAA4C;EACtD,MAAM,EACJ,gBACA,UACA,WACA,aACA,aACA,UACA,KACA,QACA,4BACE;EAEJ,MAAM;GAAE;GAAgB;GAAU;GAAW;EAAY,CAAC;EAE1D,KAAK,YAAY,QAAQ,aAAa,KAAK;EAC3C,KAAK,cAAc,eAAe,KAAK;EACvC,KAAK,WAAW,YAAY,KAAK;EACjC,KAAK,MAAM;EACX,KAAK,SAAS,UAAU,KAAK;EAC7B,KAAK,0BACH,2BAA2B,KAAK;CACpC;;;;;;;;CASA,MAAM,kBACJ,UACA,iBACiB;EACjB,MAAM,WAAW,gBAAgB,UAAU,KAAK,aAAa,KAAK,QAAQ;EAE1E,OAAO,MAAM,IADK,SAAS;GAAE,KAAK,KAAK;GAAK,QAAQ,KAAK;EAAO,CAC/C,CAAC,CAAC,QAAQ;GACzB,SAAS;GACT,WAAW;EACb,CAAC;CACH;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,IAAa,4BAAb,cAA+C,8BAA8B;CAC3E,SAAS;CAET,YAAY,QAAwC;EAClD,MAAM,MAAM;CACd;CAEA,IAAI,aAAa;EACf,OAAO,CAAC,KAAK,SAAS;CACxB;;;;;CAMA,MAAM,oBAAoB,GAA0C;EAClE,IAAI,KAAK,gBAIP,OAAO,GAFJ,KAAK,YAAY,CAAC,IAAI,KAAK,wBAAwB,KAAK,MAAM,CAAC,EAEtD;EAGd,OAAO,GADW,KAAK,YAAY,KAAK,OAC5B;CACd;;;;;;;CAQA,MAAM,YACJ,aACA,cACe;EACf,MAAM,MAAM,YAAY,aAAa,YAAY;EACjD,MAAM,WAAW,MAAM,KAAK,YAAY,YAAY;EACpD,KAAK,SAAS,MAAM,KAAK,kBAAkB,SAAS,MAAM,EAAE,GAAG,KAAK,MAAM;CAC5E;;;;;CAMA,MAAM,QAAQ;EACZ,MAAM,MAAM,MAAM;EAClB,KAAK,SAAS;CAChB;AACF"}
|