openlit 1.11.0 → 1.13.0

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.
Files changed (192) hide show
  1. package/README.md +1 -1
  2. package/dist/config.d.ts +12 -4
  3. package/dist/config.js +7 -17
  4. package/dist/config.js.map +1 -1
  5. package/dist/evals/llm/anthropic.js +10 -6
  6. package/dist/evals/llm/anthropic.js.map +1 -1
  7. package/dist/evals/llm/openai.js +9 -5
  8. package/dist/evals/llm/openai.js.map +1 -1
  9. package/dist/features/vault.js +1 -1
  10. package/dist/features/vault.js.map +1 -1
  11. package/dist/helpers.d.ts +93 -1
  12. package/dist/helpers.js +271 -8
  13. package/dist/helpers.js.map +1 -1
  14. package/dist/index.d.ts +6 -5
  15. package/dist/index.js +95 -50
  16. package/dist/index.js.map +1 -1
  17. package/dist/instrumentation/__tests__/anthropic-wrapper.test.js +215 -27
  18. package/dist/instrumentation/__tests__/anthropic-wrapper.test.js.map +1 -1
  19. package/dist/instrumentation/__tests__/base-wrapper.test.js +19 -23
  20. package/dist/instrumentation/__tests__/base-wrapper.test.js.map +1 -1
  21. package/dist/instrumentation/__tests__/bedrock-trace-comparison.test.d.ts +1 -0
  22. package/dist/instrumentation/__tests__/bedrock-trace-comparison.test.js +422 -0
  23. package/dist/instrumentation/__tests__/bedrock-trace-comparison.test.js.map +1 -0
  24. package/dist/instrumentation/__tests__/chroma-trace-comparison.test.js +1 -1
  25. package/dist/instrumentation/__tests__/chroma-trace-comparison.test.js.map +1 -1
  26. package/dist/instrumentation/__tests__/cohere-wrapper.test.js +150 -25
  27. package/dist/instrumentation/__tests__/cohere-wrapper.test.js.map +1 -1
  28. package/dist/instrumentation/__tests__/google-ai-trace-comparison.test.js +152 -33
  29. package/dist/instrumentation/__tests__/google-ai-trace-comparison.test.js.map +1 -1
  30. package/dist/instrumentation/__tests__/groq-trace-comparison.test.js +391 -45
  31. package/dist/instrumentation/__tests__/groq-trace-comparison.test.js.map +1 -1
  32. package/dist/instrumentation/__tests__/huggingface-trace-comparison.test.d.ts +2 -2
  33. package/dist/instrumentation/__tests__/huggingface-trace-comparison.test.js +323 -31
  34. package/dist/instrumentation/__tests__/huggingface-trace-comparison.test.js.map +1 -1
  35. package/dist/instrumentation/__tests__/langchain-wrapper.test.d.ts +1 -0
  36. package/dist/instrumentation/__tests__/langchain-wrapper.test.js +282 -0
  37. package/dist/instrumentation/__tests__/langchain-wrapper.test.js.map +1 -0
  38. package/dist/instrumentation/__tests__/milvus-trace-comparison.test.js +1 -1
  39. package/dist/instrumentation/__tests__/milvus-trace-comparison.test.js.map +1 -1
  40. package/dist/instrumentation/__tests__/mistral-trace-comparison.test.d.ts +0 -3
  41. package/dist/instrumentation/__tests__/mistral-trace-comparison.test.js +275 -68
  42. package/dist/instrumentation/__tests__/mistral-trace-comparison.test.js.map +1 -1
  43. package/dist/instrumentation/__tests__/openai-wrapper.test.js +7 -9
  44. package/dist/instrumentation/__tests__/openai-wrapper.test.js.map +1 -1
  45. package/dist/instrumentation/__tests__/qdrant-trace-comparison.test.js +1 -1
  46. package/dist/instrumentation/__tests__/qdrant-trace-comparison.test.js.map +1 -1
  47. package/dist/instrumentation/__tests__/replicate-trace-comparison.test.d.ts +2 -1
  48. package/dist/instrumentation/__tests__/replicate-trace-comparison.test.js +209 -21
  49. package/dist/instrumentation/__tests__/replicate-trace-comparison.test.js.map +1 -1
  50. package/dist/instrumentation/__tests__/together-trace-comparison.test.js +231 -51
  51. package/dist/instrumentation/__tests__/together-trace-comparison.test.js.map +1 -1
  52. package/dist/instrumentation/__tests__/vercel-ai-trace-comparison.test.d.ts +8 -0
  53. package/dist/instrumentation/__tests__/vercel-ai-trace-comparison.test.js +446 -0
  54. package/dist/instrumentation/__tests__/vercel-ai-trace-comparison.test.js.map +1 -0
  55. package/dist/instrumentation/anthropic/index.d.ts +2 -3
  56. package/dist/instrumentation/anthropic/index.js.map +1 -1
  57. package/dist/instrumentation/anthropic/wrapper.d.ts +1 -3
  58. package/dist/instrumentation/anthropic/wrapper.js +211 -91
  59. package/dist/instrumentation/anthropic/wrapper.js.map +1 -1
  60. package/dist/instrumentation/azure-ai-inference/index.d.ts +11 -0
  61. package/dist/instrumentation/azure-ai-inference/index.js +76 -0
  62. package/dist/instrumentation/azure-ai-inference/index.js.map +1 -0
  63. package/dist/instrumentation/azure-ai-inference/wrapper.d.ts +42 -0
  64. package/dist/instrumentation/azure-ai-inference/wrapper.js +515 -0
  65. package/dist/instrumentation/azure-ai-inference/wrapper.js.map +1 -0
  66. package/dist/instrumentation/base-wrapper.d.ts +2 -1
  67. package/dist/instrumentation/base-wrapper.js +35 -23
  68. package/dist/instrumentation/base-wrapper.js.map +1 -1
  69. package/dist/instrumentation/bedrock/wrapper.d.ts +21 -3
  70. package/dist/instrumentation/bedrock/wrapper.js +318 -265
  71. package/dist/instrumentation/bedrock/wrapper.js.map +1 -1
  72. package/dist/instrumentation/chroma/wrapper.js +1 -1
  73. package/dist/instrumentation/chroma/wrapper.js.map +1 -1
  74. package/dist/instrumentation/claude-agent-sdk/index.d.ts +23 -0
  75. package/dist/instrumentation/claude-agent-sdk/index.js +83 -0
  76. package/dist/instrumentation/claude-agent-sdk/index.js.map +1 -0
  77. package/dist/instrumentation/claude-agent-sdk/wrapper.d.ts +13 -0
  78. package/dist/instrumentation/claude-agent-sdk/wrapper.js +1031 -0
  79. package/dist/instrumentation/claude-agent-sdk/wrapper.js.map +1 -0
  80. package/dist/instrumentation/cohere/index.d.ts +2 -3
  81. package/dist/instrumentation/cohere/index.js.map +1 -1
  82. package/dist/instrumentation/cohere/wrapper.d.ts +1 -1
  83. package/dist/instrumentation/cohere/wrapper.js +215 -56
  84. package/dist/instrumentation/cohere/wrapper.js.map +1 -1
  85. package/dist/instrumentation/cursor-sdk/index.d.ts +21 -0
  86. package/dist/instrumentation/cursor-sdk/index.js +58 -0
  87. package/dist/instrumentation/cursor-sdk/index.js.map +1 -0
  88. package/dist/instrumentation/cursor-sdk/wrapper.d.ts +17 -0
  89. package/dist/instrumentation/cursor-sdk/wrapper.js +689 -0
  90. package/dist/instrumentation/cursor-sdk/wrapper.js.map +1 -0
  91. package/dist/instrumentation/google-adk/index.d.ts +57 -0
  92. package/dist/instrumentation/google-adk/index.js +371 -0
  93. package/dist/instrumentation/google-adk/index.js.map +1 -0
  94. package/dist/instrumentation/google-adk/utils.d.ts +45 -0
  95. package/dist/instrumentation/google-adk/utils.js +663 -0
  96. package/dist/instrumentation/google-adk/utils.js.map +1 -0
  97. package/dist/instrumentation/google-adk/wrapper.d.ts +11 -0
  98. package/dist/instrumentation/google-adk/wrapper.js +391 -0
  99. package/dist/instrumentation/google-adk/wrapper.js.map +1 -0
  100. package/dist/instrumentation/google-ai/wrapper.d.ts +7 -4
  101. package/dist/instrumentation/google-ai/wrapper.js +197 -61
  102. package/dist/instrumentation/google-ai/wrapper.js.map +1 -1
  103. package/dist/instrumentation/groq/wrapper.js +137 -65
  104. package/dist/instrumentation/groq/wrapper.js.map +1 -1
  105. package/dist/instrumentation/huggingface/wrapper.js +241 -39
  106. package/dist/instrumentation/huggingface/wrapper.js.map +1 -1
  107. package/dist/instrumentation/index.d.ts +2 -2
  108. package/dist/instrumentation/index.js +66 -6
  109. package/dist/instrumentation/index.js.map +1 -1
  110. package/dist/instrumentation/langchain/index.d.ts +0 -7
  111. package/dist/instrumentation/langchain/index.js +2 -20
  112. package/dist/instrumentation/langchain/index.js.map +1 -1
  113. package/dist/instrumentation/langchain/wrapper.d.ts +35 -0
  114. package/dist/instrumentation/langchain/wrapper.js +1098 -184
  115. package/dist/instrumentation/langchain/wrapper.js.map +1 -1
  116. package/dist/instrumentation/langgraph/index.d.ts +12 -0
  117. package/dist/instrumentation/langgraph/index.js +99 -0
  118. package/dist/instrumentation/langgraph/index.js.map +1 -0
  119. package/dist/instrumentation/langgraph/wrapper.d.ts +20 -0
  120. package/dist/instrumentation/langgraph/wrapper.js +619 -0
  121. package/dist/instrumentation/langgraph/wrapper.js.map +1 -0
  122. package/dist/instrumentation/llamaindex/index.d.ts +31 -6
  123. package/dist/instrumentation/llamaindex/index.js +180 -61
  124. package/dist/instrumentation/llamaindex/index.js.map +1 -1
  125. package/dist/instrumentation/llamaindex/wrapper.d.ts +15 -3
  126. package/dist/instrumentation/llamaindex/wrapper.js +670 -179
  127. package/dist/instrumentation/llamaindex/wrapper.js.map +1 -1
  128. package/dist/instrumentation/milvus/wrapper.js +1 -1
  129. package/dist/instrumentation/milvus/wrapper.js.map +1 -1
  130. package/dist/instrumentation/mistral/wrapper.js +154 -79
  131. package/dist/instrumentation/mistral/wrapper.js.map +1 -1
  132. package/dist/instrumentation/ollama/index.js +33 -4
  133. package/dist/instrumentation/ollama/index.js.map +1 -1
  134. package/dist/instrumentation/ollama/wrapper.d.ts +28 -2
  135. package/dist/instrumentation/ollama/wrapper.js +432 -48
  136. package/dist/instrumentation/ollama/wrapper.js.map +1 -1
  137. package/dist/instrumentation/openai/index.d.ts +2 -3
  138. package/dist/instrumentation/openai/index.js.map +1 -1
  139. package/dist/instrumentation/openai/wrapper.js +293 -194
  140. package/dist/instrumentation/openai/wrapper.js.map +1 -1
  141. package/dist/instrumentation/openai-agents/index.d.ts +20 -0
  142. package/dist/instrumentation/openai-agents/index.js +174 -0
  143. package/dist/instrumentation/openai-agents/index.js.map +1 -0
  144. package/dist/instrumentation/openai-agents/processor.d.ts +35 -0
  145. package/dist/instrumentation/openai-agents/processor.js +249 -0
  146. package/dist/instrumentation/openai-agents/processor.js.map +1 -0
  147. package/dist/instrumentation/openai-agents/utils.d.ts +20 -0
  148. package/dist/instrumentation/openai-agents/utils.js +624 -0
  149. package/dist/instrumentation/openai-agents/utils.js.map +1 -0
  150. package/dist/instrumentation/pinecone/wrapper.js +2 -2
  151. package/dist/instrumentation/pinecone/wrapper.js.map +1 -1
  152. package/dist/instrumentation/qdrant/wrapper.js +1 -1
  153. package/dist/instrumentation/qdrant/wrapper.js.map +1 -1
  154. package/dist/instrumentation/replicate/wrapper.js +103 -21
  155. package/dist/instrumentation/replicate/wrapper.js.map +1 -1
  156. package/dist/instrumentation/strands/index.d.ts +21 -0
  157. package/dist/instrumentation/strands/index.js +83 -0
  158. package/dist/instrumentation/strands/index.js.map +1 -0
  159. package/dist/instrumentation/strands/processor.d.ts +45 -0
  160. package/dist/instrumentation/strands/processor.js +545 -0
  161. package/dist/instrumentation/strands/processor.js.map +1 -0
  162. package/dist/instrumentation/strands/utils.d.ts +24 -0
  163. package/dist/instrumentation/strands/utils.js +360 -0
  164. package/dist/instrumentation/strands/utils.js.map +1 -0
  165. package/dist/instrumentation/together/wrapper.js +125 -51
  166. package/dist/instrumentation/together/wrapper.js.map +1 -1
  167. package/dist/instrumentation/vercel-ai/wrapper.d.ts +28 -2
  168. package/dist/instrumentation/vercel-ai/wrapper.js +314 -164
  169. package/dist/instrumentation/vercel-ai/wrapper.js.map +1 -1
  170. package/dist/llm/anthropic.js +10 -6
  171. package/dist/llm/anthropic.js.map +1 -1
  172. package/dist/llm/openai.js +9 -5
  173. package/dist/llm/openai.js.map +1 -1
  174. package/dist/otel/__tests__/metrics.test.js +16 -27
  175. package/dist/otel/__tests__/metrics.test.js.map +1 -1
  176. package/dist/otel/events.d.ts +11 -0
  177. package/dist/otel/events.js +74 -0
  178. package/dist/otel/events.js.map +1 -0
  179. package/dist/otel/metrics.d.ts +5 -6
  180. package/dist/otel/metrics.js +66 -48
  181. package/dist/otel/metrics.js.map +1 -1
  182. package/dist/otel/tracing.d.ts +6 -2
  183. package/dist/otel/tracing.js +71 -24
  184. package/dist/otel/tracing.js.map +1 -1
  185. package/dist/otel/utils.d.ts +11 -0
  186. package/dist/otel/utils.js +34 -0
  187. package/dist/otel/utils.js.map +1 -0
  188. package/dist/semantic-convention.d.ts +49 -5
  189. package/dist/semantic-convention.js +56 -8
  190. package/dist/semantic-convention.js.map +1 -1
  191. package/dist/types.d.ts +58 -22
  192. package/package.json +41 -9
@@ -13,23 +13,13 @@ class OpenlitLangChainInstrumentation extends instrumentation_1.InstrumentationB
13
13
  this._ritmHook = null;
14
14
  }
15
15
  init() {
16
- // We bypass OTel's RequireInTheMiddleSingleton here because it uses a null-whitelist
17
- // RITM instance, which causes RITM to report `name` as the `fullModuleName` (including
18
- // the .cjs extension), e.g. '@langchain/core/language_models/chat_models.cjs'.
19
- // The trie search then fails to match our registered bare name (without .cjs).
20
- // Instead, we set up a direct require-in-the-middle Hook in enable() with a proper
21
- // whitelist, which causes RITM to preserve the original specifier as `name`.
22
16
  return [];
23
17
  }
24
- /** Override enable() to install a direct RITM Hook rather than going through the singleton. */
25
18
  enable() {
26
- super.enable(); // sets this._enabled = true, initialises tracer
19
+ super.enable();
27
20
  if (this._ritmHook)
28
21
  return;
29
22
  try {
30
- // Require RITM directly — it is a transitive dep of @opentelemetry/instrumentation.
31
- // Using a whitelist ['@langchain/core/language_models/chat_models'] causes RITM to
32
- // preserve the original module specifier as `name` (avoiding the .cjs issue).
33
23
  // eslint-disable-next-line @typescript-eslint/no-var-requires
34
24
  const { Hook } = require('require-in-the-middle');
35
25
  this._ritmHook = new Hook(['@langchain/core/language_models/chat_models'], { internals: true }, (exports) => {
@@ -37,16 +27,14 @@ class OpenlitLangChainInstrumentation extends instrumentation_1.InstrumentationB
37
27
  return exports;
38
28
  });
39
29
  }
40
- catch { /* require-in-the-middle not available — no-op */ }
30
+ catch { /* require-in-the-middle not available */ }
41
31
  }
42
- /** Override disable() to remove our direct RITM Hook. */
43
32
  disable() {
44
33
  super.disable();
45
34
  this._ritmHook?.unhook?.();
46
35
  this._ritmHook = null;
47
36
  this._unpatch();
48
37
  }
49
- /** Called from tests / manual usage — pass the @langchain/core/callbacks/manager exports. */
50
38
  manualPatch(callbacksManagerModule) {
51
39
  const CallbackManager = callbacksManagerModule?.CallbackManager;
52
40
  if (CallbackManager) {
@@ -54,10 +42,6 @@ class OpenlitLangChainInstrumentation extends instrumentation_1.InstrumentationB
54
42
  this._applyPatch(CallbackManager);
55
43
  }
56
44
  }
57
- /**
58
- * Scan require.cache for @langchain/core's dist/callbacks/manager.cjs.
59
- * It is always loaded as a relative dep before the chat_models hook fires.
60
- */
61
45
  _patchFromCache() {
62
46
  try {
63
47
  const cache = require.cache;
@@ -82,8 +66,6 @@ class OpenlitLangChainInstrumentation extends instrumentation_1.InstrumentationB
82
66
  }
83
67
  _applyPatch(CallbackManager) {
84
68
  try {
85
- // Patch _configureSync — the single low-level entry point called by both
86
- // CallbackManager.configure and getCallbackManagerForConfig (Runnables/chains).
87
69
  if ((0, instrumentation_1.isWrapped)(CallbackManager._configureSync)) {
88
70
  this._unwrap(CallbackManager, '_configureSync');
89
71
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/instrumentation/langchain/index.ts"],"names":[],"mappings":";;;;;AAAA,oEAIwC;AAExC,6CAAwD;AACxD,wDAAyC;AAIzC,MAAqB,+BAAgC,SAAQ,qCAAmB;IAI9E,YAAY,SAAyC,EAAE;QACrD,KAAK,CAAC,GAAG,iCAAsB,4BAA4B,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAJxE,qBAAgB,GAAQ,IAAI,CAAC;QAC7B,cAAS,GAAQ,IAAI,CAAC;IAI9B,CAAC;IAES,IAAI;QACZ,qFAAqF;QACrF,uFAAuF;QACvF,+EAA+E;QAC/E,+EAA+E;QAC/E,mFAAmF;QACnF,6EAA6E;QAC7E,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,+FAA+F;IACxF,MAAM;QACX,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,gDAAgD;QAChE,IAAI,IAAI,CAAC,SAAS;YAAE,OAAO;QAC3B,IAAI,CAAC;YACH,oFAAoF;YACpF,mFAAmF;YACnF,8EAA8E;YAC9E,8DAA8D;YAC9D,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;YAClD,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,CACvB,CAAC,6CAA6C,CAAC,EAC/C,EAAE,SAAS,EAAE,IA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gBAAgB,GAAG,eAAe,CAAC;wBACxC,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;wBAClC,OAAO;oBACT,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,8DAA8D,EAAE,CAAC,CAAC,CAAC;QACnF,CAAC;IACH,CAAC;IAEO,WAAW,CAAC,eAAoB;QACtC,IAAI,CAAC;YACH,yEAAyE;YACzE,gFAAgF;YAChF,IAAI,IAAA,2BAAS,EAAC,eAAe,CAAC,cAAc,CAAC,EAAE,CAAC;gBAC9C,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;YAClD,CAAC;YACD,IAAI,CAAC,KAAK,CACR,eAAe,EACf,gBAAgB,EAChB,iBAAgB,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAC9C,CAAC;QACJ,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,CAAC,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IAEO,QAAQ;QACd,IAAI,CAAC,IAAI,CAAC,gBAAgB;YAAE,OAAO;QACnC,IAAI,CAAC;YACH,IAAI,IAAA,2BAAS,EAAC,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,EAAE,CAAC;gBACpD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;YACxD,CAAC;QACH,CAAC;QAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;QACxB,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAC/B,CAAC;CACF;AA9GD,kDA8GC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/instrumentation/langchain/index.ts"],"names":[],"mappings":";;;;;AAAA,oEAIwC;AAExC,6CAAwD;AACxD,wDAAyC;AAIzC,MAAqB,+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AE,OAAO;QACnC,IAAI,CAAC;YACH,IAAI,IAAA,2BAAS,EAAC,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,EAAE,CAAC;gBACpD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;YACxD,CAAC;QACH,CAAC;QAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;QACxB,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAC/B,CAAC;CACF;AA5FD,kDA4FC"}
@@ -1,6 +1,41 @@
1
1
  import { Tracer } from '@opentelemetry/api';
2
+ import { runWithFrameworkLlm } from '../../helpers';
2
3
  import BaseWrapper from '../base-wrapper';
4
+ declare class OpenLITCallbackHandler {
5
+ name: string;
6
+ lc_serializable: boolean;
7
+ awaitHandlers: boolean;
8
+ private tracer;
9
+ private spans;
10
+ private skippedRuns;
11
+ constructor(tracer: Tracer);
12
+ private _getNameFromCallback;
13
+ private _resolveParentRunId;
14
+ private _getParentContext;
15
+ private _createSpan;
16
+ private _newHolder;
17
+ private _setCommonAttributes;
18
+ private _setModelParameters;
19
+ private _endSpan;
20
+ handleChainStart(chain: any, inputs: any, runId: string, parentRunId?: string, _tags?: string[], metadata?: any, _runType?: string, name?: string): void;
21
+ handleChainEnd(outputs: any, runId: string): void;
22
+ handleChainError(error: any, runId: string): void;
23
+ handleChatModelStart(llm: any, messages: any[][], runId: string, parentRunId?: string, _extraParams?: any, _tags?: string[], metadata?: any, kwargs?: any): void;
24
+ handleLLMStart(serialized: any, prompts: string[], runId: string, parentRunId?: string, _extraParams?: any, _tags?: string[], metadata?: any, kwargs?: any): void;
25
+ handleLLMNewToken(token: string, _idx: any, runId: string, _chunk?: any): void;
26
+ handleLLMEnd(output: any, runId: string): void;
27
+ handleLLMError(error: any, runId: string): void;
28
+ handleToolStart(tool: any, input: string, runId: string, parentRunId?: string, _tags?: string[], metadata?: any, kwargs?: any): void;
29
+ handleToolEnd(output: any, runId: string): void;
30
+ handleToolError(error: any, runId: string): void;
31
+ handleRetrieverStart(retriever: any, query: string, runId: string, parentRunId?: string, _tags?: string[], metadata?: any, kwargs?: any): void;
32
+ handleRetrieverEnd(documents: any[], runId: string): void;
33
+ handleRetrieverError(error: any, runId: string): void;
34
+ handleAgentAction(action: any, runId: string): void;
35
+ handleAgentFinish(finish: any, runId: string): void;
36
+ }
3
37
  declare class LangChainWrapper extends BaseWrapper {
4
38
  static _patchConfigure(tracer: Tracer): any;
5
39
  }
40
+ export { OpenLITCallbackHandler, runWithFrameworkLlm };
6
41
  export default LangChainWrapper;