langwatch 0.3.2 → 0.4.1

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 (206) hide show
  1. package/dist/{add-LBBS4I3H.js → add-RGWB3264.js} +35 -28
  2. package/dist/add-RGWB3264.js.map +1 -0
  3. package/dist/{add-RD3ZKFAT.mjs → add-WLUMK5VQ.mjs} +23 -16
  4. package/dist/add-WLUMK5VQ.mjs.map +1 -0
  5. package/dist/chunk-4ILMGMAP.mjs +155 -0
  6. package/dist/chunk-4ILMGMAP.mjs.map +1 -0
  7. package/dist/chunk-4TF2O2TH.js +207 -0
  8. package/dist/chunk-4TF2O2TH.js.map +1 -0
  9. package/dist/chunk-5N5BUR2Z.js +636 -0
  10. package/dist/chunk-5N5BUR2Z.js.map +1 -0
  11. package/dist/chunk-AZELEDOV.js +155 -0
  12. package/dist/chunk-AZELEDOV.js.map +1 -0
  13. package/dist/{chunk-YN4436PK.mjs → chunk-CU3443HD.mjs} +14 -9
  14. package/dist/{chunk-2JU376G7.js → chunk-D2CSG4SJ.js} +4 -4
  15. package/dist/chunk-D2CSG4SJ.js.map +1 -0
  16. package/dist/chunk-DEVJ7BPE.js +63 -0
  17. package/dist/chunk-DEVJ7BPE.js.map +1 -0
  18. package/dist/chunk-DISMHYXC.js +184 -0
  19. package/dist/chunk-DISMHYXC.js.map +1 -0
  20. package/dist/{chunk-E7UE2MPD.mjs → chunk-ECUXLXFT.mjs} +2 -2
  21. package/dist/chunk-EJWJXTPU.mjs +626 -0
  22. package/dist/chunk-EJWJXTPU.mjs.map +1 -0
  23. package/dist/chunk-FQSWUK5N.mjs +63 -0
  24. package/dist/chunk-FQSWUK5N.mjs.map +1 -0
  25. package/dist/{chunk-3GKPQB4R.mjs → chunk-HUI45ULC.mjs} +4 -4
  26. package/dist/chunk-HUI45ULC.mjs.map +1 -0
  27. package/dist/chunk-IZ2U3ABC.mjs +636 -0
  28. package/dist/chunk-IZ2U3ABC.mjs.map +1 -0
  29. package/dist/{chunk-HJU67C7H.js → chunk-K64Y6YUG.js} +10 -10
  30. package/dist/{chunk-HJU67C7H.js.map → chunk-K64Y6YUG.js.map} +1 -1
  31. package/dist/chunk-M4VUHTT2.js +626 -0
  32. package/dist/chunk-M4VUHTT2.js.map +1 -0
  33. package/dist/{chunk-PR3JDWC3.mjs → chunk-N2V6J3U2.mjs} +28 -3
  34. package/dist/chunk-N2V6J3U2.mjs.map +1 -0
  35. package/dist/{chunk-FJLK5CFL.js → chunk-OXBO24RB.js} +13 -8
  36. package/dist/chunk-OXBO24RB.js.map +1 -0
  37. package/dist/{chunk-SMXXAVMB.js → chunk-SGNJDRCT.js} +2 -2
  38. package/dist/chunk-SGNJDRCT.js.map +1 -0
  39. package/dist/{chunk-W5ZEP3CI.mjs → chunk-SYMZPWZE.mjs} +2 -2
  40. package/dist/chunk-SYMZPWZE.mjs.map +1 -0
  41. package/dist/{chunk-KGDAENGD.js → chunk-YH5TIVK2.js} +28 -3
  42. package/dist/chunk-YH5TIVK2.js.map +1 -0
  43. package/dist/chunk-YNQ44U6D.mjs +184 -0
  44. package/dist/chunk-YNQ44U6D.mjs.map +1 -0
  45. package/dist/chunk-ZJZ3MIWE.mjs +207 -0
  46. package/dist/chunk-ZJZ3MIWE.mjs.map +1 -0
  47. package/dist/cli/index.js +8 -8
  48. package/dist/cli/index.mjs +8 -8
  49. package/dist/{create-G5MTGOOH.js → create-7K2CC4KQ.js} +11 -11
  50. package/dist/{create-G5MTGOOH.js.map → create-7K2CC4KQ.js.map} +1 -1
  51. package/dist/{create-QUZYBMQB.mjs → create-MK7NEGCM.mjs} +8 -8
  52. package/dist/implementation-C4lvooSg.d.mts +576 -0
  53. package/dist/implementation-CzemP9jY.d.ts +576 -0
  54. package/dist/index-DTEZr0Jn.d.mts +34 -0
  55. package/dist/index-DTEZr0Jn.d.ts +34 -0
  56. package/dist/index.d.mts +121 -47
  57. package/dist/index.d.ts +121 -47
  58. package/dist/index.js +17 -12
  59. package/dist/index.js.map +1 -1
  60. package/dist/index.mjs +28 -23
  61. package/dist/index.mjs.map +1 -1
  62. package/dist/init-GDKJICSS.js +16 -0
  63. package/dist/{init-XU2JFY6N.js.map → init-GDKJICSS.js.map} +1 -1
  64. package/dist/{init-H67RW22E.mjs → init-RINSTP4L.mjs} +5 -5
  65. package/dist/{list-ZXFLAF52.js → list-DBUK47MA.js} +30 -17
  66. package/dist/list-DBUK47MA.js.map +1 -0
  67. package/dist/{list-7NPSX2E4.mjs → list-ZOMRKOBV.mjs} +29 -16
  68. package/dist/list-ZOMRKOBV.mjs.map +1 -0
  69. package/dist/{login-76NQIHKR.js → login-A7LEPNBR.js} +8 -4
  70. package/dist/login-A7LEPNBR.js.map +1 -0
  71. package/dist/{login-EK4WVOI2.mjs → login-ULPHWIAX.mjs} +8 -4
  72. package/dist/login-ULPHWIAX.mjs.map +1 -0
  73. package/dist/observability-sdk/index.d.mts +134 -0
  74. package/dist/observability-sdk/index.d.ts +134 -0
  75. package/dist/observability-sdk/index.js +42 -0
  76. package/dist/observability-sdk/index.js.map +1 -0
  77. package/dist/observability-sdk/index.mjs +42 -0
  78. package/dist/observability-sdk/instrumentation/langchain/index.d.mts +69 -0
  79. package/dist/observability-sdk/instrumentation/langchain/index.d.ts +69 -0
  80. package/dist/observability-sdk/instrumentation/langchain/index.js +518 -0
  81. package/dist/observability-sdk/instrumentation/langchain/index.js.map +1 -0
  82. package/dist/observability-sdk/instrumentation/langchain/index.mjs +518 -0
  83. package/dist/observability-sdk/instrumentation/langchain/index.mjs.map +1 -0
  84. package/dist/observability-sdk/setup/node/index.d.mts +368 -0
  85. package/dist/observability-sdk/setup/node/index.d.ts +368 -0
  86. package/dist/observability-sdk/setup/node/index.js +279 -0
  87. package/dist/observability-sdk/setup/node/index.js.map +1 -0
  88. package/dist/observability-sdk/setup/node/index.mjs +279 -0
  89. package/dist/observability-sdk/setup/node/index.mjs.map +1 -0
  90. package/dist/{remove-XBNGIVMR.js → remove-ODTJLFWR.js} +19 -15
  91. package/dist/remove-ODTJLFWR.js.map +1 -0
  92. package/dist/{remove-SDJYEPAY.mjs → remove-RAJBGHQQ.mjs} +12 -8
  93. package/dist/remove-RAJBGHQQ.mjs.map +1 -0
  94. package/dist/{sync-ST2IWXSB.mjs → sync-2IXPWN64.mjs} +40 -33
  95. package/dist/sync-2IXPWN64.mjs.map +1 -0
  96. package/dist/{sync-EISKGPTL.js → sync-PBOL5ODF.js} +53 -46
  97. package/dist/sync-PBOL5ODF.js.map +1 -0
  98. package/dist/{prompt-D-jpMrLS.d.mts → types-1q5wIYP5.d.mts} +628 -14
  99. package/dist/{prompt-D-jpMrLS.d.ts → types-C9k5gGhU.d.ts} +628 -14
  100. package/dist/types-DRiQaKFG.d.mts +254 -0
  101. package/dist/types-DRiQaKFG.d.ts +254 -0
  102. package/dist/types-Dmazk5Bk.d.mts +44 -0
  103. package/dist/types-Dmazk5Bk.d.ts +44 -0
  104. package/package.json +39 -39
  105. package/dist/add-LBBS4I3H.js.map +0 -1
  106. package/dist/add-RD3ZKFAT.mjs.map +0 -1
  107. package/dist/chunk-2JU376G7.js.map +0 -1
  108. package/dist/chunk-2ODBGSBI.js +0 -4
  109. package/dist/chunk-2ODBGSBI.js.map +0 -1
  110. package/dist/chunk-3GKPQB4R.mjs.map +0 -1
  111. package/dist/chunk-52GXX3MA.js +0 -426
  112. package/dist/chunk-52GXX3MA.js.map +0 -1
  113. package/dist/chunk-5NC5ILKA.js +0 -94
  114. package/dist/chunk-5NC5ILKA.js.map +0 -1
  115. package/dist/chunk-AAROJADR.mjs +0 -49
  116. package/dist/chunk-AAROJADR.mjs.map +0 -1
  117. package/dist/chunk-DTEKFQ4U.js +0 -159
  118. package/dist/chunk-DTEKFQ4U.js.map +0 -1
  119. package/dist/chunk-F63YKTXA.mjs +0 -47
  120. package/dist/chunk-F63YKTXA.mjs.map +0 -1
  121. package/dist/chunk-FJLK5CFL.js.map +0 -1
  122. package/dist/chunk-GJSEBQXF.mjs +0 -392
  123. package/dist/chunk-GJSEBQXF.mjs.map +0 -1
  124. package/dist/chunk-IGHXIIIK.js +0 -49
  125. package/dist/chunk-IGHXIIIK.js.map +0 -1
  126. package/dist/chunk-J7ICRUU4.mjs +0 -426
  127. package/dist/chunk-J7ICRUU4.mjs.map +0 -1
  128. package/dist/chunk-KGDAENGD.js.map +0 -1
  129. package/dist/chunk-LD74LVRU.js +0 -47
  130. package/dist/chunk-LD74LVRU.js.map +0 -1
  131. package/dist/chunk-PCQVQ7SB.js +0 -45
  132. package/dist/chunk-PCQVQ7SB.js.map +0 -1
  133. package/dist/chunk-PR3JDWC3.mjs.map +0 -1
  134. package/dist/chunk-PWZBLTHR.js +0 -118
  135. package/dist/chunk-PWZBLTHR.js.map +0 -1
  136. package/dist/chunk-QEWDG5QE.mjs +0 -45
  137. package/dist/chunk-QEWDG5QE.mjs.map +0 -1
  138. package/dist/chunk-SMXXAVMB.js.map +0 -1
  139. package/dist/chunk-STV4ZVNA.mjs +0 -118
  140. package/dist/chunk-STV4ZVNA.mjs.map +0 -1
  141. package/dist/chunk-T5AZMMVS.mjs +0 -94
  142. package/dist/chunk-T5AZMMVS.mjs.map +0 -1
  143. package/dist/chunk-UU33HCCZ.mjs +0 -159
  144. package/dist/chunk-UU33HCCZ.mjs.map +0 -1
  145. package/dist/chunk-VGHLQXKB.js +0 -392
  146. package/dist/chunk-VGHLQXKB.js.map +0 -1
  147. package/dist/chunk-W5ZEP3CI.mjs.map +0 -1
  148. package/dist/chunk-Y666BJA5.mjs +0 -4
  149. package/dist/chunk-YN4436PK.mjs.map +0 -1
  150. package/dist/client-B2HqIKg6.d.ts +0 -51
  151. package/dist/client-XyCqclCi.d.mts +0 -51
  152. package/dist/client-browser.d.mts +0 -8
  153. package/dist/client-browser.d.ts +0 -8
  154. package/dist/client-browser.js +0 -88
  155. package/dist/client-browser.js.map +0 -1
  156. package/dist/client-browser.mjs +0 -88
  157. package/dist/client-browser.mjs.map +0 -1
  158. package/dist/client-node.d.mts +0 -8
  159. package/dist/client-node.d.ts +0 -8
  160. package/dist/client-node.js +0 -95
  161. package/dist/client-node.js.map +0 -1
  162. package/dist/client-node.mjs +0 -95
  163. package/dist/client-node.mjs.map +0 -1
  164. package/dist/evaluation/index.d.mts +0 -897
  165. package/dist/evaluation/index.d.ts +0 -897
  166. package/dist/evaluation/index.js +0 -14
  167. package/dist/evaluation/index.js.map +0 -1
  168. package/dist/evaluation/index.mjs +0 -14
  169. package/dist/filterable-batch-span-processor-zO5kcjBY.d.mts +0 -64
  170. package/dist/filterable-batch-span-processor-zO5kcjBY.d.ts +0 -64
  171. package/dist/init-XU2JFY6N.js +0 -16
  172. package/dist/list-7NPSX2E4.mjs.map +0 -1
  173. package/dist/list-ZXFLAF52.js.map +0 -1
  174. package/dist/login-76NQIHKR.js.map +0 -1
  175. package/dist/login-EK4WVOI2.mjs.map +0 -1
  176. package/dist/observability/index.d.mts +0 -260
  177. package/dist/observability/index.d.ts +0 -260
  178. package/dist/observability/index.js +0 -21
  179. package/dist/observability/index.js.map +0 -1
  180. package/dist/observability/index.mjs +0 -21
  181. package/dist/observability/index.mjs.map +0 -1
  182. package/dist/observability/instrumentation/langchain/index.d.mts +0 -40
  183. package/dist/observability/instrumentation/langchain/index.d.ts +0 -40
  184. package/dist/observability/instrumentation/langchain/index.js +0 -668
  185. package/dist/observability/instrumentation/langchain/index.js.map +0 -1
  186. package/dist/observability/instrumentation/langchain/index.mjs +0 -668
  187. package/dist/observability/instrumentation/langchain/index.mjs.map +0 -1
  188. package/dist/prompt/index.d.mts +0 -10
  189. package/dist/prompt/index.d.ts +0 -10
  190. package/dist/prompt/index.js +0 -22
  191. package/dist/prompt/index.js.map +0 -1
  192. package/dist/prompt/index.mjs +0 -22
  193. package/dist/prompt/index.mjs.map +0 -1
  194. package/dist/record-evaluation-CmxMXa-3.d.mts +0 -25
  195. package/dist/record-evaluation-CmxMXa-3.d.ts +0 -25
  196. package/dist/remove-SDJYEPAY.mjs.map +0 -1
  197. package/dist/remove-XBNGIVMR.js.map +0 -1
  198. package/dist/sync-EISKGPTL.js.map +0 -1
  199. package/dist/sync-ST2IWXSB.mjs.map +0 -1
  200. package/dist/trace-CqaKo0kZ.d.ts +0 -622
  201. package/dist/trace-DtVc5GhF.d.mts +0 -622
  202. /package/dist/{chunk-Y666BJA5.mjs.map → chunk-CU3443HD.mjs.map} +0 -0
  203. /package/dist/{chunk-E7UE2MPD.mjs.map → chunk-ECUXLXFT.mjs.map} +0 -0
  204. /package/dist/{create-QUZYBMQB.mjs.map → create-MK7NEGCM.mjs.map} +0 -0
  205. /package/dist/{init-H67RW22E.mjs.map → init-RINSTP4L.mjs.map} +0 -0
  206. /package/dist/{evaluation → observability-sdk}/index.mjs.map +0 -0
@@ -0,0 +1,576 @@
1
+ import { BatchSpanProcessor, SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace-base';
2
+ import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
3
+ import { Logger, LogRecord, LoggerProvider } from '@opentelemetry/api-logs';
4
+ import { a as SemConvLogRecordAttributes, S as SemConvAttributes } from './types-DRiQaKFG.mjs';
5
+ import { TracerProvider } from '@opentelemetry/api';
6
+ import { a as LangWatchTracer } from './types-1q5wIYP5.mjs';
7
+
8
+ /**
9
+ * Filterable Batch Span Exporter for OpenTelemetry
10
+ *
11
+ * This module provides a BatchSpanProcessor subclass that allows filtering of spans before export
12
+ * based on configurable rules. Spans matching any exclude rule are dropped and not exported.
13
+ *
14
+ * @module filterable-batch-span-exporter
15
+ */
16
+
17
+ /**
18
+ * A rule for excluding spans from export based on their name or instrumentation scope name.
19
+ *
20
+ * @property fieldName - The span field to match against ('span_name' or 'instrumentation_scope_name').
21
+ * @property matchValue - The value to match against the field.
22
+ * @property matchOperation - The operation to use for matching ('includes', 'exact_match', 'starts_with', 'ends_with').
23
+ *
24
+ * @example
25
+ * const rule: SpanProcessingExcludeRule = {
26
+ * fieldName: 'span_name',
27
+ * matchValue: 'heartbeat',
28
+ * matchOperation: 'exact_match',
29
+ * };
30
+ */
31
+ interface SpanProcessingExcludeRule {
32
+ fieldName: "span_name" | "instrumentation_scope_name";
33
+ matchValue: string;
34
+ matchOperation: "includes" | "exact_match" | "starts_with" | "ends_with";
35
+ }
36
+ /**
37
+ * A BatchSpanProcessor that filters out spans matching any of the provided exclude rules before export.
38
+ *
39
+ * This is useful for dropping noisy or irrelevant spans (e.g., health checks, heartbeats) from being exported to your tracing backend.
40
+ *
41
+ * @example
42
+ * import { FilterableBatchSpanProcessor } from './filterable-batch-span-exporter';
43
+ * import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
44
+ *
45
+ * const exporter = new OTLPTraceExporter({ url: '...' });
46
+ * const filters = [
47
+ * { fieldName: 'span_name', matchValue: 'heartbeat', matchOperation: 'exact_match' },
48
+ * { fieldName: 'instrumentation_scope_name', matchValue: 'internal', matchOperation: 'starts_with' },
49
+ * ];
50
+ * provider.addSpanProcessor(new FilterableBatchSpanProcessor(exporter, filters));
51
+ */
52
+ declare class FilterableBatchSpanProcessor extends BatchSpanProcessor {
53
+ private readonly _filters;
54
+ /**
55
+ * Create a new FilterableBatchSpanProcessor.
56
+ *
57
+ * @param exporter - The underlying SpanExporter to use for exporting spans.
58
+ * @param filters - An array of rules for excluding spans from export.
59
+ */
60
+ constructor(exporter: SpanExporter, filters: SpanProcessingExcludeRule[]);
61
+ /**
62
+ * Called when a span ends. If the span matches any exclude rule, it is dropped and not exported.
63
+ *
64
+ * @param span - The ReadableSpan that has ended.
65
+ */
66
+ onEnd(span: ReadableSpan): void;
67
+ }
68
+
69
+ interface LangWatchTraceExporterOptions {
70
+ endpoint?: string;
71
+ apiKey?: string;
72
+ includeAllSpans?: boolean;
73
+ debug?: boolean;
74
+ }
75
+ /**
76
+ * LangWatchTraceExporter extends the OpenTelemetry OTLP HTTP trace exporter
77
+ * to send trace data to LangWatch with proper authentication and metadata headers.
78
+ *
79
+ * This exporter automatically configures:
80
+ * - Authorization headers using the provided API key or environment variables/fallback
81
+ * - SDK version and language identification headers
82
+ * - Proper endpoint configuration for LangWatch ingestion using provided URL or environment variables/fallback
83
+ *
84
+ * @example
85
+ * ```typescript
86
+ * import { LangWatchTraceExporter } from '@langwatch/observability';
87
+ *
88
+ * // Using environment variables/fallback configuration
89
+ * const exporter = new LangWatchTraceExporter();
90
+ *
91
+ * // Using custom options
92
+ * const exporter = new LangWatchTraceExporter({
93
+ * apiKey: 'your-api-key',
94
+ * endpoint: 'https://custom.langwatch.com'
95
+ * });
96
+ * ```
97
+ */
98
+ declare class LangWatchTraceExporter extends OTLPTraceExporter {
99
+ /**
100
+ * Creates a new LangWatchExporter instance.
101
+ *
102
+ * @param opts - Optional configuration options for the exporter
103
+ * @param opts.apiKey - Optional API key for LangWatch authentication. If not provided,
104
+ * will use environment variables or fallback configuration.
105
+ * @param opts.endpoint - Optional custom endpoint URL for LangWatch ingestion.
106
+ * If not provided, will use environment variables or fallback configuration.
107
+ * @param opts.includeAllSpans - Deprecated: This option is deprecated and will be removed in a future version
108
+ * @param opts.debug - Deprecated: This option is deprecated and will be removed in a future version
109
+ */
110
+ constructor(opts?: LangWatchTraceExporterOptions);
111
+ }
112
+
113
+ /**
114
+ * Anthropic AI system identifier
115
+ * Used to identify Anthropic's Claude models
116
+ */
117
+ declare const VAL_GEN_AI_SYSTEM_ANTHROPIC = "anthropic";
118
+ /**
119
+ * AWS Bedrock system identifier
120
+ * Used to identify AWS Bedrock AI services
121
+ */
122
+ declare const VAL_GEN_AI_SYSTEM_AWS_BEDROCK = "aws.bedrock";
123
+ /**
124
+ * Azure AI Inference system identifier
125
+ * Used to identify Azure AI Inference services
126
+ */
127
+ declare const VAL_GEN_AI_SYSTEM_AZURE_AI_INFERENCE = "azure.ai.inference";
128
+ /**
129
+ * Azure AI OpenAI system identifier
130
+ * Used to identify Azure OpenAI services
131
+ */
132
+ declare const VAL_GEN_AI_SYSTEM_AZURE_AI_OPENAI = "azure.ai.openai";
133
+ /**
134
+ * Cohere system identifier
135
+ * Used to identify Cohere AI models
136
+ */
137
+ declare const VAL_GEN_AI_SYSTEM_COHERE = "cohere";
138
+ /**
139
+ * DeepSeek system identifier
140
+ * Used to identify DeepSeek AI models
141
+ */
142
+ declare const VAL_GEN_AI_SYSTEM_DEEPSEEK = "deepseek";
143
+ /**
144
+ * GCP Gemini system identifier
145
+ * Used to identify Google Cloud Gemini models
146
+ */
147
+ declare const VAL_GEN_AI_SYSTEM_GCP_GEMINI = "gcp.gemini";
148
+ /**
149
+ * GCP Gen AI system identifier
150
+ * Used to identify Google Cloud Generative AI services
151
+ */
152
+ declare const VAL_GEN_AI_SYSTEM_GCP_GEN_AI = "gcp.gen_ai";
153
+ /**
154
+ * GCP Vertex AI system identifier
155
+ * Used to identify Google Cloud Vertex AI services
156
+ */
157
+ declare const VAL_GEN_AI_SYSTEM_GCP_VERTEX_AI = "gcp.vertex_ai";
158
+ /**
159
+ * Groq system identifier
160
+ * Used to identify Groq AI models
161
+ */
162
+ declare const VAL_GEN_AI_SYSTEM_GROQ = "groq";
163
+ /**
164
+ * IBM WatsonX AI system identifier
165
+ * Used to identify IBM WatsonX AI services
166
+ */
167
+ declare const VAL_GEN_AI_SYSTEM_IBM_WATSONX_AI = "ibm.watsonx.ai";
168
+ /**
169
+ * Mistral AI system identifier
170
+ * Used to identify Mistral AI models
171
+ */
172
+ declare const VAL_GEN_AI_SYSTEM_MISTRAL_AI = "mistral_ai";
173
+ /**
174
+ * OpenAI system identifier
175
+ * Used to identify OpenAI models and services
176
+ */
177
+ declare const VAL_GEN_AI_SYSTEM_OPENAI = "openai";
178
+ /**
179
+ * Perplexity system identifier
180
+ * Used to identify Perplexity AI models
181
+ */
182
+ declare const VAL_GEN_AI_SYSTEM_PERPLEXITY = "perplexity";
183
+ /**
184
+ * XAI system identifier
185
+ * Used to identify XAI models and services
186
+ */
187
+ declare const VAL_GEN_AI_SYSTEM_XAI = "xai";
188
+ /**
189
+ * Content filter finish reason
190
+ * Used when generation stops due to content filtering
191
+ */
192
+ declare const VAL_GEN_AI_FINISH_REASON_CONTENT_FILTER = "content_filter";
193
+ /**
194
+ * Error finish reason
195
+ * Used when generation stops due to an error
196
+ */
197
+ declare const VAL_GEN_AI_FINISH_REASON_ERROR = "error";
198
+ /**
199
+ * Length finish reason
200
+ * Used when generation stops due to length limits
201
+ */
202
+ declare const VAL_GEN_AI_FINISH_REASON_LENGTH = "length";
203
+ /**
204
+ * Stop finish reason
205
+ * Used when generation stops due to stop tokens
206
+ */
207
+ declare const VAL_GEN_AI_FINISH_REASON_STOP = "stop";
208
+ /**
209
+ * Tool calls finish reason
210
+ * Used when generation stops due to tool calls
211
+ */
212
+ declare const VAL_GEN_AI_FINISH_REASON_TOOL_CALLS = "tool_calls";
213
+ /**
214
+ * Union type of all supported GenAI system identifiers
215
+ * Used for type safety when working with system identification
216
+ */
217
+ type VAL_GEN_AI_SYSTEMS = typeof VAL_GEN_AI_SYSTEM_ANTHROPIC | typeof VAL_GEN_AI_SYSTEM_AWS_BEDROCK | typeof VAL_GEN_AI_SYSTEM_AZURE_AI_INFERENCE | typeof VAL_GEN_AI_SYSTEM_AZURE_AI_OPENAI | typeof VAL_GEN_AI_SYSTEM_COHERE | typeof VAL_GEN_AI_SYSTEM_DEEPSEEK | typeof VAL_GEN_AI_SYSTEM_GCP_GEMINI | typeof VAL_GEN_AI_SYSTEM_GCP_GEN_AI | typeof VAL_GEN_AI_SYSTEM_GCP_VERTEX_AI | typeof VAL_GEN_AI_SYSTEM_GROQ | typeof VAL_GEN_AI_SYSTEM_IBM_WATSONX_AI | typeof VAL_GEN_AI_SYSTEM_MISTRAL_AI | typeof VAL_GEN_AI_SYSTEM_OPENAI | typeof VAL_GEN_AI_SYSTEM_PERPLEXITY | typeof VAL_GEN_AI_SYSTEM_XAI;
218
+ /**
219
+ * Union type of all supported GenAI finish reasons
220
+ * Used for type safety when working with generation completion reasons
221
+ */
222
+ type VAL_GEN_AI_FINISH_REASONS = typeof VAL_GEN_AI_FINISH_REASON_CONTENT_FILTER | typeof VAL_GEN_AI_FINISH_REASON_ERROR | typeof VAL_GEN_AI_FINISH_REASON_LENGTH | typeof VAL_GEN_AI_FINISH_REASON_STOP | typeof VAL_GEN_AI_FINISH_REASON_TOOL_CALLS;
223
+
224
+ /**
225
+ * Body for a system message event in a GenAI span.
226
+ *
227
+ * Used to log system/instruction messages sent to the model.
228
+ *
229
+ * @property content - The message content.
230
+ * @property role - The role of the message, typically 'system' or 'instruction'.
231
+ *
232
+ * @example
233
+ * logger.emitGenAISystemMessageEvent({ content: 'You are a helpful assistant.' });
234
+ */
235
+ interface LangWatchSpanGenAISystemMessageEventBody {
236
+ /** Content of the system message */
237
+ content?: string;
238
+ /** Role of the message (system or instruction) */
239
+ role?: "system" | "instruction";
240
+ }
241
+ /**
242
+ * Body for a user message event in a GenAI span.
243
+ *
244
+ * Used to log user/customer messages sent to the model.
245
+ *
246
+ * @property content - The message content.
247
+ * @property role - The role of the message, typically 'user' or 'customer'.
248
+ *
249
+ * @example
250
+ * logger.emitGenAIUserMessageEvent({ content: 'What is the weather today?' });
251
+ */
252
+ interface LangWatchSpanGenAIUserMessageEventBody {
253
+ /** Content of the user message */
254
+ content?: string;
255
+ /** Role of the message (user or customer) */
256
+ role?: "user" | "customer";
257
+ }
258
+ /**
259
+ * Body for an assistant message event in a GenAI span.
260
+ *
261
+ * Used to log assistant/bot responses, including tool calls.
262
+ *
263
+ * @property content - The message content.
264
+ * @property role - The role of the message, typically 'assistant' or 'bot'.
265
+ * @property tool_calls - Array of tool call objects, if the assistant invoked tools/functions.
266
+ *
267
+ * @example
268
+ * logger.emitGenAIAssistantMessageEvent({ content: 'The weather is sunny.', role: 'assistant' });
269
+ */
270
+ interface LangWatchSpanGenAIAssistantMessageEventBody {
271
+ /** Content of the assistant message */
272
+ content?: string;
273
+ /** Role of the message (assistant or bot) */
274
+ role?: "assistant" | "bot";
275
+ /** Tool calls made by the assistant */
276
+ tool_calls?: {
277
+ function: {
278
+ /** Name of the function called */
279
+ name: string;
280
+ /** Arguments passed to the function */
281
+ arguments?: string;
282
+ };
283
+ /** Tool call identifier */
284
+ id: string;
285
+ /** Type of tool call */
286
+ type: "function";
287
+ }[];
288
+ }
289
+ /**
290
+ * Body for a tool message event in a GenAI span.
291
+ *
292
+ * Used to log messages from tools/functions invoked by the assistant.
293
+ *
294
+ * @property content - The message content.
295
+ * @property id - Unique identifier for the tool call.
296
+ * @property role - The role, typically 'tool' or 'function'.
297
+ *
298
+ * @example
299
+ * logger.emitGenAIToolMessageEvent({ content: 'Result from tool', id: 'tool-1', role: 'tool' });
300
+ */
301
+ interface LangWatchSpanGenAIToolMessageEventBody {
302
+ /** Content of the tool message */
303
+ content?: string;
304
+ /** Tool call identifier */
305
+ id: string;
306
+ /** Role of the message (tool or function) */
307
+ role?: "tool" | "function";
308
+ }
309
+ /**
310
+ * Body for a choice event in a GenAI span.
311
+ *
312
+ * Used to log the model's output choices, including finish reason and message content.
313
+ *
314
+ * @property finish_reason - Why the generation finished (e.g., 'stop', 'length').
315
+ * @property index - Index of the choice (for multi-choice outputs).
316
+ * @property message - The message content and tool calls for this choice.
317
+ *
318
+ * @example
319
+ * logger.emitGenAIChoiceEvent({ finish_reason: 'stop', index: 0, message: { content: 'Hello!' } });
320
+ */
321
+ interface LangWatchSpanGenAIChoiceEventBody {
322
+ /** Reason the generation finished */
323
+ finish_reason: VAL_GEN_AI_FINISH_REASONS | (string & {});
324
+ /** Index of the choice */
325
+ index: number;
326
+ /** Message content for the choice */
327
+ message?: {
328
+ /** Content of the message */
329
+ content?: string;
330
+ /** Role of the message (assistant or bot) */
331
+ role?: "assistant" | "bot";
332
+ /** Tool calls made by the assistant */
333
+ tool_calls?: {
334
+ function: {
335
+ /** Name of the function called */
336
+ name: string;
337
+ /** Arguments passed to the function */
338
+ arguments?: string;
339
+ };
340
+ /** Tool call identifier */
341
+ id: string;
342
+ /** Type of tool call */
343
+ type: "function";
344
+ }[];
345
+ };
346
+ }
347
+ /**
348
+ * Extension of OpenTelemetry's LogRecord with LangWatch and GenAI-specific attributes.
349
+ */
350
+ interface LangWatchLogRecord extends LogRecord {
351
+ /**
352
+ * Additional attributes to add to the log record.
353
+ *
354
+ * @default {}
355
+ */
356
+ attributes?: SemConvLogRecordAttributes;
357
+ }
358
+ /**
359
+ * Options for emitting a log record.
360
+ */
361
+ interface EmitOptions {
362
+ /**
363
+ * Whether to not include the OTel context on the log record.
364
+ *
365
+ * With standard OpenTelemetry, the context is not included on the log record by
366
+ * default, so this is useful if you want to emit a lot without having to manually
367
+ * set the context on each log record.
368
+ *
369
+ * @default false
370
+ */
371
+ excludeContext?: boolean;
372
+ }
373
+ /**
374
+ * Extension of OpenTelemetry's Logger with LangWatch and GenAI-specific methods.
375
+ */
376
+ interface LangWatchLogger extends Logger {
377
+ /**
378
+ * Emit a log record with LangWatch and GenAI-specific attributes.
379
+ *
380
+ * @param logRecord - The log record to emit
381
+ * @param options - Optional options for emitting the log record
382
+ */
383
+ emit(logRecord: LangWatchLogRecord, options?: EmitOptions): void;
384
+ /**
385
+ * Emit a GenAI system message event to the logger.
386
+ *
387
+ * This logs a system/instruction message sent to the model.
388
+ *
389
+ * @param body - The event body (content and role)
390
+ * @param system - The GenAI system (optional, e.g., 'openai', 'anthropic')
391
+ * @param attributes - Additional OpenTelemetry attributes (optional)
392
+ * @returns this
393
+ */
394
+ emitGenAISystemMessageEvent(body: LangWatchSpanGenAISystemMessageEventBody, system?: VAL_GEN_AI_SYSTEMS | (string & {}), attributes?: SemConvAttributes): void;
395
+ /**
396
+ * Emit a GenAI user message event to the logger.
397
+ *
398
+ * This logs a user/customer message sent to the model.
399
+ *
400
+ * @param body - The event body (content and role)
401
+ * @param system - The GenAI system (optional)
402
+ * @param attributes - Additional OpenTelemetry attributes (optional)
403
+ * @returns this
404
+ */
405
+ emitGenAIUserMessageEvent(body: LangWatchSpanGenAIUserMessageEventBody, system?: VAL_GEN_AI_SYSTEMS | (string & {}), attributes?: SemConvAttributes): void;
406
+ /**
407
+ * Emit a GenAI assistant message event to the logger.
408
+ *
409
+ * This logs an assistant/bot response, including tool calls if present.
410
+ *
411
+ * @param body - The event body (content, role, tool_calls)
412
+ * @param system - The GenAI system (optional)
413
+ * @param attributes - Additional OpenTelemetry attributes (optional)
414
+ * @returns this
415
+ */
416
+ emitGenAIAssistantMessageEvent(body: LangWatchSpanGenAIAssistantMessageEventBody, system?: VAL_GEN_AI_SYSTEMS | (string & {}), attributes?: SemConvAttributes): void;
417
+ /**
418
+ * Emit a GenAI tool message event to the logger.
419
+ *
420
+ * This logs a message from a tool/function invoked by the assistant.
421
+ *
422
+ * @param body - The event body (content, id, role)
423
+ * @param system - The GenAI system (optional)
424
+ * @param attributes - Additional OpenTelemetry attributes (optional)
425
+ * @returns this
426
+ */
427
+ emitGenAIToolMessageEvent(body: LangWatchSpanGenAIToolMessageEventBody, system?: VAL_GEN_AI_SYSTEMS | (string & {}), attributes?: SemConvAttributes): void;
428
+ /**
429
+ * Emit a GenAI choice event to the logger.
430
+ *
431
+ * This logs a model output choice, including finish reason and message content.
432
+ *
433
+ * @param body - The event body (finish_reason, index, message)
434
+ * @param system - The GenAI system (optional)
435
+ * @param attributes - Additional OpenTelemetry attributes (optional)
436
+ * @returns this
437
+ */
438
+ emitGenAIChoiceEvent(body: LangWatchSpanGenAIChoiceEventBody, system?: VAL_GEN_AI_SYSTEMS | (string & {}), attributes?: SemConvAttributes): void;
439
+ }
440
+
441
+ /**
442
+ * Retrieves a LangWatch logger with the specified name and optional version.
443
+ *
444
+ * @param name - The name of the logger (typically your service or module name).
445
+ * @param version - (Optional) The version of the logger.
446
+ * @returns A {@link LangWatchLogger} instance.
447
+ *
448
+ * @remarks
449
+ * Uses the logger provider set during observability setup. If no provider is set, returns
450
+ * a NoOp logger.
451
+ *
452
+ * @example
453
+ * ```ts
454
+ * const logger = getLangWatchLogger("my-service");
455
+ * logger.info("Service started");
456
+ * ```
457
+ *
458
+ * @see {@link setLangWatchLoggerProvider}
459
+ */
460
+ declare function getLangWatchLogger(name: string, version?: string): LangWatchLogger;
461
+ /**
462
+ * Retrieves a LangWatch logger from a specific OpenTelemetry logger provider.
463
+ *
464
+ * @param loggerProvider - The OpenTelemetry logger provider to use.
465
+ * @param name - The name of the logger.
466
+ * @param version - (Optional) The version of the logger.
467
+ * @returns A {@link LangWatchLogger} instance.
468
+ *
469
+ * @remarks
470
+ * Use this function if you want to use a custom logger provider instead of the global one.
471
+ *
472
+ * @example
473
+ * ```ts
474
+ * const customProvider = new LoggerProvider();
475
+ * const logger = getLangWatchLoggerFromProvider(customProvider, "custom-service");
476
+ * ```
477
+ */
478
+ declare function getLangWatchLoggerFromProvider(loggerProvider: LoggerProvider, name: string, version?: string): LangWatchLogger;
479
+
480
+ /**
481
+ * Get a LangWatch tracer from the global OpenTelemetry tracer provider.
482
+ *
483
+ * This is the primary entry point for obtaining a LangWatch tracer instance.
484
+ * It uses the globally configured OpenTelemetry tracer provider and wraps
485
+ * the resulting tracer with LangWatch-specific enhancements.
486
+ *
487
+ * **Prerequisites**: Ensure that LangWatch's observability setup has been
488
+ * initialized before calling this function, otherwise the global tracer
489
+ * provider may not be properly configured.
490
+ *
491
+ * @param name - The name of the tracer, typically your service or library name
492
+ * @param version - Optional version identifier for the tracer
493
+ * @returns A LangWatch tracer with enhanced functionality
494
+ *
495
+ * @example Basic usage
496
+ * ```typescript
497
+ * import { getLangWatchTracer } from '@langwatch/typescript-sdk';
498
+ *
499
+ * const tracer = getLangWatchTracer('my-service', '1.0.0');
500
+ *
501
+ * // Use the tracer to create spans
502
+ * const result = await tracer.withActiveSpan('operation', async (span) => {
503
+ * span.setAttributes({ userId: '123' });
504
+ * return await performOperation();
505
+ * });
506
+ * ```
507
+ *
508
+ * @example Multiple tracers for different components
509
+ * ```typescript
510
+ * const apiTracer = getLangWatchTracer('api-server', '2.1.0');
511
+ * const dbTracer = getLangWatchTracer('database-client', '1.5.2');
512
+ *
513
+ * // Each tracer can be used independently
514
+ * await apiTracer.withActiveSpan('handle-request', async (span) => {
515
+ * await dbTracer.withActiveSpan('query-users', async (dbSpan) => {
516
+ * // Nested spans with proper parent-child relationships
517
+ * });
518
+ * });
519
+ * ```
520
+ */
521
+ declare function getLangWatchTracer(name: string, version?: string): LangWatchTracer;
522
+ /**
523
+ * Get a LangWatch tracer from a specific OpenTelemetry tracer provider.
524
+ *
525
+ * This function provides more control over which tracer provider is used,
526
+ * allowing you to work with custom or multiple tracer provider instances.
527
+ * This is useful in advanced scenarios where you need to:
528
+ * - Use different tracer providers for different parts of your application
529
+ * - Work with custom tracer provider configurations
530
+ * - Test with mock tracer providers
531
+ *
532
+ * @param tracerProvider - The OpenTelemetry tracer provider to use
533
+ * @param name - The name of the tracer, typically your service or library name
534
+ * @param version - Optional version identifier for the tracer
535
+ * @returns A LangWatch tracer with enhanced functionality
536
+ *
537
+ * @example Custom tracer provider
538
+ * ```typescript
539
+ * import { NodeTracerProvider } from '@opentelemetry/sdk-node';
540
+ * import { getLangWatchTracerFromProvider } from '@langwatch/typescript-sdk';
541
+ *
542
+ * // Create a custom tracer provider with specific configuration
543
+ * const customProvider = new NodeTracerProvider({
544
+ * resource: Resource.default().merge(
545
+ * new Resource({
546
+ * [SemanticResourceAttributes.SERVICE_NAME]: 'custom-service',
547
+ * })
548
+ * )
549
+ * });
550
+ *
551
+ * const tracer = getLangWatchTracerFromProvider(
552
+ * customProvider,
553
+ * 'custom-tracer',
554
+ * '1.0.0'
555
+ * );
556
+ * ```
557
+ *
558
+ * @example Testing with mock provider
559
+ * ```typescript
560
+ * import { InMemorySpanExporter } from '@opentelemetry/sdk-trace-base';
561
+ *
562
+ * const mockExporter = new InMemorySpanExporter();
563
+ * const testProvider = new NodeTracerProvider();
564
+ * testProvider.addSpanProcessor(new SimpleSpanProcessor(mockExporter));
565
+ *
566
+ * const testTracer = getLangWatchTracerFromProvider(
567
+ * testProvider,
568
+ * 'test-tracer'
569
+ * );
570
+ *
571
+ * // Use testTracer in tests and verify spans via mockExporter
572
+ * ```
573
+ */
574
+ declare function getLangWatchTracerFromProvider(tracerProvider: TracerProvider, name: string, version?: string): LangWatchTracer;
575
+
576
+ export { FilterableBatchSpanProcessor as F, LangWatchTraceExporter as L, type SpanProcessingExcludeRule as S, type LangWatchTraceExporterOptions as a, getLangWatchLoggerFromProvider as b, type LangWatchLogger as c, getLangWatchTracer as d, getLangWatchTracerFromProvider as e, getLangWatchLogger as g };