langchain 0.3.31 → 1.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/rolldown_runtime.cjs +38 -0
- package/dist/_virtual/rolldown_runtime.js +34 -0
- package/dist/agents/ReactAgent.cjs +247 -0
- package/dist/agents/ReactAgent.cjs.map +1 -0
- package/dist/agents/ReactAgent.d.cts +68 -0
- package/dist/agents/ReactAgent.d.cts.map +1 -0
- package/dist/agents/ReactAgent.d.ts +68 -0
- package/dist/agents/ReactAgent.d.ts.map +1 -0
- package/dist/agents/ReactAgent.js +246 -0
- package/dist/agents/ReactAgent.js.map +1 -0
- package/dist/agents/RunnableCallable.cjs +30 -0
- package/dist/agents/RunnableCallable.cjs.map +1 -0
- package/dist/agents/RunnableCallable.d.cts +34 -0
- package/dist/agents/RunnableCallable.d.cts.map +1 -0
- package/dist/agents/RunnableCallable.d.ts +34 -0
- package/dist/agents/RunnableCallable.d.ts.map +1 -0
- package/dist/agents/RunnableCallable.js +29 -0
- package/dist/agents/RunnableCallable.js.map +1 -0
- package/dist/agents/annotation.cjs +29 -0
- package/dist/agents/annotation.cjs.map +1 -0
- package/dist/agents/annotation.d.cts +38 -0
- package/dist/agents/annotation.d.cts.map +1 -0
- package/dist/agents/annotation.d.ts +38 -0
- package/dist/agents/annotation.d.ts.map +1 -0
- package/dist/agents/annotation.js +28 -0
- package/dist/agents/annotation.js.map +1 -0
- package/dist/agents/constants.cjs +7 -0
- package/dist/agents/constants.cjs.map +1 -0
- package/dist/agents/constants.js +6 -0
- package/dist/agents/constants.js.map +1 -0
- package/dist/agents/errors.cjs +49 -0
- package/dist/agents/errors.cjs.map +1 -0
- package/dist/agents/errors.d.cts +25 -0
- package/dist/agents/errors.d.cts.map +1 -0
- package/dist/agents/errors.d.ts +25 -0
- package/dist/agents/errors.d.ts.map +1 -0
- package/dist/agents/errors.js +45 -0
- package/dist/agents/errors.js.map +1 -0
- package/dist/agents/index.cjs +16 -59
- package/dist/agents/index.cjs.map +1 -0
- package/dist/agents/index.d.cts +98 -0
- package/dist/agents/index.d.cts.map +1 -0
- package/dist/agents/index.d.ts +98 -20
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +14 -19
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/interrupt.cjs +2 -0
- package/dist/agents/interrupt.d.cts +79 -0
- package/dist/agents/interrupt.d.cts.map +1 -0
- package/dist/agents/interrupt.d.ts +82 -0
- package/dist/agents/interrupt.d.ts.map +1 -0
- package/dist/agents/interrupt.js +1 -0
- package/dist/agents/nodes/AgentNode.cjs +266 -0
- package/dist/agents/nodes/AgentNode.cjs.map +1 -0
- package/dist/agents/nodes/AgentNode.js +265 -0
- package/dist/agents/nodes/AgentNode.js.map +1 -0
- package/dist/agents/nodes/ToolNode.cjs +169 -0
- package/dist/agents/nodes/ToolNode.cjs.map +1 -0
- package/dist/agents/nodes/ToolNode.d.cts +98 -0
- package/dist/agents/nodes/ToolNode.d.cts.map +1 -0
- package/dist/agents/nodes/ToolNode.d.ts +98 -0
- package/dist/agents/nodes/ToolNode.d.ts.map +1 -0
- package/dist/agents/nodes/ToolNode.js +168 -0
- package/dist/agents/nodes/ToolNode.js.map +1 -0
- package/dist/agents/nodes/utils.cjs +17 -0
- package/dist/agents/nodes/utils.cjs.map +1 -0
- package/dist/agents/nodes/utils.js +16 -0
- package/dist/agents/nodes/utils.js.map +1 -0
- package/dist/agents/responses.cjs +167 -0
- package/dist/agents/responses.cjs.map +1 -0
- package/dist/agents/responses.d.cts +121 -0
- package/dist/agents/responses.d.cts.map +1 -0
- package/dist/agents/responses.d.ts +121 -0
- package/dist/agents/responses.d.ts.map +1 -0
- package/dist/agents/responses.js +162 -0
- package/dist/agents/responses.js.map +1 -0
- package/dist/agents/types.d.cts +261 -0
- package/dist/agents/types.d.cts.map +1 -0
- package/dist/agents/types.d.ts +252 -84
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/utils.cjs +254 -0
- package/dist/agents/utils.cjs.map +1 -0
- package/dist/agents/utils.js +246 -0
- package/dist/agents/utils.js.map +1 -0
- package/dist/agents/withAgentName.cjs +39 -0
- package/dist/agents/withAgentName.cjs.map +1 -0
- package/dist/agents/withAgentName.js +38 -0
- package/dist/agents/withAgentName.js.map +1 -0
- package/dist/chains/analyze_documents_chain.cjs +81 -97
- package/dist/chains/analyze_documents_chain.cjs.map +1 -0
- package/dist/chains/analyze_documents_chain.d.cts +58 -0
- package/dist/chains/analyze_documents_chain.d.cts.map +1 -0
- package/dist/chains/analyze_documents_chain.d.ts +27 -21
- package/dist/chains/analyze_documents_chain.d.ts.map +1 -0
- package/dist/chains/analyze_documents_chain.js +80 -93
- package/dist/chains/analyze_documents_chain.js.map +1 -0
- package/dist/chains/api/api_chain.cjs +98 -118
- package/dist/chains/api/api_chain.cjs.map +1 -0
- package/dist/chains/api/api_chain.d.cts +63 -0
- package/dist/chains/api/api_chain.d.cts.map +1 -0
- package/dist/chains/api/api_chain.d.ts +47 -41
- package/dist/chains/api/api_chain.d.ts.map +1 -0
- package/dist/chains/api/api_chain.js +97 -113
- package/dist/chains/api/api_chain.js.map +1 -0
- package/dist/chains/api/prompts.cjs +22 -13
- package/dist/chains/api/prompts.cjs.map +1 -0
- package/dist/chains/api/prompts.js +19 -9
- package/dist/chains/api/prompts.js.map +1 -0
- package/dist/chains/base.cjs +178 -232
- package/dist/chains/base.cjs.map +1 -0
- package/dist/chains/base.d.cts +88 -0
- package/dist/chains/base.d.cts.map +1 -0
- package/dist/chains/base.d.ts +81 -76
- package/dist/chains/base.d.ts.map +1 -0
- package/dist/chains/base.js +177 -195
- package/dist/chains/base.js.map +1 -0
- package/dist/chains/chat_vector_db_chain.cjs +116 -163
- package/dist/chains/chat_vector_db_chain.cjs.map +1 -0
- package/dist/chains/chat_vector_db_chain.d.cts +62 -0
- package/dist/chains/chat_vector_db_chain.d.cts.map +1 -0
- package/dist/chains/chat_vector_db_chain.d.ts +53 -47
- package/dist/chains/chat_vector_db_chain.d.ts.map +1 -0
- package/dist/chains/chat_vector_db_chain.js +113 -157
- package/dist/chains/chat_vector_db_chain.js.map +1 -0
- package/dist/chains/combine_docs_chain.cjs +271 -397
- package/dist/chains/combine_docs_chain.cjs.map +1 -0
- package/dist/chains/combine_docs_chain.d.cts +126 -0
- package/dist/chains/combine_docs_chain.d.cts.map +1 -0
- package/dist/chains/combine_docs_chain.d.ts +92 -86
- package/dist/chains/combine_docs_chain.d.ts.map +1 -0
- package/dist/chains/combine_docs_chain.js +267 -390
- package/dist/chains/combine_docs_chain.js.map +1 -0
- package/dist/chains/combine_documents/base.cjs +21 -18
- package/dist/chains/combine_documents/base.cjs.map +1 -0
- package/dist/chains/combine_documents/base.js +16 -13
- package/dist/chains/combine_documents/base.js.map +1 -0
- package/dist/chains/combine_documents/index.cjs +16 -5
- package/dist/chains/combine_documents/index.cjs.map +1 -0
- package/dist/chains/combine_documents/index.d.cts +2 -0
- package/dist/chains/combine_documents/index.d.ts +2 -1
- package/dist/chains/combine_documents/index.js +10 -1
- package/dist/chains/combine_documents/index.js.map +1 -0
- package/dist/chains/combine_documents/reduce.cjs +66 -64
- package/dist/chains/combine_documents/reduce.cjs.map +1 -0
- package/dist/chains/combine_documents/reduce.d.cts +36 -0
- package/dist/chains/combine_documents/reduce.d.cts.map +1 -0
- package/dist/chains/combine_documents/reduce.d.ts +10 -2
- package/dist/chains/combine_documents/reduce.d.ts.map +1 -0
- package/dist/chains/combine_documents/reduce.js +60 -61
- package/dist/chains/combine_documents/reduce.js.map +1 -0
- package/dist/chains/combine_documents/stuff.cjs +39 -39
- package/dist/chains/combine_documents/stuff.cjs.map +1 -0
- package/dist/chains/combine_documents/stuff.d.cts +40 -0
- package/dist/chains/combine_documents/stuff.d.cts.map +1 -0
- package/dist/chains/combine_documents/stuff.d.ts +21 -9
- package/dist/chains/combine_documents/stuff.d.ts.map +1 -0
- package/dist/chains/combine_documents/stuff.js +38 -36
- package/dist/chains/combine_documents/stuff.js.map +1 -0
- package/dist/chains/constitutional_ai/constitutional_chain.cjs +129 -159
- package/dist/chains/constitutional_ai/constitutional_chain.cjs.map +1 -0
- package/dist/chains/constitutional_ai/constitutional_chain.d.cts +79 -0
- package/dist/chains/constitutional_ai/constitutional_chain.d.cts.map +1 -0
- package/dist/chains/constitutional_ai/constitutional_chain.d.ts +46 -40
- package/dist/chains/constitutional_ai/constitutional_chain.d.ts.map +1 -0
- package/dist/chains/constitutional_ai/constitutional_chain.js +127 -153
- package/dist/chains/constitutional_ai/constitutional_chain.js.map +1 -0
- package/dist/chains/constitutional_ai/constitutional_principle.cjs +320 -332
- package/dist/chains/constitutional_ai/constitutional_principle.cjs.map +1 -0
- package/dist/chains/constitutional_ai/constitutional_principle.d.cts +50 -0
- package/dist/chains/constitutional_ai/constitutional_principle.d.cts.map +1 -0
- package/dist/chains/constitutional_ai/constitutional_principle.d.ts +20 -10
- package/dist/chains/constitutional_ai/constitutional_principle.d.ts.map +1 -0
- package/dist/chains/constitutional_ai/constitutional_principle.js +318 -328
- package/dist/chains/constitutional_ai/constitutional_principle.js.map +1 -0
- package/dist/chains/constitutional_ai/constitutional_prompts.cjs +68 -59
- package/dist/chains/constitutional_ai/constitutional_prompts.cjs.map +1 -0
- package/dist/chains/constitutional_ai/constitutional_prompts.js +65 -55
- package/dist/chains/constitutional_ai/constitutional_prompts.js.map +1 -0
- package/dist/chains/conversation.cjs +43 -40
- package/dist/chains/conversation.cjs.map +1 -0
- package/dist/chains/conversation.d.cts +34 -0
- package/dist/chains/conversation.d.cts.map +1 -0
- package/dist/chains/conversation.d.ts +14 -4
- package/dist/chains/conversation.d.ts.map +1 -0
- package/dist/chains/conversation.js +40 -35
- package/dist/chains/conversation.js.map +1 -0
- package/dist/chains/conversational_retrieval_chain.cjs +210 -277
- package/dist/chains/conversational_retrieval_chain.cjs.map +1 -0
- package/dist/chains/conversational_retrieval_chain.d.cts +152 -0
- package/dist/chains/conversational_retrieval_chain.d.cts.map +1 -0
- package/dist/chains/conversational_retrieval_chain.d.ts +66 -60
- package/dist/chains/conversational_retrieval_chain.d.ts.map +1 -0
- package/dist/chains/conversational_retrieval_chain.js +207 -271
- package/dist/chains/conversational_retrieval_chain.js.map +1 -0
- package/dist/chains/graph_qa/cypher.cjs +130 -178
- package/dist/chains/graph_qa/cypher.cjs.map +1 -0
- package/dist/chains/graph_qa/cypher.d.cts +76 -0
- package/dist/chains/graph_qa/cypher.d.cts.map +1 -0
- package/dist/chains/graph_qa/cypher.d.ts +46 -38
- package/dist/chains/graph_qa/cypher.d.ts.map +1 -0
- package/dist/chains/graph_qa/cypher.js +122 -173
- package/dist/chains/graph_qa/cypher.js.map +1 -0
- package/dist/chains/graph_qa/prompts.cjs +15 -10
- package/dist/chains/graph_qa/prompts.cjs.map +1 -0
- package/dist/chains/graph_qa/prompts.js +12 -6
- package/dist/chains/graph_qa/prompts.js.map +1 -0
- package/dist/chains/history_aware_retriever.cjs +53 -51
- package/dist/chains/history_aware_retriever.cjs.map +1 -0
- package/dist/chains/history_aware_retriever.d.cts +64 -0
- package/dist/chains/history_aware_retriever.d.cts.map +1 -0
- package/dist/chains/history_aware_retriever.d.ts +32 -22
- package/dist/chains/history_aware_retriever.d.ts.map +1 -0
- package/dist/chains/history_aware_retriever.js +46 -47
- package/dist/chains/history_aware_retriever.js.map +1 -0
- package/dist/chains/index.cjs +109 -62
- package/dist/chains/index.cjs.map +1 -0
- package/dist/chains/index.d.cts +26 -0
- package/dist/chains/index.d.ts +26 -25
- package/dist/chains/index.js +69 -24
- package/dist/chains/index.js.map +1 -0
- package/dist/chains/llm_chain.cjs +149 -214
- package/dist/chains/llm_chain.cjs.map +1 -0
- package/dist/chains/llm_chain.d.cts +97 -0
- package/dist/chains/llm_chain.d.cts.map +1 -0
- package/dist/chains/llm_chain.d.ts +69 -64
- package/dist/chains/llm_chain.d.ts.map +1 -0
- package/dist/chains/llm_chain.js +147 -209
- package/dist/chains/llm_chain.js.map +1 -0
- package/dist/chains/load.cjs +42 -33
- package/dist/chains/load.cjs.map +1 -0
- package/dist/chains/load.d.cts +30 -0
- package/dist/chains/load.d.cts.map +1 -0
- package/dist/chains/load.d.ts +8 -1
- package/dist/chains/load.d.ts.map +1 -0
- package/dist/chains/load.js +34 -27
- package/dist/chains/load.js.map +1 -0
- package/dist/chains/openai_functions/base.cjs +133 -137
- package/dist/chains/openai_functions/base.cjs.map +1 -0
- package/dist/chains/openai_functions/base.d.cts +172 -0
- package/dist/chains/openai_functions/base.d.cts.map +1 -0
- package/dist/chains/openai_functions/base.d.ts +59 -41
- package/dist/chains/openai_functions/base.d.ts.map +1 -0
- package/dist/chains/openai_functions/base.js +132 -134
- package/dist/chains/openai_functions/base.js.map +1 -0
- package/dist/chains/openai_functions/extraction.cjs +58 -60
- package/dist/chains/openai_functions/extraction.cjs.map +1 -0
- package/dist/chains/openai_functions/extraction.d.cts +31 -0
- package/dist/chains/openai_functions/extraction.d.cts.map +1 -0
- package/dist/chains/openai_functions/extraction.d.ts +14 -5
- package/dist/chains/openai_functions/extraction.d.ts.map +1 -0
- package/dist/chains/openai_functions/extraction.js +56 -56
- package/dist/chains/openai_functions/extraction.js.map +1 -0
- package/dist/chains/openai_functions/index.cjs +38 -17
- package/dist/chains/openai_functions/index.cjs.map +1 -0
- package/dist/chains/openai_functions/index.d.cts +6 -0
- package/dist/chains/openai_functions/index.d.ts +6 -5
- package/dist/chains/openai_functions/index.js +24 -5
- package/dist/chains/openai_functions/index.js.map +1 -0
- package/dist/chains/openai_functions/openapi.cjs +271 -388
- package/dist/chains/openai_functions/openapi.cjs.map +1 -0
- package/dist/chains/openai_functions/openapi.d.cts +61 -0
- package/dist/chains/openai_functions/openapi.d.cts.map +1 -0
- package/dist/chains/openai_functions/openapi.d.ts +32 -24
- package/dist/chains/openai_functions/openapi.d.ts.map +1 -0
- package/dist/chains/openai_functions/openapi.js +268 -382
- package/dist/chains/openai_functions/openapi.js.map +1 -0
- package/dist/chains/openai_functions/structured_output.cjs +98 -140
- package/dist/chains/openai_functions/structured_output.cjs.map +1 -0
- package/dist/chains/openai_functions/structured_output.d.cts +38 -0
- package/dist/chains/openai_functions/structured_output.d.cts.map +1 -0
- package/dist/chains/openai_functions/structured_output.d.ts +20 -41
- package/dist/chains/openai_functions/structured_output.d.ts.map +1 -0
- package/dist/chains/openai_functions/structured_output.js +96 -134
- package/dist/chains/openai_functions/structured_output.js.map +1 -0
- package/dist/chains/openai_functions/tagging.cjs +59 -59
- package/dist/chains/openai_functions/tagging.cjs.map +1 -0
- package/dist/chains/openai_functions/tagging.d.cts +49 -0
- package/dist/chains/openai_functions/tagging.d.cts.map +1 -0
- package/dist/chains/openai_functions/tagging.d.ts +17 -8
- package/dist/chains/openai_functions/tagging.d.ts.map +1 -0
- package/dist/chains/openai_functions/tagging.js +57 -55
- package/dist/chains/openai_functions/tagging.js.map +1 -0
- package/dist/chains/openai_moderation.cjs +105 -161
- package/dist/chains/openai_moderation.cjs.map +1 -0
- package/dist/chains/openai_moderation.d.cts +74 -0
- package/dist/chains/openai_moderation.d.cts.map +1 -0
- package/dist/chains/openai_moderation.d.ts +34 -28
- package/dist/chains/openai_moderation.d.ts.map +1 -0
- package/dist/chains/openai_moderation.js +103 -156
- package/dist/chains/openai_moderation.js.map +1 -0
- package/dist/chains/query_constructor/index.cjs +136 -145
- package/dist/chains/query_constructor/index.cjs.map +1 -0
- package/dist/chains/query_constructor/index.d.cts +80 -0
- package/dist/chains/query_constructor/index.d.cts.map +1 -0
- package/dist/chains/query_constructor/index.d.ts +57 -49
- package/dist/chains/query_constructor/index.d.ts.map +1 -0
- package/dist/chains/query_constructor/index.js +121 -134
- package/dist/chains/query_constructor/index.js.map +1 -0
- package/dist/chains/query_constructor/ir.cjs +22 -17
- package/dist/chains/query_constructor/ir.cjs.map +1 -0
- package/dist/chains/query_constructor/ir.d.cts +1 -0
- package/dist/chains/query_constructor/ir.d.ts +1 -1
- package/dist/chains/query_constructor/ir.js +12 -1
- package/dist/chains/query_constructor/ir.js.map +1 -0
- package/dist/chains/query_constructor/parser.cjs +78 -123
- package/dist/chains/query_constructor/parser.cjs.map +1 -0
- package/dist/chains/query_constructor/parser.d.cts +43 -0
- package/dist/chains/query_constructor/parser.d.cts.map +1 -0
- package/dist/chains/query_constructor/parser.d.ts +34 -28
- package/dist/chains/query_constructor/parser.d.ts.map +1 -0
- package/dist/chains/query_constructor/parser.js +78 -120
- package/dist/chains/query_constructor/parser.js.map +1 -0
- package/dist/chains/query_constructor/prompt.cjs +39 -31
- package/dist/chains/query_constructor/prompt.cjs.map +1 -0
- package/dist/chains/query_constructor/prompt.d.cts +22 -0
- package/dist/chains/query_constructor/prompt.d.cts.map +1 -0
- package/dist/chains/query_constructor/prompt.d.ts +19 -17
- package/dist/chains/query_constructor/prompt.d.ts.map +1 -0
- package/dist/chains/query_constructor/prompt.js +33 -27
- package/dist/chains/query_constructor/prompt.js.map +1 -0
- package/dist/chains/question_answering/load.cjs +88 -77
- package/dist/chains/question_answering/load.cjs.map +1 -0
- package/dist/chains/question_answering/load.d.cts +72 -0
- package/dist/chains/question_answering/load.d.cts.map +1 -0
- package/dist/chains/question_answering/load.d.ts +31 -24
- package/dist/chains/question_answering/load.d.ts.map +1 -0
- package/dist/chains/question_answering/load.js +87 -72
- package/dist/chains/question_answering/load.js.map +1 -0
- package/dist/chains/question_answering/map_reduce_prompts.cjs +18 -30
- package/dist/chains/question_answering/map_reduce_prompts.cjs.map +1 -0
- package/dist/chains/question_answering/map_reduce_prompts.js +16 -27
- package/dist/chains/question_answering/map_reduce_prompts.js.map +1 -0
- package/dist/chains/question_answering/refine_prompts.cjs +30 -33
- package/dist/chains/question_answering/refine_prompts.cjs.map +1 -0
- package/dist/chains/question_answering/refine_prompts.js +28 -30
- package/dist/chains/question_answering/refine_prompts.js.map +1 -0
- package/dist/chains/question_answering/stuff_prompts.cjs +15 -15
- package/dist/chains/question_answering/stuff_prompts.cjs.map +1 -0
- package/dist/chains/question_answering/stuff_prompts.js +14 -12
- package/dist/chains/question_answering/stuff_prompts.js.map +1 -0
- package/dist/chains/retrieval.cjs +51 -55
- package/dist/chains/retrieval.cjs.map +1 -0
- package/dist/chains/retrieval.d.cts +77 -0
- package/dist/chains/retrieval.d.cts.map +1 -0
- package/dist/chains/retrieval.d.ts +44 -32
- package/dist/chains/retrieval.d.ts.map +1 -0
- package/dist/chains/retrieval.js +45 -52
- package/dist/chains/retrieval.js.map +1 -0
- package/dist/chains/retrieval_qa.cjs +104 -125
- package/dist/chains/retrieval_qa.cjs.map +1 -0
- package/dist/chains/retrieval_qa.d.cts +81 -0
- package/dist/chains/retrieval_qa.d.cts.map +1 -0
- package/dist/chains/retrieval_qa.d.ts +40 -34
- package/dist/chains/retrieval_qa.d.ts.map +1 -0
- package/dist/chains/retrieval_qa.js +104 -121
- package/dist/chains/retrieval_qa.js.map +1 -0
- package/dist/chains/router/llm_router.cjs +48 -45
- package/dist/chains/router/llm_router.cjs.map +1 -0
- package/dist/chains/router/llm_router.d.cts +54 -0
- package/dist/chains/router/llm_router.d.cts.map +1 -0
- package/dist/chains/router/llm_router.d.ts +34 -28
- package/dist/chains/router/llm_router.d.ts.map +1 -0
- package/dist/chains/router/llm_router.js +48 -41
- package/dist/chains/router/llm_router.js.map +1 -0
- package/dist/chains/router/multi_prompt.cjs +114 -128
- package/dist/chains/router/multi_prompt.cjs.map +1 -0
- package/dist/chains/router/multi_prompt.d.cts +76 -0
- package/dist/chains/router/multi_prompt.d.cts.map +1 -0
- package/dist/chains/router/multi_prompt.d.ts +47 -33
- package/dist/chains/router/multi_prompt.d.ts.map +1 -0
- package/dist/chains/router/multi_prompt.js +110 -121
- package/dist/chains/router/multi_prompt.js.map +1 -0
- package/dist/chains/router/multi_prompt_prompt.cjs +4 -24
- package/dist/chains/router/multi_prompt_prompt.cjs.map +1 -0
- package/dist/chains/router/multi_prompt_prompt.js +6 -23
- package/dist/chains/router/multi_prompt_prompt.js.map +1 -0
- package/dist/chains/router/multi_retrieval_prompt.cjs +4 -24
- package/dist/chains/router/multi_retrieval_prompt.cjs.map +1 -0
- package/dist/chains/router/multi_retrieval_prompt.js +6 -23
- package/dist/chains/router/multi_retrieval_prompt.js.map +1 -0
- package/dist/chains/router/multi_retrieval_qa.cjs +135 -151
- package/dist/chains/router/multi_retrieval_qa.cjs.map +1 -0
- package/dist/chains/router/multi_retrieval_qa.d.cts +100 -0
- package/dist/chains/router/multi_retrieval_qa.d.cts.map +1 -0
- package/dist/chains/router/multi_retrieval_qa.d.ts +57 -43
- package/dist/chains/router/multi_retrieval_qa.d.ts.map +1 -0
- package/dist/chains/router/multi_retrieval_qa.js +131 -144
- package/dist/chains/router/multi_retrieval_qa.js.map +1 -0
- package/dist/chains/router/multi_route.cjs +66 -96
- package/dist/chains/router/multi_route.cjs.map +1 -0
- package/dist/chains/router/multi_route.d.cts +69 -0
- package/dist/chains/router/multi_route.d.cts.map +1 -0
- package/dist/chains/router/multi_route.d.ts +36 -31
- package/dist/chains/router/multi_route.d.ts.map +1 -0
- package/dist/chains/router/multi_route.js +66 -92
- package/dist/chains/router/multi_route.js.map +1 -0
- package/dist/chains/router/utils.cjs +16 -31
- package/dist/chains/router/utils.cjs.map +1 -0
- package/dist/chains/router/utils.js +16 -29
- package/dist/chains/router/utils.js.map +1 -0
- package/dist/chains/sequential_chain.cjs +247 -316
- package/dist/chains/sequential_chain.cjs.map +1 -0
- package/dist/chains/sequential_chain.d.cts +158 -0
- package/dist/chains/sequential_chain.d.cts.map +1 -0
- package/dist/chains/sequential_chain.d.ts +54 -48
- package/dist/chains/sequential_chain.d.ts.map +1 -0
- package/dist/chains/sequential_chain.js +246 -311
- package/dist/chains/sequential_chain.js.map +1 -0
- package/dist/chains/serde.d.cts +156 -0
- package/dist/chains/serde.d.cts.map +1 -0
- package/dist/chains/serde.d.ts +59 -53
- package/dist/chains/serde.d.ts.map +1 -0
- package/dist/chains/sql_db/index.cjs +35 -14
- package/dist/chains/sql_db/index.cjs.map +1 -0
- package/dist/chains/sql_db/index.d.cts +3 -0
- package/dist/chains/sql_db/index.d.ts +3 -2
- package/dist/chains/sql_db/index.js +21 -2
- package/dist/chains/sql_db/index.js.map +1 -0
- package/dist/chains/sql_db/sql_db_chain.cjs +189 -263
- package/dist/chains/sql_db/sql_db_chain.cjs.map +1 -0
- package/dist/chains/sql_db/sql_db_chain.d.cts +124 -0
- package/dist/chains/sql_db/sql_db_chain.d.cts.map +1 -0
- package/dist/chains/sql_db/sql_db_chain.d.ts +62 -53
- package/dist/chains/sql_db/sql_db_chain.d.ts.map +1 -0
- package/dist/chains/sql_db/sql_db_chain.js +185 -256
- package/dist/chains/sql_db/sql_db_chain.js.map +1 -0
- package/dist/chains/sql_db/sql_db_prompt.cjs +78 -33
- package/dist/chains/sql_db/sql_db_prompt.cjs.map +1 -0
- package/dist/chains/sql_db/sql_db_prompt.d.cts +44 -0
- package/dist/chains/sql_db/sql_db_prompt.d.cts.map +1 -0
- package/dist/chains/sql_db/sql_db_prompt.d.ts +37 -38
- package/dist/chains/sql_db/sql_db_prompt.d.ts.map +1 -0
- package/dist/chains/sql_db/sql_db_prompt.js +69 -29
- package/dist/chains/sql_db/sql_db_prompt.js.map +1 -0
- package/dist/chains/summarization/load.cjs +71 -57
- package/dist/chains/summarization/load.cjs.map +1 -0
- package/dist/chains/summarization/load.d.cts +33 -0
- package/dist/chains/summarization/load.d.cts.map +1 -0
- package/dist/chains/summarization/load.d.ts +22 -16
- package/dist/chains/summarization/load.d.ts.map +1 -0
- package/dist/chains/summarization/load.js +70 -52
- package/dist/chains/summarization/load.js.map +1 -0
- package/dist/chains/summarization/refine_prompts.cjs +11 -7
- package/dist/chains/summarization/refine_prompts.cjs.map +1 -0
- package/dist/chains/summarization/refine_prompts.js +9 -3
- package/dist/chains/summarization/refine_prompts.js.map +1 -0
- package/dist/chains/summarization/stuff_prompts.cjs +11 -8
- package/dist/chains/summarization/stuff_prompts.cjs.map +1 -0
- package/dist/chains/summarization/stuff_prompts.js +9 -4
- package/dist/chains/summarization/stuff_prompts.js.map +1 -0
- package/dist/chains/transform.cjs +41 -54
- package/dist/chains/transform.cjs.map +1 -0
- package/dist/chains/transform.d.cts +44 -0
- package/dist/chains/transform.d.cts.map +1 -0
- package/dist/chains/transform.d.ts +22 -16
- package/dist/chains/transform.d.ts.map +1 -0
- package/dist/chains/transform.js +41 -50
- package/dist/chains/transform.js.map +1 -0
- package/dist/chains/vector_db_qa.cjs +93 -122
- package/dist/chains/vector_db_qa.cjs.map +1 -0
- package/dist/chains/vector_db_qa.d.cts +66 -0
- package/dist/chains/vector_db_qa.d.cts.map +1 -0
- package/dist/chains/vector_db_qa.d.ts +43 -37
- package/dist/chains/vector_db_qa.d.ts.map +1 -0
- package/dist/chains/vector_db_qa.js +92 -117
- package/dist/chains/vector_db_qa.js.map +1 -0
- package/dist/chat_models/universal.cjs +533 -679
- package/dist/chat_models/universal.cjs.map +1 -0
- package/dist/chat_models/universal.d.cts +213 -0
- package/dist/chat_models/universal.d.cts.map +1 -0
- package/dist/chat_models/universal.d.ts +187 -94
- package/dist/chat_models/universal.d.ts.map +1 -0
- package/dist/chat_models/universal.js +525 -642
- package/dist/chat_models/universal.js.map +1 -0
- package/dist/document.cjs +21 -5
- package/dist/document.cjs.map +1 -0
- package/dist/document.d.cts +2 -0
- package/dist/document.d.ts +2 -1
- package/dist/document.js +10 -1
- package/dist/document.js.map +1 -0
- package/dist/document_loaders/base.cjs +22 -17
- package/dist/document_loaders/base.cjs.map +1 -0
- package/dist/document_loaders/base.d.cts +1 -0
- package/dist/document_loaders/base.d.ts +1 -1
- package/dist/document_loaders/base.js +12 -1
- package/dist/document_loaders/base.js.map +1 -0
- package/dist/document_loaders/fs/buffer.cjs +67 -95
- package/dist/document_loaders/fs/buffer.cjs.map +1 -0
- package/dist/document_loaders/fs/buffer.d.cts +46 -0
- package/dist/document_loaders/fs/buffer.d.cts.map +1 -0
- package/dist/document_loaders/fs/buffer.d.ts +37 -31
- package/dist/document_loaders/fs/buffer.d.ts.map +1 -0
- package/dist/document_loaders/fs/buffer.js +61 -58
- package/dist/document_loaders/fs/buffer.js.map +1 -0
- package/dist/document_loaders/fs/directory.cjs +112 -164
- package/dist/document_loaders/fs/directory.cjs.map +1 -0
- package/dist/document_loaders/fs/directory.d.cts +77 -0
- package/dist/document_loaders/fs/directory.d.cts.map +1 -0
- package/dist/document_loaders/fs/directory.d.ts +47 -39
- package/dist/document_loaders/fs/directory.d.ts.map +1 -0
- package/dist/document_loaders/fs/directory.js +106 -128
- package/dist/document_loaders/fs/directory.js.map +1 -0
- package/dist/document_loaders/fs/json.cjs +119 -144
- package/dist/document_loaders/fs/json.cjs.map +1 -0
- package/dist/document_loaders/fs/json.d.cts +65 -0
- package/dist/document_loaders/fs/json.d.cts.map +1 -0
- package/dist/document_loaders/fs/json.d.ts +48 -42
- package/dist/document_loaders/fs/json.d.ts.map +1 -0
- package/dist/document_loaders/fs/json.js +112 -136
- package/dist/document_loaders/fs/json.js.map +1 -0
- package/dist/document_loaders/fs/multi_file.cjs +80 -96
- package/dist/document_loaders/fs/multi_file.cjs.map +1 -0
- package/dist/document_loaders/fs/multi_file.d.cts +43 -0
- package/dist/document_loaders/fs/multi_file.d.cts.map +1 -0
- package/dist/document_loaders/fs/multi_file.d.ts +23 -17
- package/dist/document_loaders/fs/multi_file.d.ts.map +1 -0
- package/dist/document_loaders/fs/multi_file.js +73 -91
- package/dist/document_loaders/fs/multi_file.js.map +1 -0
- package/dist/document_loaders/fs/text.cjs +99 -129
- package/dist/document_loaders/fs/text.cjs.map +1 -0
- package/dist/document_loaders/fs/text.d.cts +57 -0
- package/dist/document_loaders/fs/text.d.cts.map +1 -0
- package/dist/document_loaders/fs/text.d.ts +42 -36
- package/dist/document_loaders/fs/text.d.ts.map +1 -0
- package/dist/document_loaders/fs/text.js +92 -91
- package/dist/document_loaders/fs/text.js.map +1 -0
- package/dist/embeddings/cache_backed.cjs +138 -141
- package/dist/embeddings/cache_backed.cjs.map +1 -0
- package/dist/embeddings/cache_backed.d.cts +107 -0
- package/dist/embeddings/cache_backed.d.cts.map +1 -0
- package/dist/embeddings/cache_backed.d.ts +53 -47
- package/dist/embeddings/cache_backed.d.ts.map +1 -0
- package/dist/embeddings/cache_backed.js +132 -137
- package/dist/embeddings/cache_backed.js.map +1 -0
- package/dist/embeddings/fake.cjs +22 -17
- package/dist/embeddings/fake.cjs.map +1 -0
- package/dist/embeddings/fake.d.cts +1 -0
- package/dist/embeddings/fake.d.ts +1 -1
- package/dist/embeddings/fake.js +12 -1
- package/dist/embeddings/fake.js.map +1 -0
- package/dist/evaluation/agents/index.cjs +1 -17
- package/dist/evaluation/agents/index.js +1 -1
- package/dist/evaluation/agents/prompt.cjs +19 -18
- package/dist/evaluation/agents/prompt.cjs.map +1 -0
- package/dist/evaluation/agents/prompt.js +17 -15
- package/dist/evaluation/agents/prompt.js.map +1 -0
- package/dist/evaluation/agents/trajectory.cjs +124 -181
- package/dist/evaluation/agents/trajectory.cjs.map +1 -0
- package/dist/evaluation/agents/trajectory.d.cts +61 -0
- package/dist/evaluation/agents/trajectory.d.cts.map +1 -0
- package/dist/evaluation/agents/trajectory.d.ts +48 -42
- package/dist/evaluation/agents/trajectory.d.ts.map +1 -0
- package/dist/evaluation/agents/trajectory.js +121 -175
- package/dist/evaluation/agents/trajectory.js.map +1 -0
- package/dist/evaluation/base.cjs +159 -264
- package/dist/evaluation/base.cjs.map +1 -0
- package/dist/evaluation/base.d.cts +240 -0
- package/dist/evaluation/base.d.cts.map +1 -0
- package/dist/evaluation/base.d.ts +170 -163
- package/dist/evaluation/base.d.ts.map +1 -0
- package/dist/evaluation/base.js +156 -255
- package/dist/evaluation/base.js.map +1 -0
- package/dist/evaluation/comparison/index.cjs +1 -17
- package/dist/evaluation/comparison/index.js +1 -1
- package/dist/evaluation/comparison/pairwise.cjs +172 -238
- package/dist/evaluation/comparison/pairwise.cjs.map +1 -0
- package/dist/evaluation/comparison/pairwise.d.cts +56 -0
- package/dist/evaluation/comparison/pairwise.d.cts.map +1 -0
- package/dist/evaluation/comparison/pairwise.d.ts +39 -33
- package/dist/evaluation/comparison/pairwise.d.ts.map +1 -0
- package/dist/evaluation/comparison/pairwise.js +168 -231
- package/dist/evaluation/comparison/pairwise.js.map +1 -0
- package/dist/evaluation/comparison/prompt.cjs +26 -23
- package/dist/evaluation/comparison/prompt.cjs.map +1 -0
- package/dist/evaluation/comparison/prompt.js +23 -19
- package/dist/evaluation/comparison/prompt.js.map +1 -0
- package/dist/evaluation/criteria/criteria.cjs +159 -254
- package/dist/evaluation/criteria/criteria.cjs.map +1 -0
- package/dist/evaluation/criteria/criteria.d.cts +85 -0
- package/dist/evaluation/criteria/criteria.d.cts.map +1 -0
- package/dist/evaluation/criteria/criteria.d.ts +69 -57
- package/dist/evaluation/criteria/criteria.d.ts.map +1 -0
- package/dist/evaluation/criteria/criteria.js +155 -247
- package/dist/evaluation/criteria/criteria.js.map +1 -0
- package/dist/evaluation/criteria/index.cjs +1 -17
- package/dist/evaluation/criteria/index.js +1 -1
- package/dist/evaluation/criteria/prompt.cjs +24 -10
- package/dist/evaluation/criteria/prompt.cjs.map +1 -0
- package/dist/evaluation/criteria/prompt.js +21 -6
- package/dist/evaluation/criteria/prompt.js.map +1 -0
- package/dist/evaluation/embedding_distance/base.cjs +101 -156
- package/dist/evaluation/embedding_distance/base.cjs.map +1 -0
- package/dist/evaluation/embedding_distance/base.d.cts +82 -0
- package/dist/evaluation/embedding_distance/base.d.cts.map +1 -0
- package/dist/evaluation/embedding_distance/base.d.ts +46 -41
- package/dist/evaluation/embedding_distance/base.d.ts.map +1 -0
- package/dist/evaluation/embedding_distance/base.js +97 -149
- package/dist/evaluation/embedding_distance/base.js.map +1 -0
- package/dist/evaluation/embedding_distance/index.cjs +1 -17
- package/dist/evaluation/embedding_distance/index.js +1 -1
- package/dist/evaluation/index.cjs +54 -23
- package/dist/evaluation/index.cjs.map +1 -0
- package/dist/evaluation/index.d.cts +8 -0
- package/dist/evaluation/index.d.ts +8 -7
- package/dist/evaluation/index.js +35 -7
- package/dist/evaluation/index.js.map +1 -0
- package/dist/evaluation/loader.cjs +59 -56
- package/dist/evaluation/loader.cjs.map +1 -0
- package/dist/evaluation/loader.d.cts +32 -0
- package/dist/evaluation/loader.d.cts.map +1 -0
- package/dist/evaluation/loader.d.ts +22 -17
- package/dist/evaluation/loader.d.ts.map +1 -0
- package/dist/evaluation/loader.js +58 -53
- package/dist/evaluation/loader.js.map +1 -0
- package/dist/evaluation/qa/eval_chain.cjs +39 -36
- package/dist/evaluation/qa/eval_chain.cjs.map +1 -0
- package/dist/evaluation/qa/eval_chain.d.cts +22 -0
- package/dist/evaluation/qa/eval_chain.d.cts.map +1 -0
- package/dist/evaluation/qa/eval_chain.d.ts +18 -13
- package/dist/evaluation/qa/eval_chain.d.ts.map +1 -0
- package/dist/evaluation/qa/eval_chain.js +39 -32
- package/dist/evaluation/qa/eval_chain.js.map +1 -0
- package/dist/evaluation/qa/index.cjs +1 -5
- package/dist/evaluation/qa/index.js +1 -1
- package/dist/evaluation/qa/prompt.cjs +15 -22
- package/dist/evaluation/qa/prompt.cjs.map +1 -0
- package/dist/evaluation/qa/prompt.js +13 -18
- package/dist/evaluation/qa/prompt.js.map +1 -0
- package/dist/evaluation/types.d.cts +40 -0
- package/dist/evaluation/types.d.cts.map +1 -0
- package/dist/evaluation/types.d.ts +38 -33
- package/dist/evaluation/types.d.ts.map +1 -0
- package/dist/hub/base.cjs +100 -150
- package/dist/hub/base.cjs.map +1 -0
- package/dist/hub/base.d.cts +29 -0
- package/dist/hub/base.d.cts.map +1 -0
- package/dist/hub/base.d.ts +20 -22
- package/dist/hub/base.d.ts.map +1 -0
- package/dist/hub/base.js +98 -146
- package/dist/hub/base.js.map +1 -0
- package/dist/hub/index.cjs +46 -50
- package/dist/hub/index.cjs.map +1 -0
- package/dist/hub/index.d.cts +32 -0
- package/dist/hub/index.d.cts.map +1 -0
- package/dist/hub/index.d.ts +14 -8
- package/dist/hub/index.d.ts.map +1 -0
- package/dist/hub/index.js +45 -46
- package/dist/hub/index.js.map +1 -0
- package/dist/hub/node.cjs +32 -86
- package/dist/hub/node.cjs.map +1 -0
- package/dist/hub/node.d.cts +23 -0
- package/dist/hub/node.d.cts.map +1 -0
- package/dist/hub/node.d.ts +11 -6
- package/dist/hub/node.d.ts.map +1 -0
- package/dist/hub/node.js +31 -50
- package/dist/hub/node.js.map +1 -0
- package/dist/index.cjs +118 -2
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +36 -2
- package/dist/index.js.map +1 -0
- package/dist/langchain-core/dist/load/map_keys.d.cts +10 -0
- package/dist/langchain-core/dist/load/map_keys.d.cts.map +1 -0
- package/dist/langchain-core/dist/load/serializable.d.cts +82 -0
- package/dist/langchain-core/dist/load/serializable.d.cts.map +1 -0
- package/dist/langchain-core/dist/messages/base.d.cts +134 -0
- package/dist/langchain-core/dist/messages/base.d.cts.map +1 -0
- package/dist/langchain-core/dist/messages/content/base.d.cts +22 -0
- package/dist/langchain-core/dist/messages/content/base.d.cts.map +1 -0
- package/dist/langchain-core/dist/messages/content/data.d.cts +96 -0
- package/dist/langchain-core/dist/messages/content/data.d.cts.map +1 -0
- package/dist/langchain-core/dist/messages/content/index.d.cts +102 -0
- package/dist/langchain-core/dist/messages/content/index.d.cts.map +1 -0
- package/dist/langchain-core/dist/messages/content/multimodal.d.cts +110 -0
- package/dist/langchain-core/dist/messages/content/multimodal.d.cts.map +1 -0
- package/dist/langchain-core/dist/messages/content/tools.d.cts +153 -0
- package/dist/langchain-core/dist/messages/content/tools.d.cts.map +1 -0
- package/dist/langchain-core/dist/prompt_values.d.cts +13 -0
- package/dist/langchain-core/dist/prompt_values.d.cts.map +1 -0
- package/dist/langchain-core/dist/utils/types/index.d.cts +8 -0
- package/dist/langchain-core/dist/utils/types/index.d.cts.map +1 -0
- package/dist/libs/langchain-core/dist/load/map_keys.d.ts +10 -0
- package/dist/libs/langchain-core/dist/load/map_keys.d.ts.map +1 -0
- package/dist/libs/langchain-core/dist/load/serializable.d.ts +82 -0
- package/dist/libs/langchain-core/dist/load/serializable.d.ts.map +1 -0
- package/dist/libs/langchain-core/dist/messages/base.d.ts +134 -0
- package/dist/libs/langchain-core/dist/messages/base.d.ts.map +1 -0
- package/dist/libs/langchain-core/dist/messages/content/base.d.ts +22 -0
- package/dist/libs/langchain-core/dist/messages/content/base.d.ts.map +1 -0
- package/dist/libs/langchain-core/dist/messages/content/data.d.ts +96 -0
- package/dist/libs/langchain-core/dist/messages/content/data.d.ts.map +1 -0
- package/dist/libs/langchain-core/dist/messages/content/index.d.ts +102 -0
- package/dist/libs/langchain-core/dist/messages/content/index.d.ts.map +1 -0
- package/dist/libs/langchain-core/dist/messages/content/multimodal.d.ts +110 -0
- package/dist/libs/langchain-core/dist/messages/content/multimodal.d.ts.map +1 -0
- package/dist/libs/langchain-core/dist/messages/content/tools.d.ts +153 -0
- package/dist/libs/langchain-core/dist/messages/content/tools.d.ts.map +1 -0
- package/dist/libs/langchain-core/dist/prompt_values.d.ts +13 -0
- package/dist/libs/langchain-core/dist/prompt_values.d.ts.map +1 -0
- package/dist/libs/langchain-core/dist/utils/types/index.d.ts +8 -0
- package/dist/libs/langchain-core/dist/utils/types/index.d.ts.map +1 -0
- package/dist/load/import_constants.cjs +31 -30
- package/dist/load/import_constants.cjs.map +1 -0
- package/dist/load/import_constants.js +30 -27
- package/dist/load/import_constants.js.map +1 -0
- package/dist/load/import_map.cjs +224 -211
- package/dist/load/import_map.cjs.map +1 -0
- package/dist/load/import_map.js +215 -170
- package/dist/load/import_map.js.map +1 -0
- package/dist/load/import_type.d.cts +6 -0
- package/dist/load/import_type.d.cts.map +1 -0
- package/dist/load/import_type.d.ts +6 -5
- package/dist/load/import_type.d.ts.map +1 -0
- package/dist/load/index.cjs +28 -60
- package/dist/load/index.cjs.map +1 -0
- package/dist/load/index.d.cts +23 -0
- package/dist/load/index.d.cts.map +1 -0
- package/dist/load/index.d.ts +13 -1
- package/dist/load/index.d.ts.map +1 -0
- package/dist/load/index.js +26 -23
- package/dist/load/index.js.map +1 -0
- package/dist/load/map_keys.d.cts +8 -0
- package/dist/load/map_keys.d.cts.map +1 -0
- package/dist/load/map_keys.d.ts +7 -2
- package/dist/load/map_keys.d.ts.map +1 -0
- package/dist/load/serializable.cjs +22 -17
- package/dist/load/serializable.cjs.map +1 -0
- package/dist/load/serializable.d.cts +10 -0
- package/dist/load/serializable.d.cts.map +1 -0
- package/dist/load/serializable.d.ts +9 -0
- package/dist/load/serializable.d.ts.map +1 -0
- package/dist/load/serializable.js +12 -1
- package/dist/load/serializable.js.map +1 -0
- package/dist/memory/buffer_memory.cjs +78 -94
- package/dist/memory/buffer_memory.cjs.map +1 -0
- package/dist/memory/buffer_memory.d.cts +67 -0
- package/dist/memory/buffer_memory.d.cts.map +1 -0
- package/dist/memory/buffer_memory.d.ts +25 -19
- package/dist/memory/buffer_memory.d.ts.map +1 -0
- package/dist/memory/buffer_memory.js +77 -90
- package/dist/memory/buffer_memory.js.map +1 -0
- package/dist/memory/buffer_token_memory.cjs +78 -105
- package/dist/memory/buffer_token_memory.cjs.map +1 -0
- package/dist/memory/buffer_token_memory.d.cts +67 -0
- package/dist/memory/buffer_token_memory.d.cts.map +1 -0
- package/dist/memory/buffer_token_memory.d.ts +41 -30
- package/dist/memory/buffer_token_memory.d.ts.map +1 -0
- package/dist/memory/buffer_token_memory.js +77 -101
- package/dist/memory/buffer_token_memory.js.map +1 -0
- package/dist/memory/buffer_window_memory.cjs +75 -96
- package/dist/memory/buffer_window_memory.cjs.map +1 -0
- package/dist/memory/buffer_window_memory.d.cts +64 -0
- package/dist/memory/buffer_window_memory.d.cts.map +1 -0
- package/dist/memory/buffer_window_memory.d.ts +29 -23
- package/dist/memory/buffer_window_memory.d.ts.map +1 -0
- package/dist/memory/buffer_window_memory.js +74 -92
- package/dist/memory/buffer_window_memory.js.map +1 -0
- package/dist/memory/chat_memory.cjs +51 -61
- package/dist/memory/chat_memory.cjs.map +1 -0
- package/dist/memory/chat_memory.d.cts +42 -0
- package/dist/memory/chat_memory.d.cts.map +1 -0
- package/dist/memory/chat_memory.d.ts +29 -23
- package/dist/memory/chat_memory.d.ts.map +1 -0
- package/dist/memory/chat_memory.js +46 -58
- package/dist/memory/chat_memory.js.map +1 -0
- package/dist/memory/combined_memory.cjs +86 -121
- package/dist/memory/combined_memory.cjs.map +1 -0
- package/dist/memory/combined_memory.d.cts +60 -0
- package/dist/memory/combined_memory.d.cts.map +1 -0
- package/dist/memory/combined_memory.d.ts +47 -41
- package/dist/memory/combined_memory.d.ts.map +1 -0
- package/dist/memory/combined_memory.js +86 -117
- package/dist/memory/combined_memory.js.map +1 -0
- package/dist/memory/entity_memory.cjs +142 -200
- package/dist/memory/entity_memory.cjs.map +1 -0
- package/dist/memory/entity_memory.d.cts +99 -0
- package/dist/memory/entity_memory.d.cts.map +1 -0
- package/dist/memory/entity_memory.d.ts +58 -47
- package/dist/memory/entity_memory.d.ts.map +1 -0
- package/dist/memory/entity_memory.js +140 -195
- package/dist/memory/entity_memory.js.map +1 -0
- package/dist/memory/index.cjs +85 -31
- package/dist/memory/index.cjs.map +1 -0
- package/dist/memory/index.d.cts +14 -0
- package/dist/memory/index.d.ts +14 -12
- package/dist/memory/index.js +39 -12
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/prompt.cjs +35 -24
- package/dist/memory/prompt.cjs.map +1 -0
- package/dist/memory/prompt.d.cts +12 -0
- package/dist/memory/prompt.d.cts.map +1 -0
- package/dist/memory/prompt.d.ts +11 -22
- package/dist/memory/prompt.d.ts.map +1 -0
- package/dist/memory/prompt.js +30 -20
- package/dist/memory/prompt.js.map +1 -0
- package/dist/memory/stores/entity/base.cjs +11 -9
- package/dist/memory/stores/entity/base.cjs.map +1 -0
- package/dist/memory/stores/entity/base.d.cts +18 -0
- package/dist/memory/stores/entity/base.d.cts.map +1 -0
- package/dist/memory/stores/entity/base.d.ts +12 -6
- package/dist/memory/stores/entity/base.d.ts.map +1 -0
- package/dist/memory/stores/entity/base.js +10 -5
- package/dist/memory/stores/entity/base.js.map +1 -0
- package/dist/memory/stores/entity/in_memory.cjs +62 -65
- package/dist/memory/stores/entity/in_memory.cjs.map +1 -0
- package/dist/memory/stores/entity/in_memory.js +62 -61
- package/dist/memory/stores/entity/in_memory.js.map +1 -0
- package/dist/memory/summary.cjs +124 -151
- package/dist/memory/summary.cjs.map +1 -0
- package/dist/memory/summary.d.cts +101 -0
- package/dist/memory/summary.d.cts.map +1 -0
- package/dist/memory/summary.d.ts +53 -48
- package/dist/memory/summary.d.ts.map +1 -0
- package/dist/memory/summary.js +121 -145
- package/dist/memory/summary.js.map +1 -0
- package/dist/memory/summary_buffer.cjs +115 -137
- package/dist/memory/summary_buffer.cjs.map +1 -0
- package/dist/memory/summary_buffer.d.cts +90 -0
- package/dist/memory/summary_buffer.d.cts.map +1 -0
- package/dist/memory/summary_buffer.d.ts +44 -38
- package/dist/memory/summary_buffer.d.ts.map +1 -0
- package/dist/memory/summary_buffer.js +114 -133
- package/dist/memory/summary_buffer.js.map +1 -0
- package/dist/memory/vector_store.cjs +85 -116
- package/dist/memory/vector_store.cjs.map +1 -0
- package/dist/memory/vector_store.d.cts +81 -0
- package/dist/memory/vector_store.d.cts.map +1 -0
- package/dist/memory/vector_store.d.ts +41 -37
- package/dist/memory/vector_store.d.ts.map +1 -0
- package/dist/memory/vector_store.js +84 -112
- package/dist/memory/vector_store.js.map +1 -0
- package/dist/node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.cjs +248 -0
- package/dist/node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.js +244 -0
- package/dist/node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.cjs +3040 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.js +3039 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/env.cjs +12 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/env.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/env.js +12 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/env.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/experimental/otel/constants.cjs +71 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/experimental/otel/constants.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/experimental/otel/constants.js +38 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/experimental/otel/constants.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/experimental/otel/translator.cjs +221 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/experimental/otel/translator.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/experimental/otel/translator.js +221 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/experimental/otel/translator.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/index.cjs +11 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/index.js +11 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.cjs +701 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.js +700 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/constants.cjs +7 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/constants.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/constants.js +6 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/constants.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/fetch.cjs +29 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/fetch.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/fetch.js +28 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/fetch.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/otel.cjs +115 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/otel.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/otel.js +113 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/singletons/otel.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/_uuid.cjs +14 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/_uuid.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/_uuid.js +13 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/_uuid.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/async_caller.cjs +94 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/async_caller.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/async_caller.js +94 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/async_caller.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.cjs +140 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.js +135 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.cjs +89 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.js +86 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/fast-safe-stringify/index.cjs +140 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/fast-safe-stringify/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/fast-safe-stringify/index.js +140 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/fast-safe-stringify/index.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/messages.cjs +18 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/messages.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/messages.js +16 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/messages.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/project.cjs +10 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/project.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/project.js +10 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/project.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/prompts.cjs +30 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/prompts.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/prompts.js +30 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/prompts.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/warn.cjs +13 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/warn.cjs.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/warn.js +12 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/warn.js.map +1 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/index.cjs +6 -0
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/index.js +6 -0
- package/dist/node_modules/.pnpm/p-finally@1.0.0/node_modules/p-finally/index.cjs +27 -0
- package/dist/node_modules/.pnpm/p-finally@1.0.0/node_modules/p-finally/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/p-finally@1.0.0/node_modules/p-finally/index.js +23 -0
- package/dist/node_modules/.pnpm/p-finally@1.0.0/node_modules/p-finally/index.js.map +1 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/index.cjs +267 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/index.js +263 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/lower-bound.cjs +32 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/lower-bound.cjs.map +1 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/lower-bound.js +28 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/lower-bound.js.map +1 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/priority-queue.cjs +49 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/priority-queue.cjs.map +1 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/priority-queue.js +45 -0
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/priority-queue.js.map +1 -0
- package/dist/node_modules/.pnpm/p-timeout@3.2.0/node_modules/p-timeout/index.cjs +52 -0
- package/dist/node_modules/.pnpm/p-timeout@3.2.0/node_modules/p-timeout/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/p-timeout@3.2.0/node_modules/p-timeout/index.js +48 -0
- package/dist/node_modules/.pnpm/p-timeout@3.2.0/node_modules/p-timeout/index.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/comparator.cjs +90 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/comparator.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/comparator.js +86 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/comparator.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/range.cjs +294 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/range.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/range.js +290 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/range.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.cjs +191 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.js +187 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/clean.cjs +24 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/clean.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/clean.js +20 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/clean.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/cmp.cjs +51 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/cmp.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/cmp.js +47 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/cmp.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/coerce.cjs +48 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/coerce.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/coerce.js +44 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/coerce.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-build.cjs +25 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-build.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-build.js +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-build.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-loose.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-loose.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-loose.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-loose.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/diff.cjs +43 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/diff.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/diff.js +39 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/diff.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/eq.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/eq.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/eq.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/eq.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gt.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gt.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gt.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gt.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/inc.cjs +32 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/inc.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/inc.js +28 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/inc.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lt.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lt.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lt.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lt.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lte.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lte.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lte.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lte.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/major.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/major.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/major.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/major.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/minor.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/minor.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/minor.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/minor.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/neq.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/neq.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/neq.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/neq.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/parse.cjs +29 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/parse.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/parse.js +25 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/parse.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/patch.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/patch.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/patch.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/patch.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/prerelease.cjs +24 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/prerelease.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/prerelease.js +20 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/prerelease.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rcompare.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rcompare.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rcompare.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rcompare.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rsort.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rsort.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rsort.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rsort.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/satisfies.cjs +28 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/satisfies.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/satisfies.js +24 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/satisfies.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/sort.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/sort.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/sort.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/sort.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/valid.cjs +24 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/valid.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/valid.js +20 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/valid.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/index.cjs +146 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/index.js +142 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/index.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.cjs +41 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.js +37 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.cjs +19 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.js +15 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.cjs +32 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.js +28 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/lrucache.cjs +47 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/lrucache.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/lrucache.js +43 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/lrucache.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.cjs +25 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.js +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.cjs +94 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.js +90 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/gtr.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/gtr.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/gtr.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/gtr.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/intersects.cjs +25 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/intersects.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/intersects.js +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/intersects.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/ltr.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/ltr.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/ltr.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/ltr.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/max-satisfying.cjs +41 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/max-satisfying.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/max-satisfying.js +37 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/max-satisfying.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-satisfying.cjs +41 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-satisfying.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-satisfying.js +37 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-satisfying.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-version.cjs +55 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-version.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-version.js +51 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-version.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/outside.cjs +74 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/outside.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/outside.js +70 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/outside.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/simplify.cjs +48 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/simplify.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/simplify.js +44 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/simplify.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/subset.cjs +112 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/subset.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/subset.js +108 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/subset.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/to-comparators.cjs +21 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/to-comparators.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/to-comparators.js +17 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/to-comparators.js.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/valid.cjs +27 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/valid.cjs.map +1 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/valid.js +23 -0
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/valid.js.map +1 -0
- package/dist/output_parsers/combining.cjs +59 -90
- package/dist/output_parsers/combining.cjs.map +1 -0
- package/dist/output_parsers/combining.d.cts +46 -0
- package/dist/output_parsers/combining.d.cts.map +1 -0
- package/dist/output_parsers/combining.d.ts +33 -26
- package/dist/output_parsers/combining.d.ts.map +1 -0
- package/dist/output_parsers/combining.js +58 -86
- package/dist/output_parsers/combining.js.map +1 -0
- package/dist/output_parsers/datetime.cjs +44 -61
- package/dist/output_parsers/datetime.cjs.map +1 -0
- package/dist/output_parsers/datetime.d.cts +33 -0
- package/dist/output_parsers/datetime.d.cts.map +1 -0
- package/dist/output_parsers/datetime.d.ts +27 -21
- package/dist/output_parsers/datetime.d.ts.map +1 -0
- package/dist/output_parsers/datetime.js +44 -58
- package/dist/output_parsers/datetime.js.map +1 -0
- package/dist/output_parsers/expression.cjs +84 -102
- package/dist/output_parsers/expression.cjs.map +1 -0
- package/dist/output_parsers/expression.d.cts +53 -0
- package/dist/output_parsers/expression.d.cts.map +1 -0
- package/dist/output_parsers/expression.d.ts +34 -28
- package/dist/output_parsers/expression.d.ts.map +1 -0
- package/dist/output_parsers/expression.js +77 -83
- package/dist/output_parsers/expression.js.map +1 -0
- package/dist/output_parsers/expression_type_handlers/array_literal_expression_handler.cjs +36 -42
- package/dist/output_parsers/expression_type_handlers/array_literal_expression_handler.cjs.map +1 -0
- package/dist/output_parsers/expression_type_handlers/array_literal_expression_handler.js +37 -39
- package/dist/output_parsers/expression_type_handlers/array_literal_expression_handler.js.map +1 -0
- package/dist/output_parsers/expression_type_handlers/base.cjs +127 -163
- package/dist/output_parsers/expression_type_handlers/base.cjs.map +1 -0
- package/dist/output_parsers/expression_type_handlers/base.d.cts +108 -0
- package/dist/output_parsers/expression_type_handlers/base.d.cts.map +1 -0
- package/dist/output_parsers/expression_type_handlers/base.d.ts +97 -89
- package/dist/output_parsers/expression_type_handlers/base.d.ts.map +1 -0
- package/dist/output_parsers/expression_type_handlers/base.js +126 -125
- package/dist/output_parsers/expression_type_handlers/base.js.map +1 -0
- package/dist/output_parsers/expression_type_handlers/boolean_literal_handler.cjs +36 -40
- package/dist/output_parsers/expression_type_handlers/boolean_literal_handler.cjs.map +1 -0
- package/dist/output_parsers/expression_type_handlers/boolean_literal_handler.js +37 -37
- package/dist/output_parsers/expression_type_handlers/boolean_literal_handler.js.map +1 -0
- package/dist/output_parsers/expression_type_handlers/call_expression_handler.cjs +62 -72
- package/dist/output_parsers/expression_type_handlers/call_expression_handler.cjs.map +1 -0
- package/dist/output_parsers/expression_type_handlers/call_expression_handler.js +63 -69
- package/dist/output_parsers/expression_type_handlers/call_expression_handler.js.map +1 -0
- package/dist/output_parsers/expression_type_handlers/factory.cjs +64 -72
- package/dist/output_parsers/expression_type_handlers/factory.cjs.map +1 -0
- package/dist/output_parsers/expression_type_handlers/factory.d.cts +35 -0
- package/dist/output_parsers/expression_type_handlers/factory.d.cts.map +1 -0
- package/dist/output_parsers/expression_type_handlers/factory.d.ts +26 -19
- package/dist/output_parsers/expression_type_handlers/factory.d.ts.map +1 -0
- package/dist/output_parsers/expression_type_handlers/factory.js +56 -60
- package/dist/output_parsers/expression_type_handlers/factory.js.map +1 -0
- package/dist/output_parsers/expression_type_handlers/grammar/parser_grammar.cjs +18 -15
- package/dist/output_parsers/expression_type_handlers/grammar/parser_grammar.cjs.map +1 -0
- package/dist/output_parsers/expression_type_handlers/grammar/parser_grammar.js +17 -12
- package/dist/output_parsers/expression_type_handlers/grammar/parser_grammar.js.map +1 -0
- package/dist/output_parsers/expression_type_handlers/identifier_handler.cjs +38 -39
- package/dist/output_parsers/expression_type_handlers/identifier_handler.cjs.map +1 -0
- package/dist/output_parsers/expression_type_handlers/identifier_handler.js +39 -36
- package/dist/output_parsers/expression_type_handlers/identifier_handler.js.map +1 -0
- package/dist/output_parsers/expression_type_handlers/member_expression_handler.cjs +46 -60
- package/dist/output_parsers/expression_type_handlers/member_expression_handler.cjs.map +1 -0
- package/dist/output_parsers/expression_type_handlers/member_expression_handler.js +47 -57
- package/dist/output_parsers/expression_type_handlers/member_expression_handler.js.map +1 -0
- package/dist/output_parsers/expression_type_handlers/numeric_literal_handler.cjs +34 -38
- package/dist/output_parsers/expression_type_handlers/numeric_literal_handler.cjs.map +1 -0
- package/dist/output_parsers/expression_type_handlers/numeric_literal_handler.js +35 -35
- package/dist/output_parsers/expression_type_handlers/numeric_literal_handler.js.map +1 -0
- package/dist/output_parsers/expression_type_handlers/object_literal_expression_handler.cjs +38 -43
- package/dist/output_parsers/expression_type_handlers/object_literal_expression_handler.cjs.map +1 -0
- package/dist/output_parsers/expression_type_handlers/object_literal_expression_handler.js +38 -39
- package/dist/output_parsers/expression_type_handlers/object_literal_expression_handler.js.map +1 -0
- package/dist/output_parsers/expression_type_handlers/property_assignment_handler.cjs +43 -51
- package/dist/output_parsers/expression_type_handlers/property_assignment_handler.cjs.map +1 -0
- package/dist/output_parsers/expression_type_handlers/property_assignment_handler.js +44 -48
- package/dist/output_parsers/expression_type_handlers/property_assignment_handler.js.map +1 -0
- package/dist/output_parsers/expression_type_handlers/string_literal_handler.cjs +35 -36
- package/dist/output_parsers/expression_type_handlers/string_literal_handler.cjs.map +1 -0
- package/dist/output_parsers/expression_type_handlers/string_literal_handler.js +36 -33
- package/dist/output_parsers/expression_type_handlers/string_literal_handler.js.map +1 -0
- package/dist/output_parsers/expression_type_handlers/types.d.cts +95 -0
- package/dist/output_parsers/expression_type_handlers/types.d.cts.map +1 -0
- package/dist/output_parsers/expression_type_handlers/types.d.ts +36 -32
- package/dist/output_parsers/expression_type_handlers/types.d.ts.map +1 -0
- package/dist/output_parsers/fix.cjs +88 -100
- package/dist/output_parsers/fix.cjs.map +1 -0
- package/dist/output_parsers/fix.d.cts +60 -0
- package/dist/output_parsers/fix.d.cts.map +1 -0
- package/dist/output_parsers/fix.d.ts +49 -42
- package/dist/output_parsers/fix.d.ts.map +1 -0
- package/dist/output_parsers/fix.js +86 -95
- package/dist/output_parsers/fix.js.map +1 -0
- package/dist/output_parsers/http_response.cjs +51 -80
- package/dist/output_parsers/http_response.cjs.map +1 -0
- package/dist/output_parsers/http_response.d.cts +33 -0
- package/dist/output_parsers/http_response.d.cts.map +1 -0
- package/dist/output_parsers/http_response.d.ts +26 -21
- package/dist/output_parsers/http_response.d.ts.map +1 -0
- package/dist/output_parsers/http_response.js +51 -77
- package/dist/output_parsers/http_response.js.map +1 -0
- package/dist/output_parsers/index.cjs +74 -31
- package/dist/output_parsers/index.cjs.map +1 -0
- package/dist/output_parsers/index.d.cts +11 -0
- package/dist/output_parsers/index.d.ts +11 -11
- package/dist/output_parsers/index.js +37 -11
- package/dist/output_parsers/index.js.map +1 -0
- package/dist/output_parsers/noop.cjs +41 -47
- package/dist/output_parsers/noop.cjs.map +1 -0
- package/dist/output_parsers/noop.js +40 -43
- package/dist/output_parsers/noop.js.map +1 -0
- package/dist/output_parsers/openai_functions.cjs +141 -206
- package/dist/output_parsers/openai_functions.cjs.map +1 -0
- package/dist/output_parsers/openai_functions.d.cts +85 -0
- package/dist/output_parsers/openai_functions.d.cts.map +1 -0
- package/dist/output_parsers/openai_functions.d.ts +64 -58
- package/dist/output_parsers/openai_functions.d.ts.map +1 -0
- package/dist/output_parsers/openai_functions.js +139 -201
- package/dist/output_parsers/openai_functions.js.map +1 -0
- package/dist/output_parsers/openai_tools.cjs +86 -140
- package/dist/output_parsers/openai_tools.cjs.map +1 -0
- package/dist/output_parsers/openai_tools.d.cts +69 -0
- package/dist/output_parsers/openai_tools.d.cts.map +1 -0
- package/dist/output_parsers/openai_tools.d.ts +51 -42
- package/dist/output_parsers/openai_tools.d.ts.map +1 -0
- package/dist/output_parsers/openai_tools.js +84 -135
- package/dist/output_parsers/openai_tools.js.map +1 -0
- package/dist/output_parsers/prompts.cjs +10 -7
- package/dist/output_parsers/prompts.cjs.map +1 -0
- package/dist/output_parsers/prompts.js +8 -3
- package/dist/output_parsers/prompts.js.map +1 -0
- package/dist/output_parsers/regex.cjs +72 -106
- package/dist/output_parsers/regex.cjs.map +1 -0
- package/dist/output_parsers/regex.d.cts +49 -0
- package/dist/output_parsers/regex.d.cts.map +1 -0
- package/dist/output_parsers/regex.d.ts +38 -33
- package/dist/output_parsers/regex.d.ts.map +1 -0
- package/dist/output_parsers/regex.js +72 -103
- package/dist/output_parsers/regex.js.map +1 -0
- package/dist/output_parsers/router.cjs +38 -45
- package/dist/output_parsers/router.cjs.map +1 -0
- package/dist/output_parsers/router.d.cts +36 -0
- package/dist/output_parsers/router.d.cts.map +1 -0
- package/dist/output_parsers/router.d.ts +23 -17
- package/dist/output_parsers/router.d.ts.map +1 -0
- package/dist/output_parsers/router.js +37 -41
- package/dist/output_parsers/router.js.map +1 -0
- package/dist/output_parsers/structured.cjs +148 -180
- package/dist/output_parsers/structured.cjs.map +1 -0
- package/dist/output_parsers/structured.d.cts +97 -0
- package/dist/output_parsers/structured.d.cts.map +1 -0
- package/dist/output_parsers/structured.d.ts +82 -74
- package/dist/output_parsers/structured.d.ts.map +1 -0
- package/dist/output_parsers/structured.js +144 -173
- package/dist/output_parsers/structured.js.map +1 -0
- package/dist/retrievers/contextual_compression.cjs +51 -51
- package/dist/retrievers/contextual_compression.cjs.map +1 -0
- package/dist/retrievers/contextual_compression.d.cts +42 -0
- package/dist/retrievers/contextual_compression.d.cts.map +1 -0
- package/dist/retrievers/contextual_compression.d.ts +19 -13
- package/dist/retrievers/contextual_compression.d.ts.map +1 -0
- package/dist/retrievers/contextual_compression.js +46 -48
- package/dist/retrievers/contextual_compression.js.map +1 -0
- package/dist/retrievers/document_compressors/chain_extract.cjs +97 -104
- package/dist/retrievers/document_compressors/chain_extract.cjs.map +1 -0
- package/dist/retrievers/document_compressors/chain_extract.d.cts +47 -0
- package/dist/retrievers/document_compressors/chain_extract.d.cts.map +1 -0
- package/dist/retrievers/document_compressors/chain_extract.d.ts +35 -26
- package/dist/retrievers/document_compressors/chain_extract.d.ts.map +1 -0
- package/dist/retrievers/document_compressors/chain_extract.js +89 -98
- package/dist/retrievers/document_compressors/chain_extract.js.map +1 -0
- package/dist/retrievers/document_compressors/chain_extract_prompt.cjs +5 -3
- package/dist/retrievers/document_compressors/chain_extract_prompt.cjs.map +1 -0
- package/dist/retrievers/document_compressors/chain_extract_prompt.js +6 -1
- package/dist/retrievers/document_compressors/chain_extract_prompt.js.map +1 -0
- package/dist/retrievers/document_compressors/embeddings_filter.cjs +72 -89
- package/dist/retrievers/document_compressors/embeddings_filter.cjs.map +1 -0
- package/dist/retrievers/document_compressors/embeddings_filter.d.cts +58 -0
- package/dist/retrievers/document_compressors/embeddings_filter.d.cts.map +1 -0
- package/dist/retrievers/document_compressors/embeddings_filter.d.ts +35 -29
- package/dist/retrievers/document_compressors/embeddings_filter.d.ts.map +1 -0
- package/dist/retrievers/document_compressors/embeddings_filter.js +66 -85
- package/dist/retrievers/document_compressors/embeddings_filter.js.map +1 -0
- package/dist/retrievers/document_compressors/index.cjs +66 -64
- package/dist/retrievers/document_compressors/index.cjs.map +1 -0
- package/dist/retrievers/document_compressors/index.d.cts +61 -0
- package/dist/retrievers/document_compressors/index.d.cts.map +1 -0
- package/dist/retrievers/document_compressors/index.d.ts +25 -19
- package/dist/retrievers/document_compressors/index.d.ts.map +1 -0
- package/dist/retrievers/document_compressors/index.js +60 -60
- package/dist/retrievers/document_compressors/index.js.map +1 -0
- package/dist/retrievers/ensemble.cjs +74 -89
- package/dist/retrievers/ensemble.cjs.map +1 -0
- package/dist/retrievers/ensemble.d.cts +39 -0
- package/dist/retrievers/ensemble.d.cts.map +1 -0
- package/dist/retrievers/ensemble.d.ts +31 -26
- package/dist/retrievers/ensemble.d.ts.map +1 -0
- package/dist/retrievers/ensemble.js +68 -85
- package/dist/retrievers/ensemble.js.map +1 -0
- package/dist/retrievers/hyde.cjs +108 -111
- package/dist/retrievers/hyde.cjs.map +1 -0
- package/dist/retrievers/hyde.d.cts +61 -0
- package/dist/retrievers/hyde.d.cts.map +1 -0
- package/dist/retrievers/hyde.d.ts +20 -14
- package/dist/retrievers/hyde.d.ts.map +1 -0
- package/dist/retrievers/hyde.js +101 -106
- package/dist/retrievers/hyde.js.map +1 -0
- package/dist/retrievers/matryoshka_retriever.cjs +114 -146
- package/dist/retrievers/matryoshka_retriever.cjs.map +1 -0
- package/dist/retrievers/matryoshka_retriever.d.cts +99 -0
- package/dist/retrievers/matryoshka_retriever.d.cts.map +1 -0
- package/dist/retrievers/matryoshka_retriever.d.ts +70 -64
- package/dist/retrievers/matryoshka_retriever.d.ts.map +1 -0
- package/dist/retrievers/matryoshka_retriever.js +109 -143
- package/dist/retrievers/matryoshka_retriever.js.map +1 -0
- package/dist/retrievers/multi_query.cjs +133 -156
- package/dist/retrievers/multi_query.cjs.map +1 -0
- package/dist/retrievers/multi_query.d.cts +59 -0
- package/dist/retrievers/multi_query.d.cts.map +1 -0
- package/dist/retrievers/multi_query.d.ts +39 -33
- package/dist/retrievers/multi_query.d.ts.map +1 -0
- package/dist/retrievers/multi_query.js +127 -152
- package/dist/retrievers/multi_query.js.map +1 -0
- package/dist/retrievers/multi_vector.cjs +65 -92
- package/dist/retrievers/multi_vector.cjs.map +1 -0
- package/dist/retrievers/multi_vector.d.cts +51 -0
- package/dist/retrievers/multi_vector.d.cts.map +1 -0
- package/dist/retrievers/multi_vector.d.ts +27 -21
- package/dist/retrievers/multi_vector.d.ts.map +1 -0
- package/dist/retrievers/multi_vector.js +59 -88
- package/dist/retrievers/multi_vector.js.map +1 -0
- package/dist/retrievers/parent_document.cjs +135 -226
- package/dist/retrievers/parent_document.cjs.map +1 -0
- package/dist/retrievers/parent_document.d.cts +92 -0
- package/dist/retrievers/parent_document.d.cts.map +1 -0
- package/dist/retrievers/parent_document.d.ts +55 -49
- package/dist/retrievers/parent_document.d.ts.map +1 -0
- package/dist/retrievers/parent_document.js +129 -189
- package/dist/retrievers/parent_document.js.map +1 -0
- package/dist/retrievers/score_threshold.cjs +42 -44
- package/dist/retrievers/score_threshold.cjs.map +1 -0
- package/dist/retrievers/score_threshold.d.cts +20 -0
- package/dist/retrievers/score_threshold.d.cts.map +1 -0
- package/dist/retrievers/score_threshold.d.ts +16 -11
- package/dist/retrievers/score_threshold.d.ts.map +1 -0
- package/dist/retrievers/score_threshold.js +37 -41
- package/dist/retrievers/score_threshold.js.map +1 -0
- package/dist/retrievers/self_query/functional.cjs +21 -5
- package/dist/retrievers/self_query/functional.cjs.map +1 -0
- package/dist/retrievers/self_query/functional.d.cts +2 -0
- package/dist/retrievers/self_query/functional.d.ts +2 -1
- package/dist/retrievers/self_query/functional.js +10 -1
- package/dist/retrievers/self_query/functional.js.map +1 -0
- package/dist/retrievers/self_query/index.cjs +128 -124
- package/dist/retrievers/self_query/index.cjs.map +1 -0
- package/dist/retrievers/self_query/index.d.cts +79 -0
- package/dist/retrievers/self_query/index.d.cts.map +1 -0
- package/dist/retrievers/self_query/index.d.ts +53 -48
- package/dist/retrievers/self_query/index.d.ts.map +1 -0
- package/dist/retrievers/self_query/index.js +105 -119
- package/dist/retrievers/self_query/index.js.map +1 -0
- package/dist/retrievers/time_weighted.cjs +234 -254
- package/dist/retrievers/time_weighted.cjs.map +1 -0
- package/dist/retrievers/time_weighted.d.cts +142 -0
- package/dist/retrievers/time_weighted.d.cts.map +1 -0
- package/dist/retrievers/time_weighted.d.ts +115 -114
- package/dist/retrievers/time_weighted.d.ts.map +1 -0
- package/dist/retrievers/time_weighted.js +226 -250
- package/dist/retrievers/time_weighted.js.map +1 -0
- package/dist/sql_db.cjs +117 -196
- package/dist/sql_db.cjs.map +1 -0
- package/dist/sql_db.d.cts +60 -0
- package/dist/sql_db.d.cts.map +1 -0
- package/dist/sql_db.d.ts +44 -38
- package/dist/sql_db.d.ts.map +1 -0
- package/dist/sql_db.js +111 -159
- package/dist/sql_db.js.map +1 -0
- package/dist/storage/encoder_backed.cjs +91 -102
- package/dist/storage/encoder_backed.cjs.map +1 -0
- package/dist/storage/encoder_backed.d.cts +54 -0
- package/dist/storage/encoder_backed.d.cts.map +1 -0
- package/dist/storage/encoder_backed.d.ts +42 -35
- package/dist/storage/encoder_backed.d.ts.map +1 -0
- package/dist/storage/encoder_backed.js +83 -96
- package/dist/storage/encoder_backed.js.map +1 -0
- package/dist/storage/file_system.cjs +155 -214
- package/dist/storage/file_system.cjs.map +1 -0
- package/dist/storage/file_system.d.cts +83 -0
- package/dist/storage/file_system.d.cts.map +1 -0
- package/dist/storage/file_system.d.ts +50 -53
- package/dist/storage/file_system.d.ts.map +1 -0
- package/dist/storage/file_system.js +149 -177
- package/dist/storage/file_system.js.map +1 -0
- package/dist/storage/in_memory.cjs +21 -5
- package/dist/storage/in_memory.cjs.map +1 -0
- package/dist/storage/in_memory.d.cts +2 -0
- package/dist/storage/in_memory.d.ts +2 -1
- package/dist/storage/in_memory.js +10 -1
- package/dist/storage/in_memory.js.map +1 -0
- package/dist/stores/doc/base.cjs +18 -8
- package/dist/stores/doc/base.cjs.map +1 -0
- package/dist/stores/doc/base.d.cts +15 -0
- package/dist/stores/doc/base.d.cts.map +1 -0
- package/dist/stores/doc/base.d.ts +9 -3
- package/dist/stores/doc/base.d.ts.map +1 -0
- package/dist/stores/doc/base.js +13 -5
- package/dist/stores/doc/base.js.map +1 -0
- package/dist/stores/doc/in_memory.cjs +91 -104
- package/dist/stores/doc/in_memory.cjs.map +1 -0
- package/dist/stores/doc/in_memory.d.cts +53 -0
- package/dist/stores/doc/in_memory.d.cts.map +1 -0
- package/dist/stores/doc/in_memory.d.ts +42 -35
- package/dist/stores/doc/in_memory.d.ts.map +1 -0
- package/dist/stores/doc/in_memory.js +84 -99
- package/dist/stores/doc/in_memory.js.map +1 -0
- package/dist/stores/file/base.cjs +11 -9
- package/dist/stores/file/base.cjs.map +1 -0
- package/dist/stores/file/base.d.cts +15 -0
- package/dist/stores/file/base.d.cts.map +1 -0
- package/dist/stores/file/base.d.ts +9 -3
- package/dist/stores/file/base.d.ts.map +1 -0
- package/dist/stores/file/base.js +10 -5
- package/dist/stores/file/base.js.map +1 -0
- package/dist/stores/file/in_memory.cjs +51 -50
- package/dist/stores/file/in_memory.cjs.map +1 -0
- package/dist/stores/file/in_memory.d.cts +33 -0
- package/dist/stores/file/in_memory.d.cts.map +1 -0
- package/dist/stores/file/in_memory.d.ts +24 -18
- package/dist/stores/file/in_memory.d.ts.map +1 -0
- package/dist/stores/file/in_memory.js +45 -46
- package/dist/stores/file/in_memory.js.map +1 -0
- package/dist/stores/file/node.cjs +50 -77
- package/dist/stores/file/node.cjs.map +1 -0
- package/dist/stores/file/node.d.cts +29 -0
- package/dist/stores/file/node.d.cts.map +1 -0
- package/dist/stores/file/node.d.ts +23 -17
- package/dist/stores/file/node.d.ts.map +1 -0
- package/dist/stores/file/node.js +43 -39
- package/dist/stores/file/node.js.map +1 -0
- package/dist/stores/message/in_memory.cjs +21 -5
- package/dist/stores/message/in_memory.cjs.map +1 -0
- package/dist/stores/message/in_memory.d.cts +2 -0
- package/dist/stores/message/in_memory.d.ts +2 -1
- package/dist/stores/message/in_memory.js +10 -1
- package/dist/stores/message/in_memory.js.map +1 -0
- package/dist/text_splitter.cjs +22 -17
- package/dist/text_splitter.cjs.map +1 -0
- package/dist/text_splitter.d.cts +1 -0
- package/dist/text_splitter.d.ts +1 -1
- package/dist/text_splitter.js +12 -1
- package/dist/text_splitter.js.map +1 -0
- package/dist/tools/chain.cjs +34 -28
- package/dist/tools/chain.cjs.map +1 -0
- package/dist/tools/chain.d.cts +32 -0
- package/dist/tools/chain.d.cts.map +1 -0
- package/dist/tools/chain.d.ts +16 -7
- package/dist/tools/chain.d.ts.map +1 -0
- package/dist/tools/chain.js +28 -24
- package/dist/tools/chain.js.map +1 -0
- package/dist/tools/fs.cjs +53 -90
- package/dist/tools/fs.cjs.map +1 -0
- package/dist/tools/fs.d.cts +92 -0
- package/dist/tools/fs.d.cts.map +1 -0
- package/dist/tools/fs.d.ts +70 -36
- package/dist/tools/fs.d.ts.map +1 -0
- package/dist/tools/fs.js +51 -85
- package/dist/tools/fs.js.map +1 -0
- package/dist/tools/index.cjs +68 -26
- package/dist/tools/index.cjs.map +1 -0
- package/dist/tools/index.d.cts +8 -0
- package/dist/tools/index.d.ts +8 -8
- package/dist/tools/index.js +30 -8
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/json.cjs +101 -159
- package/dist/tools/json.cjs.map +1 -0
- package/dist/tools/json.d.cts +65 -0
- package/dist/tools/json.d.cts.map +1 -0
- package/dist/tools/json.d.ts +46 -41
- package/dist/tools/json.d.ts.map +1 -0
- package/dist/tools/json.js +98 -150
- package/dist/tools/json.js.map +1 -0
- package/dist/tools/render.cjs +49 -48
- package/dist/tools/render.cjs.map +1 -0
- package/dist/tools/render.d.cts +32 -0
- package/dist/tools/render.d.cts.map +1 -0
- package/dist/tools/render.d.ts +8 -2
- package/dist/tools/render.d.ts.map +1 -0
- package/dist/tools/render.js +43 -45
- package/dist/tools/render.js.map +1 -0
- package/dist/tools/requests.cjs +66 -106
- package/dist/tools/requests.cjs.map +1 -0
- package/dist/tools/requests.d.cts +56 -0
- package/dist/tools/requests.d.cts.map +1 -0
- package/dist/tools/requests.d.ts +36 -27
- package/dist/tools/requests.d.ts.map +1 -0
- package/dist/tools/requests.js +64 -101
- package/dist/tools/requests.js.map +1 -0
- package/dist/tools/retriever.cjs +28 -14
- package/dist/tools/retriever.cjs.map +1 -0
- package/dist/tools/retriever.d.cts +19 -0
- package/dist/tools/retriever.d.cts.map +1 -0
- package/dist/tools/retriever.d.ts +13 -8
- package/dist/tools/retriever.d.ts.map +1 -0
- package/dist/tools/retriever.js +22 -11
- package/dist/tools/retriever.js.map +1 -0
- package/dist/tools/sql.cjs +147 -204
- package/dist/tools/sql.cjs.map +1 -0
- package/dist/tools/sql.d.cts +86 -0
- package/dist/tools/sql.d.cts.map +1 -0
- package/dist/tools/sql.d.ts +45 -40
- package/dist/tools/sql.d.ts.map +1 -0
- package/dist/tools/sql.js +137 -196
- package/dist/tools/sql.js.map +1 -0
- package/dist/tools/vectorstore.cjs +43 -65
- package/dist/tools/vectorstore.cjs.map +1 -0
- package/dist/tools/vectorstore.d.cts +40 -0
- package/dist/tools/vectorstore.d.cts.map +1 -0
- package/dist/tools/vectorstore.d.ts +28 -23
- package/dist/tools/vectorstore.d.ts.map +1 -0
- package/dist/tools/vectorstore.js +42 -61
- package/dist/tools/vectorstore.js.map +1 -0
- package/dist/tools/webbrowser.cjs +165 -254
- package/dist/tools/webbrowser.cjs.map +1 -0
- package/dist/tools/webbrowser.d.cts +69 -0
- package/dist/tools/webbrowser.d.cts.map +1 -0
- package/dist/tools/webbrowser.d.ts +47 -31
- package/dist/tools/webbrowser.d.ts.map +1 -0
- package/dist/tools/webbrowser.js +158 -213
- package/dist/tools/webbrowser.js.map +1 -0
- package/dist/types/expression-parser.d.cts +89 -0
- package/dist/types/expression-parser.d.cts.map +1 -0
- package/dist/types/expression-parser.d.ts +89 -0
- package/dist/types/expression-parser.d.ts.map +1 -0
- package/dist/types/type-utils.d.cts +7 -0
- package/dist/types/type-utils.d.cts.map +1 -0
- package/dist/types/type-utils.d.ts +7 -1
- package/dist/types/type-utils.d.ts.map +1 -0
- package/dist/util/document.cjs +20 -9
- package/dist/util/document.cjs.map +1 -0
- package/dist/util/document.d.cts +15 -0
- package/dist/util/document.d.cts.map +1 -0
- package/dist/util/document.d.ts +7 -1
- package/dist/util/document.d.ts.map +1 -0
- package/dist/util/document.js +16 -7
- package/dist/util/document.js.map +1 -0
- package/dist/util/entrypoint_deprecation.cjs +1 -69
- package/dist/util/entrypoint_deprecation.js +1 -65
- package/dist/util/env.cjs +2 -12
- package/dist/util/env.js +1 -1
- package/dist/util/extname.cjs +5 -3
- package/dist/util/extname.cjs.map +1 -0
- package/dist/util/extname.js +6 -1
- package/dist/util/extname.js.map +1 -0
- package/dist/util/hub.cjs +32 -39
- package/dist/util/hub.cjs.map +1 -0
- package/dist/util/hub.js +32 -33
- package/dist/util/hub.js.map +1 -0
- package/dist/util/load.cjs +12 -44
- package/dist/util/load.cjs.map +1 -0
- package/dist/util/load.d.cts +6 -0
- package/dist/util/load.d.cts.map +1 -0
- package/dist/util/load.d.ts +6 -3
- package/dist/util/load.d.ts.map +1 -0
- package/dist/util/load.js +13 -9
- package/dist/util/load.js.map +1 -0
- package/dist/util/math.cjs +22 -17
- package/dist/util/math.cjs.map +1 -0
- package/dist/util/math.d.cts +1 -0
- package/dist/util/math.d.ts +1 -1
- package/dist/util/math.js +12 -1
- package/dist/util/math.js.map +1 -0
- package/dist/util/ml-distance/distances.cjs +29 -45
- package/dist/util/ml-distance/distances.cjs.map +1 -0
- package/dist/util/ml-distance/distances.js +29 -42
- package/dist/util/ml-distance/distances.js.map +1 -0
- package/dist/util/ml-distance/similarities.cjs +20 -17
- package/dist/util/ml-distance/similarities.cjs.map +1 -0
- package/dist/util/ml-distance/similarities.d.cts +11 -0
- package/dist/util/ml-distance/similarities.d.cts.map +1 -0
- package/dist/util/ml-distance/similarities.d.ts +5 -1
- package/dist/util/ml-distance/similarities.d.ts.map +1 -0
- package/dist/util/ml-distance/similarities.js +20 -15
- package/dist/util/ml-distance/similarities.js.map +1 -0
- package/dist/util/ml-distance-euclidean/euclidean.cjs +10 -10
- package/dist/util/ml-distance-euclidean/euclidean.cjs.map +1 -0
- package/dist/util/ml-distance-euclidean/euclidean.js +11 -8
- package/dist/util/ml-distance-euclidean/euclidean.js.map +1 -0
- package/dist/util/openapi.cjs +148 -233
- package/dist/util/openapi.cjs.map +1 -0
- package/dist/util/openapi.d.cts +83 -0
- package/dist/util/openapi.d.cts.map +1 -0
- package/dist/util/openapi.d.ts +81 -74
- package/dist/util/openapi.d.ts.map +1 -0
- package/dist/util/openapi.js +147 -196
- package/dist/util/openapi.js.map +1 -0
- package/dist/util/parse.cjs +17 -54
- package/dist/util/parse.cjs.map +1 -0
- package/dist/util/parse.js +18 -18
- package/dist/util/parse.js.map +1 -0
- package/dist/util/set.cjs +25 -30
- package/dist/util/set.cjs.map +1 -0
- package/dist/util/set.js +25 -28
- package/dist/util/set.js.map +1 -0
- package/dist/util/sql_utils.cjs +128 -217
- package/dist/util/sql_utils.cjs.map +1 -0
- package/dist/util/sql_utils.d.cts +31 -0
- package/dist/util/sql_utils.d.cts.map +1 -0
- package/dist/util/sql_utils.d.ts +24 -25
- package/dist/util/sql_utils.d.ts.map +1 -0
- package/dist/util/sql_utils.js +130 -215
- package/dist/util/sql_utils.js.map +1 -0
- package/dist/util/time.cjs +23 -11
- package/dist/util/time.cjs.map +1 -0
- package/dist/util/time.d.cts +10 -0
- package/dist/util/time.d.cts.map +1 -0
- package/dist/util/time.d.ts +5 -1
- package/dist/util/time.d.ts.map +1 -0
- package/dist/util/time.js +17 -8
- package/dist/util/time.js.map +1 -0
- package/dist/vectorstores/memory.cjs +263 -270
- package/dist/vectorstores/memory.cjs.map +1 -0
- package/dist/vectorstores/memory.d.cts +216 -0
- package/dist/vectorstores/memory.d.cts.map +1 -0
- package/dist/vectorstores/memory.d.ts +91 -82
- package/dist/vectorstores/memory.d.ts.map +1 -0
- package/dist/vectorstores/memory.js +257 -266
- package/dist/vectorstores/memory.js.map +1 -0
- package/package.json +563 -1146
- package/agents/format_scratchpad/log.cjs +0 -1
- package/agents/format_scratchpad/log.d.cts +0 -1
- package/agents/format_scratchpad/log.d.ts +0 -1
- package/agents/format_scratchpad/log.js +0 -1
- package/agents/format_scratchpad/log_to_message.cjs +0 -1
- package/agents/format_scratchpad/log_to_message.d.cts +0 -1
- package/agents/format_scratchpad/log_to_message.d.ts +0 -1
- package/agents/format_scratchpad/log_to_message.js +0 -1
- package/agents/format_scratchpad/openai_tools.cjs +0 -1
- package/agents/format_scratchpad/openai_tools.d.cts +0 -1
- package/agents/format_scratchpad/openai_tools.d.ts +0 -1
- package/agents/format_scratchpad/openai_tools.js +0 -1
- package/agents/format_scratchpad/xml.cjs +0 -1
- package/agents/format_scratchpad/xml.d.cts +0 -1
- package/agents/format_scratchpad/xml.d.ts +0 -1
- package/agents/format_scratchpad/xml.js +0 -1
- package/agents/format_scratchpad.cjs +0 -1
- package/agents/format_scratchpad.d.cts +0 -1
- package/agents/format_scratchpad.d.ts +0 -1
- package/agents/format_scratchpad.js +0 -1
- package/agents/load.cjs +0 -1
- package/agents/load.d.cts +0 -1
- package/agents/load.d.ts +0 -1
- package/agents/load.js +0 -1
- package/agents/openai/output_parser.cjs +0 -1
- package/agents/openai/output_parser.d.cts +0 -1
- package/agents/openai/output_parser.d.ts +0 -1
- package/agents/openai/output_parser.js +0 -1
- package/agents/react/output_parser.cjs +0 -1
- package/agents/react/output_parser.d.cts +0 -1
- package/agents/react/output_parser.d.ts +0 -1
- package/agents/react/output_parser.js +0 -1
- package/agents/toolkits/sql.cjs +0 -1
- package/agents/toolkits/sql.d.cts +0 -1
- package/agents/toolkits/sql.d.ts +0 -1
- package/agents/toolkits/sql.js +0 -1
- package/agents/toolkits.cjs +0 -1
- package/agents/toolkits.d.cts +0 -1
- package/agents/toolkits.d.ts +0 -1
- package/agents/toolkits.js +0 -1
- package/agents/xml/output_parser.cjs +0 -1
- package/agents/xml/output_parser.d.cts +0 -1
- package/agents/xml/output_parser.d.ts +0 -1
- package/agents/xml/output_parser.js +0 -1
- package/agents.cjs +0 -1
- package/agents.d.cts +0 -1
- package/agents.d.ts +0 -1
- package/agents.js +0 -1
- package/cache/file_system.cjs +0 -1
- package/cache/file_system.d.cts +0 -1
- package/cache/file_system.d.ts +0 -1
- package/cache/file_system.js +0 -1
- package/callbacks.cjs +0 -1
- package/callbacks.d.cts +0 -1
- package/callbacks.d.ts +0 -1
- package/callbacks.js +0 -1
- package/chains/combine_documents/reduce.cjs +0 -1
- package/chains/combine_documents/reduce.d.cts +0 -1
- package/chains/combine_documents/reduce.d.ts +0 -1
- package/chains/combine_documents/reduce.js +0 -1
- package/chains/combine_documents.cjs +0 -1
- package/chains/combine_documents.d.cts +0 -1
- package/chains/combine_documents.d.ts +0 -1
- package/chains/combine_documents.js +0 -1
- package/chains/graph_qa/cypher.cjs +0 -1
- package/chains/graph_qa/cypher.d.cts +0 -1
- package/chains/graph_qa/cypher.d.ts +0 -1
- package/chains/graph_qa/cypher.js +0 -1
- package/chains/history_aware_retriever.cjs +0 -1
- package/chains/history_aware_retriever.d.cts +0 -1
- package/chains/history_aware_retriever.d.ts +0 -1
- package/chains/history_aware_retriever.js +0 -1
- package/chains/load.cjs +0 -1
- package/chains/load.d.cts +0 -1
- package/chains/load.d.ts +0 -1
- package/chains/load.js +0 -1
- package/chains/openai_functions.cjs +0 -1
- package/chains/openai_functions.d.cts +0 -1
- package/chains/openai_functions.d.ts +0 -1
- package/chains/openai_functions.js +0 -1
- package/chains/query_constructor/ir.cjs +0 -1
- package/chains/query_constructor/ir.d.cts +0 -1
- package/chains/query_constructor/ir.d.ts +0 -1
- package/chains/query_constructor/ir.js +0 -1
- package/chains/query_constructor.cjs +0 -1
- package/chains/query_constructor.d.cts +0 -1
- package/chains/query_constructor.d.ts +0 -1
- package/chains/query_constructor.js +0 -1
- package/chains/retrieval.cjs +0 -1
- package/chains/retrieval.d.cts +0 -1
- package/chains/retrieval.d.ts +0 -1
- package/chains/retrieval.js +0 -1
- package/chains/sql_db.cjs +0 -1
- package/chains/sql_db.d.cts +0 -1
- package/chains/sql_db.d.ts +0 -1
- package/chains/sql_db.js +0 -1
- package/chains.cjs +0 -1
- package/chains.d.cts +0 -1
- package/chains.d.ts +0 -1
- package/chains.js +0 -1
- package/chat_models/universal.cjs +0 -1
- package/chat_models/universal.d.cts +0 -1
- package/chat_models/universal.d.ts +0 -1
- package/chat_models/universal.js +0 -1
- package/dist/agents/agent.cjs +0 -570
- package/dist/agents/agent.d.ts +0 -284
- package/dist/agents/agent.js +0 -524
- package/dist/agents/chat/index.cjs +0 -123
- package/dist/agents/chat/index.d.ts +0 -87
- package/dist/agents/chat/index.js +0 -119
- package/dist/agents/chat/outputParser.cjs +0 -94
- package/dist/agents/chat/outputParser.d.ts +0 -70
- package/dist/agents/chat/outputParser.js +0 -90
- package/dist/agents/chat/prompt.cjs +0 -28
- package/dist/agents/chat/prompt.d.ts +0 -3
- package/dist/agents/chat/prompt.js +0 -25
- package/dist/agents/chat_convo/index.cjs +0 -148
- package/dist/agents/chat_convo/index.d.ts +0 -82
- package/dist/agents/chat_convo/index.js +0 -144
- package/dist/agents/chat_convo/outputParser.cjs +0 -163
- package/dist/agents/chat_convo/outputParser.d.ts +0 -75
- package/dist/agents/chat_convo/outputParser.js +0 -158
- package/dist/agents/chat_convo/prompt.cjs +0 -60
- package/dist/agents/chat_convo/prompt.d.ts +0 -5
- package/dist/agents/chat_convo/prompt.js +0 -57
- package/dist/agents/executor.cjs +0 -687
- package/dist/agents/executor.d.ts +0 -163
- package/dist/agents/executor.js +0 -681
- package/dist/agents/format_scratchpad/log.cjs +0 -15
- package/dist/agents/format_scratchpad/log.d.ts +0 -9
- package/dist/agents/format_scratchpad/log.js +0 -12
- package/dist/agents/format_scratchpad/log_to_message.cjs +0 -21
- package/dist/agents/format_scratchpad/log_to_message.d.ts +0 -3
- package/dist/agents/format_scratchpad/log_to_message.js +0 -18
- package/dist/agents/format_scratchpad/openai_functions.cjs +0 -45
- package/dist/agents/format_scratchpad/openai_functions.d.ts +0 -21
- package/dist/agents/format_scratchpad/openai_functions.js +0 -41
- package/dist/agents/format_scratchpad/openai_tools.cjs +0 -5
- package/dist/agents/format_scratchpad/openai_tools.d.ts +0 -2
- package/dist/agents/format_scratchpad/openai_tools.js +0 -2
- package/dist/agents/format_scratchpad/tool_calling.cjs +0 -29
- package/dist/agents/format_scratchpad/tool_calling.d.ts +0 -10
- package/dist/agents/format_scratchpad/tool_calling.js +0 -25
- package/dist/agents/format_scratchpad/xml.cjs +0 -11
- package/dist/agents/format_scratchpad/xml.d.ts +0 -2
- package/dist/agents/format_scratchpad/xml.js +0 -8
- package/dist/agents/helpers.cjs +0 -21
- package/dist/agents/helpers.d.ts +0 -4
- package/dist/agents/helpers.js +0 -17
- package/dist/agents/initialize.cjs +0 -136
- package/dist/agents/initialize.d.ts +0 -60
- package/dist/agents/initialize.js +0 -131
- package/dist/agents/load.cjs +0 -21
- package/dist/agents/load.d.ts +0 -8
- package/dist/agents/load.js +0 -17
- package/dist/agents/mrkl/index.cjs +0 -136
- package/dist/agents/mrkl/index.d.ts +0 -93
- package/dist/agents/mrkl/index.js +0 -132
- package/dist/agents/mrkl/outputParser.cjs +0 -65
- package/dist/agents/mrkl/outputParser.d.ts +0 -37
- package/dist/agents/mrkl/outputParser.js +0 -61
- package/dist/agents/mrkl/prompt.cjs +0 -18
- package/dist/agents/mrkl/prompt.d.ts +0 -3
- package/dist/agents/mrkl/prompt.js +0 -15
- package/dist/agents/openai/output_parser.cjs +0 -22
- package/dist/agents/openai/output_parser.d.ts +0 -2
- package/dist/agents/openai/output_parser.js +0 -6
- package/dist/agents/openai_functions/index.cjs +0 -249
- package/dist/agents/openai_functions/index.d.ts +0 -154
- package/dist/agents/openai_functions/index.js +0 -243
- package/dist/agents/openai_functions/output_parser.cjs +0 -100
- package/dist/agents/openai_functions/output_parser.d.ts +0 -56
- package/dist/agents/openai_functions/output_parser.js +0 -96
- package/dist/agents/openai_functions/prompt.cjs +0 -5
- package/dist/agents/openai_functions/prompt.d.ts +0 -2
- package/dist/agents/openai_functions/prompt.js +0 -2
- package/dist/agents/openai_tools/index.cjs +0 -92
- package/dist/agents/openai_tools/index.d.ts +0 -89
- package/dist/agents/openai_tools/index.js +0 -88
- package/dist/agents/openai_tools/output_parser.cjs +0 -105
- package/dist/agents/openai_tools/output_parser.d.ts +0 -49
- package/dist/agents/openai_tools/output_parser.js +0 -101
- package/dist/agents/react/index.cjs +0 -80
- package/dist/agents/react/index.d.ts +0 -70
- package/dist/agents/react/index.js +0 -77
- package/dist/agents/react/output_parser.cjs +0 -112
- package/dist/agents/react/output_parser.d.ts +0 -62
- package/dist/agents/react/output_parser.js +0 -108
- package/dist/agents/react/prompt.cjs +0 -13
- package/dist/agents/react/prompt.d.ts +0 -1
- package/dist/agents/react/prompt.js +0 -10
- package/dist/agents/structured_chat/index.cjs +0 -260
- package/dist/agents/structured_chat/index.d.ts +0 -172
- package/dist/agents/structured_chat/index.js +0 -255
- package/dist/agents/structured_chat/outputParser.cjs +0 -162
- package/dist/agents/structured_chat/outputParser.d.ts +0 -89
- package/dist/agents/structured_chat/outputParser.js +0 -157
- package/dist/agents/structured_chat/prompt.cjs +0 -62
- package/dist/agents/structured_chat/prompt.d.ts +0 -4
- package/dist/agents/structured_chat/prompt.js +0 -59
- package/dist/agents/tool_calling/index.cjs +0 -93
- package/dist/agents/tool_calling/index.d.ts +0 -78
- package/dist/agents/tool_calling/index.js +0 -90
- package/dist/agents/tool_calling/output_parser.cjs +0 -75
- package/dist/agents/tool_calling/output_parser.d.ts +0 -22
- package/dist/agents/tool_calling/output_parser.js +0 -70
- package/dist/agents/toolkits/base.cjs +0 -5
- package/dist/agents/toolkits/base.d.ts +0 -1
- package/dist/agents/toolkits/base.js +0 -1
- package/dist/agents/toolkits/conversational_retrieval/openai_functions.cjs +0 -49
- package/dist/agents/toolkits/conversational_retrieval/openai_functions.d.ts +0 -21
- package/dist/agents/toolkits/conversational_retrieval/openai_functions.js +0 -46
- package/dist/agents/toolkits/conversational_retrieval/token_buffer_memory.cjs +0 -134
- package/dist/agents/toolkits/conversational_retrieval/token_buffer_memory.d.ts +0 -52
- package/dist/agents/toolkits/conversational_retrieval/token_buffer_memory.js +0 -130
- package/dist/agents/toolkits/conversational_retrieval/tool.cjs +0 -19
- package/dist/agents/toolkits/conversational_retrieval/tool.d.ts +0 -15
- package/dist/agents/toolkits/conversational_retrieval/tool.js +0 -16
- package/dist/agents/toolkits/index.cjs +0 -21
- package/dist/agents/toolkits/index.d.ts +0 -6
- package/dist/agents/toolkits/index.js +0 -6
- package/dist/agents/toolkits/json/json.cjs +0 -76
- package/dist/agents/toolkits/json/json.d.ts +0 -36
- package/dist/agents/toolkits/json/json.js +0 -71
- package/dist/agents/toolkits/json/prompt.cjs +0 -27
- package/dist/agents/toolkits/json/prompt.d.ts +0 -2
- package/dist/agents/toolkits/json/prompt.js +0 -24
- package/dist/agents/toolkits/openapi/openapi.cjs +0 -111
- package/dist/agents/toolkits/openapi/openapi.d.ts +0 -64
- package/dist/agents/toolkits/openapi/openapi.js +0 -105
- package/dist/agents/toolkits/openapi/prompt.cjs +0 -32
- package/dist/agents/toolkits/openapi/prompt.d.ts +0 -3
- package/dist/agents/toolkits/openapi/prompt.js +0 -29
- package/dist/agents/toolkits/sql/index.cjs +0 -9
- package/dist/agents/toolkits/sql/index.d.ts +0 -2
- package/dist/agents/toolkits/sql/index.js +0 -2
- package/dist/agents/toolkits/sql/prompt.cjs +0 -20
- package/dist/agents/toolkits/sql/prompt.d.ts +0 -2
- package/dist/agents/toolkits/sql/prompt.js +0 -17
- package/dist/agents/toolkits/sql/sql.cjs +0 -77
- package/dist/agents/toolkits/sql/sql.d.ts +0 -32
- package/dist/agents/toolkits/sql/sql.js +0 -72
- package/dist/agents/toolkits/vectorstore/prompt.cjs +0 -11
- package/dist/agents/toolkits/vectorstore/prompt.d.ts +0 -2
- package/dist/agents/toolkits/vectorstore/prompt.js +0 -8
- package/dist/agents/toolkits/vectorstore/vectorstore.cjs +0 -137
- package/dist/agents/toolkits/vectorstore/vectorstore.d.ts +0 -55
- package/dist/agents/toolkits/vectorstore/vectorstore.js +0 -130
- package/dist/agents/types.cjs +0 -19
- package/dist/agents/types.js +0 -14
- package/dist/agents/xml/index.cjs +0 -185
- package/dist/agents/xml/index.d.ts +0 -122
- package/dist/agents/xml/index.js +0 -180
- package/dist/agents/xml/output_parser.cjs +0 -67
- package/dist/agents/xml/output_parser.d.ts +0 -35
- package/dist/agents/xml/output_parser.js +0 -63
- package/dist/agents/xml/prompt.cjs +0 -23
- package/dist/agents/xml/prompt.d.ts +0 -1
- package/dist/agents/xml/prompt.js +0 -20
- package/dist/cache/base.cjs +0 -17
- package/dist/cache/base.d.ts +0 -1
- package/dist/cache/base.js +0 -1
- package/dist/cache/file_system.cjs +0 -72
- package/dist/cache/file_system.d.ts +0 -34
- package/dist/cache/file_system.js +0 -65
- package/dist/callbacks/handlers/console.cjs +0 -17
- package/dist/callbacks/handlers/console.d.ts +0 -1
- package/dist/callbacks/handlers/console.js +0 -1
- package/dist/callbacks/handlers/run_collector.cjs +0 -17
- package/dist/callbacks/handlers/run_collector.d.ts +0 -1
- package/dist/callbacks/handlers/run_collector.js +0 -1
- package/dist/callbacks/handlers/tracer.cjs +0 -17
- package/dist/callbacks/handlers/tracer.d.ts +0 -1
- package/dist/callbacks/handlers/tracer.js +0 -1
- package/dist/callbacks/handlers/tracer_langchain.cjs +0 -17
- package/dist/callbacks/handlers/tracer_langchain.d.ts +0 -1
- package/dist/callbacks/handlers/tracer_langchain.js +0 -1
- package/dist/callbacks/index.cjs +0 -14
- package/dist/callbacks/index.d.ts +0 -5
- package/dist/callbacks/index.js +0 -5
- package/dist/callbacks/promises.cjs +0 -17
- package/dist/callbacks/promises.d.ts +0 -1
- package/dist/callbacks/promises.js +0 -1
- package/dist/chains/api/prompts.d.ts +0 -13
- package/dist/chains/combine_documents/base.d.ts +0 -13
- package/dist/chains/constitutional_ai/constitutional_prompts.d.ts +0 -19
- package/dist/chains/graph_qa/prompts.d.ts +0 -9
- package/dist/chains/question_answering/map_reduce_prompts.d.ts +0 -6
- package/dist/chains/question_answering/refine_prompts.d.ts +0 -17
- package/dist/chains/question_answering/stuff_prompts.d.ts +0 -7
- package/dist/chains/router/multi_prompt_prompt.d.ts +0 -2
- package/dist/chains/router/multi_retrieval_prompt.d.ts +0 -2
- package/dist/chains/router/utils.d.ts +0 -3
- package/dist/chains/serde.cjs +0 -2
- package/dist/chains/serde.js +0 -1
- package/dist/chains/summarization/refine_prompts.d.ts +0 -5
- package/dist/chains/summarization/stuff_prompts.d.ts +0 -4
- package/dist/document_transformers/openai_functions.cjs +0 -52
- package/dist/document_transformers/openai_functions.d.ts +0 -23
- package/dist/document_transformers/openai_functions.js +0 -46
- package/dist/evaluation/agents/index.d.ts +0 -1
- package/dist/evaluation/agents/prompt.d.ts +0 -6
- package/dist/evaluation/comparison/index.d.ts +0 -1
- package/dist/evaluation/comparison/prompt.d.ts +0 -21
- package/dist/evaluation/criteria/index.d.ts +0 -1
- package/dist/evaluation/criteria/prompt.d.ts +0 -12
- package/dist/evaluation/embedding_distance/index.d.ts +0 -1
- package/dist/evaluation/qa/index.d.ts +0 -1
- package/dist/evaluation/qa/prompt.d.ts +0 -11
- package/dist/evaluation/types.cjs +0 -2
- package/dist/evaluation/types.js +0 -1
- package/dist/experimental/autogpt/agent.cjs +0 -210
- package/dist/experimental/autogpt/agent.d.ts +0 -80
- package/dist/experimental/autogpt/agent.js +0 -206
- package/dist/experimental/autogpt/index.cjs +0 -10
- package/dist/experimental/autogpt/index.d.ts +0 -4
- package/dist/experimental/autogpt/index.js +0 -3
- package/dist/experimental/autogpt/output_parser.cjs +0 -85
- package/dist/experimental/autogpt/output_parser.d.ts +0 -33
- package/dist/experimental/autogpt/output_parser.js +0 -80
- package/dist/experimental/autogpt/prompt.cjs +0 -137
- package/dist/experimental/autogpt/prompt.d.ts +0 -58
- package/dist/experimental/autogpt/prompt.js +0 -133
- package/dist/experimental/autogpt/prompt_generator.cjs +0 -154
- package/dist/experimental/autogpt/prompt_generator.d.ts +0 -49
- package/dist/experimental/autogpt/prompt_generator.js +0 -149
- package/dist/experimental/autogpt/schema.cjs +0 -4
- package/dist/experimental/autogpt/schema.d.ts +0 -18
- package/dist/experimental/autogpt/schema.js +0 -1
- package/dist/experimental/babyagi/agent.cjs +0 -274
- package/dist/experimental/babyagi/agent.d.ts +0 -135
- package/dist/experimental/babyagi/agent.js +0 -270
- package/dist/experimental/babyagi/index.cjs +0 -11
- package/dist/experimental/babyagi/index.d.ts +0 -4
- package/dist/experimental/babyagi/index.js +0 -4
- package/dist/experimental/babyagi/task_creation.cjs +0 -42
- package/dist/experimental/babyagi/task_creation.d.ts +0 -16
- package/dist/experimental/babyagi/task_creation.js +0 -38
- package/dist/experimental/babyagi/task_execution.cjs +0 -32
- package/dist/experimental/babyagi/task_execution.d.ts +0 -15
- package/dist/experimental/babyagi/task_execution.js +0 -28
- package/dist/experimental/babyagi/task_prioritization.cjs +0 -34
- package/dist/experimental/babyagi/task_prioritization.d.ts +0 -14
- package/dist/experimental/babyagi/task_prioritization.js +0 -30
- package/dist/experimental/chains/violation_of_expectations/index.cjs +0 -5
- package/dist/experimental/chains/violation_of_expectations/index.d.ts +0 -1
- package/dist/experimental/chains/violation_of_expectations/index.js +0 -1
- package/dist/experimental/chains/violation_of_expectations/types.cjs +0 -49
- package/dist/experimental/chains/violation_of_expectations/types.d.ts +0 -69
- package/dist/experimental/chains/violation_of_expectations/types.js +0 -46
- package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_chain.cjs +0 -336
- package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_chain.d.ts +0 -149
- package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_chain.js +0 -332
- package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_prompt.cjs +0 -49
- package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_prompt.d.ts +0 -5
- package/dist/experimental/chains/violation_of_expectations/violation_of_expectations_prompt.js +0 -46
- package/dist/experimental/generative_agents/generative_agent.cjs +0 -397
- package/dist/experimental/generative_agents/generative_agent.d.ts +0 -160
- package/dist/experimental/generative_agents/generative_agent.js +0 -393
- package/dist/experimental/generative_agents/generative_agent_memory.cjs +0 -518
- package/dist/experimental/generative_agents/generative_agent_memory.d.ts +0 -200
- package/dist/experimental/generative_agents/generative_agent_memory.js +0 -514
- package/dist/experimental/generative_agents/index.cjs +0 -7
- package/dist/experimental/generative_agents/index.d.ts +0 -2
- package/dist/experimental/generative_agents/index.js +0 -2
- package/dist/experimental/masking/index.cjs +0 -9
- package/dist/experimental/masking/index.d.ts +0 -4
- package/dist/experimental/masking/index.js +0 -3
- package/dist/experimental/masking/parser.cjs +0 -134
- package/dist/experimental/masking/parser.d.ts +0 -44
- package/dist/experimental/masking/parser.js +0 -130
- package/dist/experimental/masking/regex_masking_transformer.cjs +0 -145
- package/dist/experimental/masking/regex_masking_transformer.d.ts +0 -48
- package/dist/experimental/masking/regex_masking_transformer.js +0 -141
- package/dist/experimental/masking/transformer.cjs +0 -9
- package/dist/experimental/masking/transformer.d.ts +0 -7
- package/dist/experimental/masking/transformer.js +0 -5
- package/dist/experimental/masking/types.cjs +0 -2
- package/dist/experimental/masking/types.d.ts +0 -25
- package/dist/experimental/masking/types.js +0 -1
- package/dist/experimental/openai_assistant/index.cjs +0 -268
- package/dist/experimental/openai_assistant/index.d.ts +0 -68
- package/dist/experimental/openai_assistant/index.js +0 -264
- package/dist/experimental/openai_assistant/schema.cjs +0 -2
- package/dist/experimental/openai_assistant/schema.d.ts +0 -11
- package/dist/experimental/openai_assistant/schema.js +0 -1
- package/dist/experimental/openai_files/index.cjs +0 -88
- package/dist/experimental/openai_files/index.d.ts +0 -87
- package/dist/experimental/openai_files/index.js +0 -84
- package/dist/experimental/plan_and_execute/agent_executor.cjs +0 -172
- package/dist/experimental/plan_and_execute/agent_executor.d.ts +0 -86
- package/dist/experimental/plan_and_execute/agent_executor.js +0 -167
- package/dist/experimental/plan_and_execute/base.cjs +0 -97
- package/dist/experimental/plan_and_execute/base.d.ts +0 -84
- package/dist/experimental/plan_and_execute/base.js +0 -88
- package/dist/experimental/plan_and_execute/index.cjs +0 -14
- package/dist/experimental/plan_and_execute/index.d.ts +0 -3
- package/dist/experimental/plan_and_execute/index.js +0 -3
- package/dist/experimental/plan_and_execute/outputParser.cjs +0 -46
- package/dist/experimental/plan_and_execute/outputParser.d.ts +0 -25
- package/dist/experimental/plan_and_execute/outputParser.js +0 -42
- package/dist/experimental/plan_and_execute/prompt.cjs +0 -43
- package/dist/experimental/plan_and_execute/prompt.d.ts +0 -12
- package/dist/experimental/plan_and_execute/prompt.js +0 -39
- package/dist/experimental/prompts/custom_format.cjs +0 -78
- package/dist/experimental/prompts/custom_format.d.ts +0 -24
- package/dist/experimental/prompts/custom_format.js +0 -74
- package/dist/experimental/prompts/handlebars.cjs +0 -71
- package/dist/experimental/prompts/handlebars.d.ts +0 -13
- package/dist/experimental/prompts/handlebars.js +0 -62
- package/dist/indexes/index.cjs +0 -10
- package/dist/indexes/index.d.ts +0 -2
- package/dist/indexes/index.js +0 -2
- package/dist/load/import_constants.d.ts +0 -1
- package/dist/load/import_map.d.ts +0 -181
- package/dist/load/import_type.cjs +0 -3
- package/dist/load/import_type.js +0 -2
- package/dist/load/map_keys.cjs +0 -2
- package/dist/load/map_keys.js +0 -1
- package/dist/memory/base.cjs +0 -20
- package/dist/memory/base.d.ts +0 -2
- package/dist/memory/base.js +0 -2
- package/dist/memory/stores/entity/in_memory.d.ts +0 -40
- package/dist/output_parsers/expression_type_handlers/array_literal_expression_handler.d.ts +0 -24
- package/dist/output_parsers/expression_type_handlers/boolean_literal_handler.d.ts +0 -24
- package/dist/output_parsers/expression_type_handlers/call_expression_handler.d.ts +0 -28
- package/dist/output_parsers/expression_type_handlers/grammar/parser_grammar.d.ts +0 -13
- package/dist/output_parsers/expression_type_handlers/identifier_handler.d.ts +0 -25
- package/dist/output_parsers/expression_type_handlers/member_expression_handler.d.ts +0 -23
- package/dist/output_parsers/expression_type_handlers/numeric_literal_handler.d.ts +0 -22
- package/dist/output_parsers/expression_type_handlers/object_literal_expression_handler.d.ts +0 -22
- package/dist/output_parsers/expression_type_handlers/property_assignment_handler.d.ts +0 -23
- package/dist/output_parsers/expression_type_handlers/string_literal_handler.d.ts +0 -22
- package/dist/output_parsers/expression_type_handlers/types.cjs +0 -2
- package/dist/output_parsers/expression_type_handlers/types.js +0 -1
- package/dist/output_parsers/json.cjs +0 -5
- package/dist/output_parsers/json.d.ts +0 -1
- package/dist/output_parsers/json.js +0 -1
- package/dist/output_parsers/list.cjs +0 -7
- package/dist/output_parsers/list.d.ts +0 -1
- package/dist/output_parsers/list.js +0 -1
- package/dist/output_parsers/noop.d.ts +0 -26
- package/dist/output_parsers/prompts.d.ts +0 -3
- package/dist/prompts/base.cjs +0 -10
- package/dist/prompts/base.d.ts +0 -3
- package/dist/prompts/base.js +0 -3
- package/dist/prompts/chat.cjs +0 -15
- package/dist/prompts/chat.d.ts +0 -2
- package/dist/prompts/chat.js +0 -2
- package/dist/prompts/few_shot.cjs +0 -6
- package/dist/prompts/few_shot.d.ts +0 -1
- package/dist/prompts/few_shot.js +0 -1
- package/dist/prompts/index.cjs +0 -6
- package/dist/prompts/index.d.ts +0 -0
- package/dist/prompts/index.js +0 -6
- package/dist/prompts/pipeline.cjs +0 -5
- package/dist/prompts/pipeline.d.ts +0 -1
- package/dist/prompts/pipeline.js +0 -1
- package/dist/prompts/prompt.cjs +0 -5
- package/dist/prompts/prompt.d.ts +0 -1
- package/dist/prompts/prompt.js +0 -1
- package/dist/prompts/selectors/LengthBasedExampleSelector.cjs +0 -5
- package/dist/prompts/selectors/LengthBasedExampleSelector.d.ts +0 -1
- package/dist/prompts/selectors/LengthBasedExampleSelector.js +0 -1
- package/dist/prompts/selectors/SemanticSimilarityExampleSelector.cjs +0 -17
- package/dist/prompts/selectors/SemanticSimilarityExampleSelector.d.ts +0 -1
- package/dist/prompts/selectors/SemanticSimilarityExampleSelector.js +0 -1
- package/dist/prompts/selectors/conditional.cjs +0 -8
- package/dist/prompts/selectors/conditional.d.ts +0 -1
- package/dist/prompts/selectors/conditional.js +0 -1
- package/dist/prompts/serde.cjs +0 -2
- package/dist/prompts/serde.d.ts +0 -1
- package/dist/prompts/serde.js +0 -1
- package/dist/prompts/template.cjs +0 -11
- package/dist/prompts/template.d.ts +0 -1
- package/dist/prompts/template.js +0 -1
- package/dist/retrievers/document_compressors/chain_extract_prompt.d.ts +0 -1
- package/dist/retrievers/document_compressors/test/document_compressor.int.test.cjs +0 -28
- package/dist/retrievers/document_compressors/test/document_compressor.int.test.d.ts +0 -1
- package/dist/retrievers/document_compressors/test/document_compressor.int.test.js +0 -26
- package/dist/retrievers/self_query/base.cjs +0 -6
- package/dist/retrievers/self_query/base.d.ts +0 -1
- package/dist/retrievers/self_query/base.js +0 -1
- package/dist/runnables/remote.cjs +0 -17
- package/dist/runnables/remote.d.ts +0 -1
- package/dist/runnables/remote.js +0 -1
- package/dist/schema/prompt_template.cjs +0 -34
- package/dist/schema/prompt_template.d.ts +0 -13
- package/dist/schema/prompt_template.js +0 -30
- package/dist/schema/query_constructor.cjs +0 -32
- package/dist/schema/query_constructor.d.ts +0 -12
- package/dist/schema/query_constructor.js +0 -28
- package/dist/smith/config.cjs +0 -81
- package/dist/smith/config.d.ts +0 -245
- package/dist/smith/config.js +0 -74
- package/dist/smith/index.cjs +0 -20
- package/dist/smith/index.d.ts +0 -3
- package/dist/smith/index.js +0 -3
- package/dist/smith/name_generation.cjs +0 -725
- package/dist/smith/name_generation.d.ts +0 -1
- package/dist/smith/name_generation.js +0 -722
- package/dist/smith/progress.cjs +0 -69
- package/dist/smith/progress.d.ts +0 -22
- package/dist/smith/progress.js +0 -65
- package/dist/smith/runner_utils.cjs +0 -575
- package/dist/smith/runner_utils.d.ts +0 -90
- package/dist/smith/runner_utils.js +0 -572
- package/dist/stores/message/utils.cjs +0 -6
- package/dist/stores/message/utils.d.ts +0 -1
- package/dist/stores/message/utils.js +0 -1
- package/dist/tools/base.cjs +0 -7
- package/dist/tools/base.d.ts +0 -1
- package/dist/tools/base.js +0 -1
- package/dist/tools/convert_to_openai.cjs +0 -21
- package/dist/tools/convert_to_openai.d.ts +0 -5
- package/dist/tools/convert_to_openai.js +0 -16
- package/dist/tools/dynamic.cjs +0 -6
- package/dist/tools/dynamic.d.ts +0 -1
- package/dist/tools/dynamic.js +0 -1
- package/dist/types/type-utils.cjs +0 -2
- package/dist/types/type-utils.js +0 -1
- package/dist/util/async_caller.cjs +0 -17
- package/dist/util/async_caller.d.ts +0 -1
- package/dist/util/async_caller.js +0 -1
- package/dist/util/axios-fetch-adapter.cjs +0 -404
- package/dist/util/axios-fetch-adapter.d.ts +0 -6
- package/dist/util/axios-fetch-adapter.js +0 -398
- package/dist/util/axios-types.cjs +0 -2
- package/dist/util/axios-types.d.ts +0 -12
- package/dist/util/axios-types.js +0 -1
- package/dist/util/azure.cjs +0 -43
- package/dist/util/azure.d.ts +0 -30
- package/dist/util/azure.js +0 -40
- package/dist/util/entrypoint_deprecation.d.ts +0 -10
- package/dist/util/env.d.ts +0 -1
- package/dist/util/event-source-parse.cjs +0 -17
- package/dist/util/event-source-parse.d.ts +0 -1
- package/dist/util/event-source-parse.js +0 -1
- package/dist/util/extname.d.ts +0 -1
- package/dist/util/hub.d.ts +0 -2
- package/dist/util/ml-distance/distances.d.ts +0 -24
- package/dist/util/ml-distance-euclidean/euclidean.d.ts +0 -2
- package/dist/util/parse.d.ts +0 -2
- package/dist/util/prompt-layer.cjs +0 -27
- package/dist/util/prompt-layer.d.ts +0 -3
- package/dist/util/prompt-layer.js +0 -23
- package/dist/util/set.d.ts +0 -15
- package/dist/util/stream.cjs +0 -17
- package/dist/util/stream.d.ts +0 -1
- package/dist/util/stream.js +0 -1
- package/dist/util/testing/llms/fake.cjs +0 -82
- package/dist/util/testing/llms/fake.d.ts +0 -31
- package/dist/util/testing/llms/fake.js +0 -78
- package/dist/util/testing/tools/calculator.cjs +0 -47
- package/dist/util/testing/tools/calculator.d.ts +0 -19
- package/dist/util/testing/tools/calculator.js +0 -43
- package/dist/util/testing/tools/serpapi.cjs +0 -201
- package/dist/util/testing/tools/serpapi.d.ts +0 -302
- package/dist/util/testing/tools/serpapi.js +0 -197
- package/dist/util/testing/tools/tavily_search.cjs +0 -75
- package/dist/util/testing/tools/tavily_search.d.ts +0 -23
- package/dist/util/testing/tools/tavily_search.js +0 -71
- package/dist/util/tiktoken.cjs +0 -17
- package/dist/util/tiktoken.d.ts +0 -1
- package/dist/util/tiktoken.js +0 -1
- package/dist/util/types.cjs +0 -5
- package/dist/util/types.d.ts +0 -4
- package/dist/util/types.js +0 -4
- package/document.cjs +0 -1
- package/document.d.cts +0 -1
- package/document.d.ts +0 -1
- package/document.js +0 -1
- package/document_loaders/base.cjs +0 -1
- package/document_loaders/base.d.cts +0 -1
- package/document_loaders/base.d.ts +0 -1
- package/document_loaders/base.js +0 -1
- package/document_loaders/fs/buffer.cjs +0 -1
- package/document_loaders/fs/buffer.d.cts +0 -1
- package/document_loaders/fs/buffer.d.ts +0 -1
- package/document_loaders/fs/buffer.js +0 -1
- package/document_loaders/fs/directory.cjs +0 -1
- package/document_loaders/fs/directory.d.cts +0 -1
- package/document_loaders/fs/directory.d.ts +0 -1
- package/document_loaders/fs/directory.js +0 -1
- package/document_loaders/fs/json.cjs +0 -1
- package/document_loaders/fs/json.d.cts +0 -1
- package/document_loaders/fs/json.d.ts +0 -1
- package/document_loaders/fs/json.js +0 -1
- package/document_loaders/fs/multi_file.cjs +0 -1
- package/document_loaders/fs/multi_file.d.cts +0 -1
- package/document_loaders/fs/multi_file.d.ts +0 -1
- package/document_loaders/fs/multi_file.js +0 -1
- package/document_loaders/fs/text.cjs +0 -1
- package/document_loaders/fs/text.d.cts +0 -1
- package/document_loaders/fs/text.d.ts +0 -1
- package/document_loaders/fs/text.js +0 -1
- package/document_transformers/openai_functions.cjs +0 -1
- package/document_transformers/openai_functions.d.cts +0 -1
- package/document_transformers/openai_functions.d.ts +0 -1
- package/document_transformers/openai_functions.js +0 -1
- package/embeddings/cache_backed.cjs +0 -1
- package/embeddings/cache_backed.d.cts +0 -1
- package/embeddings/cache_backed.d.ts +0 -1
- package/embeddings/cache_backed.js +0 -1
- package/embeddings/fake.cjs +0 -1
- package/embeddings/fake.d.cts +0 -1
- package/embeddings/fake.d.ts +0 -1
- package/embeddings/fake.js +0 -1
- package/evaluation.cjs +0 -1
- package/evaluation.d.cts +0 -1
- package/evaluation.d.ts +0 -1
- package/evaluation.js +0 -1
- package/experimental/autogpt.cjs +0 -1
- package/experimental/autogpt.d.cts +0 -1
- package/experimental/autogpt.d.ts +0 -1
- package/experimental/autogpt.js +0 -1
- package/experimental/babyagi.cjs +0 -1
- package/experimental/babyagi.d.cts +0 -1
- package/experimental/babyagi.d.ts +0 -1
- package/experimental/babyagi.js +0 -1
- package/experimental/chains/violation_of_expectations.cjs +0 -1
- package/experimental/chains/violation_of_expectations.d.cts +0 -1
- package/experimental/chains/violation_of_expectations.d.ts +0 -1
- package/experimental/chains/violation_of_expectations.js +0 -1
- package/experimental/generative_agents.cjs +0 -1
- package/experimental/generative_agents.d.cts +0 -1
- package/experimental/generative_agents.d.ts +0 -1
- package/experimental/generative_agents.js +0 -1
- package/experimental/masking.cjs +0 -1
- package/experimental/masking.d.cts +0 -1
- package/experimental/masking.d.ts +0 -1
- package/experimental/masking.js +0 -1
- package/experimental/openai_assistant.cjs +0 -1
- package/experimental/openai_assistant.d.cts +0 -1
- package/experimental/openai_assistant.d.ts +0 -1
- package/experimental/openai_assistant.js +0 -1
- package/experimental/openai_files.cjs +0 -1
- package/experimental/openai_files.d.cts +0 -1
- package/experimental/openai_files.d.ts +0 -1
- package/experimental/openai_files.js +0 -1
- package/experimental/plan_and_execute.cjs +0 -1
- package/experimental/plan_and_execute.d.cts +0 -1
- package/experimental/plan_and_execute.d.ts +0 -1
- package/experimental/plan_and_execute.js +0 -1
- package/experimental/prompts/custom_format.cjs +0 -1
- package/experimental/prompts/custom_format.d.cts +0 -1
- package/experimental/prompts/custom_format.d.ts +0 -1
- package/experimental/prompts/custom_format.js +0 -1
- package/experimental/prompts/handlebars.cjs +0 -1
- package/experimental/prompts/handlebars.d.cts +0 -1
- package/experimental/prompts/handlebars.d.ts +0 -1
- package/experimental/prompts/handlebars.js +0 -1
- package/hub/node.cjs +0 -1
- package/hub/node.d.cts +0 -1
- package/hub/node.d.ts +0 -1
- package/hub/node.js +0 -1
- package/hub.cjs +0 -1
- package/hub.d.cts +0 -1
- package/hub.d.ts +0 -1
- package/hub.js +0 -1
- package/indexes.cjs +0 -1
- package/indexes.d.cts +0 -1
- package/indexes.d.ts +0 -1
- package/indexes.js +0 -1
- package/load/serializable.cjs +0 -1
- package/load/serializable.d.cts +0 -1
- package/load/serializable.d.ts +0 -1
- package/load/serializable.js +0 -1
- package/load.cjs +0 -1
- package/load.d.cts +0 -1
- package/load.d.ts +0 -1
- package/load.js +0 -1
- package/memory/chat_memory.cjs +0 -1
- package/memory/chat_memory.d.cts +0 -1
- package/memory/chat_memory.d.ts +0 -1
- package/memory/chat_memory.js +0 -1
- package/memory.cjs +0 -1
- package/memory.d.cts +0 -1
- package/memory.d.ts +0 -1
- package/memory.js +0 -1
- package/output_parsers/expression.cjs +0 -1
- package/output_parsers/expression.d.cts +0 -1
- package/output_parsers/expression.d.ts +0 -1
- package/output_parsers/expression.js +0 -1
- package/output_parsers.cjs +0 -1
- package/output_parsers.d.cts +0 -1
- package/output_parsers.d.ts +0 -1
- package/output_parsers.js +0 -1
- package/retrievers/contextual_compression.cjs +0 -1
- package/retrievers/contextual_compression.d.cts +0 -1
- package/retrievers/contextual_compression.d.ts +0 -1
- package/retrievers/contextual_compression.js +0 -1
- package/retrievers/document_compressors/chain_extract.cjs +0 -1
- package/retrievers/document_compressors/chain_extract.d.cts +0 -1
- package/retrievers/document_compressors/chain_extract.d.ts +0 -1
- package/retrievers/document_compressors/chain_extract.js +0 -1
- package/retrievers/document_compressors/embeddings_filter.cjs +0 -1
- package/retrievers/document_compressors/embeddings_filter.d.cts +0 -1
- package/retrievers/document_compressors/embeddings_filter.d.ts +0 -1
- package/retrievers/document_compressors/embeddings_filter.js +0 -1
- package/retrievers/document_compressors.cjs +0 -1
- package/retrievers/document_compressors.d.cts +0 -1
- package/retrievers/document_compressors.d.ts +0 -1
- package/retrievers/document_compressors.js +0 -1
- package/retrievers/ensemble.cjs +0 -1
- package/retrievers/ensemble.d.cts +0 -1
- package/retrievers/ensemble.d.ts +0 -1
- package/retrievers/ensemble.js +0 -1
- package/retrievers/hyde.cjs +0 -1
- package/retrievers/hyde.d.cts +0 -1
- package/retrievers/hyde.d.ts +0 -1
- package/retrievers/hyde.js +0 -1
- package/retrievers/matryoshka_retriever.cjs +0 -1
- package/retrievers/matryoshka_retriever.d.cts +0 -1
- package/retrievers/matryoshka_retriever.d.ts +0 -1
- package/retrievers/matryoshka_retriever.js +0 -1
- package/retrievers/multi_query.cjs +0 -1
- package/retrievers/multi_query.d.cts +0 -1
- package/retrievers/multi_query.d.ts +0 -1
- package/retrievers/multi_query.js +0 -1
- package/retrievers/multi_vector.cjs +0 -1
- package/retrievers/multi_vector.d.cts +0 -1
- package/retrievers/multi_vector.d.ts +0 -1
- package/retrievers/multi_vector.js +0 -1
- package/retrievers/parent_document.cjs +0 -1
- package/retrievers/parent_document.d.cts +0 -1
- package/retrievers/parent_document.d.ts +0 -1
- package/retrievers/parent_document.js +0 -1
- package/retrievers/score_threshold.cjs +0 -1
- package/retrievers/score_threshold.d.cts +0 -1
- package/retrievers/score_threshold.d.ts +0 -1
- package/retrievers/score_threshold.js +0 -1
- package/retrievers/self_query/functional.cjs +0 -1
- package/retrievers/self_query/functional.d.cts +0 -1
- package/retrievers/self_query/functional.d.ts +0 -1
- package/retrievers/self_query/functional.js +0 -1
- package/retrievers/self_query.cjs +0 -1
- package/retrievers/self_query.d.cts +0 -1
- package/retrievers/self_query.d.ts +0 -1
- package/retrievers/self_query.js +0 -1
- package/retrievers/time_weighted.cjs +0 -1
- package/retrievers/time_weighted.d.cts +0 -1
- package/retrievers/time_weighted.d.ts +0 -1
- package/retrievers/time_weighted.js +0 -1
- package/runnables/remote.cjs +0 -1
- package/runnables/remote.d.cts +0 -1
- package/runnables/remote.d.ts +0 -1
- package/runnables/remote.js +0 -1
- package/schema/prompt_template.cjs +0 -1
- package/schema/prompt_template.d.cts +0 -1
- package/schema/prompt_template.d.ts +0 -1
- package/schema/prompt_template.js +0 -1
- package/schema/query_constructor.cjs +0 -1
- package/schema/query_constructor.d.cts +0 -1
- package/schema/query_constructor.d.ts +0 -1
- package/schema/query_constructor.js +0 -1
- package/smith.cjs +0 -1
- package/smith.d.cts +0 -1
- package/smith.d.ts +0 -1
- package/smith.js +0 -1
- package/sql_db.cjs +0 -1
- package/sql_db.d.cts +0 -1
- package/sql_db.d.ts +0 -1
- package/sql_db.js +0 -1
- package/storage/encoder_backed.cjs +0 -1
- package/storage/encoder_backed.d.cts +0 -1
- package/storage/encoder_backed.d.ts +0 -1
- package/storage/encoder_backed.js +0 -1
- package/storage/file_system.cjs +0 -1
- package/storage/file_system.d.cts +0 -1
- package/storage/file_system.d.ts +0 -1
- package/storage/file_system.js +0 -1
- package/storage/in_memory.cjs +0 -1
- package/storage/in_memory.d.cts +0 -1
- package/storage/in_memory.d.ts +0 -1
- package/storage/in_memory.js +0 -1
- package/stores/doc/base.cjs +0 -1
- package/stores/doc/base.d.cts +0 -1
- package/stores/doc/base.d.ts +0 -1
- package/stores/doc/base.js +0 -1
- package/stores/doc/in_memory.cjs +0 -1
- package/stores/doc/in_memory.d.cts +0 -1
- package/stores/doc/in_memory.d.ts +0 -1
- package/stores/doc/in_memory.js +0 -1
- package/stores/file/in_memory.cjs +0 -1
- package/stores/file/in_memory.d.cts +0 -1
- package/stores/file/in_memory.d.ts +0 -1
- package/stores/file/in_memory.js +0 -1
- package/stores/file/node.cjs +0 -1
- package/stores/file/node.d.cts +0 -1
- package/stores/file/node.d.ts +0 -1
- package/stores/file/node.js +0 -1
- package/stores/message/in_memory.cjs +0 -1
- package/stores/message/in_memory.d.cts +0 -1
- package/stores/message/in_memory.d.ts +0 -1
- package/stores/message/in_memory.js +0 -1
- package/text_splitter.cjs +0 -1
- package/text_splitter.d.cts +0 -1
- package/text_splitter.d.ts +0 -1
- package/text_splitter.js +0 -1
- package/tools/chain.cjs +0 -1
- package/tools/chain.d.cts +0 -1
- package/tools/chain.d.ts +0 -1
- package/tools/chain.js +0 -1
- package/tools/render.cjs +0 -1
- package/tools/render.d.cts +0 -1
- package/tools/render.d.ts +0 -1
- package/tools/render.js +0 -1
- package/tools/retriever.cjs +0 -1
- package/tools/retriever.d.cts +0 -1
- package/tools/retriever.d.ts +0 -1
- package/tools/retriever.js +0 -1
- package/tools/sql.cjs +0 -1
- package/tools/sql.d.cts +0 -1
- package/tools/sql.d.ts +0 -1
- package/tools/sql.js +0 -1
- package/tools/webbrowser.cjs +0 -1
- package/tools/webbrowser.d.cts +0 -1
- package/tools/webbrowser.d.ts +0 -1
- package/tools/webbrowser.js +0 -1
- package/tools.cjs +0 -1
- package/tools.d.cts +0 -1
- package/tools.d.ts +0 -1
- package/tools.js +0 -1
- package/util/document.cjs +0 -1
- package/util/document.d.cts +0 -1
- package/util/document.d.ts +0 -1
- package/util/document.js +0 -1
- package/util/math.cjs +0 -1
- package/util/math.d.cts +0 -1
- package/util/math.d.ts +0 -1
- package/util/math.js +0 -1
- package/util/time.cjs +0 -1
- package/util/time.d.cts +0 -1
- package/util/time.d.ts +0 -1
- package/util/time.js +0 -1
- package/vectorstores/memory.cjs +0 -1
- package/vectorstores/memory.d.cts +0 -1
- package/vectorstores/memory.d.ts +0 -1
- package/vectorstores/memory.js +0 -1
|
@@ -0,0 +1,3039 @@
|
|
|
1
|
+
import { getEnv, getEnvironmentVariable, getLangChainEnvVarsMetadata, getLangSmithEnvironmentVariable, getOtelEnabled, getRuntimeEnvironment } from "./utils/env.js";
|
|
2
|
+
import { getDefaultOTLPTracerComponents, getOTELContext, getOTELTrace } from "./singletons/otel.js";
|
|
3
|
+
import { LangSmithToOTELTranslator } from "./experimental/otel/translator.js";
|
|
4
|
+
import { AsyncCaller } from "./utils/async_caller.js";
|
|
5
|
+
import { convertLangChainMessageToExample, isLangChainMessage } from "./utils/messages.js";
|
|
6
|
+
import { assertUuid } from "./utils/_uuid.js";
|
|
7
|
+
import { warnOnce } from "./utils/warn.js";
|
|
8
|
+
import { parsePromptIdentifier } from "./utils/prompts.js";
|
|
9
|
+
import { raiseForStatus } from "./utils/error.js";
|
|
10
|
+
import { _getFetchImplementation, _globalFetchImplementationIsNodeFetch } from "./singletons/fetch.js";
|
|
11
|
+
import { serialize } from "./utils/fast-safe-stringify/index.js";
|
|
12
|
+
import { __version__ } from "./index.js";
|
|
13
|
+
import * as uuid from "uuid";
|
|
14
|
+
|
|
15
|
+
//#region ../../node_modules/.pnpm/langsmith@0.3.64_@opentelemetry+api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.js
|
|
16
|
+
function mergeRuntimeEnvIntoRun(run) {
|
|
17
|
+
const runtimeEnv = getRuntimeEnvironment();
|
|
18
|
+
const envVars = getLangChainEnvVarsMetadata();
|
|
19
|
+
const extra = run.extra ?? {};
|
|
20
|
+
const metadata = extra.metadata;
|
|
21
|
+
run.extra = {
|
|
22
|
+
...extra,
|
|
23
|
+
runtime: {
|
|
24
|
+
...runtimeEnv,
|
|
25
|
+
...extra?.runtime
|
|
26
|
+
},
|
|
27
|
+
metadata: {
|
|
28
|
+
...envVars,
|
|
29
|
+
...envVars.revision_id || "revision_id" in run && run.revision_id ? { revision_id: ("revision_id" in run ? run.revision_id : void 0) ?? envVars.revision_id } : {},
|
|
30
|
+
...metadata
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
return run;
|
|
34
|
+
}
|
|
35
|
+
const getTracingSamplingRate = (configRate) => {
|
|
36
|
+
const samplingRateStr = configRate?.toString() ?? getLangSmithEnvironmentVariable("TRACING_SAMPLING_RATE");
|
|
37
|
+
if (samplingRateStr === void 0) return void 0;
|
|
38
|
+
const samplingRate = parseFloat(samplingRateStr);
|
|
39
|
+
if (samplingRate < 0 || samplingRate > 1) throw new Error(`LANGSMITH_TRACING_SAMPLING_RATE must be between 0 and 1 if set. Got: ${samplingRate}`);
|
|
40
|
+
return samplingRate;
|
|
41
|
+
};
|
|
42
|
+
const isLocalhost = (url) => {
|
|
43
|
+
const strippedUrl = url.replace("http://", "").replace("https://", "");
|
|
44
|
+
const hostname = strippedUrl.split("/")[0].split(":")[0];
|
|
45
|
+
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1";
|
|
46
|
+
};
|
|
47
|
+
async function toArray(iterable) {
|
|
48
|
+
const result = [];
|
|
49
|
+
for await (const item of iterable) result.push(item);
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
function trimQuotes(str) {
|
|
53
|
+
if (str === void 0) return void 0;
|
|
54
|
+
return str.trim().replace(/^"(.*)"$/, "$1").replace(/^'(.*)'$/, "$1");
|
|
55
|
+
}
|
|
56
|
+
const handle429 = async (response) => {
|
|
57
|
+
if (response?.status === 429) {
|
|
58
|
+
const retryAfter = parseInt(response.headers.get("retry-after") ?? "10", 10) * 1e3;
|
|
59
|
+
if (retryAfter > 0) {
|
|
60
|
+
await new Promise((resolve) => setTimeout(resolve, retryAfter));
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
65
|
+
};
|
|
66
|
+
function _formatFeedbackScore(score) {
|
|
67
|
+
if (typeof score === "number") return Number(score.toFixed(4));
|
|
68
|
+
return score;
|
|
69
|
+
}
|
|
70
|
+
var AutoBatchQueue = class {
|
|
71
|
+
constructor() {
|
|
72
|
+
Object.defineProperty(this, "items", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
configurable: true,
|
|
75
|
+
writable: true,
|
|
76
|
+
value: []
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(this, "sizeBytes", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
configurable: true,
|
|
81
|
+
writable: true,
|
|
82
|
+
value: 0
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
peek() {
|
|
86
|
+
return this.items[0];
|
|
87
|
+
}
|
|
88
|
+
push(item) {
|
|
89
|
+
let itemPromiseResolve;
|
|
90
|
+
const itemPromise = new Promise((resolve) => {
|
|
91
|
+
itemPromiseResolve = resolve;
|
|
92
|
+
});
|
|
93
|
+
const size = serialize(item.item, `Serializing run with id: ${item.item.id}`).length;
|
|
94
|
+
this.items.push({
|
|
95
|
+
action: item.action,
|
|
96
|
+
payload: item.item,
|
|
97
|
+
otelContext: item.otelContext,
|
|
98
|
+
apiKey: item.apiKey,
|
|
99
|
+
apiUrl: item.apiUrl,
|
|
100
|
+
itemPromiseResolve,
|
|
101
|
+
itemPromise,
|
|
102
|
+
size
|
|
103
|
+
});
|
|
104
|
+
this.sizeBytes += size;
|
|
105
|
+
return itemPromise;
|
|
106
|
+
}
|
|
107
|
+
pop(upToSizeBytes) {
|
|
108
|
+
if (upToSizeBytes < 1) throw new Error("Number of bytes to pop off may not be less than 1.");
|
|
109
|
+
const popped = [];
|
|
110
|
+
let poppedSizeBytes = 0;
|
|
111
|
+
while (poppedSizeBytes + (this.peek()?.size ?? 0) < upToSizeBytes && this.items.length > 0) {
|
|
112
|
+
const item = this.items.shift();
|
|
113
|
+
if (item) {
|
|
114
|
+
popped.push(item);
|
|
115
|
+
poppedSizeBytes += item.size;
|
|
116
|
+
this.sizeBytes -= item.size;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (popped.length === 0 && this.items.length > 0) {
|
|
120
|
+
const item = this.items.shift();
|
|
121
|
+
popped.push(item);
|
|
122
|
+
poppedSizeBytes += item.size;
|
|
123
|
+
this.sizeBytes -= item.size;
|
|
124
|
+
}
|
|
125
|
+
return [popped.map((it) => ({
|
|
126
|
+
action: it.action,
|
|
127
|
+
item: it.payload,
|
|
128
|
+
otelContext: it.otelContext,
|
|
129
|
+
apiKey: it.apiKey,
|
|
130
|
+
apiUrl: it.apiUrl
|
|
131
|
+
})), () => popped.forEach((it) => it.itemPromiseResolve())];
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
const DEFAULT_UNCOMPRESSED_BATCH_SIZE_LIMIT_BYTES = 24 * 1024 * 1024;
|
|
135
|
+
const SERVER_INFO_REQUEST_TIMEOUT_MS = 1e4;
|
|
136
|
+
const DEFAULT_API_URL = "https://api.smith.langchain.com";
|
|
137
|
+
var Client = class Client {
|
|
138
|
+
get _fetch() {
|
|
139
|
+
return this.fetchImplementation || _getFetchImplementation(this.debug);
|
|
140
|
+
}
|
|
141
|
+
constructor(config = {}) {
|
|
142
|
+
Object.defineProperty(this, "apiKey", {
|
|
143
|
+
enumerable: true,
|
|
144
|
+
configurable: true,
|
|
145
|
+
writable: true,
|
|
146
|
+
value: void 0
|
|
147
|
+
});
|
|
148
|
+
Object.defineProperty(this, "apiUrl", {
|
|
149
|
+
enumerable: true,
|
|
150
|
+
configurable: true,
|
|
151
|
+
writable: true,
|
|
152
|
+
value: void 0
|
|
153
|
+
});
|
|
154
|
+
Object.defineProperty(this, "webUrl", {
|
|
155
|
+
enumerable: true,
|
|
156
|
+
configurable: true,
|
|
157
|
+
writable: true,
|
|
158
|
+
value: void 0
|
|
159
|
+
});
|
|
160
|
+
Object.defineProperty(this, "caller", {
|
|
161
|
+
enumerable: true,
|
|
162
|
+
configurable: true,
|
|
163
|
+
writable: true,
|
|
164
|
+
value: void 0
|
|
165
|
+
});
|
|
166
|
+
Object.defineProperty(this, "batchIngestCaller", {
|
|
167
|
+
enumerable: true,
|
|
168
|
+
configurable: true,
|
|
169
|
+
writable: true,
|
|
170
|
+
value: void 0
|
|
171
|
+
});
|
|
172
|
+
Object.defineProperty(this, "timeout_ms", {
|
|
173
|
+
enumerable: true,
|
|
174
|
+
configurable: true,
|
|
175
|
+
writable: true,
|
|
176
|
+
value: void 0
|
|
177
|
+
});
|
|
178
|
+
Object.defineProperty(this, "_tenantId", {
|
|
179
|
+
enumerable: true,
|
|
180
|
+
configurable: true,
|
|
181
|
+
writable: true,
|
|
182
|
+
value: null
|
|
183
|
+
});
|
|
184
|
+
Object.defineProperty(this, "hideInputs", {
|
|
185
|
+
enumerable: true,
|
|
186
|
+
configurable: true,
|
|
187
|
+
writable: true,
|
|
188
|
+
value: void 0
|
|
189
|
+
});
|
|
190
|
+
Object.defineProperty(this, "hideOutputs", {
|
|
191
|
+
enumerable: true,
|
|
192
|
+
configurable: true,
|
|
193
|
+
writable: true,
|
|
194
|
+
value: void 0
|
|
195
|
+
});
|
|
196
|
+
Object.defineProperty(this, "tracingSampleRate", {
|
|
197
|
+
enumerable: true,
|
|
198
|
+
configurable: true,
|
|
199
|
+
writable: true,
|
|
200
|
+
value: void 0
|
|
201
|
+
});
|
|
202
|
+
Object.defineProperty(this, "filteredPostUuids", {
|
|
203
|
+
enumerable: true,
|
|
204
|
+
configurable: true,
|
|
205
|
+
writable: true,
|
|
206
|
+
value: /* @__PURE__ */ new Set()
|
|
207
|
+
});
|
|
208
|
+
Object.defineProperty(this, "autoBatchTracing", {
|
|
209
|
+
enumerable: true,
|
|
210
|
+
configurable: true,
|
|
211
|
+
writable: true,
|
|
212
|
+
value: true
|
|
213
|
+
});
|
|
214
|
+
Object.defineProperty(this, "autoBatchQueue", {
|
|
215
|
+
enumerable: true,
|
|
216
|
+
configurable: true,
|
|
217
|
+
writable: true,
|
|
218
|
+
value: new AutoBatchQueue()
|
|
219
|
+
});
|
|
220
|
+
Object.defineProperty(this, "autoBatchTimeout", {
|
|
221
|
+
enumerable: true,
|
|
222
|
+
configurable: true,
|
|
223
|
+
writable: true,
|
|
224
|
+
value: void 0
|
|
225
|
+
});
|
|
226
|
+
Object.defineProperty(this, "autoBatchAggregationDelayMs", {
|
|
227
|
+
enumerable: true,
|
|
228
|
+
configurable: true,
|
|
229
|
+
writable: true,
|
|
230
|
+
value: 250
|
|
231
|
+
});
|
|
232
|
+
Object.defineProperty(this, "batchSizeBytesLimit", {
|
|
233
|
+
enumerable: true,
|
|
234
|
+
configurable: true,
|
|
235
|
+
writable: true,
|
|
236
|
+
value: void 0
|
|
237
|
+
});
|
|
238
|
+
Object.defineProperty(this, "fetchOptions", {
|
|
239
|
+
enumerable: true,
|
|
240
|
+
configurable: true,
|
|
241
|
+
writable: true,
|
|
242
|
+
value: void 0
|
|
243
|
+
});
|
|
244
|
+
Object.defineProperty(this, "settings", {
|
|
245
|
+
enumerable: true,
|
|
246
|
+
configurable: true,
|
|
247
|
+
writable: true,
|
|
248
|
+
value: void 0
|
|
249
|
+
});
|
|
250
|
+
Object.defineProperty(this, "blockOnRootRunFinalization", {
|
|
251
|
+
enumerable: true,
|
|
252
|
+
configurable: true,
|
|
253
|
+
writable: true,
|
|
254
|
+
value: getEnvironmentVariable("LANGSMITH_TRACING_BACKGROUND") === "false"
|
|
255
|
+
});
|
|
256
|
+
Object.defineProperty(this, "traceBatchConcurrency", {
|
|
257
|
+
enumerable: true,
|
|
258
|
+
configurable: true,
|
|
259
|
+
writable: true,
|
|
260
|
+
value: 5
|
|
261
|
+
});
|
|
262
|
+
Object.defineProperty(this, "_serverInfo", {
|
|
263
|
+
enumerable: true,
|
|
264
|
+
configurable: true,
|
|
265
|
+
writable: true,
|
|
266
|
+
value: void 0
|
|
267
|
+
});
|
|
268
|
+
Object.defineProperty(this, "_getServerInfoPromise", {
|
|
269
|
+
enumerable: true,
|
|
270
|
+
configurable: true,
|
|
271
|
+
writable: true,
|
|
272
|
+
value: void 0
|
|
273
|
+
});
|
|
274
|
+
Object.defineProperty(this, "manualFlushMode", {
|
|
275
|
+
enumerable: true,
|
|
276
|
+
configurable: true,
|
|
277
|
+
writable: true,
|
|
278
|
+
value: false
|
|
279
|
+
});
|
|
280
|
+
Object.defineProperty(this, "langSmithToOTELTranslator", {
|
|
281
|
+
enumerable: true,
|
|
282
|
+
configurable: true,
|
|
283
|
+
writable: true,
|
|
284
|
+
value: void 0
|
|
285
|
+
});
|
|
286
|
+
Object.defineProperty(this, "fetchImplementation", {
|
|
287
|
+
enumerable: true,
|
|
288
|
+
configurable: true,
|
|
289
|
+
writable: true,
|
|
290
|
+
value: void 0
|
|
291
|
+
});
|
|
292
|
+
Object.defineProperty(this, "multipartStreamingDisabled", {
|
|
293
|
+
enumerable: true,
|
|
294
|
+
configurable: true,
|
|
295
|
+
writable: true,
|
|
296
|
+
value: false
|
|
297
|
+
});
|
|
298
|
+
Object.defineProperty(this, "debug", {
|
|
299
|
+
enumerable: true,
|
|
300
|
+
configurable: true,
|
|
301
|
+
writable: true,
|
|
302
|
+
value: getEnvironmentVariable("LANGSMITH_DEBUG") === "true"
|
|
303
|
+
});
|
|
304
|
+
const defaultConfig = Client.getDefaultClientConfig();
|
|
305
|
+
this.tracingSampleRate = getTracingSamplingRate(config.tracingSamplingRate);
|
|
306
|
+
this.apiUrl = trimQuotes(config.apiUrl ?? defaultConfig.apiUrl) ?? "";
|
|
307
|
+
if (this.apiUrl.endsWith("/")) this.apiUrl = this.apiUrl.slice(0, -1);
|
|
308
|
+
this.apiKey = trimQuotes(config.apiKey ?? defaultConfig.apiKey);
|
|
309
|
+
this.webUrl = trimQuotes(config.webUrl ?? defaultConfig.webUrl);
|
|
310
|
+
if (this.webUrl?.endsWith("/")) this.webUrl = this.webUrl.slice(0, -1);
|
|
311
|
+
this.timeout_ms = config.timeout_ms ?? 9e4;
|
|
312
|
+
this.caller = new AsyncCaller({
|
|
313
|
+
...config.callerOptions ?? {},
|
|
314
|
+
maxRetries: 4,
|
|
315
|
+
debug: config.debug ?? this.debug
|
|
316
|
+
});
|
|
317
|
+
this.traceBatchConcurrency = config.traceBatchConcurrency ?? this.traceBatchConcurrency;
|
|
318
|
+
if (this.traceBatchConcurrency < 1) throw new Error("Trace batch concurrency must be positive.");
|
|
319
|
+
this.debug = config.debug ?? this.debug;
|
|
320
|
+
this.fetchImplementation = config.fetchImplementation;
|
|
321
|
+
this.batchIngestCaller = new AsyncCaller({
|
|
322
|
+
maxRetries: 2,
|
|
323
|
+
maxConcurrency: this.traceBatchConcurrency,
|
|
324
|
+
...config.callerOptions ?? {},
|
|
325
|
+
onFailedResponseHook: handle429,
|
|
326
|
+
debug: config.debug ?? this.debug
|
|
327
|
+
});
|
|
328
|
+
this.hideInputs = config.hideInputs ?? config.anonymizer ?? defaultConfig.hideInputs;
|
|
329
|
+
this.hideOutputs = config.hideOutputs ?? config.anonymizer ?? defaultConfig.hideOutputs;
|
|
330
|
+
this.autoBatchTracing = config.autoBatchTracing ?? this.autoBatchTracing;
|
|
331
|
+
this.blockOnRootRunFinalization = config.blockOnRootRunFinalization ?? this.blockOnRootRunFinalization;
|
|
332
|
+
this.batchSizeBytesLimit = config.batchSizeBytesLimit;
|
|
333
|
+
this.fetchOptions = config.fetchOptions || {};
|
|
334
|
+
this.manualFlushMode = config.manualFlushMode ?? this.manualFlushMode;
|
|
335
|
+
if (getOtelEnabled()) this.langSmithToOTELTranslator = new LangSmithToOTELTranslator();
|
|
336
|
+
}
|
|
337
|
+
static getDefaultClientConfig() {
|
|
338
|
+
const apiKey = getLangSmithEnvironmentVariable("API_KEY");
|
|
339
|
+
const apiUrl = getLangSmithEnvironmentVariable("ENDPOINT") ?? DEFAULT_API_URL;
|
|
340
|
+
const hideInputs = getLangSmithEnvironmentVariable("HIDE_INPUTS") === "true";
|
|
341
|
+
const hideOutputs = getLangSmithEnvironmentVariable("HIDE_OUTPUTS") === "true";
|
|
342
|
+
return {
|
|
343
|
+
apiUrl,
|
|
344
|
+
apiKey,
|
|
345
|
+
webUrl: void 0,
|
|
346
|
+
hideInputs,
|
|
347
|
+
hideOutputs
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
getHostUrl() {
|
|
351
|
+
if (this.webUrl) return this.webUrl;
|
|
352
|
+
else if (isLocalhost(this.apiUrl)) {
|
|
353
|
+
this.webUrl = "http://localhost:3000";
|
|
354
|
+
return this.webUrl;
|
|
355
|
+
} else if (this.apiUrl.endsWith("/api/v1")) {
|
|
356
|
+
this.webUrl = this.apiUrl.replace("/api/v1", "");
|
|
357
|
+
return this.webUrl;
|
|
358
|
+
} else if (this.apiUrl.includes("/api") && !this.apiUrl.split(".", 1)[0].endsWith("api")) {
|
|
359
|
+
this.webUrl = this.apiUrl.replace("/api", "");
|
|
360
|
+
return this.webUrl;
|
|
361
|
+
} else if (this.apiUrl.split(".", 1)[0].includes("dev")) {
|
|
362
|
+
this.webUrl = "https://dev.smith.langchain.com";
|
|
363
|
+
return this.webUrl;
|
|
364
|
+
} else if (this.apiUrl.split(".", 1)[0].includes("eu")) {
|
|
365
|
+
this.webUrl = "https://eu.smith.langchain.com";
|
|
366
|
+
return this.webUrl;
|
|
367
|
+
} else if (this.apiUrl.split(".", 1)[0].includes("beta")) {
|
|
368
|
+
this.webUrl = "https://beta.smith.langchain.com";
|
|
369
|
+
return this.webUrl;
|
|
370
|
+
} else {
|
|
371
|
+
this.webUrl = "https://smith.langchain.com";
|
|
372
|
+
return this.webUrl;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
get headers() {
|
|
376
|
+
const headers = { "User-Agent": `langsmith-js/${__version__}` };
|
|
377
|
+
if (this.apiKey) headers["x-api-key"] = `${this.apiKey}`;
|
|
378
|
+
return headers;
|
|
379
|
+
}
|
|
380
|
+
_getPlatformEndpointPath(path) {
|
|
381
|
+
const needsV1Prefix = this.apiUrl.slice(-3) !== "/v1" && this.apiUrl.slice(-4) !== "/v1/";
|
|
382
|
+
return needsV1Prefix ? `/v1/platform/${path}` : `/platform/${path}`;
|
|
383
|
+
}
|
|
384
|
+
async processInputs(inputs) {
|
|
385
|
+
if (this.hideInputs === false) return inputs;
|
|
386
|
+
if (this.hideInputs === true) return {};
|
|
387
|
+
if (typeof this.hideInputs === "function") return this.hideInputs(inputs);
|
|
388
|
+
return inputs;
|
|
389
|
+
}
|
|
390
|
+
async processOutputs(outputs) {
|
|
391
|
+
if (this.hideOutputs === false) return outputs;
|
|
392
|
+
if (this.hideOutputs === true) return {};
|
|
393
|
+
if (typeof this.hideOutputs === "function") return this.hideOutputs(outputs);
|
|
394
|
+
return outputs;
|
|
395
|
+
}
|
|
396
|
+
async prepareRunCreateOrUpdateInputs(run) {
|
|
397
|
+
const runParams = { ...run };
|
|
398
|
+
if (runParams.inputs !== void 0) runParams.inputs = await this.processInputs(runParams.inputs);
|
|
399
|
+
if (runParams.outputs !== void 0) runParams.outputs = await this.processOutputs(runParams.outputs);
|
|
400
|
+
return runParams;
|
|
401
|
+
}
|
|
402
|
+
async _getResponse(path, queryParams) {
|
|
403
|
+
const paramsString = queryParams?.toString() ?? "";
|
|
404
|
+
const url = `${this.apiUrl}${path}?${paramsString}`;
|
|
405
|
+
const response = await this.caller.call(async () => {
|
|
406
|
+
const res = await this._fetch(url, {
|
|
407
|
+
method: "GET",
|
|
408
|
+
headers: this.headers,
|
|
409
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
410
|
+
...this.fetchOptions
|
|
411
|
+
});
|
|
412
|
+
await raiseForStatus(res, `Failed to fetch ${path}`);
|
|
413
|
+
return res;
|
|
414
|
+
});
|
|
415
|
+
return response;
|
|
416
|
+
}
|
|
417
|
+
async _get(path, queryParams) {
|
|
418
|
+
const response = await this._getResponse(path, queryParams);
|
|
419
|
+
return response.json();
|
|
420
|
+
}
|
|
421
|
+
async *_getPaginated(path, queryParams = new URLSearchParams(), transform) {
|
|
422
|
+
let offset = Number(queryParams.get("offset")) || 0;
|
|
423
|
+
const limit = Number(queryParams.get("limit")) || 100;
|
|
424
|
+
while (true) {
|
|
425
|
+
queryParams.set("offset", String(offset));
|
|
426
|
+
queryParams.set("limit", String(limit));
|
|
427
|
+
const url = `${this.apiUrl}${path}?${queryParams}`;
|
|
428
|
+
const response = await this.caller.call(async () => {
|
|
429
|
+
const res = await this._fetch(url, {
|
|
430
|
+
method: "GET",
|
|
431
|
+
headers: this.headers,
|
|
432
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
433
|
+
...this.fetchOptions
|
|
434
|
+
});
|
|
435
|
+
await raiseForStatus(res, `Failed to fetch ${path}`);
|
|
436
|
+
return res;
|
|
437
|
+
});
|
|
438
|
+
const items = transform ? transform(await response.json()) : await response.json();
|
|
439
|
+
if (items.length === 0) break;
|
|
440
|
+
yield items;
|
|
441
|
+
if (items.length < limit) break;
|
|
442
|
+
offset += items.length;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
async *_getCursorPaginatedList(path, body = null, requestMethod = "POST", dataKey = "runs") {
|
|
446
|
+
const bodyParams = body ? { ...body } : {};
|
|
447
|
+
while (true) {
|
|
448
|
+
const body$1 = JSON.stringify(bodyParams);
|
|
449
|
+
const response = await this.caller.call(async () => {
|
|
450
|
+
const res = await this._fetch(`${this.apiUrl}${path}`, {
|
|
451
|
+
method: requestMethod,
|
|
452
|
+
headers: {
|
|
453
|
+
...this.headers,
|
|
454
|
+
"Content-Type": "application/json"
|
|
455
|
+
},
|
|
456
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
457
|
+
...this.fetchOptions,
|
|
458
|
+
body: body$1
|
|
459
|
+
});
|
|
460
|
+
await raiseForStatus(res, `Failed to fetch ${path}`);
|
|
461
|
+
return res;
|
|
462
|
+
});
|
|
463
|
+
const responseBody = await response.json();
|
|
464
|
+
if (!responseBody) break;
|
|
465
|
+
if (!responseBody[dataKey]) break;
|
|
466
|
+
yield responseBody[dataKey];
|
|
467
|
+
const cursors = responseBody.cursors;
|
|
468
|
+
if (!cursors) break;
|
|
469
|
+
if (!cursors.next) break;
|
|
470
|
+
bodyParams.cursor = cursors.next;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
_shouldSample() {
|
|
474
|
+
if (this.tracingSampleRate === void 0) return true;
|
|
475
|
+
return Math.random() < this.tracingSampleRate;
|
|
476
|
+
}
|
|
477
|
+
_filterForSampling(runs, patch = false) {
|
|
478
|
+
if (this.tracingSampleRate === void 0) return runs;
|
|
479
|
+
if (patch) {
|
|
480
|
+
const sampled = [];
|
|
481
|
+
for (const run of runs) if (!this.filteredPostUuids.has(run.trace_id)) sampled.push(run);
|
|
482
|
+
else if (run.id === run.trace_id) this.filteredPostUuids.delete(run.trace_id);
|
|
483
|
+
return sampled;
|
|
484
|
+
} else {
|
|
485
|
+
const sampled = [];
|
|
486
|
+
for (const run of runs) {
|
|
487
|
+
const traceId = run.trace_id ?? run.id;
|
|
488
|
+
if (this.filteredPostUuids.has(traceId)) continue;
|
|
489
|
+
if (run.id === traceId) if (this._shouldSample()) sampled.push(run);
|
|
490
|
+
else this.filteredPostUuids.add(traceId);
|
|
491
|
+
else sampled.push(run);
|
|
492
|
+
}
|
|
493
|
+
return sampled;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
async _getBatchSizeLimitBytes() {
|
|
497
|
+
const serverInfo = await this._ensureServerInfo();
|
|
498
|
+
return this.batchSizeBytesLimit ?? serverInfo.batch_ingest_config?.size_limit_bytes ?? DEFAULT_UNCOMPRESSED_BATCH_SIZE_LIMIT_BYTES;
|
|
499
|
+
}
|
|
500
|
+
async _getDatasetExamplesMultiPartSupport() {
|
|
501
|
+
const serverInfo = await this._ensureServerInfo();
|
|
502
|
+
return serverInfo.instance_flags?.dataset_examples_multipart_enabled ?? false;
|
|
503
|
+
}
|
|
504
|
+
drainAutoBatchQueue(batchSizeLimit) {
|
|
505
|
+
const promises = [];
|
|
506
|
+
while (this.autoBatchQueue.items.length > 0) {
|
|
507
|
+
const [batch, done] = this.autoBatchQueue.pop(batchSizeLimit);
|
|
508
|
+
if (!batch.length) {
|
|
509
|
+
done();
|
|
510
|
+
break;
|
|
511
|
+
}
|
|
512
|
+
const batchesByDestination = batch.reduce((acc, item) => {
|
|
513
|
+
const apiUrl = item.apiUrl ?? this.apiUrl;
|
|
514
|
+
const apiKey = item.apiKey ?? this.apiKey;
|
|
515
|
+
const isDefault = item.apiKey === this.apiKey && item.apiUrl === this.apiUrl;
|
|
516
|
+
const batchKey = isDefault ? "default" : `${apiUrl}|${apiKey}`;
|
|
517
|
+
if (!acc[batchKey]) acc[batchKey] = [];
|
|
518
|
+
acc[batchKey].push(item);
|
|
519
|
+
return acc;
|
|
520
|
+
}, {});
|
|
521
|
+
const batchPromises = [];
|
|
522
|
+
for (const [batchKey, batch$1] of Object.entries(batchesByDestination)) {
|
|
523
|
+
const batchPromise = this._processBatch(batch$1, {
|
|
524
|
+
apiUrl: batchKey === "default" ? void 0 : batchKey.split("|")[0],
|
|
525
|
+
apiKey: batchKey === "default" ? void 0 : batchKey.split("|")[1]
|
|
526
|
+
});
|
|
527
|
+
batchPromises.push(batchPromise);
|
|
528
|
+
}
|
|
529
|
+
const allBatchesPromise = Promise.all(batchPromises).finally(done);
|
|
530
|
+
promises.push(allBatchesPromise);
|
|
531
|
+
}
|
|
532
|
+
return Promise.all(promises);
|
|
533
|
+
}
|
|
534
|
+
async _processBatch(batch, options) {
|
|
535
|
+
if (!batch.length) return;
|
|
536
|
+
try {
|
|
537
|
+
if (this.langSmithToOTELTranslator !== void 0) this._sendBatchToOTELTranslator(batch);
|
|
538
|
+
else {
|
|
539
|
+
const ingestParams = {
|
|
540
|
+
runCreates: batch.filter((item) => item.action === "create").map((item) => item.item),
|
|
541
|
+
runUpdates: batch.filter((item) => item.action === "update").map((item) => item.item)
|
|
542
|
+
};
|
|
543
|
+
const serverInfo = await this._ensureServerInfo();
|
|
544
|
+
if (serverInfo?.batch_ingest_config?.use_multipart_endpoint) {
|
|
545
|
+
const useGzip = serverInfo?.instance_flags?.gzip_body_enabled;
|
|
546
|
+
await this.multipartIngestRuns(ingestParams, {
|
|
547
|
+
...options,
|
|
548
|
+
useGzip
|
|
549
|
+
});
|
|
550
|
+
} else await this.batchIngestRuns(ingestParams, options);
|
|
551
|
+
}
|
|
552
|
+
} catch (e) {
|
|
553
|
+
console.error("Error exporting batch:", e);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
_sendBatchToOTELTranslator(batch) {
|
|
557
|
+
if (this.langSmithToOTELTranslator !== void 0) {
|
|
558
|
+
const otelContextMap = /* @__PURE__ */ new Map();
|
|
559
|
+
const operations = [];
|
|
560
|
+
for (const item of batch) if (item.item.id && item.otelContext) {
|
|
561
|
+
otelContextMap.set(item.item.id, item.otelContext);
|
|
562
|
+
if (item.action === "create") operations.push({
|
|
563
|
+
operation: "post",
|
|
564
|
+
id: item.item.id,
|
|
565
|
+
trace_id: item.item.trace_id ?? item.item.id,
|
|
566
|
+
run: item.item
|
|
567
|
+
});
|
|
568
|
+
else operations.push({
|
|
569
|
+
operation: "patch",
|
|
570
|
+
id: item.item.id,
|
|
571
|
+
trace_id: item.item.trace_id ?? item.item.id,
|
|
572
|
+
run: item.item
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
this.langSmithToOTELTranslator.exportBatch(operations, otelContextMap);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
async processRunOperation(item) {
|
|
579
|
+
clearTimeout(this.autoBatchTimeout);
|
|
580
|
+
this.autoBatchTimeout = void 0;
|
|
581
|
+
item.item = mergeRuntimeEnvIntoRun(item.item);
|
|
582
|
+
const itemPromise = this.autoBatchQueue.push(item);
|
|
583
|
+
if (this.manualFlushMode) return itemPromise;
|
|
584
|
+
const sizeLimitBytes = await this._getBatchSizeLimitBytes();
|
|
585
|
+
if (this.autoBatchQueue.sizeBytes > sizeLimitBytes) this.drainAutoBatchQueue(sizeLimitBytes);
|
|
586
|
+
if (this.autoBatchQueue.items.length > 0) this.autoBatchTimeout = setTimeout(() => {
|
|
587
|
+
this.autoBatchTimeout = void 0;
|
|
588
|
+
this.drainAutoBatchQueue(sizeLimitBytes);
|
|
589
|
+
}, this.autoBatchAggregationDelayMs);
|
|
590
|
+
return itemPromise;
|
|
591
|
+
}
|
|
592
|
+
async _getServerInfo() {
|
|
593
|
+
const response = await this.caller.call(async () => {
|
|
594
|
+
const res = await this._fetch(`${this.apiUrl}/info`, {
|
|
595
|
+
method: "GET",
|
|
596
|
+
headers: { Accept: "application/json" },
|
|
597
|
+
signal: AbortSignal.timeout(SERVER_INFO_REQUEST_TIMEOUT_MS),
|
|
598
|
+
...this.fetchOptions
|
|
599
|
+
});
|
|
600
|
+
await raiseForStatus(res, "get server info");
|
|
601
|
+
return res;
|
|
602
|
+
});
|
|
603
|
+
const json = await response.json();
|
|
604
|
+
if (this.debug) console.log("\n=== LangSmith Server Configuration ===\n" + JSON.stringify(json, null, 2) + "\n");
|
|
605
|
+
return json;
|
|
606
|
+
}
|
|
607
|
+
async _ensureServerInfo() {
|
|
608
|
+
if (this._getServerInfoPromise === void 0) this._getServerInfoPromise = (async () => {
|
|
609
|
+
if (this._serverInfo === void 0) try {
|
|
610
|
+
this._serverInfo = await this._getServerInfo();
|
|
611
|
+
} catch (e) {
|
|
612
|
+
console.warn(`[LANGSMITH]: Failed to fetch info on supported operations. Falling back to batch operations and default limits. Info: ${e.status ?? "Unspecified status code"} ${e.message}`);
|
|
613
|
+
}
|
|
614
|
+
return this._serverInfo ?? {};
|
|
615
|
+
})();
|
|
616
|
+
return this._getServerInfoPromise.then((serverInfo) => {
|
|
617
|
+
if (this._serverInfo === void 0) this._getServerInfoPromise = void 0;
|
|
618
|
+
return serverInfo;
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
async _getSettings() {
|
|
622
|
+
if (!this.settings) this.settings = this._get("/settings");
|
|
623
|
+
return await this.settings;
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Flushes current queued traces.
|
|
627
|
+
*/
|
|
628
|
+
async flush() {
|
|
629
|
+
const sizeLimitBytes = await this._getBatchSizeLimitBytes();
|
|
630
|
+
await this.drainAutoBatchQueue(sizeLimitBytes);
|
|
631
|
+
}
|
|
632
|
+
_cloneCurrentOTELContext() {
|
|
633
|
+
const otel_trace = getOTELTrace();
|
|
634
|
+
const otel_context = getOTELContext();
|
|
635
|
+
if (this.langSmithToOTELTranslator !== void 0) {
|
|
636
|
+
const currentSpan = otel_trace.getActiveSpan();
|
|
637
|
+
if (currentSpan) return otel_trace.setSpan(otel_context.active(), currentSpan);
|
|
638
|
+
}
|
|
639
|
+
return void 0;
|
|
640
|
+
}
|
|
641
|
+
async createRun(run, options) {
|
|
642
|
+
if (!this._filterForSampling([run]).length) return;
|
|
643
|
+
const headers = {
|
|
644
|
+
...this.headers,
|
|
645
|
+
"Content-Type": "application/json"
|
|
646
|
+
};
|
|
647
|
+
const session_name = run.project_name;
|
|
648
|
+
delete run.project_name;
|
|
649
|
+
const runCreate = await this.prepareRunCreateOrUpdateInputs({
|
|
650
|
+
session_name,
|
|
651
|
+
...run,
|
|
652
|
+
start_time: run.start_time ?? Date.now()
|
|
653
|
+
});
|
|
654
|
+
if (this.autoBatchTracing && runCreate.trace_id !== void 0 && runCreate.dotted_order !== void 0) {
|
|
655
|
+
const otelContext = this._cloneCurrentOTELContext();
|
|
656
|
+
this.processRunOperation({
|
|
657
|
+
action: "create",
|
|
658
|
+
item: runCreate,
|
|
659
|
+
otelContext,
|
|
660
|
+
apiKey: options?.apiKey,
|
|
661
|
+
apiUrl: options?.apiUrl
|
|
662
|
+
}).catch(console.error);
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
const mergedRunCreateParam = mergeRuntimeEnvIntoRun(runCreate);
|
|
666
|
+
if (options?.apiKey !== void 0) headers["x-api-key"] = options.apiKey;
|
|
667
|
+
const body = serialize(mergedRunCreateParam, `Creating run with id: ${mergedRunCreateParam.id}`);
|
|
668
|
+
await this.caller.call(async () => {
|
|
669
|
+
const res = await this._fetch(`${options?.apiUrl ?? this.apiUrl}/runs`, {
|
|
670
|
+
method: "POST",
|
|
671
|
+
headers,
|
|
672
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
673
|
+
...this.fetchOptions,
|
|
674
|
+
body
|
|
675
|
+
});
|
|
676
|
+
await raiseForStatus(res, "create run", true);
|
|
677
|
+
return res;
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* Batch ingest/upsert multiple runs in the Langsmith system.
|
|
682
|
+
* @param runs
|
|
683
|
+
*/
|
|
684
|
+
async batchIngestRuns({ runCreates, runUpdates }, options) {
|
|
685
|
+
if (runCreates === void 0 && runUpdates === void 0) return;
|
|
686
|
+
let preparedCreateParams = await Promise.all(runCreates?.map((create) => this.prepareRunCreateOrUpdateInputs(create)) ?? []);
|
|
687
|
+
let preparedUpdateParams = await Promise.all(runUpdates?.map((update) => this.prepareRunCreateOrUpdateInputs(update)) ?? []);
|
|
688
|
+
if (preparedCreateParams.length > 0 && preparedUpdateParams.length > 0) {
|
|
689
|
+
const createById = preparedCreateParams.reduce((params, run) => {
|
|
690
|
+
if (!run.id) return params;
|
|
691
|
+
params[run.id] = run;
|
|
692
|
+
return params;
|
|
693
|
+
}, {});
|
|
694
|
+
const standaloneUpdates = [];
|
|
695
|
+
for (const updateParam of preparedUpdateParams) if (updateParam.id !== void 0 && createById[updateParam.id]) createById[updateParam.id] = {
|
|
696
|
+
...createById[updateParam.id],
|
|
697
|
+
...updateParam
|
|
698
|
+
};
|
|
699
|
+
else standaloneUpdates.push(updateParam);
|
|
700
|
+
preparedCreateParams = Object.values(createById);
|
|
701
|
+
preparedUpdateParams = standaloneUpdates;
|
|
702
|
+
}
|
|
703
|
+
const rawBatch = {
|
|
704
|
+
post: preparedCreateParams,
|
|
705
|
+
patch: preparedUpdateParams
|
|
706
|
+
};
|
|
707
|
+
if (!rawBatch.post.length && !rawBatch.patch.length) return;
|
|
708
|
+
const batchChunks = {
|
|
709
|
+
post: [],
|
|
710
|
+
patch: []
|
|
711
|
+
};
|
|
712
|
+
for (const k of ["post", "patch"]) {
|
|
713
|
+
const key = k;
|
|
714
|
+
const batchItems = rawBatch[key].reverse();
|
|
715
|
+
let batchItem = batchItems.pop();
|
|
716
|
+
while (batchItem !== void 0) {
|
|
717
|
+
batchChunks[key].push(batchItem);
|
|
718
|
+
batchItem = batchItems.pop();
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
if (batchChunks.post.length > 0 || batchChunks.patch.length > 0) {
|
|
722
|
+
const runIds = batchChunks.post.map((item) => item.id).concat(batchChunks.patch.map((item) => item.id)).join(",");
|
|
723
|
+
await this._postBatchIngestRuns(serialize(batchChunks, `Ingesting runs with ids: ${runIds}`), options);
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
async _postBatchIngestRuns(body, options) {
|
|
727
|
+
const headers = {
|
|
728
|
+
...this.headers,
|
|
729
|
+
"Content-Type": "application/json",
|
|
730
|
+
Accept: "application/json"
|
|
731
|
+
};
|
|
732
|
+
if (options?.apiKey !== void 0) headers["x-api-key"] = options.apiKey;
|
|
733
|
+
await this.batchIngestCaller.call(async () => {
|
|
734
|
+
const res = await this._fetch(`${options?.apiUrl ?? this.apiUrl}/runs/batch`, {
|
|
735
|
+
method: "POST",
|
|
736
|
+
headers,
|
|
737
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
738
|
+
...this.fetchOptions,
|
|
739
|
+
body
|
|
740
|
+
});
|
|
741
|
+
await raiseForStatus(res, "batch create run", true);
|
|
742
|
+
return res;
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Batch ingest/upsert multiple runs in the Langsmith system.
|
|
747
|
+
* @param runs
|
|
748
|
+
*/
|
|
749
|
+
async multipartIngestRuns({ runCreates, runUpdates }, options) {
|
|
750
|
+
if (runCreates === void 0 && runUpdates === void 0) return;
|
|
751
|
+
const allAttachments = {};
|
|
752
|
+
let preparedCreateParams = [];
|
|
753
|
+
for (const create of runCreates ?? []) {
|
|
754
|
+
const preparedCreate = await this.prepareRunCreateOrUpdateInputs(create);
|
|
755
|
+
if (preparedCreate.id !== void 0 && preparedCreate.attachments !== void 0) allAttachments[preparedCreate.id] = preparedCreate.attachments;
|
|
756
|
+
delete preparedCreate.attachments;
|
|
757
|
+
preparedCreateParams.push(preparedCreate);
|
|
758
|
+
}
|
|
759
|
+
let preparedUpdateParams = [];
|
|
760
|
+
for (const update of runUpdates ?? []) preparedUpdateParams.push(await this.prepareRunCreateOrUpdateInputs(update));
|
|
761
|
+
const invalidRunCreate = preparedCreateParams.find((runCreate) => {
|
|
762
|
+
return runCreate.trace_id === void 0 || runCreate.dotted_order === void 0;
|
|
763
|
+
});
|
|
764
|
+
if (invalidRunCreate !== void 0) throw new Error(`Multipart ingest requires "trace_id" and "dotted_order" to be set when creating a run`);
|
|
765
|
+
const invalidRunUpdate = preparedUpdateParams.find((runUpdate) => {
|
|
766
|
+
return runUpdate.trace_id === void 0 || runUpdate.dotted_order === void 0;
|
|
767
|
+
});
|
|
768
|
+
if (invalidRunUpdate !== void 0) throw new Error(`Multipart ingest requires "trace_id" and "dotted_order" to be set when updating a run`);
|
|
769
|
+
if (preparedCreateParams.length > 0 && preparedUpdateParams.length > 0) {
|
|
770
|
+
const createById = preparedCreateParams.reduce((params, run) => {
|
|
771
|
+
if (!run.id) return params;
|
|
772
|
+
params[run.id] = run;
|
|
773
|
+
return params;
|
|
774
|
+
}, {});
|
|
775
|
+
const standaloneUpdates = [];
|
|
776
|
+
for (const updateParam of preparedUpdateParams) if (updateParam.id !== void 0 && createById[updateParam.id]) createById[updateParam.id] = {
|
|
777
|
+
...createById[updateParam.id],
|
|
778
|
+
...updateParam
|
|
779
|
+
};
|
|
780
|
+
else standaloneUpdates.push(updateParam);
|
|
781
|
+
preparedCreateParams = Object.values(createById);
|
|
782
|
+
preparedUpdateParams = standaloneUpdates;
|
|
783
|
+
}
|
|
784
|
+
if (preparedCreateParams.length === 0 && preparedUpdateParams.length === 0) return;
|
|
785
|
+
const accumulatedContext = [];
|
|
786
|
+
const accumulatedParts = [];
|
|
787
|
+
for (const [method, payloads] of [["post", preparedCreateParams], ["patch", preparedUpdateParams]]) for (const originalPayload of payloads) {
|
|
788
|
+
const { inputs, outputs, events, extra, error, serialized, attachments,...payload } = originalPayload;
|
|
789
|
+
const fields = {
|
|
790
|
+
inputs,
|
|
791
|
+
outputs,
|
|
792
|
+
events,
|
|
793
|
+
extra,
|
|
794
|
+
error,
|
|
795
|
+
serialized
|
|
796
|
+
};
|
|
797
|
+
const stringifiedPayload = serialize(payload, `Serializing for multipart ingestion of run with id: ${payload.id}`);
|
|
798
|
+
accumulatedParts.push({
|
|
799
|
+
name: `${method}.${payload.id}`,
|
|
800
|
+
payload: new Blob([stringifiedPayload], { type: `application/json; length=${stringifiedPayload.length}` })
|
|
801
|
+
});
|
|
802
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
803
|
+
if (value === void 0) continue;
|
|
804
|
+
const stringifiedValue = serialize(value, `Serializing ${key} for multipart ingestion of run with id: ${payload.id}`);
|
|
805
|
+
accumulatedParts.push({
|
|
806
|
+
name: `${method}.${payload.id}.${key}`,
|
|
807
|
+
payload: new Blob([stringifiedValue], { type: `application/json; length=${stringifiedValue.length}` })
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
if (payload.id !== void 0) {
|
|
811
|
+
const attachments$1 = allAttachments[payload.id];
|
|
812
|
+
if (attachments$1) {
|
|
813
|
+
delete allAttachments[payload.id];
|
|
814
|
+
for (const [name, attachment] of Object.entries(attachments$1)) {
|
|
815
|
+
let contentType;
|
|
816
|
+
let content;
|
|
817
|
+
if (Array.isArray(attachment)) [contentType, content] = attachment;
|
|
818
|
+
else {
|
|
819
|
+
contentType = attachment.mimeType;
|
|
820
|
+
content = attachment.data;
|
|
821
|
+
}
|
|
822
|
+
if (name.includes(".")) {
|
|
823
|
+
console.warn(`Skipping attachment '${name}' for run ${payload.id}: Invalid attachment name. Attachment names must not contain periods ('.'). Please rename the attachment and try again.`);
|
|
824
|
+
continue;
|
|
825
|
+
}
|
|
826
|
+
accumulatedParts.push({
|
|
827
|
+
name: `attachment.${payload.id}.${name}`,
|
|
828
|
+
payload: new Blob([content], { type: `${contentType}; length=${content.byteLength}` })
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
accumulatedContext.push(`trace=${payload.trace_id},id=${payload.id}`);
|
|
834
|
+
}
|
|
835
|
+
await this._sendMultipartRequest(accumulatedParts, accumulatedContext.join("; "), options);
|
|
836
|
+
}
|
|
837
|
+
async _createNodeFetchBody(parts, boundary) {
|
|
838
|
+
const chunks = [];
|
|
839
|
+
for (const part of parts) {
|
|
840
|
+
chunks.push(new Blob([`--${boundary}\r\n`]));
|
|
841
|
+
chunks.push(new Blob([`Content-Disposition: form-data; name="${part.name}"\r\n`, `Content-Type: ${part.payload.type}\r\n\r\n`]));
|
|
842
|
+
chunks.push(part.payload);
|
|
843
|
+
chunks.push(new Blob(["\r\n"]));
|
|
844
|
+
}
|
|
845
|
+
chunks.push(new Blob([`--${boundary}--\r\n`]));
|
|
846
|
+
const body = new Blob(chunks);
|
|
847
|
+
const arrayBuffer = await body.arrayBuffer();
|
|
848
|
+
return arrayBuffer;
|
|
849
|
+
}
|
|
850
|
+
async _createMultipartStream(parts, boundary) {
|
|
851
|
+
const encoder = new TextEncoder();
|
|
852
|
+
const stream = new ReadableStream({ async start(controller) {
|
|
853
|
+
const writeChunk = async (chunk) => {
|
|
854
|
+
if (typeof chunk === "string") controller.enqueue(encoder.encode(chunk));
|
|
855
|
+
else controller.enqueue(chunk);
|
|
856
|
+
};
|
|
857
|
+
for (const part of parts) {
|
|
858
|
+
await writeChunk(`--${boundary}\r\n`);
|
|
859
|
+
await writeChunk(`Content-Disposition: form-data; name="${part.name}"\r\n`);
|
|
860
|
+
await writeChunk(`Content-Type: ${part.payload.type}\r\n\r\n`);
|
|
861
|
+
const payloadStream = part.payload.stream();
|
|
862
|
+
const reader = payloadStream.getReader();
|
|
863
|
+
try {
|
|
864
|
+
let result;
|
|
865
|
+
while (!(result = await reader.read()).done) controller.enqueue(result.value);
|
|
866
|
+
} finally {
|
|
867
|
+
reader.releaseLock();
|
|
868
|
+
}
|
|
869
|
+
await writeChunk("\r\n");
|
|
870
|
+
}
|
|
871
|
+
await writeChunk(`--${boundary}--\r\n`);
|
|
872
|
+
controller.close();
|
|
873
|
+
} });
|
|
874
|
+
return stream;
|
|
875
|
+
}
|
|
876
|
+
async _sendMultipartRequest(parts, context, options) {
|
|
877
|
+
const boundary = "----LangSmithFormBoundary" + Math.random().toString(36).slice(2);
|
|
878
|
+
const isNodeFetch = _globalFetchImplementationIsNodeFetch();
|
|
879
|
+
const buildBuffered = () => this._createNodeFetchBody(parts, boundary);
|
|
880
|
+
const buildStream = () => this._createMultipartStream(parts, boundary);
|
|
881
|
+
const sendWithRetry = async (bodyFactory) => {
|
|
882
|
+
return this.batchIngestCaller.call(async () => {
|
|
883
|
+
const body = await bodyFactory();
|
|
884
|
+
const headers = {
|
|
885
|
+
...this.headers,
|
|
886
|
+
"Content-Type": `multipart/form-data; boundary=${boundary}`
|
|
887
|
+
};
|
|
888
|
+
if (options?.apiKey !== void 0) headers["x-api-key"] = options.apiKey;
|
|
889
|
+
let transformedBody = body;
|
|
890
|
+
if (options?.useGzip && typeof body === "object" && "pipeThrough" in body) {
|
|
891
|
+
transformedBody = body.pipeThrough(new CompressionStream("gzip"));
|
|
892
|
+
headers["Content-Encoding"] = "gzip";
|
|
893
|
+
}
|
|
894
|
+
const response = await this._fetch(`${options?.apiUrl ?? this.apiUrl}/runs/multipart`, {
|
|
895
|
+
method: "POST",
|
|
896
|
+
headers,
|
|
897
|
+
body: transformedBody,
|
|
898
|
+
duplex: "half",
|
|
899
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
900
|
+
...this.fetchOptions
|
|
901
|
+
});
|
|
902
|
+
await raiseForStatus(response, `Failed to send multipart request`, true);
|
|
903
|
+
return response;
|
|
904
|
+
});
|
|
905
|
+
};
|
|
906
|
+
try {
|
|
907
|
+
let res;
|
|
908
|
+
let streamedAttempt = false;
|
|
909
|
+
if (!isNodeFetch && !this.multipartStreamingDisabled && getEnv() !== "bun") {
|
|
910
|
+
streamedAttempt = true;
|
|
911
|
+
res = await sendWithRetry(buildStream);
|
|
912
|
+
} else res = await sendWithRetry(buildBuffered);
|
|
913
|
+
if ((!this.multipartStreamingDisabled || streamedAttempt) && res.status === 422 && (options?.apiUrl ?? this.apiUrl) !== DEFAULT_API_URL) {
|
|
914
|
+
console.warn(`Streaming multipart upload to ${options?.apiUrl ?? this.apiUrl}/runs/multipart failed. This usually means the host does not support chunked uploads. Retrying with a buffered upload for operation "${context}".`);
|
|
915
|
+
this.multipartStreamingDisabled = true;
|
|
916
|
+
res = await sendWithRetry(buildBuffered);
|
|
917
|
+
}
|
|
918
|
+
} catch (e) {
|
|
919
|
+
console.warn(`${e.message.trim()}\n\nContext: ${context}`);
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
async updateRun(runId, run, options) {
|
|
923
|
+
assertUuid(runId);
|
|
924
|
+
if (run.inputs) run.inputs = await this.processInputs(run.inputs);
|
|
925
|
+
if (run.outputs) run.outputs = await this.processOutputs(run.outputs);
|
|
926
|
+
const data = {
|
|
927
|
+
...run,
|
|
928
|
+
id: runId
|
|
929
|
+
};
|
|
930
|
+
if (!this._filterForSampling([data], true).length) return;
|
|
931
|
+
if (this.autoBatchTracing && data.trace_id !== void 0 && data.dotted_order !== void 0) {
|
|
932
|
+
const otelContext = this._cloneCurrentOTELContext();
|
|
933
|
+
if (run.end_time !== void 0 && data.parent_run_id === void 0 && this.blockOnRootRunFinalization && !this.manualFlushMode) {
|
|
934
|
+
await this.processRunOperation({
|
|
935
|
+
action: "update",
|
|
936
|
+
item: data,
|
|
937
|
+
otelContext,
|
|
938
|
+
apiKey: options?.apiKey,
|
|
939
|
+
apiUrl: options?.apiUrl
|
|
940
|
+
}).catch(console.error);
|
|
941
|
+
return;
|
|
942
|
+
} else this.processRunOperation({
|
|
943
|
+
action: "update",
|
|
944
|
+
item: data,
|
|
945
|
+
otelContext,
|
|
946
|
+
apiKey: options?.apiKey,
|
|
947
|
+
apiUrl: options?.apiUrl
|
|
948
|
+
}).catch(console.error);
|
|
949
|
+
return;
|
|
950
|
+
}
|
|
951
|
+
const headers = {
|
|
952
|
+
...this.headers,
|
|
953
|
+
"Content-Type": "application/json"
|
|
954
|
+
};
|
|
955
|
+
if (options?.apiKey !== void 0) headers["x-api-key"] = options.apiKey;
|
|
956
|
+
const body = serialize(run, `Serializing payload to update run with id: ${runId}`);
|
|
957
|
+
await this.caller.call(async () => {
|
|
958
|
+
const res = await this._fetch(`${options?.apiUrl ?? this.apiUrl}/runs/${runId}`, {
|
|
959
|
+
method: "PATCH",
|
|
960
|
+
headers,
|
|
961
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
962
|
+
...this.fetchOptions,
|
|
963
|
+
body
|
|
964
|
+
});
|
|
965
|
+
await raiseForStatus(res, "update run", true);
|
|
966
|
+
return res;
|
|
967
|
+
});
|
|
968
|
+
}
|
|
969
|
+
async readRun(runId, { loadChildRuns } = { loadChildRuns: false }) {
|
|
970
|
+
assertUuid(runId);
|
|
971
|
+
let run = await this._get(`/runs/${runId}`);
|
|
972
|
+
if (loadChildRuns) run = await this._loadChildRuns(run);
|
|
973
|
+
return run;
|
|
974
|
+
}
|
|
975
|
+
async getRunUrl({ runId, run, projectOpts }) {
|
|
976
|
+
if (run !== void 0) {
|
|
977
|
+
let sessionId;
|
|
978
|
+
if (run.session_id) sessionId = run.session_id;
|
|
979
|
+
else if (projectOpts?.projectName) sessionId = (await this.readProject({ projectName: projectOpts?.projectName })).id;
|
|
980
|
+
else if (projectOpts?.projectId) sessionId = projectOpts?.projectId;
|
|
981
|
+
else {
|
|
982
|
+
const project = await this.readProject({ projectName: getLangSmithEnvironmentVariable("PROJECT") || "default" });
|
|
983
|
+
sessionId = project.id;
|
|
984
|
+
}
|
|
985
|
+
const tenantId = await this._getTenantId();
|
|
986
|
+
return `${this.getHostUrl()}/o/${tenantId}/projects/p/${sessionId}/r/${run.id}?poll=true`;
|
|
987
|
+
} else if (runId !== void 0) {
|
|
988
|
+
const run_ = await this.readRun(runId);
|
|
989
|
+
if (!run_.app_path) throw new Error(`Run ${runId} has no app_path`);
|
|
990
|
+
const baseUrl = this.getHostUrl();
|
|
991
|
+
return `${baseUrl}${run_.app_path}`;
|
|
992
|
+
} else throw new Error("Must provide either runId or run");
|
|
993
|
+
}
|
|
994
|
+
async _loadChildRuns(run) {
|
|
995
|
+
const childRuns = await toArray(this.listRuns({
|
|
996
|
+
isRoot: false,
|
|
997
|
+
projectId: run.session_id,
|
|
998
|
+
traceId: run.trace_id
|
|
999
|
+
}));
|
|
1000
|
+
const treemap = {};
|
|
1001
|
+
const runs = {};
|
|
1002
|
+
childRuns.sort((a, b) => (a?.dotted_order ?? "").localeCompare(b?.dotted_order ?? ""));
|
|
1003
|
+
for (const childRun of childRuns) {
|
|
1004
|
+
if (childRun.parent_run_id === null || childRun.parent_run_id === void 0) throw new Error(`Child run ${childRun.id} has no parent`);
|
|
1005
|
+
if (childRun.dotted_order?.startsWith(run.dotted_order ?? "") && childRun.id !== run.id) {
|
|
1006
|
+
if (!(childRun.parent_run_id in treemap)) treemap[childRun.parent_run_id] = [];
|
|
1007
|
+
treemap[childRun.parent_run_id].push(childRun);
|
|
1008
|
+
runs[childRun.id] = childRun;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
run.child_runs = treemap[run.id] || [];
|
|
1012
|
+
for (const runId in treemap) if (runId !== run.id) runs[runId].child_runs = treemap[runId];
|
|
1013
|
+
return run;
|
|
1014
|
+
}
|
|
1015
|
+
/**
|
|
1016
|
+
* List runs from the LangSmith server.
|
|
1017
|
+
* @param projectId - The ID of the project to filter by.
|
|
1018
|
+
* @param projectName - The name of the project to filter by.
|
|
1019
|
+
* @param parentRunId - The ID of the parent run to filter by.
|
|
1020
|
+
* @param traceId - The ID of the trace to filter by.
|
|
1021
|
+
* @param referenceExampleId - The ID of the reference example to filter by.
|
|
1022
|
+
* @param startTime - The start time to filter by.
|
|
1023
|
+
* @param isRoot - Indicates whether to only return root runs.
|
|
1024
|
+
* @param runType - The run type to filter by.
|
|
1025
|
+
* @param error - Indicates whether to filter by error runs.
|
|
1026
|
+
* @param id - The ID of the run to filter by.
|
|
1027
|
+
* @param query - The query string to filter by.
|
|
1028
|
+
* @param filter - The filter string to apply to the run spans.
|
|
1029
|
+
* @param traceFilter - The filter string to apply on the root run of the trace.
|
|
1030
|
+
* @param treeFilter - The filter string to apply on other runs in the trace.
|
|
1031
|
+
* @param limit - The maximum number of runs to retrieve.
|
|
1032
|
+
* @returns {AsyncIterable<Run>} - The runs.
|
|
1033
|
+
*
|
|
1034
|
+
* @example
|
|
1035
|
+
* // List all runs in a project
|
|
1036
|
+
* const projectRuns = client.listRuns({ projectName: "<your_project>" });
|
|
1037
|
+
*
|
|
1038
|
+
* @example
|
|
1039
|
+
* // List LLM and Chat runs in the last 24 hours
|
|
1040
|
+
* const todaysLLMRuns = client.listRuns({
|
|
1041
|
+
* projectName: "<your_project>",
|
|
1042
|
+
* start_time: new Date(Date.now() - 24 * 60 * 60 * 1000),
|
|
1043
|
+
* run_type: "llm",
|
|
1044
|
+
* });
|
|
1045
|
+
*
|
|
1046
|
+
* @example
|
|
1047
|
+
* // List traces in a project
|
|
1048
|
+
* const rootRuns = client.listRuns({
|
|
1049
|
+
* projectName: "<your_project>",
|
|
1050
|
+
* execution_order: 1,
|
|
1051
|
+
* });
|
|
1052
|
+
*
|
|
1053
|
+
* @example
|
|
1054
|
+
* // List runs without errors
|
|
1055
|
+
* const correctRuns = client.listRuns({
|
|
1056
|
+
* projectName: "<your_project>",
|
|
1057
|
+
* error: false,
|
|
1058
|
+
* });
|
|
1059
|
+
*
|
|
1060
|
+
* @example
|
|
1061
|
+
* // List runs by run ID
|
|
1062
|
+
* const runIds = [
|
|
1063
|
+
* "a36092d2-4ad5-4fb4-9c0d-0dba9a2ed836",
|
|
1064
|
+
* "9398e6be-964f-4aa4-8ae9-ad78cd4b7074",
|
|
1065
|
+
* ];
|
|
1066
|
+
* const selectedRuns = client.listRuns({ run_ids: runIds });
|
|
1067
|
+
*
|
|
1068
|
+
* @example
|
|
1069
|
+
* // List all "chain" type runs that took more than 10 seconds and had `total_tokens` greater than 5000
|
|
1070
|
+
* const chainRuns = client.listRuns({
|
|
1071
|
+
* projectName: "<your_project>",
|
|
1072
|
+
* filter: 'and(eq(run_type, "chain"), gt(latency, 10), gt(total_tokens, 5000))',
|
|
1073
|
+
* });
|
|
1074
|
+
*
|
|
1075
|
+
* @example
|
|
1076
|
+
* // List all runs called "extractor" whose root of the trace was assigned feedback "user_score" score of 1
|
|
1077
|
+
* const goodExtractorRuns = client.listRuns({
|
|
1078
|
+
* projectName: "<your_project>",
|
|
1079
|
+
* filter: 'eq(name, "extractor")',
|
|
1080
|
+
* traceFilter: 'and(eq(feedback_key, "user_score"), eq(feedback_score, 1))',
|
|
1081
|
+
* });
|
|
1082
|
+
*
|
|
1083
|
+
* @example
|
|
1084
|
+
* // List all runs that started after a specific timestamp and either have "error" not equal to null or a "Correctness" feedback score equal to 0
|
|
1085
|
+
* const complexRuns = client.listRuns({
|
|
1086
|
+
* projectName: "<your_project>",
|
|
1087
|
+
* filter: 'and(gt(start_time, "2023-07-15T12:34:56Z"), or(neq(error, null), and(eq(feedback_key, "Correctness"), eq(feedback_score, 0.0))))',
|
|
1088
|
+
* });
|
|
1089
|
+
*
|
|
1090
|
+
* @example
|
|
1091
|
+
* // List all runs where `tags` include "experimental" or "beta" and `latency` is greater than 2 seconds
|
|
1092
|
+
* const taggedRuns = client.listRuns({
|
|
1093
|
+
* projectName: "<your_project>",
|
|
1094
|
+
* filter: 'and(or(has(tags, "experimental"), has(tags, "beta")), gt(latency, 2))',
|
|
1095
|
+
* });
|
|
1096
|
+
*/
|
|
1097
|
+
async *listRuns(props) {
|
|
1098
|
+
const { projectId, projectName, parentRunId, traceId, referenceExampleId, startTime, executionOrder, isRoot, runType, error, id, query, filter, traceFilter, treeFilter, limit, select, order } = props;
|
|
1099
|
+
let projectIds = [];
|
|
1100
|
+
if (projectId) projectIds = Array.isArray(projectId) ? projectId : [projectId];
|
|
1101
|
+
if (projectName) {
|
|
1102
|
+
const projectNames = Array.isArray(projectName) ? projectName : [projectName];
|
|
1103
|
+
const projectIds_ = await Promise.all(projectNames.map((name) => this.readProject({ projectName: name }).then((project) => project.id)));
|
|
1104
|
+
projectIds.push(...projectIds_);
|
|
1105
|
+
}
|
|
1106
|
+
const default_select = [
|
|
1107
|
+
"app_path",
|
|
1108
|
+
"completion_cost",
|
|
1109
|
+
"completion_tokens",
|
|
1110
|
+
"dotted_order",
|
|
1111
|
+
"end_time",
|
|
1112
|
+
"error",
|
|
1113
|
+
"events",
|
|
1114
|
+
"extra",
|
|
1115
|
+
"feedback_stats",
|
|
1116
|
+
"first_token_time",
|
|
1117
|
+
"id",
|
|
1118
|
+
"inputs",
|
|
1119
|
+
"name",
|
|
1120
|
+
"outputs",
|
|
1121
|
+
"parent_run_id",
|
|
1122
|
+
"parent_run_ids",
|
|
1123
|
+
"prompt_cost",
|
|
1124
|
+
"prompt_tokens",
|
|
1125
|
+
"reference_example_id",
|
|
1126
|
+
"run_type",
|
|
1127
|
+
"session_id",
|
|
1128
|
+
"start_time",
|
|
1129
|
+
"status",
|
|
1130
|
+
"tags",
|
|
1131
|
+
"total_cost",
|
|
1132
|
+
"total_tokens",
|
|
1133
|
+
"trace_id"
|
|
1134
|
+
];
|
|
1135
|
+
const body = {
|
|
1136
|
+
session: projectIds.length ? projectIds : null,
|
|
1137
|
+
run_type: runType,
|
|
1138
|
+
reference_example: referenceExampleId,
|
|
1139
|
+
query,
|
|
1140
|
+
filter,
|
|
1141
|
+
trace_filter: traceFilter,
|
|
1142
|
+
tree_filter: treeFilter,
|
|
1143
|
+
execution_order: executionOrder,
|
|
1144
|
+
parent_run: parentRunId,
|
|
1145
|
+
start_time: startTime ? startTime.toISOString() : null,
|
|
1146
|
+
error,
|
|
1147
|
+
id,
|
|
1148
|
+
limit,
|
|
1149
|
+
trace: traceId,
|
|
1150
|
+
select: select ? select : default_select,
|
|
1151
|
+
is_root: isRoot,
|
|
1152
|
+
order
|
|
1153
|
+
};
|
|
1154
|
+
let runsYielded = 0;
|
|
1155
|
+
for await (const runs of this._getCursorPaginatedList("/runs/query", body)) if (limit) {
|
|
1156
|
+
if (runsYielded >= limit) break;
|
|
1157
|
+
if (runs.length + runsYielded > limit) {
|
|
1158
|
+
const newRuns = runs.slice(0, limit - runsYielded);
|
|
1159
|
+
yield* newRuns;
|
|
1160
|
+
break;
|
|
1161
|
+
}
|
|
1162
|
+
runsYielded += runs.length;
|
|
1163
|
+
yield* runs;
|
|
1164
|
+
} else yield* runs;
|
|
1165
|
+
}
|
|
1166
|
+
async *listGroupRuns(props) {
|
|
1167
|
+
const { projectId, projectName, groupBy, filter, startTime, endTime, limit, offset } = props;
|
|
1168
|
+
const sessionId = projectId || (await this.readProject({ projectName })).id;
|
|
1169
|
+
const baseBody = {
|
|
1170
|
+
session_id: sessionId,
|
|
1171
|
+
group_by: groupBy,
|
|
1172
|
+
filter,
|
|
1173
|
+
start_time: startTime ? startTime.toISOString() : null,
|
|
1174
|
+
end_time: endTime ? endTime.toISOString() : null,
|
|
1175
|
+
limit: Number(limit) || 100
|
|
1176
|
+
};
|
|
1177
|
+
let currentOffset = Number(offset) || 0;
|
|
1178
|
+
const path = "/runs/group";
|
|
1179
|
+
const url = `${this.apiUrl}${path}`;
|
|
1180
|
+
while (true) {
|
|
1181
|
+
const currentBody = {
|
|
1182
|
+
...baseBody,
|
|
1183
|
+
offset: currentOffset
|
|
1184
|
+
};
|
|
1185
|
+
const filteredPayload = Object.fromEntries(Object.entries(currentBody).filter(([_, value]) => value !== void 0));
|
|
1186
|
+
const body = JSON.stringify(filteredPayload);
|
|
1187
|
+
const response = await this.caller.call(async () => {
|
|
1188
|
+
const res = await this._fetch(url, {
|
|
1189
|
+
method: "POST",
|
|
1190
|
+
headers: {
|
|
1191
|
+
...this.headers,
|
|
1192
|
+
"Content-Type": "application/json"
|
|
1193
|
+
},
|
|
1194
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1195
|
+
...this.fetchOptions,
|
|
1196
|
+
body
|
|
1197
|
+
});
|
|
1198
|
+
await raiseForStatus(res, `Failed to fetch ${path}`);
|
|
1199
|
+
return res;
|
|
1200
|
+
});
|
|
1201
|
+
const items = await response.json();
|
|
1202
|
+
const { groups, total } = items;
|
|
1203
|
+
if (groups.length === 0) break;
|
|
1204
|
+
for (const thread of groups) yield thread;
|
|
1205
|
+
currentOffset += groups.length;
|
|
1206
|
+
if (currentOffset >= total) break;
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
async getRunStats({ id, trace, parentRun, runType, projectNames, projectIds, referenceExampleIds, startTime, endTime, error, query, filter, traceFilter, treeFilter, isRoot, dataSourceType }) {
|
|
1210
|
+
let projectIds_ = projectIds || [];
|
|
1211
|
+
if (projectNames) projectIds_ = [...projectIds || [], ...await Promise.all(projectNames.map((name) => this.readProject({ projectName: name }).then((project) => project.id)))];
|
|
1212
|
+
const payload = {
|
|
1213
|
+
id,
|
|
1214
|
+
trace,
|
|
1215
|
+
parent_run: parentRun,
|
|
1216
|
+
run_type: runType,
|
|
1217
|
+
session: projectIds_,
|
|
1218
|
+
reference_example: referenceExampleIds,
|
|
1219
|
+
start_time: startTime,
|
|
1220
|
+
end_time: endTime,
|
|
1221
|
+
error,
|
|
1222
|
+
query,
|
|
1223
|
+
filter,
|
|
1224
|
+
trace_filter: traceFilter,
|
|
1225
|
+
tree_filter: treeFilter,
|
|
1226
|
+
is_root: isRoot,
|
|
1227
|
+
data_source_type: dataSourceType
|
|
1228
|
+
};
|
|
1229
|
+
const filteredPayload = Object.fromEntries(Object.entries(payload).filter(([_, value]) => value !== void 0));
|
|
1230
|
+
const body = JSON.stringify(filteredPayload);
|
|
1231
|
+
const response = await this.caller.call(async () => {
|
|
1232
|
+
const res = await this._fetch(`${this.apiUrl}/runs/stats`, {
|
|
1233
|
+
method: "POST",
|
|
1234
|
+
headers: this.headers,
|
|
1235
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1236
|
+
...this.fetchOptions,
|
|
1237
|
+
body
|
|
1238
|
+
});
|
|
1239
|
+
await raiseForStatus(res, "get run stats");
|
|
1240
|
+
return res;
|
|
1241
|
+
});
|
|
1242
|
+
const result = await response.json();
|
|
1243
|
+
return result;
|
|
1244
|
+
}
|
|
1245
|
+
async shareRun(runId, { shareId } = {}) {
|
|
1246
|
+
const data = {
|
|
1247
|
+
run_id: runId,
|
|
1248
|
+
share_token: shareId || uuid.v4()
|
|
1249
|
+
};
|
|
1250
|
+
assertUuid(runId);
|
|
1251
|
+
const body = JSON.stringify(data);
|
|
1252
|
+
const response = await this.caller.call(async () => {
|
|
1253
|
+
const res = await this._fetch(`${this.apiUrl}/runs/${runId}/share`, {
|
|
1254
|
+
method: "PUT",
|
|
1255
|
+
headers: this.headers,
|
|
1256
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1257
|
+
...this.fetchOptions,
|
|
1258
|
+
body
|
|
1259
|
+
});
|
|
1260
|
+
await raiseForStatus(res, "share run");
|
|
1261
|
+
return res;
|
|
1262
|
+
});
|
|
1263
|
+
const result = await response.json();
|
|
1264
|
+
if (result === null || !("share_token" in result)) throw new Error("Invalid response from server");
|
|
1265
|
+
return `${this.getHostUrl()}/public/${result["share_token"]}/r`;
|
|
1266
|
+
}
|
|
1267
|
+
async unshareRun(runId) {
|
|
1268
|
+
assertUuid(runId);
|
|
1269
|
+
await this.caller.call(async () => {
|
|
1270
|
+
const res = await this._fetch(`${this.apiUrl}/runs/${runId}/share`, {
|
|
1271
|
+
method: "DELETE",
|
|
1272
|
+
headers: this.headers,
|
|
1273
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1274
|
+
...this.fetchOptions
|
|
1275
|
+
});
|
|
1276
|
+
await raiseForStatus(res, "unshare run", true);
|
|
1277
|
+
return res;
|
|
1278
|
+
});
|
|
1279
|
+
}
|
|
1280
|
+
async readRunSharedLink(runId) {
|
|
1281
|
+
assertUuid(runId);
|
|
1282
|
+
const response = await this.caller.call(async () => {
|
|
1283
|
+
const res = await this._fetch(`${this.apiUrl}/runs/${runId}/share`, {
|
|
1284
|
+
method: "GET",
|
|
1285
|
+
headers: this.headers,
|
|
1286
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1287
|
+
...this.fetchOptions
|
|
1288
|
+
});
|
|
1289
|
+
await raiseForStatus(res, "read run shared link");
|
|
1290
|
+
return res;
|
|
1291
|
+
});
|
|
1292
|
+
const result = await response.json();
|
|
1293
|
+
if (result === null || !("share_token" in result)) return void 0;
|
|
1294
|
+
return `${this.getHostUrl()}/public/${result["share_token"]}/r`;
|
|
1295
|
+
}
|
|
1296
|
+
async listSharedRuns(shareToken, { runIds } = {}) {
|
|
1297
|
+
const queryParams = new URLSearchParams({ share_token: shareToken });
|
|
1298
|
+
if (runIds !== void 0) for (const runId of runIds) queryParams.append("id", runId);
|
|
1299
|
+
assertUuid(shareToken);
|
|
1300
|
+
const response = await this.caller.call(async () => {
|
|
1301
|
+
const res = await this._fetch(`${this.apiUrl}/public/${shareToken}/runs${queryParams}`, {
|
|
1302
|
+
method: "GET",
|
|
1303
|
+
headers: this.headers,
|
|
1304
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1305
|
+
...this.fetchOptions
|
|
1306
|
+
});
|
|
1307
|
+
await raiseForStatus(res, "list shared runs");
|
|
1308
|
+
return res;
|
|
1309
|
+
});
|
|
1310
|
+
const runs = await response.json();
|
|
1311
|
+
return runs;
|
|
1312
|
+
}
|
|
1313
|
+
async readDatasetSharedSchema(datasetId, datasetName) {
|
|
1314
|
+
if (!datasetId && !datasetName) throw new Error("Either datasetId or datasetName must be given");
|
|
1315
|
+
if (!datasetId) {
|
|
1316
|
+
const dataset = await this.readDataset({ datasetName });
|
|
1317
|
+
datasetId = dataset.id;
|
|
1318
|
+
}
|
|
1319
|
+
assertUuid(datasetId);
|
|
1320
|
+
const response = await this.caller.call(async () => {
|
|
1321
|
+
const res = await this._fetch(`${this.apiUrl}/datasets/${datasetId}/share`, {
|
|
1322
|
+
method: "GET",
|
|
1323
|
+
headers: this.headers,
|
|
1324
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1325
|
+
...this.fetchOptions
|
|
1326
|
+
});
|
|
1327
|
+
await raiseForStatus(res, "read dataset shared schema");
|
|
1328
|
+
return res;
|
|
1329
|
+
});
|
|
1330
|
+
const shareSchema = await response.json();
|
|
1331
|
+
shareSchema.url = `${this.getHostUrl()}/public/${shareSchema.share_token}/d`;
|
|
1332
|
+
return shareSchema;
|
|
1333
|
+
}
|
|
1334
|
+
async shareDataset(datasetId, datasetName) {
|
|
1335
|
+
if (!datasetId && !datasetName) throw new Error("Either datasetId or datasetName must be given");
|
|
1336
|
+
if (!datasetId) {
|
|
1337
|
+
const dataset = await this.readDataset({ datasetName });
|
|
1338
|
+
datasetId = dataset.id;
|
|
1339
|
+
}
|
|
1340
|
+
const data = { dataset_id: datasetId };
|
|
1341
|
+
assertUuid(datasetId);
|
|
1342
|
+
const body = JSON.stringify(data);
|
|
1343
|
+
const response = await this.caller.call(async () => {
|
|
1344
|
+
const res = await this._fetch(`${this.apiUrl}/datasets/${datasetId}/share`, {
|
|
1345
|
+
method: "PUT",
|
|
1346
|
+
headers: this.headers,
|
|
1347
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1348
|
+
...this.fetchOptions,
|
|
1349
|
+
body
|
|
1350
|
+
});
|
|
1351
|
+
await raiseForStatus(res, "share dataset");
|
|
1352
|
+
return res;
|
|
1353
|
+
});
|
|
1354
|
+
const shareSchema = await response.json();
|
|
1355
|
+
shareSchema.url = `${this.getHostUrl()}/public/${shareSchema.share_token}/d`;
|
|
1356
|
+
return shareSchema;
|
|
1357
|
+
}
|
|
1358
|
+
async unshareDataset(datasetId) {
|
|
1359
|
+
assertUuid(datasetId);
|
|
1360
|
+
await this.caller.call(async () => {
|
|
1361
|
+
const res = await this._fetch(`${this.apiUrl}/datasets/${datasetId}/share`, {
|
|
1362
|
+
method: "DELETE",
|
|
1363
|
+
headers: this.headers,
|
|
1364
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1365
|
+
...this.fetchOptions
|
|
1366
|
+
});
|
|
1367
|
+
await raiseForStatus(res, "unshare dataset", true);
|
|
1368
|
+
return res;
|
|
1369
|
+
});
|
|
1370
|
+
}
|
|
1371
|
+
async readSharedDataset(shareToken) {
|
|
1372
|
+
assertUuid(shareToken);
|
|
1373
|
+
const response = await this.caller.call(async () => {
|
|
1374
|
+
const res = await this._fetch(`${this.apiUrl}/public/${shareToken}/datasets`, {
|
|
1375
|
+
method: "GET",
|
|
1376
|
+
headers: this.headers,
|
|
1377
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1378
|
+
...this.fetchOptions
|
|
1379
|
+
});
|
|
1380
|
+
await raiseForStatus(res, "read shared dataset");
|
|
1381
|
+
return res;
|
|
1382
|
+
});
|
|
1383
|
+
const dataset = await response.json();
|
|
1384
|
+
return dataset;
|
|
1385
|
+
}
|
|
1386
|
+
/**
|
|
1387
|
+
* Get shared examples.
|
|
1388
|
+
*
|
|
1389
|
+
* @param {string} shareToken The share token to get examples for. A share token is the UUID (or LangSmith URL, including UUID) generated when explicitly marking an example as public.
|
|
1390
|
+
* @param {Object} [options] Additional options for listing the examples.
|
|
1391
|
+
* @param {string[] | undefined} [options.exampleIds] A list of example IDs to filter by.
|
|
1392
|
+
* @returns {Promise<Example[]>} The shared examples.
|
|
1393
|
+
*/
|
|
1394
|
+
async listSharedExamples(shareToken, options) {
|
|
1395
|
+
const params = {};
|
|
1396
|
+
if (options?.exampleIds) params.id = options.exampleIds;
|
|
1397
|
+
const urlParams = new URLSearchParams();
|
|
1398
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
1399
|
+
if (Array.isArray(value)) value.forEach((v) => urlParams.append(key, v));
|
|
1400
|
+
else urlParams.append(key, value);
|
|
1401
|
+
});
|
|
1402
|
+
const response = await this.caller.call(async () => {
|
|
1403
|
+
const res = await this._fetch(`${this.apiUrl}/public/${shareToken}/examples?${urlParams.toString()}`, {
|
|
1404
|
+
method: "GET",
|
|
1405
|
+
headers: this.headers,
|
|
1406
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1407
|
+
...this.fetchOptions
|
|
1408
|
+
});
|
|
1409
|
+
await raiseForStatus(res, "list shared examples");
|
|
1410
|
+
return res;
|
|
1411
|
+
});
|
|
1412
|
+
const result = await response.json();
|
|
1413
|
+
if (!response.ok) {
|
|
1414
|
+
if ("detail" in result) throw new Error(`Failed to list shared examples.\nStatus: ${response.status}\nMessage: ${Array.isArray(result.detail) ? result.detail.join("\n") : "Unspecified error"}`);
|
|
1415
|
+
throw new Error(`Failed to list shared examples: ${response.status} ${response.statusText}`);
|
|
1416
|
+
}
|
|
1417
|
+
return result.map((example) => ({
|
|
1418
|
+
...example,
|
|
1419
|
+
_hostUrl: this.getHostUrl()
|
|
1420
|
+
}));
|
|
1421
|
+
}
|
|
1422
|
+
async createProject({ projectName, description = null, metadata = null, upsert = false, projectExtra = null, referenceDatasetId = null }) {
|
|
1423
|
+
const upsert_ = upsert ? `?upsert=true` : "";
|
|
1424
|
+
const endpoint = `${this.apiUrl}/sessions${upsert_}`;
|
|
1425
|
+
const extra = projectExtra || {};
|
|
1426
|
+
if (metadata) extra["metadata"] = metadata;
|
|
1427
|
+
const body = {
|
|
1428
|
+
name: projectName,
|
|
1429
|
+
extra,
|
|
1430
|
+
description
|
|
1431
|
+
};
|
|
1432
|
+
if (referenceDatasetId !== null) body["reference_dataset_id"] = referenceDatasetId;
|
|
1433
|
+
const serializedBody = JSON.stringify(body);
|
|
1434
|
+
const response = await this.caller.call(async () => {
|
|
1435
|
+
const res = await this._fetch(endpoint, {
|
|
1436
|
+
method: "POST",
|
|
1437
|
+
headers: {
|
|
1438
|
+
...this.headers,
|
|
1439
|
+
"Content-Type": "application/json"
|
|
1440
|
+
},
|
|
1441
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1442
|
+
...this.fetchOptions,
|
|
1443
|
+
body: serializedBody
|
|
1444
|
+
});
|
|
1445
|
+
await raiseForStatus(res, "create project");
|
|
1446
|
+
return res;
|
|
1447
|
+
});
|
|
1448
|
+
const result = await response.json();
|
|
1449
|
+
return result;
|
|
1450
|
+
}
|
|
1451
|
+
async updateProject(projectId, { name = null, description = null, metadata = null, projectExtra = null, endTime = null }) {
|
|
1452
|
+
const endpoint = `${this.apiUrl}/sessions/${projectId}`;
|
|
1453
|
+
let extra = projectExtra;
|
|
1454
|
+
if (metadata) extra = {
|
|
1455
|
+
...extra || {},
|
|
1456
|
+
metadata
|
|
1457
|
+
};
|
|
1458
|
+
const body = JSON.stringify({
|
|
1459
|
+
name,
|
|
1460
|
+
extra,
|
|
1461
|
+
description,
|
|
1462
|
+
end_time: endTime ? new Date(endTime).toISOString() : null
|
|
1463
|
+
});
|
|
1464
|
+
const response = await this.caller.call(async () => {
|
|
1465
|
+
const res = await this._fetch(endpoint, {
|
|
1466
|
+
method: "PATCH",
|
|
1467
|
+
headers: {
|
|
1468
|
+
...this.headers,
|
|
1469
|
+
"Content-Type": "application/json"
|
|
1470
|
+
},
|
|
1471
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1472
|
+
...this.fetchOptions,
|
|
1473
|
+
body
|
|
1474
|
+
});
|
|
1475
|
+
await raiseForStatus(res, "update project");
|
|
1476
|
+
return res;
|
|
1477
|
+
});
|
|
1478
|
+
const result = await response.json();
|
|
1479
|
+
return result;
|
|
1480
|
+
}
|
|
1481
|
+
async hasProject({ projectId, projectName }) {
|
|
1482
|
+
let path = "/sessions";
|
|
1483
|
+
const params = new URLSearchParams();
|
|
1484
|
+
if (projectId !== void 0 && projectName !== void 0) throw new Error("Must provide either projectName or projectId, not both");
|
|
1485
|
+
else if (projectId !== void 0) {
|
|
1486
|
+
assertUuid(projectId);
|
|
1487
|
+
path += `/${projectId}`;
|
|
1488
|
+
} else if (projectName !== void 0) params.append("name", projectName);
|
|
1489
|
+
else throw new Error("Must provide projectName or projectId");
|
|
1490
|
+
const response = await this.caller.call(async () => {
|
|
1491
|
+
const res = await this._fetch(`${this.apiUrl}${path}?${params}`, {
|
|
1492
|
+
method: "GET",
|
|
1493
|
+
headers: this.headers,
|
|
1494
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1495
|
+
...this.fetchOptions
|
|
1496
|
+
});
|
|
1497
|
+
await raiseForStatus(res, "has project");
|
|
1498
|
+
return res;
|
|
1499
|
+
});
|
|
1500
|
+
try {
|
|
1501
|
+
const result = await response.json();
|
|
1502
|
+
if (!response.ok) return false;
|
|
1503
|
+
if (Array.isArray(result)) return result.length > 0;
|
|
1504
|
+
return true;
|
|
1505
|
+
} catch (e) {
|
|
1506
|
+
return false;
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
async readProject({ projectId, projectName, includeStats }) {
|
|
1510
|
+
let path = "/sessions";
|
|
1511
|
+
const params = new URLSearchParams();
|
|
1512
|
+
if (projectId !== void 0 && projectName !== void 0) throw new Error("Must provide either projectName or projectId, not both");
|
|
1513
|
+
else if (projectId !== void 0) {
|
|
1514
|
+
assertUuid(projectId);
|
|
1515
|
+
path += `/${projectId}`;
|
|
1516
|
+
} else if (projectName !== void 0) params.append("name", projectName);
|
|
1517
|
+
else throw new Error("Must provide projectName or projectId");
|
|
1518
|
+
if (includeStats !== void 0) params.append("include_stats", includeStats.toString());
|
|
1519
|
+
const response = await this._get(path, params);
|
|
1520
|
+
let result;
|
|
1521
|
+
if (Array.isArray(response)) {
|
|
1522
|
+
if (response.length === 0) throw new Error(`Project[id=${projectId}, name=${projectName}] not found`);
|
|
1523
|
+
result = response[0];
|
|
1524
|
+
} else result = response;
|
|
1525
|
+
return result;
|
|
1526
|
+
}
|
|
1527
|
+
async getProjectUrl({ projectId, projectName }) {
|
|
1528
|
+
if (projectId === void 0 && projectName === void 0) throw new Error("Must provide either projectName or projectId");
|
|
1529
|
+
const project = await this.readProject({
|
|
1530
|
+
projectId,
|
|
1531
|
+
projectName
|
|
1532
|
+
});
|
|
1533
|
+
const tenantId = await this._getTenantId();
|
|
1534
|
+
return `${this.getHostUrl()}/o/${tenantId}/projects/p/${project.id}`;
|
|
1535
|
+
}
|
|
1536
|
+
async getDatasetUrl({ datasetId, datasetName }) {
|
|
1537
|
+
if (datasetId === void 0 && datasetName === void 0) throw new Error("Must provide either datasetName or datasetId");
|
|
1538
|
+
const dataset = await this.readDataset({
|
|
1539
|
+
datasetId,
|
|
1540
|
+
datasetName
|
|
1541
|
+
});
|
|
1542
|
+
const tenantId = await this._getTenantId();
|
|
1543
|
+
return `${this.getHostUrl()}/o/${tenantId}/datasets/${dataset.id}`;
|
|
1544
|
+
}
|
|
1545
|
+
async _getTenantId() {
|
|
1546
|
+
if (this._tenantId !== null) return this._tenantId;
|
|
1547
|
+
const queryParams = new URLSearchParams({ limit: "1" });
|
|
1548
|
+
for await (const projects of this._getPaginated("/sessions", queryParams)) {
|
|
1549
|
+
this._tenantId = projects[0].tenant_id;
|
|
1550
|
+
return projects[0].tenant_id;
|
|
1551
|
+
}
|
|
1552
|
+
throw new Error("No projects found to resolve tenant.");
|
|
1553
|
+
}
|
|
1554
|
+
async *listProjects({ projectIds, name, nameContains, referenceDatasetId, referenceDatasetName, referenceFree, metadata } = {}) {
|
|
1555
|
+
const params = new URLSearchParams();
|
|
1556
|
+
if (projectIds !== void 0) for (const projectId of projectIds) params.append("id", projectId);
|
|
1557
|
+
if (name !== void 0) params.append("name", name);
|
|
1558
|
+
if (nameContains !== void 0) params.append("name_contains", nameContains);
|
|
1559
|
+
if (referenceDatasetId !== void 0) params.append("reference_dataset", referenceDatasetId);
|
|
1560
|
+
else if (referenceDatasetName !== void 0) {
|
|
1561
|
+
const dataset = await this.readDataset({ datasetName: referenceDatasetName });
|
|
1562
|
+
params.append("reference_dataset", dataset.id);
|
|
1563
|
+
}
|
|
1564
|
+
if (referenceFree !== void 0) params.append("reference_free", referenceFree.toString());
|
|
1565
|
+
if (metadata !== void 0) params.append("metadata", JSON.stringify(metadata));
|
|
1566
|
+
for await (const projects of this._getPaginated("/sessions", params)) yield* projects;
|
|
1567
|
+
}
|
|
1568
|
+
async deleteProject({ projectId, projectName }) {
|
|
1569
|
+
let projectId_;
|
|
1570
|
+
if (projectId === void 0 && projectName === void 0) throw new Error("Must provide projectName or projectId");
|
|
1571
|
+
else if (projectId !== void 0 && projectName !== void 0) throw new Error("Must provide either projectName or projectId, not both");
|
|
1572
|
+
else if (projectId === void 0) projectId_ = (await this.readProject({ projectName })).id;
|
|
1573
|
+
else projectId_ = projectId;
|
|
1574
|
+
assertUuid(projectId_);
|
|
1575
|
+
await this.caller.call(async () => {
|
|
1576
|
+
const res = await this._fetch(`${this.apiUrl}/sessions/${projectId_}`, {
|
|
1577
|
+
method: "DELETE",
|
|
1578
|
+
headers: this.headers,
|
|
1579
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1580
|
+
...this.fetchOptions
|
|
1581
|
+
});
|
|
1582
|
+
await raiseForStatus(res, `delete session ${projectId_} (${projectName})`, true);
|
|
1583
|
+
return res;
|
|
1584
|
+
});
|
|
1585
|
+
}
|
|
1586
|
+
async uploadCsv({ csvFile, fileName, inputKeys, outputKeys, description, dataType, name }) {
|
|
1587
|
+
const url = `${this.apiUrl}/datasets/upload`;
|
|
1588
|
+
const formData = new FormData();
|
|
1589
|
+
formData.append("file", csvFile, fileName);
|
|
1590
|
+
inputKeys.forEach((key) => {
|
|
1591
|
+
formData.append("input_keys", key);
|
|
1592
|
+
});
|
|
1593
|
+
outputKeys.forEach((key) => {
|
|
1594
|
+
formData.append("output_keys", key);
|
|
1595
|
+
});
|
|
1596
|
+
if (description) formData.append("description", description);
|
|
1597
|
+
if (dataType) formData.append("data_type", dataType);
|
|
1598
|
+
if (name) formData.append("name", name);
|
|
1599
|
+
const response = await this.caller.call(async () => {
|
|
1600
|
+
const res = await this._fetch(url, {
|
|
1601
|
+
method: "POST",
|
|
1602
|
+
headers: this.headers,
|
|
1603
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1604
|
+
...this.fetchOptions,
|
|
1605
|
+
body: formData
|
|
1606
|
+
});
|
|
1607
|
+
await raiseForStatus(res, "upload CSV");
|
|
1608
|
+
return res;
|
|
1609
|
+
});
|
|
1610
|
+
const result = await response.json();
|
|
1611
|
+
return result;
|
|
1612
|
+
}
|
|
1613
|
+
async createDataset(name, { description, dataType, inputsSchema, outputsSchema, metadata } = {}) {
|
|
1614
|
+
const body = {
|
|
1615
|
+
name,
|
|
1616
|
+
description,
|
|
1617
|
+
extra: metadata ? { metadata } : void 0
|
|
1618
|
+
};
|
|
1619
|
+
if (dataType) body.data_type = dataType;
|
|
1620
|
+
if (inputsSchema) body.inputs_schema_definition = inputsSchema;
|
|
1621
|
+
if (outputsSchema) body.outputs_schema_definition = outputsSchema;
|
|
1622
|
+
const serializedBody = JSON.stringify(body);
|
|
1623
|
+
const response = await this.caller.call(async () => {
|
|
1624
|
+
const res = await this._fetch(`${this.apiUrl}/datasets`, {
|
|
1625
|
+
method: "POST",
|
|
1626
|
+
headers: {
|
|
1627
|
+
...this.headers,
|
|
1628
|
+
"Content-Type": "application/json"
|
|
1629
|
+
},
|
|
1630
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1631
|
+
...this.fetchOptions,
|
|
1632
|
+
body: serializedBody
|
|
1633
|
+
});
|
|
1634
|
+
await raiseForStatus(res, "create dataset");
|
|
1635
|
+
return res;
|
|
1636
|
+
});
|
|
1637
|
+
const result = await response.json();
|
|
1638
|
+
return result;
|
|
1639
|
+
}
|
|
1640
|
+
async readDataset({ datasetId, datasetName }) {
|
|
1641
|
+
let path = "/datasets";
|
|
1642
|
+
const params = new URLSearchParams({ limit: "1" });
|
|
1643
|
+
if (datasetId && datasetName) throw new Error("Must provide either datasetName or datasetId, not both");
|
|
1644
|
+
else if (datasetId) {
|
|
1645
|
+
assertUuid(datasetId);
|
|
1646
|
+
path += `/${datasetId}`;
|
|
1647
|
+
} else if (datasetName) params.append("name", datasetName);
|
|
1648
|
+
else throw new Error("Must provide datasetName or datasetId");
|
|
1649
|
+
const response = await this._get(path, params);
|
|
1650
|
+
let result;
|
|
1651
|
+
if (Array.isArray(response)) {
|
|
1652
|
+
if (response.length === 0) throw new Error(`Dataset[id=${datasetId}, name=${datasetName}] not found`);
|
|
1653
|
+
result = response[0];
|
|
1654
|
+
} else result = response;
|
|
1655
|
+
return result;
|
|
1656
|
+
}
|
|
1657
|
+
async hasDataset({ datasetId, datasetName }) {
|
|
1658
|
+
try {
|
|
1659
|
+
await this.readDataset({
|
|
1660
|
+
datasetId,
|
|
1661
|
+
datasetName
|
|
1662
|
+
});
|
|
1663
|
+
return true;
|
|
1664
|
+
} catch (e) {
|
|
1665
|
+
if (e instanceof Error && e.message.toLocaleLowerCase().includes("not found")) return false;
|
|
1666
|
+
throw e;
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
async diffDatasetVersions({ datasetId, datasetName, fromVersion, toVersion }) {
|
|
1670
|
+
let datasetId_ = datasetId;
|
|
1671
|
+
if (datasetId_ === void 0 && datasetName === void 0) throw new Error("Must provide either datasetName or datasetId");
|
|
1672
|
+
else if (datasetId_ !== void 0 && datasetName !== void 0) throw new Error("Must provide either datasetName or datasetId, not both");
|
|
1673
|
+
else if (datasetId_ === void 0) {
|
|
1674
|
+
const dataset = await this.readDataset({ datasetName });
|
|
1675
|
+
datasetId_ = dataset.id;
|
|
1676
|
+
}
|
|
1677
|
+
const urlParams = new URLSearchParams({
|
|
1678
|
+
from_version: typeof fromVersion === "string" ? fromVersion : fromVersion.toISOString(),
|
|
1679
|
+
to_version: typeof toVersion === "string" ? toVersion : toVersion.toISOString()
|
|
1680
|
+
});
|
|
1681
|
+
const response = await this._get(`/datasets/${datasetId_}/versions/diff`, urlParams);
|
|
1682
|
+
return response;
|
|
1683
|
+
}
|
|
1684
|
+
async readDatasetOpenaiFinetuning({ datasetId, datasetName }) {
|
|
1685
|
+
const path = "/datasets";
|
|
1686
|
+
if (datasetId !== void 0) {} else if (datasetName !== void 0) datasetId = (await this.readDataset({ datasetName })).id;
|
|
1687
|
+
else throw new Error("Must provide either datasetName or datasetId");
|
|
1688
|
+
const response = await this._getResponse(`${path}/${datasetId}/openai_ft`);
|
|
1689
|
+
const datasetText = await response.text();
|
|
1690
|
+
const dataset = datasetText.trim().split("\n").map((line) => JSON.parse(line));
|
|
1691
|
+
return dataset;
|
|
1692
|
+
}
|
|
1693
|
+
async *listDatasets({ limit = 100, offset = 0, datasetIds, datasetName, datasetNameContains, metadata } = {}) {
|
|
1694
|
+
const path = "/datasets";
|
|
1695
|
+
const params = new URLSearchParams({
|
|
1696
|
+
limit: limit.toString(),
|
|
1697
|
+
offset: offset.toString()
|
|
1698
|
+
});
|
|
1699
|
+
if (datasetIds !== void 0) for (const id_ of datasetIds) params.append("id", id_);
|
|
1700
|
+
if (datasetName !== void 0) params.append("name", datasetName);
|
|
1701
|
+
if (datasetNameContains !== void 0) params.append("name_contains", datasetNameContains);
|
|
1702
|
+
if (metadata !== void 0) params.append("metadata", JSON.stringify(metadata));
|
|
1703
|
+
for await (const datasets of this._getPaginated(path, params)) yield* datasets;
|
|
1704
|
+
}
|
|
1705
|
+
/**
|
|
1706
|
+
* Update a dataset
|
|
1707
|
+
* @param props The dataset details to update
|
|
1708
|
+
* @returns The updated dataset
|
|
1709
|
+
*/
|
|
1710
|
+
async updateDataset(props) {
|
|
1711
|
+
const { datasetId, datasetName,...update } = props;
|
|
1712
|
+
if (!datasetId && !datasetName) throw new Error("Must provide either datasetName or datasetId");
|
|
1713
|
+
const _datasetId = datasetId ?? (await this.readDataset({ datasetName })).id;
|
|
1714
|
+
assertUuid(_datasetId);
|
|
1715
|
+
const body = JSON.stringify(update);
|
|
1716
|
+
const response = await this.caller.call(async () => {
|
|
1717
|
+
const res = await this._fetch(`${this.apiUrl}/datasets/${_datasetId}`, {
|
|
1718
|
+
method: "PATCH",
|
|
1719
|
+
headers: {
|
|
1720
|
+
...this.headers,
|
|
1721
|
+
"Content-Type": "application/json"
|
|
1722
|
+
},
|
|
1723
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1724
|
+
...this.fetchOptions,
|
|
1725
|
+
body
|
|
1726
|
+
});
|
|
1727
|
+
await raiseForStatus(res, "update dataset");
|
|
1728
|
+
return res;
|
|
1729
|
+
});
|
|
1730
|
+
return await response.json();
|
|
1731
|
+
}
|
|
1732
|
+
/**
|
|
1733
|
+
* Updates a tag on a dataset.
|
|
1734
|
+
*
|
|
1735
|
+
* If the tag is already assigned to a different version of this dataset,
|
|
1736
|
+
* the tag will be moved to the new version. The as_of parameter is used to
|
|
1737
|
+
* determine which version of the dataset to apply the new tags to.
|
|
1738
|
+
*
|
|
1739
|
+
* It must be an exact version of the dataset to succeed. You can
|
|
1740
|
+
* use the "readDatasetVersion" method to find the exact version
|
|
1741
|
+
* to apply the tags to.
|
|
1742
|
+
* @param params.datasetId The ID of the dataset to update. Must be provided if "datasetName" is not provided.
|
|
1743
|
+
* @param params.datasetName The name of the dataset to update. Must be provided if "datasetId" is not provided.
|
|
1744
|
+
* @param params.asOf The timestamp of the dataset to apply the new tags to.
|
|
1745
|
+
* @param params.tag The new tag to apply to the dataset.
|
|
1746
|
+
*/
|
|
1747
|
+
async updateDatasetTag(props) {
|
|
1748
|
+
const { datasetId, datasetName, asOf, tag } = props;
|
|
1749
|
+
if (!datasetId && !datasetName) throw new Error("Must provide either datasetName or datasetId");
|
|
1750
|
+
const _datasetId = datasetId ?? (await this.readDataset({ datasetName })).id;
|
|
1751
|
+
assertUuid(_datasetId);
|
|
1752
|
+
const body = JSON.stringify({
|
|
1753
|
+
as_of: typeof asOf === "string" ? asOf : asOf.toISOString(),
|
|
1754
|
+
tag
|
|
1755
|
+
});
|
|
1756
|
+
await this.caller.call(async () => {
|
|
1757
|
+
const res = await this._fetch(`${this.apiUrl}/datasets/${_datasetId}/tags`, {
|
|
1758
|
+
method: "PUT",
|
|
1759
|
+
headers: {
|
|
1760
|
+
...this.headers,
|
|
1761
|
+
"Content-Type": "application/json"
|
|
1762
|
+
},
|
|
1763
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1764
|
+
...this.fetchOptions,
|
|
1765
|
+
body
|
|
1766
|
+
});
|
|
1767
|
+
await raiseForStatus(res, "update dataset tags", true);
|
|
1768
|
+
return res;
|
|
1769
|
+
});
|
|
1770
|
+
}
|
|
1771
|
+
async deleteDataset({ datasetId, datasetName }) {
|
|
1772
|
+
let path = "/datasets";
|
|
1773
|
+
let datasetId_ = datasetId;
|
|
1774
|
+
if (datasetId !== void 0 && datasetName !== void 0) throw new Error("Must provide either datasetName or datasetId, not both");
|
|
1775
|
+
else if (datasetName !== void 0) {
|
|
1776
|
+
const dataset = await this.readDataset({ datasetName });
|
|
1777
|
+
datasetId_ = dataset.id;
|
|
1778
|
+
}
|
|
1779
|
+
if (datasetId_ !== void 0) {
|
|
1780
|
+
assertUuid(datasetId_);
|
|
1781
|
+
path += `/${datasetId_}`;
|
|
1782
|
+
} else throw new Error("Must provide datasetName or datasetId");
|
|
1783
|
+
await this.caller.call(async () => {
|
|
1784
|
+
const res = await this._fetch(this.apiUrl + path, {
|
|
1785
|
+
method: "DELETE",
|
|
1786
|
+
headers: this.headers,
|
|
1787
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1788
|
+
...this.fetchOptions
|
|
1789
|
+
});
|
|
1790
|
+
await raiseForStatus(res, `delete ${path}`, true);
|
|
1791
|
+
return res;
|
|
1792
|
+
});
|
|
1793
|
+
}
|
|
1794
|
+
async indexDataset({ datasetId, datasetName, tag }) {
|
|
1795
|
+
let datasetId_ = datasetId;
|
|
1796
|
+
if (!datasetId_ && !datasetName) throw new Error("Must provide either datasetName or datasetId");
|
|
1797
|
+
else if (datasetId_ && datasetName) throw new Error("Must provide either datasetName or datasetId, not both");
|
|
1798
|
+
else if (!datasetId_) {
|
|
1799
|
+
const dataset = await this.readDataset({ datasetName });
|
|
1800
|
+
datasetId_ = dataset.id;
|
|
1801
|
+
}
|
|
1802
|
+
assertUuid(datasetId_);
|
|
1803
|
+
const data = { tag };
|
|
1804
|
+
const body = JSON.stringify(data);
|
|
1805
|
+
const response = await this.caller.call(async () => {
|
|
1806
|
+
const res = await this._fetch(`${this.apiUrl}/datasets/${datasetId_}/index`, {
|
|
1807
|
+
method: "POST",
|
|
1808
|
+
headers: {
|
|
1809
|
+
...this.headers,
|
|
1810
|
+
"Content-Type": "application/json"
|
|
1811
|
+
},
|
|
1812
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1813
|
+
...this.fetchOptions,
|
|
1814
|
+
body
|
|
1815
|
+
});
|
|
1816
|
+
await raiseForStatus(res, "index dataset");
|
|
1817
|
+
return res;
|
|
1818
|
+
});
|
|
1819
|
+
await response.json();
|
|
1820
|
+
}
|
|
1821
|
+
/**
|
|
1822
|
+
* Lets you run a similarity search query on a dataset.
|
|
1823
|
+
*
|
|
1824
|
+
* Requires the dataset to be indexed. Please see the `indexDataset` method to set up indexing.
|
|
1825
|
+
*
|
|
1826
|
+
* @param inputs The input on which to run the similarity search. Must have the
|
|
1827
|
+
* same schema as the dataset.
|
|
1828
|
+
*
|
|
1829
|
+
* @param datasetId The dataset to search for similar examples.
|
|
1830
|
+
*
|
|
1831
|
+
* @param limit The maximum number of examples to return. Will return the top `limit` most
|
|
1832
|
+
* similar examples in order of most similar to least similar. If no similar
|
|
1833
|
+
* examples are found, random examples will be returned.
|
|
1834
|
+
*
|
|
1835
|
+
* @param filter A filter string to apply to the search. Only examples will be returned that
|
|
1836
|
+
* match the filter string. Some examples of filters
|
|
1837
|
+
*
|
|
1838
|
+
* - eq(metadata.mykey, "value")
|
|
1839
|
+
* - and(neq(metadata.my.nested.key, "value"), neq(metadata.mykey, "value"))
|
|
1840
|
+
* - or(eq(metadata.mykey, "value"), eq(metadata.mykey, "othervalue"))
|
|
1841
|
+
*
|
|
1842
|
+
* @returns A list of similar examples.
|
|
1843
|
+
*
|
|
1844
|
+
*
|
|
1845
|
+
* @example
|
|
1846
|
+
* dataset_id = "123e4567-e89b-12d3-a456-426614174000"
|
|
1847
|
+
* inputs = {"text": "How many people live in Berlin?"}
|
|
1848
|
+
* limit = 5
|
|
1849
|
+
* examples = await client.similarExamples(inputs, dataset_id, limit)
|
|
1850
|
+
*/
|
|
1851
|
+
async similarExamples(inputs, datasetId, limit, { filter } = {}) {
|
|
1852
|
+
const data = {
|
|
1853
|
+
limit,
|
|
1854
|
+
inputs
|
|
1855
|
+
};
|
|
1856
|
+
if (filter !== void 0) data["filter"] = filter;
|
|
1857
|
+
assertUuid(datasetId);
|
|
1858
|
+
const body = JSON.stringify(data);
|
|
1859
|
+
const response = await this.caller.call(async () => {
|
|
1860
|
+
const res = await this._fetch(`${this.apiUrl}/datasets/${datasetId}/search`, {
|
|
1861
|
+
headers: {
|
|
1862
|
+
...this.headers,
|
|
1863
|
+
"Content-Type": "application/json"
|
|
1864
|
+
},
|
|
1865
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1866
|
+
...this.fetchOptions,
|
|
1867
|
+
method: "POST",
|
|
1868
|
+
body
|
|
1869
|
+
});
|
|
1870
|
+
await raiseForStatus(res, "fetch similar examples");
|
|
1871
|
+
return res;
|
|
1872
|
+
});
|
|
1873
|
+
const result = await response.json();
|
|
1874
|
+
return result["examples"];
|
|
1875
|
+
}
|
|
1876
|
+
async createExample(inputsOrUpdate, outputs, options) {
|
|
1877
|
+
if (isExampleCreate(inputsOrUpdate)) {
|
|
1878
|
+
if (outputs !== void 0 || options !== void 0) throw new Error("Cannot provide outputs or options when using ExampleCreate object");
|
|
1879
|
+
}
|
|
1880
|
+
let datasetId_ = outputs ? options?.datasetId : inputsOrUpdate.dataset_id;
|
|
1881
|
+
const datasetName_ = outputs ? options?.datasetName : inputsOrUpdate.dataset_name;
|
|
1882
|
+
if (datasetId_ === void 0 && datasetName_ === void 0) throw new Error("Must provide either datasetName or datasetId");
|
|
1883
|
+
else if (datasetId_ !== void 0 && datasetName_ !== void 0) throw new Error("Must provide either datasetName or datasetId, not both");
|
|
1884
|
+
else if (datasetId_ === void 0) {
|
|
1885
|
+
const dataset = await this.readDataset({ datasetName: datasetName_ });
|
|
1886
|
+
datasetId_ = dataset.id;
|
|
1887
|
+
}
|
|
1888
|
+
const createdAt_ = (outputs ? options?.createdAt : inputsOrUpdate.created_at) || /* @__PURE__ */ new Date();
|
|
1889
|
+
let data;
|
|
1890
|
+
if (!isExampleCreate(inputsOrUpdate)) data = {
|
|
1891
|
+
inputs: inputsOrUpdate,
|
|
1892
|
+
outputs,
|
|
1893
|
+
created_at: createdAt_?.toISOString(),
|
|
1894
|
+
id: options?.exampleId,
|
|
1895
|
+
metadata: options?.metadata,
|
|
1896
|
+
split: options?.split,
|
|
1897
|
+
source_run_id: options?.sourceRunId,
|
|
1898
|
+
use_source_run_io: options?.useSourceRunIO,
|
|
1899
|
+
use_source_run_attachments: options?.useSourceRunAttachments,
|
|
1900
|
+
attachments: options?.attachments
|
|
1901
|
+
};
|
|
1902
|
+
else data = inputsOrUpdate;
|
|
1903
|
+
const response = await this._uploadExamplesMultipart(datasetId_, [data]);
|
|
1904
|
+
const example = await this.readExample(response.example_ids?.[0] ?? uuid.v4());
|
|
1905
|
+
return example;
|
|
1906
|
+
}
|
|
1907
|
+
async createExamples(propsOrUploads) {
|
|
1908
|
+
if (Array.isArray(propsOrUploads)) {
|
|
1909
|
+
if (propsOrUploads.length === 0) return [];
|
|
1910
|
+
const uploads = propsOrUploads;
|
|
1911
|
+
let datasetId_$1 = uploads[0].dataset_id;
|
|
1912
|
+
const datasetName_$1 = uploads[0].dataset_name;
|
|
1913
|
+
if (datasetId_$1 === void 0 && datasetName_$1 === void 0) throw new Error("Must provide either datasetName or datasetId");
|
|
1914
|
+
else if (datasetId_$1 !== void 0 && datasetName_$1 !== void 0) throw new Error("Must provide either datasetName or datasetId, not both");
|
|
1915
|
+
else if (datasetId_$1 === void 0) {
|
|
1916
|
+
const dataset = await this.readDataset({ datasetName: datasetName_$1 });
|
|
1917
|
+
datasetId_$1 = dataset.id;
|
|
1918
|
+
}
|
|
1919
|
+
const response$1 = await this._uploadExamplesMultipart(datasetId_$1, uploads);
|
|
1920
|
+
const examples$1 = await Promise.all(response$1.example_ids.map((id) => this.readExample(id)));
|
|
1921
|
+
return examples$1;
|
|
1922
|
+
}
|
|
1923
|
+
const { inputs, outputs, metadata, splits, sourceRunIds, useSourceRunIOs, useSourceRunAttachments, attachments, exampleIds, datasetId, datasetName } = propsOrUploads;
|
|
1924
|
+
if (inputs === void 0) throw new Error("Must provide inputs when using legacy parameters");
|
|
1925
|
+
let datasetId_ = datasetId;
|
|
1926
|
+
const datasetName_ = datasetName;
|
|
1927
|
+
if (datasetId_ === void 0 && datasetName_ === void 0) throw new Error("Must provide either datasetName or datasetId");
|
|
1928
|
+
else if (datasetId_ !== void 0 && datasetName_ !== void 0) throw new Error("Must provide either datasetName or datasetId, not both");
|
|
1929
|
+
else if (datasetId_ === void 0) {
|
|
1930
|
+
const dataset = await this.readDataset({ datasetName: datasetName_ });
|
|
1931
|
+
datasetId_ = dataset.id;
|
|
1932
|
+
}
|
|
1933
|
+
const formattedExamples = inputs.map((input, idx) => {
|
|
1934
|
+
return {
|
|
1935
|
+
dataset_id: datasetId_,
|
|
1936
|
+
inputs: input,
|
|
1937
|
+
outputs: outputs?.[idx],
|
|
1938
|
+
metadata: metadata?.[idx],
|
|
1939
|
+
split: splits?.[idx],
|
|
1940
|
+
id: exampleIds?.[idx],
|
|
1941
|
+
attachments: attachments?.[idx],
|
|
1942
|
+
source_run_id: sourceRunIds?.[idx],
|
|
1943
|
+
use_source_run_io: useSourceRunIOs?.[idx],
|
|
1944
|
+
use_source_run_attachments: useSourceRunAttachments?.[idx]
|
|
1945
|
+
};
|
|
1946
|
+
});
|
|
1947
|
+
const response = await this._uploadExamplesMultipart(datasetId_, formattedExamples);
|
|
1948
|
+
const examples = await Promise.all(response.example_ids.map((id) => this.readExample(id)));
|
|
1949
|
+
return examples;
|
|
1950
|
+
}
|
|
1951
|
+
async createLLMExample(input, generation, options) {
|
|
1952
|
+
return this.createExample({ input }, { output: generation }, options);
|
|
1953
|
+
}
|
|
1954
|
+
async createChatExample(input, generations, options) {
|
|
1955
|
+
const finalInput = input.map((message) => {
|
|
1956
|
+
if (isLangChainMessage(message)) return convertLangChainMessageToExample(message);
|
|
1957
|
+
return message;
|
|
1958
|
+
});
|
|
1959
|
+
const finalOutput = isLangChainMessage(generations) ? convertLangChainMessageToExample(generations) : generations;
|
|
1960
|
+
return this.createExample({ input: finalInput }, { output: finalOutput }, options);
|
|
1961
|
+
}
|
|
1962
|
+
async readExample(exampleId) {
|
|
1963
|
+
assertUuid(exampleId);
|
|
1964
|
+
const path = `/examples/${exampleId}`;
|
|
1965
|
+
const rawExample = await this._get(path);
|
|
1966
|
+
const { attachment_urls,...rest } = rawExample;
|
|
1967
|
+
const example = rest;
|
|
1968
|
+
if (attachment_urls) example.attachments = Object.entries(attachment_urls).reduce((acc, [key, value]) => {
|
|
1969
|
+
acc[key.slice(11)] = {
|
|
1970
|
+
presigned_url: value.presigned_url,
|
|
1971
|
+
mime_type: value.mime_type
|
|
1972
|
+
};
|
|
1973
|
+
return acc;
|
|
1974
|
+
}, {});
|
|
1975
|
+
return example;
|
|
1976
|
+
}
|
|
1977
|
+
async *listExamples({ datasetId, datasetName, exampleIds, asOf, splits, inlineS3Urls, metadata, limit, offset, filter, includeAttachments } = {}) {
|
|
1978
|
+
let datasetId_;
|
|
1979
|
+
if (datasetId !== void 0 && datasetName !== void 0) throw new Error("Must provide either datasetName or datasetId, not both");
|
|
1980
|
+
else if (datasetId !== void 0) datasetId_ = datasetId;
|
|
1981
|
+
else if (datasetName !== void 0) {
|
|
1982
|
+
const dataset = await this.readDataset({ datasetName });
|
|
1983
|
+
datasetId_ = dataset.id;
|
|
1984
|
+
} else throw new Error("Must provide a datasetName or datasetId");
|
|
1985
|
+
const params = new URLSearchParams({ dataset: datasetId_ });
|
|
1986
|
+
const dataset_version = asOf ? typeof asOf === "string" ? asOf : asOf?.toISOString() : void 0;
|
|
1987
|
+
if (dataset_version) params.append("as_of", dataset_version);
|
|
1988
|
+
const inlineS3Urls_ = inlineS3Urls ?? true;
|
|
1989
|
+
params.append("inline_s3_urls", inlineS3Urls_.toString());
|
|
1990
|
+
if (exampleIds !== void 0) for (const id_ of exampleIds) params.append("id", id_);
|
|
1991
|
+
if (splits !== void 0) for (const split of splits) params.append("splits", split);
|
|
1992
|
+
if (metadata !== void 0) {
|
|
1993
|
+
const serializedMetadata = JSON.stringify(metadata);
|
|
1994
|
+
params.append("metadata", serializedMetadata);
|
|
1995
|
+
}
|
|
1996
|
+
if (limit !== void 0) params.append("limit", limit.toString());
|
|
1997
|
+
if (offset !== void 0) params.append("offset", offset.toString());
|
|
1998
|
+
if (filter !== void 0) params.append("filter", filter);
|
|
1999
|
+
if (includeAttachments === true) [
|
|
2000
|
+
"attachment_urls",
|
|
2001
|
+
"outputs",
|
|
2002
|
+
"metadata"
|
|
2003
|
+
].forEach((field) => params.append("select", field));
|
|
2004
|
+
let i = 0;
|
|
2005
|
+
for await (const rawExamples of this._getPaginated("/examples", params)) {
|
|
2006
|
+
for (const rawExample of rawExamples) {
|
|
2007
|
+
const { attachment_urls,...rest } = rawExample;
|
|
2008
|
+
const example = rest;
|
|
2009
|
+
if (attachment_urls) example.attachments = Object.entries(attachment_urls).reduce((acc, [key, value]) => {
|
|
2010
|
+
acc[key.slice(11)] = {
|
|
2011
|
+
presigned_url: value.presigned_url,
|
|
2012
|
+
mime_type: value.mime_type || void 0
|
|
2013
|
+
};
|
|
2014
|
+
return acc;
|
|
2015
|
+
}, {});
|
|
2016
|
+
yield example;
|
|
2017
|
+
i++;
|
|
2018
|
+
}
|
|
2019
|
+
if (limit !== void 0 && i >= limit) break;
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
async deleteExample(exampleId) {
|
|
2023
|
+
assertUuid(exampleId);
|
|
2024
|
+
const path = `/examples/${exampleId}`;
|
|
2025
|
+
await this.caller.call(async () => {
|
|
2026
|
+
const res = await this._fetch(this.apiUrl + path, {
|
|
2027
|
+
method: "DELETE",
|
|
2028
|
+
headers: this.headers,
|
|
2029
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2030
|
+
...this.fetchOptions
|
|
2031
|
+
});
|
|
2032
|
+
await raiseForStatus(res, `delete ${path}`, true);
|
|
2033
|
+
return res;
|
|
2034
|
+
});
|
|
2035
|
+
}
|
|
2036
|
+
async updateExample(exampleIdOrUpdate, update) {
|
|
2037
|
+
let exampleId;
|
|
2038
|
+
if (update) exampleId = exampleIdOrUpdate;
|
|
2039
|
+
else exampleId = exampleIdOrUpdate.id;
|
|
2040
|
+
assertUuid(exampleId);
|
|
2041
|
+
let updateToUse;
|
|
2042
|
+
if (update) updateToUse = {
|
|
2043
|
+
id: exampleId,
|
|
2044
|
+
...update
|
|
2045
|
+
};
|
|
2046
|
+
else updateToUse = exampleIdOrUpdate;
|
|
2047
|
+
let datasetId;
|
|
2048
|
+
if (updateToUse.dataset_id !== void 0) datasetId = updateToUse.dataset_id;
|
|
2049
|
+
else {
|
|
2050
|
+
const example = await this.readExample(exampleId);
|
|
2051
|
+
datasetId = example.dataset_id;
|
|
2052
|
+
}
|
|
2053
|
+
return this._updateExamplesMultipart(datasetId, [updateToUse]);
|
|
2054
|
+
}
|
|
2055
|
+
async updateExamples(update) {
|
|
2056
|
+
let datasetId;
|
|
2057
|
+
if (update[0].dataset_id === void 0) {
|
|
2058
|
+
const example = await this.readExample(update[0].id);
|
|
2059
|
+
datasetId = example.dataset_id;
|
|
2060
|
+
} else datasetId = update[0].dataset_id;
|
|
2061
|
+
return this._updateExamplesMultipart(datasetId, update);
|
|
2062
|
+
}
|
|
2063
|
+
/**
|
|
2064
|
+
* Get dataset version by closest date or exact tag.
|
|
2065
|
+
*
|
|
2066
|
+
* Use this to resolve the nearest version to a given timestamp or for a given tag.
|
|
2067
|
+
*
|
|
2068
|
+
* @param options The options for getting the dataset version
|
|
2069
|
+
* @param options.datasetId The ID of the dataset
|
|
2070
|
+
* @param options.datasetName The name of the dataset
|
|
2071
|
+
* @param options.asOf The timestamp of the dataset to retrieve
|
|
2072
|
+
* @param options.tag The tag of the dataset to retrieve
|
|
2073
|
+
* @returns The dataset version
|
|
2074
|
+
*/
|
|
2075
|
+
async readDatasetVersion({ datasetId, datasetName, asOf, tag }) {
|
|
2076
|
+
let resolvedDatasetId;
|
|
2077
|
+
if (!datasetId) {
|
|
2078
|
+
const dataset = await this.readDataset({ datasetName });
|
|
2079
|
+
resolvedDatasetId = dataset.id;
|
|
2080
|
+
} else resolvedDatasetId = datasetId;
|
|
2081
|
+
assertUuid(resolvedDatasetId);
|
|
2082
|
+
if (asOf && tag || !asOf && !tag) throw new Error("Exactly one of asOf and tag must be specified.");
|
|
2083
|
+
const params = new URLSearchParams();
|
|
2084
|
+
if (asOf !== void 0) params.append("as_of", typeof asOf === "string" ? asOf : asOf.toISOString());
|
|
2085
|
+
if (tag !== void 0) params.append("tag", tag);
|
|
2086
|
+
const response = await this.caller.call(async () => {
|
|
2087
|
+
const res = await this._fetch(`${this.apiUrl}/datasets/${resolvedDatasetId}/version?${params.toString()}`, {
|
|
2088
|
+
method: "GET",
|
|
2089
|
+
headers: { ...this.headers },
|
|
2090
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2091
|
+
...this.fetchOptions
|
|
2092
|
+
});
|
|
2093
|
+
await raiseForStatus(res, "read dataset version");
|
|
2094
|
+
return res;
|
|
2095
|
+
});
|
|
2096
|
+
return await response.json();
|
|
2097
|
+
}
|
|
2098
|
+
async listDatasetSplits({ datasetId, datasetName, asOf }) {
|
|
2099
|
+
let datasetId_;
|
|
2100
|
+
if (datasetId === void 0 && datasetName === void 0) throw new Error("Must provide dataset name or ID");
|
|
2101
|
+
else if (datasetId !== void 0 && datasetName !== void 0) throw new Error("Must provide either datasetName or datasetId, not both");
|
|
2102
|
+
else if (datasetId === void 0) {
|
|
2103
|
+
const dataset = await this.readDataset({ datasetName });
|
|
2104
|
+
datasetId_ = dataset.id;
|
|
2105
|
+
} else datasetId_ = datasetId;
|
|
2106
|
+
assertUuid(datasetId_);
|
|
2107
|
+
const params = new URLSearchParams();
|
|
2108
|
+
const dataset_version = asOf ? typeof asOf === "string" ? asOf : asOf?.toISOString() : void 0;
|
|
2109
|
+
if (dataset_version) params.append("as_of", dataset_version);
|
|
2110
|
+
const response = await this._get(`/datasets/${datasetId_}/splits`, params);
|
|
2111
|
+
return response;
|
|
2112
|
+
}
|
|
2113
|
+
async updateDatasetSplits({ datasetId, datasetName, splitName, exampleIds, remove = false }) {
|
|
2114
|
+
let datasetId_;
|
|
2115
|
+
if (datasetId === void 0 && datasetName === void 0) throw new Error("Must provide dataset name or ID");
|
|
2116
|
+
else if (datasetId !== void 0 && datasetName !== void 0) throw new Error("Must provide either datasetName or datasetId, not both");
|
|
2117
|
+
else if (datasetId === void 0) {
|
|
2118
|
+
const dataset = await this.readDataset({ datasetName });
|
|
2119
|
+
datasetId_ = dataset.id;
|
|
2120
|
+
} else datasetId_ = datasetId;
|
|
2121
|
+
assertUuid(datasetId_);
|
|
2122
|
+
const data = {
|
|
2123
|
+
split_name: splitName,
|
|
2124
|
+
examples: exampleIds.map((id) => {
|
|
2125
|
+
assertUuid(id);
|
|
2126
|
+
return id;
|
|
2127
|
+
}),
|
|
2128
|
+
remove
|
|
2129
|
+
};
|
|
2130
|
+
const body = JSON.stringify(data);
|
|
2131
|
+
await this.caller.call(async () => {
|
|
2132
|
+
const res = await this._fetch(`${this.apiUrl}/datasets/${datasetId_}/splits`, {
|
|
2133
|
+
method: "PUT",
|
|
2134
|
+
headers: {
|
|
2135
|
+
...this.headers,
|
|
2136
|
+
"Content-Type": "application/json"
|
|
2137
|
+
},
|
|
2138
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2139
|
+
...this.fetchOptions,
|
|
2140
|
+
body
|
|
2141
|
+
});
|
|
2142
|
+
await raiseForStatus(res, "update dataset splits", true);
|
|
2143
|
+
return res;
|
|
2144
|
+
});
|
|
2145
|
+
}
|
|
2146
|
+
/**
|
|
2147
|
+
* @deprecated This method is deprecated and will be removed in future LangSmith versions, use `evaluate` from `langsmith/evaluation` instead.
|
|
2148
|
+
*/
|
|
2149
|
+
async evaluateRun(run, evaluator, { sourceInfo, loadChildRuns, referenceExample } = { loadChildRuns: false }) {
|
|
2150
|
+
warnOnce("This method is deprecated and will be removed in future LangSmith versions, use `evaluate` from `langsmith/evaluation` instead.");
|
|
2151
|
+
let run_;
|
|
2152
|
+
if (typeof run === "string") run_ = await this.readRun(run, { loadChildRuns });
|
|
2153
|
+
else if (typeof run === "object" && "id" in run) run_ = run;
|
|
2154
|
+
else throw new Error(`Invalid run type: ${typeof run}`);
|
|
2155
|
+
if (run_.reference_example_id !== null && run_.reference_example_id !== void 0) referenceExample = await this.readExample(run_.reference_example_id);
|
|
2156
|
+
const feedbackResult = await evaluator.evaluateRun(run_, referenceExample);
|
|
2157
|
+
const [_, feedbacks] = await this._logEvaluationFeedback(feedbackResult, run_, sourceInfo);
|
|
2158
|
+
return feedbacks[0];
|
|
2159
|
+
}
|
|
2160
|
+
async createFeedback(runId, key, { score, value, correction, comment, sourceInfo, feedbackSourceType = "api", sourceRunId, feedbackId, feedbackConfig, projectId, comparativeExperimentId }) {
|
|
2161
|
+
if (!runId && !projectId) throw new Error("One of runId or projectId must be provided");
|
|
2162
|
+
if (runId && projectId) throw new Error("Only one of runId or projectId can be provided");
|
|
2163
|
+
const feedback_source = {
|
|
2164
|
+
type: feedbackSourceType ?? "api",
|
|
2165
|
+
metadata: sourceInfo ?? {}
|
|
2166
|
+
};
|
|
2167
|
+
if (sourceRunId !== void 0 && feedback_source?.metadata !== void 0 && !feedback_source.metadata["__run"]) feedback_source.metadata["__run"] = { run_id: sourceRunId };
|
|
2168
|
+
if (feedback_source?.metadata !== void 0 && feedback_source.metadata["__run"]?.run_id !== void 0) assertUuid(feedback_source.metadata["__run"].run_id);
|
|
2169
|
+
const feedback = {
|
|
2170
|
+
id: feedbackId ?? uuid.v4(),
|
|
2171
|
+
run_id: runId,
|
|
2172
|
+
key,
|
|
2173
|
+
score: _formatFeedbackScore(score),
|
|
2174
|
+
value,
|
|
2175
|
+
correction,
|
|
2176
|
+
comment,
|
|
2177
|
+
feedback_source,
|
|
2178
|
+
comparative_experiment_id: comparativeExperimentId,
|
|
2179
|
+
feedbackConfig,
|
|
2180
|
+
session_id: projectId
|
|
2181
|
+
};
|
|
2182
|
+
const body = JSON.stringify(feedback);
|
|
2183
|
+
const url = `${this.apiUrl}/feedback`;
|
|
2184
|
+
await this.caller.call(async () => {
|
|
2185
|
+
const res = await this._fetch(url, {
|
|
2186
|
+
method: "POST",
|
|
2187
|
+
headers: {
|
|
2188
|
+
...this.headers,
|
|
2189
|
+
"Content-Type": "application/json"
|
|
2190
|
+
},
|
|
2191
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2192
|
+
...this.fetchOptions,
|
|
2193
|
+
body
|
|
2194
|
+
});
|
|
2195
|
+
await raiseForStatus(res, "create feedback", true);
|
|
2196
|
+
return res;
|
|
2197
|
+
});
|
|
2198
|
+
return feedback;
|
|
2199
|
+
}
|
|
2200
|
+
async updateFeedback(feedbackId, { score, value, correction, comment }) {
|
|
2201
|
+
const feedbackUpdate = {};
|
|
2202
|
+
if (score !== void 0 && score !== null) feedbackUpdate["score"] = _formatFeedbackScore(score);
|
|
2203
|
+
if (value !== void 0 && value !== null) feedbackUpdate["value"] = value;
|
|
2204
|
+
if (correction !== void 0 && correction !== null) feedbackUpdate["correction"] = correction;
|
|
2205
|
+
if (comment !== void 0 && comment !== null) feedbackUpdate["comment"] = comment;
|
|
2206
|
+
assertUuid(feedbackId);
|
|
2207
|
+
const body = JSON.stringify(feedbackUpdate);
|
|
2208
|
+
await this.caller.call(async () => {
|
|
2209
|
+
const res = await this._fetch(`${this.apiUrl}/feedback/${feedbackId}`, {
|
|
2210
|
+
method: "PATCH",
|
|
2211
|
+
headers: {
|
|
2212
|
+
...this.headers,
|
|
2213
|
+
"Content-Type": "application/json"
|
|
2214
|
+
},
|
|
2215
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2216
|
+
...this.fetchOptions,
|
|
2217
|
+
body
|
|
2218
|
+
});
|
|
2219
|
+
await raiseForStatus(res, "update feedback", true);
|
|
2220
|
+
return res;
|
|
2221
|
+
});
|
|
2222
|
+
}
|
|
2223
|
+
async readFeedback(feedbackId) {
|
|
2224
|
+
assertUuid(feedbackId);
|
|
2225
|
+
const path = `/feedback/${feedbackId}`;
|
|
2226
|
+
const response = await this._get(path);
|
|
2227
|
+
return response;
|
|
2228
|
+
}
|
|
2229
|
+
async deleteFeedback(feedbackId) {
|
|
2230
|
+
assertUuid(feedbackId);
|
|
2231
|
+
const path = `/feedback/${feedbackId}`;
|
|
2232
|
+
await this.caller.call(async () => {
|
|
2233
|
+
const res = await this._fetch(this.apiUrl + path, {
|
|
2234
|
+
method: "DELETE",
|
|
2235
|
+
headers: this.headers,
|
|
2236
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2237
|
+
...this.fetchOptions
|
|
2238
|
+
});
|
|
2239
|
+
await raiseForStatus(res, `delete ${path}`, true);
|
|
2240
|
+
return res;
|
|
2241
|
+
});
|
|
2242
|
+
}
|
|
2243
|
+
async *listFeedback({ runIds, feedbackKeys, feedbackSourceTypes } = {}) {
|
|
2244
|
+
const queryParams = new URLSearchParams();
|
|
2245
|
+
if (runIds) queryParams.append("run", runIds.join(","));
|
|
2246
|
+
if (feedbackKeys) for (const key of feedbackKeys) queryParams.append("key", key);
|
|
2247
|
+
if (feedbackSourceTypes) for (const type of feedbackSourceTypes) queryParams.append("source", type);
|
|
2248
|
+
for await (const feedbacks of this._getPaginated("/feedback", queryParams)) yield* feedbacks;
|
|
2249
|
+
}
|
|
2250
|
+
/**
|
|
2251
|
+
* Creates a presigned feedback token and URL.
|
|
2252
|
+
*
|
|
2253
|
+
* The token can be used to authorize feedback metrics without
|
|
2254
|
+
* needing an API key. This is useful for giving browser-based
|
|
2255
|
+
* applications the ability to submit feedback without needing
|
|
2256
|
+
* to expose an API key.
|
|
2257
|
+
*
|
|
2258
|
+
* @param runId The ID of the run.
|
|
2259
|
+
* @param feedbackKey The feedback key.
|
|
2260
|
+
* @param options Additional options for the token.
|
|
2261
|
+
* @param options.expiration The expiration time for the token.
|
|
2262
|
+
*
|
|
2263
|
+
* @returns A promise that resolves to a FeedbackIngestToken.
|
|
2264
|
+
*/
|
|
2265
|
+
async createPresignedFeedbackToken(runId, feedbackKey, { expiration, feedbackConfig } = {}) {
|
|
2266
|
+
const body = {
|
|
2267
|
+
run_id: runId,
|
|
2268
|
+
feedback_key: feedbackKey,
|
|
2269
|
+
feedback_config: feedbackConfig
|
|
2270
|
+
};
|
|
2271
|
+
if (expiration) {
|
|
2272
|
+
if (typeof expiration === "string") body["expires_at"] = expiration;
|
|
2273
|
+
else if (expiration?.hours || expiration?.minutes || expiration?.days) body["expires_in"] = expiration;
|
|
2274
|
+
} else body["expires_in"] = { hours: 3 };
|
|
2275
|
+
const serializedBody = JSON.stringify(body);
|
|
2276
|
+
const response = await this.caller.call(async () => {
|
|
2277
|
+
const res = await this._fetch(`${this.apiUrl}/feedback/tokens`, {
|
|
2278
|
+
method: "POST",
|
|
2279
|
+
headers: {
|
|
2280
|
+
...this.headers,
|
|
2281
|
+
"Content-Type": "application/json"
|
|
2282
|
+
},
|
|
2283
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2284
|
+
...this.fetchOptions,
|
|
2285
|
+
body: serializedBody
|
|
2286
|
+
});
|
|
2287
|
+
await raiseForStatus(res, "create presigned feedback token");
|
|
2288
|
+
return res;
|
|
2289
|
+
});
|
|
2290
|
+
return await response.json();
|
|
2291
|
+
}
|
|
2292
|
+
async createComparativeExperiment({ name, experimentIds, referenceDatasetId, createdAt, description, metadata, id }) {
|
|
2293
|
+
if (experimentIds.length === 0) throw new Error("At least one experiment is required");
|
|
2294
|
+
if (!referenceDatasetId) referenceDatasetId = (await this.readProject({ projectId: experimentIds[0] })).reference_dataset_id;
|
|
2295
|
+
if (!referenceDatasetId == null) throw new Error("A reference dataset is required");
|
|
2296
|
+
const body = {
|
|
2297
|
+
id,
|
|
2298
|
+
name,
|
|
2299
|
+
experiment_ids: experimentIds,
|
|
2300
|
+
reference_dataset_id: referenceDatasetId,
|
|
2301
|
+
description,
|
|
2302
|
+
created_at: (createdAt ?? /* @__PURE__ */ new Date())?.toISOString(),
|
|
2303
|
+
extra: {}
|
|
2304
|
+
};
|
|
2305
|
+
if (metadata) body.extra["metadata"] = metadata;
|
|
2306
|
+
const serializedBody = JSON.stringify(body);
|
|
2307
|
+
const response = await this.caller.call(async () => {
|
|
2308
|
+
const res = await this._fetch(`${this.apiUrl}/datasets/comparative`, {
|
|
2309
|
+
method: "POST",
|
|
2310
|
+
headers: {
|
|
2311
|
+
...this.headers,
|
|
2312
|
+
"Content-Type": "application/json"
|
|
2313
|
+
},
|
|
2314
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2315
|
+
...this.fetchOptions,
|
|
2316
|
+
body: serializedBody
|
|
2317
|
+
});
|
|
2318
|
+
await raiseForStatus(res, "create comparative experiment");
|
|
2319
|
+
return res;
|
|
2320
|
+
});
|
|
2321
|
+
return response.json();
|
|
2322
|
+
}
|
|
2323
|
+
/**
|
|
2324
|
+
* Retrieves a list of presigned feedback tokens for a given run ID.
|
|
2325
|
+
* @param runId The ID of the run.
|
|
2326
|
+
* @returns An async iterable of FeedbackIngestToken objects.
|
|
2327
|
+
*/
|
|
2328
|
+
async *listPresignedFeedbackTokens(runId) {
|
|
2329
|
+
assertUuid(runId);
|
|
2330
|
+
const params = new URLSearchParams({ run_id: runId });
|
|
2331
|
+
for await (const tokens of this._getPaginated("/feedback/tokens", params)) yield* tokens;
|
|
2332
|
+
}
|
|
2333
|
+
_selectEvalResults(results) {
|
|
2334
|
+
let results_;
|
|
2335
|
+
if ("results" in results) results_ = results.results;
|
|
2336
|
+
else if (Array.isArray(results)) results_ = results;
|
|
2337
|
+
else results_ = [results];
|
|
2338
|
+
return results_;
|
|
2339
|
+
}
|
|
2340
|
+
async _logEvaluationFeedback(evaluatorResponse, run, sourceInfo) {
|
|
2341
|
+
const evalResults = this._selectEvalResults(evaluatorResponse);
|
|
2342
|
+
const feedbacks = [];
|
|
2343
|
+
for (const res of evalResults) {
|
|
2344
|
+
let sourceInfo_ = sourceInfo || {};
|
|
2345
|
+
if (res.evaluatorInfo) sourceInfo_ = {
|
|
2346
|
+
...res.evaluatorInfo,
|
|
2347
|
+
...sourceInfo_
|
|
2348
|
+
};
|
|
2349
|
+
let runId_ = null;
|
|
2350
|
+
if (res.targetRunId) runId_ = res.targetRunId;
|
|
2351
|
+
else if (run) runId_ = run.id;
|
|
2352
|
+
feedbacks.push(await this.createFeedback(runId_, res.key, {
|
|
2353
|
+
score: res.score,
|
|
2354
|
+
value: res.value,
|
|
2355
|
+
comment: res.comment,
|
|
2356
|
+
correction: res.correction,
|
|
2357
|
+
sourceInfo: sourceInfo_,
|
|
2358
|
+
sourceRunId: res.sourceRunId,
|
|
2359
|
+
feedbackConfig: res.feedbackConfig,
|
|
2360
|
+
feedbackSourceType: "model"
|
|
2361
|
+
}));
|
|
2362
|
+
}
|
|
2363
|
+
return [evalResults, feedbacks];
|
|
2364
|
+
}
|
|
2365
|
+
async logEvaluationFeedback(evaluatorResponse, run, sourceInfo) {
|
|
2366
|
+
const [results] = await this._logEvaluationFeedback(evaluatorResponse, run, sourceInfo);
|
|
2367
|
+
return results;
|
|
2368
|
+
}
|
|
2369
|
+
/**
|
|
2370
|
+
* API for managing annotation queues
|
|
2371
|
+
*/
|
|
2372
|
+
/**
|
|
2373
|
+
* List the annotation queues on the LangSmith API.
|
|
2374
|
+
* @param options - The options for listing annotation queues
|
|
2375
|
+
* @param options.queueIds - The IDs of the queues to filter by
|
|
2376
|
+
* @param options.name - The name of the queue to filter by
|
|
2377
|
+
* @param options.nameContains - The substring that the queue name should contain
|
|
2378
|
+
* @param options.limit - The maximum number of queues to return
|
|
2379
|
+
* @returns An iterator of AnnotationQueue objects
|
|
2380
|
+
*/
|
|
2381
|
+
async *listAnnotationQueues(options = {}) {
|
|
2382
|
+
const { queueIds, name, nameContains, limit } = options;
|
|
2383
|
+
const params = new URLSearchParams();
|
|
2384
|
+
if (queueIds) queueIds.forEach((id, i) => {
|
|
2385
|
+
assertUuid(id, `queueIds[${i}]`);
|
|
2386
|
+
params.append("ids", id);
|
|
2387
|
+
});
|
|
2388
|
+
if (name) params.append("name", name);
|
|
2389
|
+
if (nameContains) params.append("name_contains", nameContains);
|
|
2390
|
+
params.append("limit", (limit !== void 0 ? Math.min(limit, 100) : 100).toString());
|
|
2391
|
+
let count = 0;
|
|
2392
|
+
for await (const queues of this._getPaginated("/annotation-queues", params)) {
|
|
2393
|
+
yield* queues;
|
|
2394
|
+
count++;
|
|
2395
|
+
if (limit !== void 0 && count >= limit) break;
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
/**
|
|
2399
|
+
* Create an annotation queue on the LangSmith API.
|
|
2400
|
+
* @param options - The options for creating an annotation queue
|
|
2401
|
+
* @param options.name - The name of the annotation queue
|
|
2402
|
+
* @param options.description - The description of the annotation queue
|
|
2403
|
+
* @param options.queueId - The ID of the annotation queue
|
|
2404
|
+
* @returns The created AnnotationQueue object
|
|
2405
|
+
*/
|
|
2406
|
+
async createAnnotationQueue(options) {
|
|
2407
|
+
const { name, description, queueId, rubricInstructions } = options;
|
|
2408
|
+
const body = {
|
|
2409
|
+
name,
|
|
2410
|
+
description,
|
|
2411
|
+
id: queueId || uuid.v4(),
|
|
2412
|
+
rubric_instructions: rubricInstructions
|
|
2413
|
+
};
|
|
2414
|
+
const serializedBody = JSON.stringify(Object.fromEntries(Object.entries(body).filter(([_, v]) => v !== void 0)));
|
|
2415
|
+
const response = await this.caller.call(async () => {
|
|
2416
|
+
const res = await this._fetch(`${this.apiUrl}/annotation-queues`, {
|
|
2417
|
+
method: "POST",
|
|
2418
|
+
headers: {
|
|
2419
|
+
...this.headers,
|
|
2420
|
+
"Content-Type": "application/json"
|
|
2421
|
+
},
|
|
2422
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2423
|
+
...this.fetchOptions,
|
|
2424
|
+
body: serializedBody
|
|
2425
|
+
});
|
|
2426
|
+
await raiseForStatus(res, "create annotation queue");
|
|
2427
|
+
return res;
|
|
2428
|
+
});
|
|
2429
|
+
return response.json();
|
|
2430
|
+
}
|
|
2431
|
+
/**
|
|
2432
|
+
* Read an annotation queue with the specified queue ID.
|
|
2433
|
+
* @param queueId - The ID of the annotation queue to read
|
|
2434
|
+
* @returns The AnnotationQueueWithDetails object
|
|
2435
|
+
*/
|
|
2436
|
+
async readAnnotationQueue(queueId) {
|
|
2437
|
+
const response = await this.caller.call(async () => {
|
|
2438
|
+
const res = await this._fetch(`${this.apiUrl}/annotation-queues/${assertUuid(queueId, "queueId")}`, {
|
|
2439
|
+
method: "GET",
|
|
2440
|
+
headers: this.headers,
|
|
2441
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2442
|
+
...this.fetchOptions
|
|
2443
|
+
});
|
|
2444
|
+
await raiseForStatus(res, "read annotation queue");
|
|
2445
|
+
return res;
|
|
2446
|
+
});
|
|
2447
|
+
return response.json();
|
|
2448
|
+
}
|
|
2449
|
+
/**
|
|
2450
|
+
* Update an annotation queue with the specified queue ID.
|
|
2451
|
+
* @param queueId - The ID of the annotation queue to update
|
|
2452
|
+
* @param options - The options for updating the annotation queue
|
|
2453
|
+
* @param options.name - The new name for the annotation queue
|
|
2454
|
+
* @param options.description - The new description for the annotation queue
|
|
2455
|
+
*/
|
|
2456
|
+
async updateAnnotationQueue(queueId, options) {
|
|
2457
|
+
const { name, description, rubricInstructions } = options;
|
|
2458
|
+
const body = JSON.stringify({
|
|
2459
|
+
name,
|
|
2460
|
+
description,
|
|
2461
|
+
rubric_instructions: rubricInstructions
|
|
2462
|
+
});
|
|
2463
|
+
await this.caller.call(async () => {
|
|
2464
|
+
const res = await this._fetch(`${this.apiUrl}/annotation-queues/${assertUuid(queueId, "queueId")}`, {
|
|
2465
|
+
method: "PATCH",
|
|
2466
|
+
headers: {
|
|
2467
|
+
...this.headers,
|
|
2468
|
+
"Content-Type": "application/json"
|
|
2469
|
+
},
|
|
2470
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2471
|
+
...this.fetchOptions,
|
|
2472
|
+
body
|
|
2473
|
+
});
|
|
2474
|
+
await raiseForStatus(res, "update annotation queue", true);
|
|
2475
|
+
return res;
|
|
2476
|
+
});
|
|
2477
|
+
}
|
|
2478
|
+
/**
|
|
2479
|
+
* Delete an annotation queue with the specified queue ID.
|
|
2480
|
+
* @param queueId - The ID of the annotation queue to delete
|
|
2481
|
+
*/
|
|
2482
|
+
async deleteAnnotationQueue(queueId) {
|
|
2483
|
+
await this.caller.call(async () => {
|
|
2484
|
+
const res = await this._fetch(`${this.apiUrl}/annotation-queues/${assertUuid(queueId, "queueId")}`, {
|
|
2485
|
+
method: "DELETE",
|
|
2486
|
+
headers: {
|
|
2487
|
+
...this.headers,
|
|
2488
|
+
Accept: "application/json"
|
|
2489
|
+
},
|
|
2490
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2491
|
+
...this.fetchOptions
|
|
2492
|
+
});
|
|
2493
|
+
await raiseForStatus(res, "delete annotation queue", true);
|
|
2494
|
+
return res;
|
|
2495
|
+
});
|
|
2496
|
+
}
|
|
2497
|
+
/**
|
|
2498
|
+
* Add runs to an annotation queue with the specified queue ID.
|
|
2499
|
+
* @param queueId - The ID of the annotation queue
|
|
2500
|
+
* @param runIds - The IDs of the runs to be added to the annotation queue
|
|
2501
|
+
*/
|
|
2502
|
+
async addRunsToAnnotationQueue(queueId, runIds) {
|
|
2503
|
+
const body = JSON.stringify(runIds.map((id, i) => assertUuid(id, `runIds[${i}]`).toString()));
|
|
2504
|
+
await this.caller.call(async () => {
|
|
2505
|
+
const res = await this._fetch(`${this.apiUrl}/annotation-queues/${assertUuid(queueId, "queueId")}/runs`, {
|
|
2506
|
+
method: "POST",
|
|
2507
|
+
headers: {
|
|
2508
|
+
...this.headers,
|
|
2509
|
+
"Content-Type": "application/json"
|
|
2510
|
+
},
|
|
2511
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2512
|
+
...this.fetchOptions,
|
|
2513
|
+
body
|
|
2514
|
+
});
|
|
2515
|
+
await raiseForStatus(res, "add runs to annotation queue", true);
|
|
2516
|
+
return res;
|
|
2517
|
+
});
|
|
2518
|
+
}
|
|
2519
|
+
/**
|
|
2520
|
+
* Get a run from an annotation queue at the specified index.
|
|
2521
|
+
* @param queueId - The ID of the annotation queue
|
|
2522
|
+
* @param index - The index of the run to retrieve
|
|
2523
|
+
* @returns A Promise that resolves to a RunWithAnnotationQueueInfo object
|
|
2524
|
+
* @throws {Error} If the run is not found at the given index or for other API-related errors
|
|
2525
|
+
*/
|
|
2526
|
+
async getRunFromAnnotationQueue(queueId, index) {
|
|
2527
|
+
const baseUrl = `/annotation-queues/${assertUuid(queueId, "queueId")}/run`;
|
|
2528
|
+
const response = await this.caller.call(async () => {
|
|
2529
|
+
const res = await this._fetch(`${this.apiUrl}${baseUrl}/${index}`, {
|
|
2530
|
+
method: "GET",
|
|
2531
|
+
headers: this.headers,
|
|
2532
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2533
|
+
...this.fetchOptions
|
|
2534
|
+
});
|
|
2535
|
+
await raiseForStatus(res, "get run from annotation queue");
|
|
2536
|
+
return res;
|
|
2537
|
+
});
|
|
2538
|
+
return response.json();
|
|
2539
|
+
}
|
|
2540
|
+
/**
|
|
2541
|
+
* Delete a run from an an annotation queue.
|
|
2542
|
+
* @param queueId - The ID of the annotation queue to delete the run from
|
|
2543
|
+
* @param queueRunId - The ID of the run to delete from the annotation queue
|
|
2544
|
+
*/
|
|
2545
|
+
async deleteRunFromAnnotationQueue(queueId, queueRunId) {
|
|
2546
|
+
await this.caller.call(async () => {
|
|
2547
|
+
const res = await this._fetch(`${this.apiUrl}/annotation-queues/${assertUuid(queueId, "queueId")}/runs/${assertUuid(queueRunId, "queueRunId")}`, {
|
|
2548
|
+
method: "DELETE",
|
|
2549
|
+
headers: {
|
|
2550
|
+
...this.headers,
|
|
2551
|
+
Accept: "application/json"
|
|
2552
|
+
},
|
|
2553
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2554
|
+
...this.fetchOptions
|
|
2555
|
+
});
|
|
2556
|
+
await raiseForStatus(res, "delete run from annotation queue", true);
|
|
2557
|
+
return res;
|
|
2558
|
+
});
|
|
2559
|
+
}
|
|
2560
|
+
/**
|
|
2561
|
+
* Get the size of an annotation queue.
|
|
2562
|
+
* @param queueId - The ID of the annotation queue
|
|
2563
|
+
*/
|
|
2564
|
+
async getSizeFromAnnotationQueue(queueId) {
|
|
2565
|
+
const response = await this.caller.call(async () => {
|
|
2566
|
+
const res = await this._fetch(`${this.apiUrl}/annotation-queues/${assertUuid(queueId, "queueId")}/size`, {
|
|
2567
|
+
method: "GET",
|
|
2568
|
+
headers: this.headers,
|
|
2569
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2570
|
+
...this.fetchOptions
|
|
2571
|
+
});
|
|
2572
|
+
await raiseForStatus(res, "get size from annotation queue");
|
|
2573
|
+
return res;
|
|
2574
|
+
});
|
|
2575
|
+
return response.json();
|
|
2576
|
+
}
|
|
2577
|
+
async _currentTenantIsOwner(owner) {
|
|
2578
|
+
const settings = await this._getSettings();
|
|
2579
|
+
return owner == "-" || settings.tenant_handle === owner;
|
|
2580
|
+
}
|
|
2581
|
+
async _ownerConflictError(action, owner) {
|
|
2582
|
+
const settings = await this._getSettings();
|
|
2583
|
+
return /* @__PURE__ */ new Error(`Cannot ${action} for another tenant.\n
|
|
2584
|
+
Current tenant: ${settings.tenant_handle}\n
|
|
2585
|
+
Requested tenant: ${owner}`);
|
|
2586
|
+
}
|
|
2587
|
+
async _getLatestCommitHash(promptOwnerAndName) {
|
|
2588
|
+
const response = await this.caller.call(async () => {
|
|
2589
|
+
const res = await this._fetch(`${this.apiUrl}/commits/${promptOwnerAndName}/?limit=1&offset=0`, {
|
|
2590
|
+
method: "GET",
|
|
2591
|
+
headers: this.headers,
|
|
2592
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2593
|
+
...this.fetchOptions
|
|
2594
|
+
});
|
|
2595
|
+
await raiseForStatus(res, "get latest commit hash");
|
|
2596
|
+
return res;
|
|
2597
|
+
});
|
|
2598
|
+
const json = await response.json();
|
|
2599
|
+
if (json.commits.length === 0) return void 0;
|
|
2600
|
+
return json.commits[0].commit_hash;
|
|
2601
|
+
}
|
|
2602
|
+
async _likeOrUnlikePrompt(promptIdentifier, like) {
|
|
2603
|
+
const [owner, promptName, _] = parsePromptIdentifier(promptIdentifier);
|
|
2604
|
+
const body = JSON.stringify({ like });
|
|
2605
|
+
const response = await this.caller.call(async () => {
|
|
2606
|
+
const res = await this._fetch(`${this.apiUrl}/likes/${owner}/${promptName}`, {
|
|
2607
|
+
method: "POST",
|
|
2608
|
+
headers: {
|
|
2609
|
+
...this.headers,
|
|
2610
|
+
"Content-Type": "application/json"
|
|
2611
|
+
},
|
|
2612
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2613
|
+
...this.fetchOptions,
|
|
2614
|
+
body
|
|
2615
|
+
});
|
|
2616
|
+
await raiseForStatus(res, `${like ? "like" : "unlike"} prompt`);
|
|
2617
|
+
return res;
|
|
2618
|
+
});
|
|
2619
|
+
return response.json();
|
|
2620
|
+
}
|
|
2621
|
+
async _getPromptUrl(promptIdentifier) {
|
|
2622
|
+
const [owner, promptName, commitHash] = parsePromptIdentifier(promptIdentifier);
|
|
2623
|
+
if (!await this._currentTenantIsOwner(owner)) if (commitHash !== "latest") return `${this.getHostUrl()}/hub/${owner}/${promptName}/${commitHash.substring(0, 8)}`;
|
|
2624
|
+
else return `${this.getHostUrl()}/hub/${owner}/${promptName}`;
|
|
2625
|
+
else {
|
|
2626
|
+
const settings = await this._getSettings();
|
|
2627
|
+
if (commitHash !== "latest") return `${this.getHostUrl()}/prompts/${promptName}/${commitHash.substring(0, 8)}?organizationId=${settings.id}`;
|
|
2628
|
+
else return `${this.getHostUrl()}/prompts/${promptName}?organizationId=${settings.id}`;
|
|
2629
|
+
}
|
|
2630
|
+
}
|
|
2631
|
+
async promptExists(promptIdentifier) {
|
|
2632
|
+
const prompt = await this.getPrompt(promptIdentifier);
|
|
2633
|
+
return !!prompt;
|
|
2634
|
+
}
|
|
2635
|
+
async likePrompt(promptIdentifier) {
|
|
2636
|
+
return this._likeOrUnlikePrompt(promptIdentifier, true);
|
|
2637
|
+
}
|
|
2638
|
+
async unlikePrompt(promptIdentifier) {
|
|
2639
|
+
return this._likeOrUnlikePrompt(promptIdentifier, false);
|
|
2640
|
+
}
|
|
2641
|
+
async *listCommits(promptOwnerAndName) {
|
|
2642
|
+
for await (const commits of this._getPaginated(`/commits/${promptOwnerAndName}/`, new URLSearchParams(), (res) => res.commits)) yield* commits;
|
|
2643
|
+
}
|
|
2644
|
+
async *listPrompts(options) {
|
|
2645
|
+
const params = new URLSearchParams();
|
|
2646
|
+
params.append("sort_field", options?.sortField ?? "updated_at");
|
|
2647
|
+
params.append("sort_direction", "desc");
|
|
2648
|
+
params.append("is_archived", (!!options?.isArchived).toString());
|
|
2649
|
+
if (options?.isPublic !== void 0) params.append("is_public", options.isPublic.toString());
|
|
2650
|
+
if (options?.query) params.append("query", options.query);
|
|
2651
|
+
for await (const prompts of this._getPaginated("/repos", params, (res) => res.repos)) yield* prompts;
|
|
2652
|
+
}
|
|
2653
|
+
async getPrompt(promptIdentifier) {
|
|
2654
|
+
const [owner, promptName, _] = parsePromptIdentifier(promptIdentifier);
|
|
2655
|
+
const response = await this.caller.call(async () => {
|
|
2656
|
+
const res = await this._fetch(`${this.apiUrl}/repos/${owner}/${promptName}`, {
|
|
2657
|
+
method: "GET",
|
|
2658
|
+
headers: this.headers,
|
|
2659
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2660
|
+
...this.fetchOptions
|
|
2661
|
+
});
|
|
2662
|
+
if (res?.status === 404) return null;
|
|
2663
|
+
await raiseForStatus(res, "get prompt");
|
|
2664
|
+
return res;
|
|
2665
|
+
});
|
|
2666
|
+
const result = await response?.json();
|
|
2667
|
+
if (result?.repo) return result.repo;
|
|
2668
|
+
else return null;
|
|
2669
|
+
}
|
|
2670
|
+
async createPrompt(promptIdentifier, options) {
|
|
2671
|
+
const settings = await this._getSettings();
|
|
2672
|
+
if (options?.isPublic && !settings.tenant_handle) throw new Error(`Cannot create a public prompt without first\n
|
|
2673
|
+
creating a LangChain Hub handle.
|
|
2674
|
+
You can add a handle by creating a public prompt at:\n
|
|
2675
|
+
https://smith.langchain.com/prompts`);
|
|
2676
|
+
const [owner, promptName, _] = parsePromptIdentifier(promptIdentifier);
|
|
2677
|
+
if (!await this._currentTenantIsOwner(owner)) throw await this._ownerConflictError("create a prompt", owner);
|
|
2678
|
+
const data = {
|
|
2679
|
+
repo_handle: promptName,
|
|
2680
|
+
...options?.description && { description: options.description },
|
|
2681
|
+
...options?.readme && { readme: options.readme },
|
|
2682
|
+
...options?.tags && { tags: options.tags },
|
|
2683
|
+
is_public: !!options?.isPublic
|
|
2684
|
+
};
|
|
2685
|
+
const body = JSON.stringify(data);
|
|
2686
|
+
const response = await this.caller.call(async () => {
|
|
2687
|
+
const res = await this._fetch(`${this.apiUrl}/repos/`, {
|
|
2688
|
+
method: "POST",
|
|
2689
|
+
headers: {
|
|
2690
|
+
...this.headers,
|
|
2691
|
+
"Content-Type": "application/json"
|
|
2692
|
+
},
|
|
2693
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2694
|
+
...this.fetchOptions,
|
|
2695
|
+
body
|
|
2696
|
+
});
|
|
2697
|
+
await raiseForStatus(res, "create prompt");
|
|
2698
|
+
return res;
|
|
2699
|
+
});
|
|
2700
|
+
const { repo } = await response.json();
|
|
2701
|
+
return repo;
|
|
2702
|
+
}
|
|
2703
|
+
async createCommit(promptIdentifier, object, options) {
|
|
2704
|
+
if (!await this.promptExists(promptIdentifier)) throw new Error("Prompt does not exist, you must create it first.");
|
|
2705
|
+
const [owner, promptName, _] = parsePromptIdentifier(promptIdentifier);
|
|
2706
|
+
const resolvedParentCommitHash = options?.parentCommitHash === "latest" || !options?.parentCommitHash ? await this._getLatestCommitHash(`${owner}/${promptName}`) : options?.parentCommitHash;
|
|
2707
|
+
const payload = {
|
|
2708
|
+
manifest: JSON.parse(JSON.stringify(object)),
|
|
2709
|
+
parent_commit: resolvedParentCommitHash
|
|
2710
|
+
};
|
|
2711
|
+
const body = JSON.stringify(payload);
|
|
2712
|
+
const response = await this.caller.call(async () => {
|
|
2713
|
+
const res = await this._fetch(`${this.apiUrl}/commits/${owner}/${promptName}`, {
|
|
2714
|
+
method: "POST",
|
|
2715
|
+
headers: {
|
|
2716
|
+
...this.headers,
|
|
2717
|
+
"Content-Type": "application/json"
|
|
2718
|
+
},
|
|
2719
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2720
|
+
...this.fetchOptions,
|
|
2721
|
+
body
|
|
2722
|
+
});
|
|
2723
|
+
await raiseForStatus(res, "create commit");
|
|
2724
|
+
return res;
|
|
2725
|
+
});
|
|
2726
|
+
const result = await response.json();
|
|
2727
|
+
return this._getPromptUrl(`${owner}/${promptName}${result.commit_hash ? `:${result.commit_hash}` : ""}`);
|
|
2728
|
+
}
|
|
2729
|
+
/**
|
|
2730
|
+
* Update examples with attachments using multipart form data.
|
|
2731
|
+
* @param updates List of ExampleUpdateWithAttachments objects to upsert
|
|
2732
|
+
* @returns Promise with the update response
|
|
2733
|
+
*/
|
|
2734
|
+
async updateExamplesMultipart(datasetId, updates = []) {
|
|
2735
|
+
return this._updateExamplesMultipart(datasetId, updates);
|
|
2736
|
+
}
|
|
2737
|
+
async _updateExamplesMultipart(datasetId, updates = []) {
|
|
2738
|
+
if (!await this._getDatasetExamplesMultiPartSupport()) throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");
|
|
2739
|
+
const formData = new FormData();
|
|
2740
|
+
for (const example of updates) {
|
|
2741
|
+
const exampleId = example.id;
|
|
2742
|
+
const exampleBody = {
|
|
2743
|
+
...example.metadata && { metadata: example.metadata },
|
|
2744
|
+
...example.split && { split: example.split }
|
|
2745
|
+
};
|
|
2746
|
+
const stringifiedExample = serialize(exampleBody, `Serializing body for example with id: ${exampleId}`);
|
|
2747
|
+
const exampleBlob = new Blob([stringifiedExample], { type: "application/json" });
|
|
2748
|
+
formData.append(exampleId, exampleBlob);
|
|
2749
|
+
if (example.inputs) {
|
|
2750
|
+
const stringifiedInputs = serialize(example.inputs, `Serializing inputs for example with id: ${exampleId}`);
|
|
2751
|
+
const inputsBlob = new Blob([stringifiedInputs], { type: "application/json" });
|
|
2752
|
+
formData.append(`${exampleId}.inputs`, inputsBlob);
|
|
2753
|
+
}
|
|
2754
|
+
if (example.outputs) {
|
|
2755
|
+
const stringifiedOutputs = serialize(example.outputs, `Serializing outputs whle updating example with id: ${exampleId}`);
|
|
2756
|
+
const outputsBlob = new Blob([stringifiedOutputs], { type: "application/json" });
|
|
2757
|
+
formData.append(`${exampleId}.outputs`, outputsBlob);
|
|
2758
|
+
}
|
|
2759
|
+
if (example.attachments) for (const [name, attachment] of Object.entries(example.attachments)) {
|
|
2760
|
+
let mimeType;
|
|
2761
|
+
let data;
|
|
2762
|
+
if (Array.isArray(attachment)) [mimeType, data] = attachment;
|
|
2763
|
+
else {
|
|
2764
|
+
mimeType = attachment.mimeType;
|
|
2765
|
+
data = attachment.data;
|
|
2766
|
+
}
|
|
2767
|
+
const attachmentBlob = new Blob([data], { type: `${mimeType}; length=${data.byteLength}` });
|
|
2768
|
+
formData.append(`${exampleId}.attachment.${name}`, attachmentBlob);
|
|
2769
|
+
}
|
|
2770
|
+
if (example.attachments_operations) {
|
|
2771
|
+
const stringifiedAttachmentsOperations = serialize(example.attachments_operations, `Serializing attachments while updating example with id: ${exampleId}`);
|
|
2772
|
+
const attachmentsOperationsBlob = new Blob([stringifiedAttachmentsOperations], { type: "application/json" });
|
|
2773
|
+
formData.append(`${exampleId}.attachments_operations`, attachmentsOperationsBlob);
|
|
2774
|
+
}
|
|
2775
|
+
}
|
|
2776
|
+
const datasetIdToUse = datasetId ?? updates[0]?.dataset_id;
|
|
2777
|
+
const response = await this.caller.call(async () => {
|
|
2778
|
+
const res = await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${datasetIdToUse}/examples`)}`, {
|
|
2779
|
+
method: "PATCH",
|
|
2780
|
+
headers: this.headers,
|
|
2781
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2782
|
+
...this.fetchOptions,
|
|
2783
|
+
body: formData
|
|
2784
|
+
});
|
|
2785
|
+
await raiseForStatus(res, "update examples");
|
|
2786
|
+
return res;
|
|
2787
|
+
});
|
|
2788
|
+
return response.json();
|
|
2789
|
+
}
|
|
2790
|
+
/**
|
|
2791
|
+
* Upload examples with attachments using multipart form data.
|
|
2792
|
+
* @param uploads List of ExampleUploadWithAttachments objects to upload
|
|
2793
|
+
* @returns Promise with the upload response
|
|
2794
|
+
* @deprecated This method is deprecated and will be removed in future LangSmith versions, please use `createExamples` instead
|
|
2795
|
+
*/
|
|
2796
|
+
async uploadExamplesMultipart(datasetId, uploads = []) {
|
|
2797
|
+
return this._uploadExamplesMultipart(datasetId, uploads);
|
|
2798
|
+
}
|
|
2799
|
+
async _uploadExamplesMultipart(datasetId, uploads = []) {
|
|
2800
|
+
if (!await this._getDatasetExamplesMultiPartSupport()) throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");
|
|
2801
|
+
const formData = new FormData();
|
|
2802
|
+
for (const example of uploads) {
|
|
2803
|
+
const exampleId = (example.id ?? uuid.v4()).toString();
|
|
2804
|
+
const exampleBody = {
|
|
2805
|
+
created_at: example.created_at,
|
|
2806
|
+
...example.metadata && { metadata: example.metadata },
|
|
2807
|
+
...example.split && { split: example.split },
|
|
2808
|
+
...example.source_run_id && { source_run_id: example.source_run_id },
|
|
2809
|
+
...example.use_source_run_io && { use_source_run_io: example.use_source_run_io },
|
|
2810
|
+
...example.use_source_run_attachments && { use_source_run_attachments: example.use_source_run_attachments }
|
|
2811
|
+
};
|
|
2812
|
+
const stringifiedExample = serialize(exampleBody, `Serializing body for uploaded example with id: ${exampleId}`);
|
|
2813
|
+
const exampleBlob = new Blob([stringifiedExample], { type: "application/json" });
|
|
2814
|
+
formData.append(exampleId, exampleBlob);
|
|
2815
|
+
if (example.inputs) {
|
|
2816
|
+
const stringifiedInputs = serialize(example.inputs, `Serializing inputs for uploaded example with id: ${exampleId}`);
|
|
2817
|
+
const inputsBlob = new Blob([stringifiedInputs], { type: "application/json" });
|
|
2818
|
+
formData.append(`${exampleId}.inputs`, inputsBlob);
|
|
2819
|
+
}
|
|
2820
|
+
if (example.outputs) {
|
|
2821
|
+
const stringifiedOutputs = serialize(example.outputs, `Serializing outputs for uploaded example with id: ${exampleId}`);
|
|
2822
|
+
const outputsBlob = new Blob([stringifiedOutputs], { type: "application/json" });
|
|
2823
|
+
formData.append(`${exampleId}.outputs`, outputsBlob);
|
|
2824
|
+
}
|
|
2825
|
+
if (example.attachments) for (const [name, attachment] of Object.entries(example.attachments)) {
|
|
2826
|
+
let mimeType;
|
|
2827
|
+
let data;
|
|
2828
|
+
if (Array.isArray(attachment)) [mimeType, data] = attachment;
|
|
2829
|
+
else {
|
|
2830
|
+
mimeType = attachment.mimeType;
|
|
2831
|
+
data = attachment.data;
|
|
2832
|
+
}
|
|
2833
|
+
const attachmentBlob = new Blob([data], { type: `${mimeType}; length=${data.byteLength}` });
|
|
2834
|
+
formData.append(`${exampleId}.attachment.${name}`, attachmentBlob);
|
|
2835
|
+
}
|
|
2836
|
+
}
|
|
2837
|
+
const response = await this.caller.call(async () => {
|
|
2838
|
+
const res = await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${datasetId}/examples`)}`, {
|
|
2839
|
+
method: "POST",
|
|
2840
|
+
headers: this.headers,
|
|
2841
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2842
|
+
...this.fetchOptions,
|
|
2843
|
+
body: formData
|
|
2844
|
+
});
|
|
2845
|
+
await raiseForStatus(res, "upload examples");
|
|
2846
|
+
return res;
|
|
2847
|
+
});
|
|
2848
|
+
return response.json();
|
|
2849
|
+
}
|
|
2850
|
+
async updatePrompt(promptIdentifier, options) {
|
|
2851
|
+
if (!await this.promptExists(promptIdentifier)) throw new Error("Prompt does not exist, you must create it first.");
|
|
2852
|
+
const [owner, promptName] = parsePromptIdentifier(promptIdentifier);
|
|
2853
|
+
if (!await this._currentTenantIsOwner(owner)) throw await this._ownerConflictError("update a prompt", owner);
|
|
2854
|
+
const payload = {};
|
|
2855
|
+
if (options?.description !== void 0) payload.description = options.description;
|
|
2856
|
+
if (options?.readme !== void 0) payload.readme = options.readme;
|
|
2857
|
+
if (options?.tags !== void 0) payload.tags = options.tags;
|
|
2858
|
+
if (options?.isPublic !== void 0) payload.is_public = options.isPublic;
|
|
2859
|
+
if (options?.isArchived !== void 0) payload.is_archived = options.isArchived;
|
|
2860
|
+
if (Object.keys(payload).length === 0) throw new Error("No valid update options provided");
|
|
2861
|
+
const body = JSON.stringify(payload);
|
|
2862
|
+
const response = await this.caller.call(async () => {
|
|
2863
|
+
const res = await this._fetch(`${this.apiUrl}/repos/${owner}/${promptName}`, {
|
|
2864
|
+
method: "PATCH",
|
|
2865
|
+
headers: {
|
|
2866
|
+
...this.headers,
|
|
2867
|
+
"Content-Type": "application/json"
|
|
2868
|
+
},
|
|
2869
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2870
|
+
...this.fetchOptions,
|
|
2871
|
+
body
|
|
2872
|
+
});
|
|
2873
|
+
await raiseForStatus(res, "update prompt");
|
|
2874
|
+
return res;
|
|
2875
|
+
});
|
|
2876
|
+
return response.json();
|
|
2877
|
+
}
|
|
2878
|
+
async deletePrompt(promptIdentifier) {
|
|
2879
|
+
if (!await this.promptExists(promptIdentifier)) throw new Error("Prompt does not exist, you must create it first.");
|
|
2880
|
+
const [owner, promptName, _] = parsePromptIdentifier(promptIdentifier);
|
|
2881
|
+
if (!await this._currentTenantIsOwner(owner)) throw await this._ownerConflictError("delete a prompt", owner);
|
|
2882
|
+
const response = await this.caller.call(async () => {
|
|
2883
|
+
const res = await this._fetch(`${this.apiUrl}/repos/${owner}/${promptName}`, {
|
|
2884
|
+
method: "DELETE",
|
|
2885
|
+
headers: this.headers,
|
|
2886
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2887
|
+
...this.fetchOptions
|
|
2888
|
+
});
|
|
2889
|
+
await raiseForStatus(res, "delete prompt");
|
|
2890
|
+
return res;
|
|
2891
|
+
});
|
|
2892
|
+
return response.json();
|
|
2893
|
+
}
|
|
2894
|
+
async pullPromptCommit(promptIdentifier, options) {
|
|
2895
|
+
const [owner, promptName, commitHash] = parsePromptIdentifier(promptIdentifier);
|
|
2896
|
+
const response = await this.caller.call(async () => {
|
|
2897
|
+
const res = await this._fetch(`${this.apiUrl}/commits/${owner}/${promptName}/${commitHash}${options?.includeModel ? "?include_model=true" : ""}`, {
|
|
2898
|
+
method: "GET",
|
|
2899
|
+
headers: this.headers,
|
|
2900
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2901
|
+
...this.fetchOptions
|
|
2902
|
+
});
|
|
2903
|
+
await raiseForStatus(res, "pull prompt commit");
|
|
2904
|
+
return res;
|
|
2905
|
+
});
|
|
2906
|
+
const result = await response.json();
|
|
2907
|
+
return {
|
|
2908
|
+
owner,
|
|
2909
|
+
repo: promptName,
|
|
2910
|
+
commit_hash: result.commit_hash,
|
|
2911
|
+
manifest: result.manifest,
|
|
2912
|
+
examples: result.examples
|
|
2913
|
+
};
|
|
2914
|
+
}
|
|
2915
|
+
/**
|
|
2916
|
+
* This method should not be used directly, use `import { pull } from "langchain/hub"` instead.
|
|
2917
|
+
* Using this method directly returns the JSON string of the prompt rather than a LangChain object.
|
|
2918
|
+
* @private
|
|
2919
|
+
*/
|
|
2920
|
+
async _pullPrompt(promptIdentifier, options) {
|
|
2921
|
+
const promptObject = await this.pullPromptCommit(promptIdentifier, { includeModel: options?.includeModel });
|
|
2922
|
+
const prompt = JSON.stringify(promptObject.manifest);
|
|
2923
|
+
return prompt;
|
|
2924
|
+
}
|
|
2925
|
+
async pushPrompt(promptIdentifier, options) {
|
|
2926
|
+
if (await this.promptExists(promptIdentifier)) {
|
|
2927
|
+
if (options && Object.keys(options).some((key) => key !== "object")) await this.updatePrompt(promptIdentifier, {
|
|
2928
|
+
description: options?.description,
|
|
2929
|
+
readme: options?.readme,
|
|
2930
|
+
tags: options?.tags,
|
|
2931
|
+
isPublic: options?.isPublic
|
|
2932
|
+
});
|
|
2933
|
+
} else await this.createPrompt(promptIdentifier, {
|
|
2934
|
+
description: options?.description,
|
|
2935
|
+
readme: options?.readme,
|
|
2936
|
+
tags: options?.tags,
|
|
2937
|
+
isPublic: options?.isPublic
|
|
2938
|
+
});
|
|
2939
|
+
if (!options?.object) return await this._getPromptUrl(promptIdentifier);
|
|
2940
|
+
const url = await this.createCommit(promptIdentifier, options?.object, { parentCommitHash: options?.parentCommitHash });
|
|
2941
|
+
return url;
|
|
2942
|
+
}
|
|
2943
|
+
/**
|
|
2944
|
+
* Clone a public dataset to your own langsmith tenant.
|
|
2945
|
+
* This operation is idempotent. If you already have a dataset with the given name,
|
|
2946
|
+
* this function will do nothing.
|
|
2947
|
+
|
|
2948
|
+
* @param {string} tokenOrUrl The token of the public dataset to clone.
|
|
2949
|
+
* @param {Object} [options] Additional options for cloning the dataset.
|
|
2950
|
+
* @param {string} [options.sourceApiUrl] The URL of the langsmith server where the data is hosted. Defaults to the API URL of your current client.
|
|
2951
|
+
* @param {string} [options.datasetName] The name of the dataset to create in your tenant. Defaults to the name of the public dataset.
|
|
2952
|
+
* @returns {Promise<void>}
|
|
2953
|
+
*/
|
|
2954
|
+
async clonePublicDataset(tokenOrUrl, options = {}) {
|
|
2955
|
+
const { sourceApiUrl = this.apiUrl, datasetName } = options;
|
|
2956
|
+
const [parsedApiUrl, tokenUuid] = this.parseTokenOrUrl(tokenOrUrl, sourceApiUrl);
|
|
2957
|
+
const sourceClient = new Client({
|
|
2958
|
+
apiUrl: parsedApiUrl,
|
|
2959
|
+
apiKey: "placeholder"
|
|
2960
|
+
});
|
|
2961
|
+
const ds = await sourceClient.readSharedDataset(tokenUuid);
|
|
2962
|
+
const finalDatasetName = datasetName || ds.name;
|
|
2963
|
+
try {
|
|
2964
|
+
if (await this.hasDataset({ datasetId: finalDatasetName })) {
|
|
2965
|
+
console.log(`Dataset ${finalDatasetName} already exists in your tenant. Skipping.`);
|
|
2966
|
+
return;
|
|
2967
|
+
}
|
|
2968
|
+
} catch (_) {}
|
|
2969
|
+
const examples = await sourceClient.listSharedExamples(tokenUuid);
|
|
2970
|
+
const dataset = await this.createDataset(finalDatasetName, {
|
|
2971
|
+
description: ds.description,
|
|
2972
|
+
dataType: ds.data_type || "kv",
|
|
2973
|
+
inputsSchema: ds.inputs_schema_definition ?? void 0,
|
|
2974
|
+
outputsSchema: ds.outputs_schema_definition ?? void 0
|
|
2975
|
+
});
|
|
2976
|
+
try {
|
|
2977
|
+
await this.createExamples({
|
|
2978
|
+
inputs: examples.map((e) => e.inputs),
|
|
2979
|
+
outputs: examples.flatMap((e) => e.outputs ? [e.outputs] : []),
|
|
2980
|
+
datasetId: dataset.id
|
|
2981
|
+
});
|
|
2982
|
+
} catch (e) {
|
|
2983
|
+
console.error(`An error occurred while creating dataset ${finalDatasetName}. You should delete it manually.`);
|
|
2984
|
+
throw e;
|
|
2985
|
+
}
|
|
2986
|
+
}
|
|
2987
|
+
parseTokenOrUrl(urlOrToken, apiUrl, numParts = 2, kind = "dataset") {
|
|
2988
|
+
try {
|
|
2989
|
+
assertUuid(urlOrToken);
|
|
2990
|
+
return [apiUrl, urlOrToken];
|
|
2991
|
+
} catch (_) {}
|
|
2992
|
+
try {
|
|
2993
|
+
const parsedUrl = new URL(urlOrToken);
|
|
2994
|
+
const pathParts = parsedUrl.pathname.split("/").filter((part) => part !== "");
|
|
2995
|
+
if (pathParts.length >= numParts) {
|
|
2996
|
+
const tokenUuid = pathParts[pathParts.length - numParts];
|
|
2997
|
+
return [apiUrl, tokenUuid];
|
|
2998
|
+
} else throw new Error(`Invalid public ${kind} URL: ${urlOrToken}`);
|
|
2999
|
+
} catch (error) {
|
|
3000
|
+
throw new Error(`Invalid public ${kind} URL or token: ${urlOrToken}`);
|
|
3001
|
+
}
|
|
3002
|
+
}
|
|
3003
|
+
/**
|
|
3004
|
+
* Awaits all pending trace batches. Useful for environments where
|
|
3005
|
+
* you need to be sure that all tracing requests finish before execution ends,
|
|
3006
|
+
* such as serverless environments.
|
|
3007
|
+
*
|
|
3008
|
+
* @example
|
|
3009
|
+
* ```
|
|
3010
|
+
* import { Client } from "langsmith";
|
|
3011
|
+
*
|
|
3012
|
+
* const client = new Client();
|
|
3013
|
+
*
|
|
3014
|
+
* try {
|
|
3015
|
+
* // Tracing happens here
|
|
3016
|
+
* ...
|
|
3017
|
+
* } finally {
|
|
3018
|
+
* await client.awaitPendingTraceBatches();
|
|
3019
|
+
* }
|
|
3020
|
+
* ```
|
|
3021
|
+
*
|
|
3022
|
+
* @returns A promise that resolves once all currently pending traces have sent.
|
|
3023
|
+
*/
|
|
3024
|
+
async awaitPendingTraceBatches() {
|
|
3025
|
+
if (this.manualFlushMode) {
|
|
3026
|
+
console.warn("[WARNING]: When tracing in manual flush mode, you must call `await client.flush()` manually to submit trace batches.");
|
|
3027
|
+
return Promise.resolve();
|
|
3028
|
+
}
|
|
3029
|
+
await Promise.all([...this.autoBatchQueue.items.map(({ itemPromise }) => itemPromise), this.batchIngestCaller.queue.onIdle()]);
|
|
3030
|
+
if (this.langSmithToOTELTranslator !== void 0) await getDefaultOTLPTracerComponents()?.DEFAULT_LANGSMITH_SPAN_PROCESSOR?.forceFlush();
|
|
3031
|
+
}
|
|
3032
|
+
};
|
|
3033
|
+
function isExampleCreate(input) {
|
|
3034
|
+
return "dataset_id" in input || "dataset_name" in input;
|
|
3035
|
+
}
|
|
3036
|
+
|
|
3037
|
+
//#endregion
|
|
3038
|
+
export { Client };
|
|
3039
|
+
//# sourceMappingURL=client.js.map
|