@arizeai/openinference-genai 0.1.5 → 0.1.7
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/README.md +5 -12
- package/dist/commonjs/__generated__/opentelemetryInputMessages.d.ts +103 -0
- package/dist/commonjs/__generated__/opentelemetryInputMessages.d.ts.map +1 -0
- package/dist/commonjs/__generated__/opentelemetryInputMessages.js +8 -0
- package/dist/commonjs/__generated__/opentelemetryInputMessages.js.map +1 -0
- package/dist/commonjs/__generated__/opentelemetryOutputMessages.d.ts +116 -0
- package/dist/commonjs/__generated__/opentelemetryOutputMessages.d.ts.map +1 -0
- package/dist/commonjs/__generated__/opentelemetryOutputMessages.js +8 -0
- package/dist/commonjs/__generated__/opentelemetryOutputMessages.js.map +1 -0
- package/dist/commonjs/attributes.d.ts +79 -0
- package/dist/commonjs/attributes.d.ts.map +1 -0
- package/dist/commonjs/attributes.js +321 -0
- package/dist/commonjs/attributes.js.map +1 -0
- package/dist/commonjs/index.d.ts +2 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +13 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/tsconfig.commonjs.tsbuildinfo +1 -0
- package/dist/commonjs/types.d.ts +9 -0
- package/dist/commonjs/types.d.ts.map +1 -0
- package/dist/commonjs/types.js +3 -0
- package/dist/commonjs/types.js.map +1 -0
- package/dist/commonjs/utils.d.ts +42 -0
- package/dist/commonjs/utils.d.ts.map +1 -0
- package/dist/commonjs/utils.js +107 -0
- package/dist/commonjs/utils.js.map +1 -0
- package/dist/esm/__generated__/opentelemetryInputMessages.js +0 -1
- package/dist/esm/__generated__/opentelemetryOutputMessages.d.ts.map +1 -1
- package/dist/esm/__generated__/opentelemetryOutputMessages.js +0 -1
- package/dist/esm/attributes.d.ts.map +1 -1
- package/dist/esm/attributes.js +1 -1
- package/dist/esm/attributes.js.map +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types.js +0 -1
- package/dist/esm/utils.d.ts +2 -2
- package/dist/esm/utils.d.ts.map +1 -1
- package/dist/esm/utils.js.map +1 -1
- package/package.json +38 -32
- package/src/__generated__/opentelemetryOutputMessages.ts +1 -6
- package/src/attributes.ts +30 -97
- package/src/index.ts +10 -11
- package/src/utils.ts +4 -8
package/README.md
CHANGED
|
@@ -65,15 +65,11 @@ import { convertGenAISpanAttributesToOpenInferenceSpanAttributes } from "@arizea
|
|
|
65
65
|
import type { Mutable } from "@arizeai/openinference-genai/types";
|
|
66
66
|
|
|
67
67
|
class OpenInferenceOTLPTraceExporter extends OTLPTraceExporter {
|
|
68
|
-
export(
|
|
69
|
-
spans: ReadableSpan[],
|
|
70
|
-
resultCallback: (result: ExportResult) => void,
|
|
71
|
-
) {
|
|
68
|
+
export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void) {
|
|
72
69
|
const processedSpans = spans.map((span) => {
|
|
73
|
-
const processedAttributes =
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
);
|
|
70
|
+
const processedAttributes = convertGenAISpanAttributesToOpenInferenceSpanAttributes(
|
|
71
|
+
span.attributes,
|
|
72
|
+
);
|
|
77
73
|
// optionally you can replace the entire attributes object with the
|
|
78
74
|
// processed attributes if you want _only_ the OpenInference attributes
|
|
79
75
|
(span as Mutable<ReadableSpan>).attributes = {
|
|
@@ -93,10 +89,7 @@ And then use it in the SpanProcessor of your choice.
|
|
|
93
89
|
```ts
|
|
94
90
|
// instrumentation.ts
|
|
95
91
|
import { resourceFromAttributes } from "@opentelemetry/resources";
|
|
96
|
-
import {
|
|
97
|
-
NodeTracerProvider,
|
|
98
|
-
BatchSpanProcessor,
|
|
99
|
-
} from "@opentelemetry/sdk-trace-node";
|
|
92
|
+
import { NodeTracerProvider, BatchSpanProcessor } from "@opentelemetry/sdk-trace-node";
|
|
100
93
|
import { ATTR_SERVICE_NAME } from "@opentelemetry/semantic-conventions";
|
|
101
94
|
|
|
102
95
|
import { SEMRESATTRS_PROJECT_NAME } from "@arizeai/openinference-semantic-conventions";
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenTelemetry input messages schema
|
|
3
|
+
* As of 10/14/2025, this schema is still in draft status.
|
|
4
|
+
* https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-input-messages.json
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Role of the entity that created the message.
|
|
8
|
+
*/
|
|
9
|
+
export type Role = Role1 | string;
|
|
10
|
+
export type Role1 = "system" | "user" | "assistant" | "tool";
|
|
11
|
+
/**
|
|
12
|
+
* The type of the content captured in this part.
|
|
13
|
+
*/
|
|
14
|
+
export type Type = "text";
|
|
15
|
+
/**
|
|
16
|
+
* Text content sent to or received from the model.
|
|
17
|
+
*/
|
|
18
|
+
export type Content = string;
|
|
19
|
+
/**
|
|
20
|
+
* The type of the content captured in this part.
|
|
21
|
+
*/
|
|
22
|
+
export type Type1 = "tool_call";
|
|
23
|
+
/**
|
|
24
|
+
* Unique identifier for the tool call.
|
|
25
|
+
*/
|
|
26
|
+
export type Id = string | null;
|
|
27
|
+
/**
|
|
28
|
+
* Name of the tool.
|
|
29
|
+
*/
|
|
30
|
+
export type Name = string;
|
|
31
|
+
/**
|
|
32
|
+
* The type of the content captured in this part.
|
|
33
|
+
*/
|
|
34
|
+
export type Type2 = "tool_call_response";
|
|
35
|
+
/**
|
|
36
|
+
* Unique tool call identifier.
|
|
37
|
+
*/
|
|
38
|
+
export type Id1 = string | null;
|
|
39
|
+
/**
|
|
40
|
+
* The type of the content captured in this part.
|
|
41
|
+
*/
|
|
42
|
+
export type Type3 = string;
|
|
43
|
+
/**
|
|
44
|
+
* List of message parts that make up the message content.
|
|
45
|
+
*/
|
|
46
|
+
export type Parts = (TextPart | ToolCallRequestPart | ToolCallResponsePart)[];
|
|
47
|
+
/**
|
|
48
|
+
* Represents the list of input messages sent to the model.
|
|
49
|
+
*/
|
|
50
|
+
export type InputMessages = ChatMessage[];
|
|
51
|
+
export interface ChatMessage {
|
|
52
|
+
role: Role;
|
|
53
|
+
parts: Parts;
|
|
54
|
+
[k: string]: unknown;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Represents text content sent to or received from the model.
|
|
58
|
+
*/
|
|
59
|
+
export interface TextPart {
|
|
60
|
+
type: Type;
|
|
61
|
+
content: Content;
|
|
62
|
+
[k: string]: unknown;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Represents a tool call requested by the model.
|
|
66
|
+
*/
|
|
67
|
+
export interface ToolCallRequestPart {
|
|
68
|
+
type: Type1;
|
|
69
|
+
id?: Id;
|
|
70
|
+
name: Name;
|
|
71
|
+
arguments?: Arguments;
|
|
72
|
+
[k: string]: unknown;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Arguments for the tool call.
|
|
76
|
+
*/
|
|
77
|
+
export interface Arguments {
|
|
78
|
+
[k: string]: unknown;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Represents a tool call result sent to the model or a built-in tool call outcome and details.
|
|
82
|
+
*/
|
|
83
|
+
export interface ToolCallResponsePart {
|
|
84
|
+
type: Type2;
|
|
85
|
+
id?: Id1;
|
|
86
|
+
response: Response;
|
|
87
|
+
[k: string]: unknown;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Tool call response.
|
|
91
|
+
*/
|
|
92
|
+
export interface Response {
|
|
93
|
+
[k: string]: unknown;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Represents an arbitrary message part with any type and properties.
|
|
97
|
+
* This allows for extensibility with custom message part types.
|
|
98
|
+
*/
|
|
99
|
+
export interface GenericPart {
|
|
100
|
+
type: Type3;
|
|
101
|
+
[k: string]: unknown;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=opentelemetryInputMessages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opentelemetryInputMessages.d.ts","sourceRoot":"","sources":["../../../src/__generated__/opentelemetryInputMessages.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,IAAI,GAAG,KAAK,GAAG,MAAM,CAAC;AAClC,MAAM,MAAM,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;AAC7D;;GAEG;AACH,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC;AAC1B;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAC7B;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG,WAAW,CAAC;AAChC;;GAEG;AACH,MAAM,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAAC;AAC/B;;GAEG;AACH,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC;AAC1B;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG,oBAAoB,CAAC;AACzC;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG,MAAM,GAAG,IAAI,CAAC;AAChC;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC;AAC3B;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG,CAAC,QAAQ,GAAG,mBAAmB,GAAG,oBAAoB,CAAC,EAAE,CAAC;AAC9E;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,WAAW,EAAE,CAAC;AAE1C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,KAAK,CAAC;IACb,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AACD;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AACD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,KAAK,CAAC;IACZ,EAAE,CAAC,EAAE,EAAE,CAAC;IACR,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AACD;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AACD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,KAAK,CAAC;IACZ,EAAE,CAAC,EAAE,GAAG,CAAC;IACT,QAAQ,EAAE,QAAQ,CAAC;IACnB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AACD;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AACD;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,KAAK,CAAC;IACZ,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* OpenTelemetry input messages schema
|
|
4
|
+
* As of 10/14/2025, this schema is still in draft status.
|
|
5
|
+
* https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-input-messages.json
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
//# sourceMappingURL=opentelemetryInputMessages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opentelemetryInputMessages.js","sourceRoot":"","sources":["../../../src/__generated__/opentelemetryInputMessages.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenTelemetry output messages schema
|
|
3
|
+
* As of 10/14/2025, this schema is still in draft status.
|
|
4
|
+
* https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-output-messages.json
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Role of the entity that created the message.
|
|
8
|
+
*/
|
|
9
|
+
export type Role = Role1 | string;
|
|
10
|
+
export type Role1 = "system" | "user" | "assistant" | "tool";
|
|
11
|
+
/**
|
|
12
|
+
* The type of the content captured in this part.
|
|
13
|
+
*/
|
|
14
|
+
export type Type = "text";
|
|
15
|
+
/**
|
|
16
|
+
* Text content sent to or received from the model.
|
|
17
|
+
*/
|
|
18
|
+
export type Content = string;
|
|
19
|
+
/**
|
|
20
|
+
* The type of the content captured in this part.
|
|
21
|
+
*/
|
|
22
|
+
export type Type1 = "tool_call";
|
|
23
|
+
/**
|
|
24
|
+
* Unique identifier for the tool call.
|
|
25
|
+
*/
|
|
26
|
+
export type Id = string | null;
|
|
27
|
+
/**
|
|
28
|
+
* Name of the tool.
|
|
29
|
+
*/
|
|
30
|
+
export type Name = string;
|
|
31
|
+
/**
|
|
32
|
+
* The type of the content captured in this part.
|
|
33
|
+
*/
|
|
34
|
+
export type Type2 = "tool_call_response";
|
|
35
|
+
/**
|
|
36
|
+
* Unique tool call identifier.
|
|
37
|
+
*/
|
|
38
|
+
export type Id1 = string | null;
|
|
39
|
+
/**
|
|
40
|
+
* The type of the content captured in this part.
|
|
41
|
+
*/
|
|
42
|
+
export type Type3 = string;
|
|
43
|
+
/**
|
|
44
|
+
* List of message parts that make up the message content.
|
|
45
|
+
*/
|
|
46
|
+
export type Parts = (TextPart | ToolCallRequestPart | ToolCallResponsePart)[];
|
|
47
|
+
/**
|
|
48
|
+
* Reason for finishing the generation.
|
|
49
|
+
*/
|
|
50
|
+
export type FinishReason = FinishReason1 | string;
|
|
51
|
+
/**
|
|
52
|
+
* Represents the reason for finishing the generation.
|
|
53
|
+
*/
|
|
54
|
+
export type FinishReason1 = "stop" | "length" | "content_filter" | "tool_call" | "error";
|
|
55
|
+
/**
|
|
56
|
+
* Represents the list of output messages generated by the model or agent.
|
|
57
|
+
*/
|
|
58
|
+
export type OutputMessages = OutputMessage[];
|
|
59
|
+
/**
|
|
60
|
+
* Represents an output message generated by the model or agent. The output message captures
|
|
61
|
+
* specific response (choice, candidate).
|
|
62
|
+
*/
|
|
63
|
+
export interface OutputMessage {
|
|
64
|
+
role: Role;
|
|
65
|
+
parts: Parts;
|
|
66
|
+
finish_reason: FinishReason;
|
|
67
|
+
[k: string]: unknown;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Represents text content sent to or received from the model.
|
|
71
|
+
*/
|
|
72
|
+
export interface TextPart {
|
|
73
|
+
type: Type;
|
|
74
|
+
content: Content;
|
|
75
|
+
[k: string]: unknown;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Represents a tool call requested by the model.
|
|
79
|
+
*/
|
|
80
|
+
export interface ToolCallRequestPart {
|
|
81
|
+
type: Type1;
|
|
82
|
+
id?: Id;
|
|
83
|
+
name: Name;
|
|
84
|
+
arguments?: Arguments;
|
|
85
|
+
[k: string]: unknown;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Arguments for the tool call.
|
|
89
|
+
*/
|
|
90
|
+
export interface Arguments {
|
|
91
|
+
[k: string]: unknown;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Represents a tool call result sent to the model or a built-in tool call outcome and details.
|
|
95
|
+
*/
|
|
96
|
+
export interface ToolCallResponsePart {
|
|
97
|
+
type: Type2;
|
|
98
|
+
id?: Id1;
|
|
99
|
+
response: Response;
|
|
100
|
+
[k: string]: unknown;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Tool call response.
|
|
104
|
+
*/
|
|
105
|
+
export interface Response {
|
|
106
|
+
[k: string]: unknown;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Represents an arbitrary message part with any type and properties.
|
|
110
|
+
* This allows for extensibility with custom message part types.
|
|
111
|
+
*/
|
|
112
|
+
export interface GenericPart {
|
|
113
|
+
type: Type3;
|
|
114
|
+
[k: string]: unknown;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=opentelemetryOutputMessages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opentelemetryOutputMessages.d.ts","sourceRoot":"","sources":["../../../src/__generated__/opentelemetryOutputMessages.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,IAAI,GAAG,KAAK,GAAG,MAAM,CAAC;AAClC,MAAM,MAAM,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;AAC7D;;GAEG;AACH,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC;AAC1B;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAC7B;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG,WAAW,CAAC;AAChC;;GAEG;AACH,MAAM,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAAC;AAC/B;;GAEG;AACH,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC;AAC1B;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG,oBAAoB,CAAC;AACzC;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG,MAAM,GAAG,IAAI,CAAC;AAChC;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC;AAC3B;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG,CAAC,QAAQ,GAAG,mBAAmB,GAAG,oBAAoB,CAAC,EAAE,CAAC;AAC9E;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,MAAM,CAAC;AAClD;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,gBAAgB,GAAG,WAAW,GAAG,OAAO,CAAC;AACzF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,aAAa,EAAE,CAAC;AAE7C;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,KAAK,CAAC;IACb,aAAa,EAAE,YAAY,CAAC;IAC5B,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AACD;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AACD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,KAAK,CAAC;IACZ,EAAE,CAAC,EAAE,EAAE,CAAC;IACR,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AACD;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AACD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,KAAK,CAAC;IACZ,EAAE,CAAC,EAAE,GAAG,CAAC;IACT,QAAQ,EAAE,QAAQ,CAAC;IACnB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AACD;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AACD;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,KAAK,CAAC;IACZ,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* OpenTelemetry output messages schema
|
|
4
|
+
* As of 10/14/2025, this schema is still in draft status.
|
|
5
|
+
* https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-output-messages.json
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
//# sourceMappingURL=opentelemetryOutputMessages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opentelemetryOutputMessages.js","sourceRoot":"","sources":["../../../src/__generated__/opentelemetryOutputMessages.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { Attributes } from "@opentelemetry/api";
|
|
2
|
+
import type { ChatMessage } from "./__generated__/opentelemetryInputMessages.js";
|
|
3
|
+
import type { OutputMessage } from "./__generated__/opentelemetryOutputMessages.js";
|
|
4
|
+
export type GenAIInputMessage = ChatMessage;
|
|
5
|
+
export type GenAIInputMessagePart = ChatMessage["parts"][number];
|
|
6
|
+
export type GenAIOutputMessage = OutputMessage & {
|
|
7
|
+
/** @deprecated use parts instead */
|
|
8
|
+
text?: string;
|
|
9
|
+
};
|
|
10
|
+
export type GenAIOutputMessagePart = OutputMessage["parts"][number];
|
|
11
|
+
/**
|
|
12
|
+
* Convert GenAI span attributes to OpenInference span attributes
|
|
13
|
+
* @param spanAttributes - The span attributes containing GenAI span attributes to convert
|
|
14
|
+
* @returns The converted OpenInference span attributes
|
|
15
|
+
*/
|
|
16
|
+
export declare const convertGenAISpanAttributesToOpenInferenceSpanAttributes: (spanAttributes: Attributes) => Attributes;
|
|
17
|
+
/**
|
|
18
|
+
* Map provider and system to openinference attributes
|
|
19
|
+
* @remarks TODO: add some heuristics that can map incoming provider names to the correct OpenInference provider name
|
|
20
|
+
* @param spanAttributes - The span attributes containing provider and system to map
|
|
21
|
+
* @returns The mapped provider and system attributes
|
|
22
|
+
*/
|
|
23
|
+
export declare const mapProviderAndSystem: (spanAttributes: Attributes) => Attributes;
|
|
24
|
+
/**
|
|
25
|
+
* Map model name to openinference attributes
|
|
26
|
+
* @param spanAttributes - The span attributes containing model name to map
|
|
27
|
+
* @returns The mapped model name attributes
|
|
28
|
+
*/
|
|
29
|
+
export declare const mapModels: (spanAttributes: Attributes) => Attributes;
|
|
30
|
+
/**
|
|
31
|
+
* Map span kind to openinference attributes
|
|
32
|
+
* @param spanAttributes - The span attributes containing span kind to map
|
|
33
|
+
* @returns The mapped span kind attributes
|
|
34
|
+
*/
|
|
35
|
+
export declare const mapSpanKind: (spanAttributes: Attributes) => Attributes;
|
|
36
|
+
/**
|
|
37
|
+
* Map invocation parameters to openinference attributes
|
|
38
|
+
* @param spanAttributes - The span attributes containing invocation parameters to map
|
|
39
|
+
* @returns The mapped invocation parameters attributes
|
|
40
|
+
*/
|
|
41
|
+
export declare const mapInvocationParameters: (spanAttributes: Attributes) => Attributes;
|
|
42
|
+
/**
|
|
43
|
+
* Map input value to openinference attributes
|
|
44
|
+
* @param spanAttributes - The span attributes containing input value to map
|
|
45
|
+
* @returns The mapped input value attributes
|
|
46
|
+
*/
|
|
47
|
+
export declare const mapInputValue: (spanAttributes: Attributes) => Attributes;
|
|
48
|
+
/**
|
|
49
|
+
* Map output value to openinference attributes
|
|
50
|
+
* @param spanAttributes - The span attributes containing output value to map
|
|
51
|
+
* @returns The mapped output value attributes
|
|
52
|
+
*/
|
|
53
|
+
export declare const mapOutputValue: (spanAttributes: Attributes) => Attributes;
|
|
54
|
+
/**
|
|
55
|
+
* Map input messages to openinference attributes
|
|
56
|
+
* @param spanAttributes - The span attributes containing input messages to map
|
|
57
|
+
* @returns The mapped input messages attributes
|
|
58
|
+
*/
|
|
59
|
+
export declare const mapInputMessages: (spanAttributes: Attributes) => Attributes;
|
|
60
|
+
/**
|
|
61
|
+
* Map output messages to openinference attributes
|
|
62
|
+
* @param spanAttributes - The span attributes containing output messages to map
|
|
63
|
+
* @returns The mapped output messages attributes
|
|
64
|
+
*/
|
|
65
|
+
export declare const mapOutputMessages: (spanAttributes: Attributes) => Attributes;
|
|
66
|
+
/**
|
|
67
|
+
* Map usage token counts to openinference attributes
|
|
68
|
+
* @param spanAttributes - The span attributes containing usage token counts to map
|
|
69
|
+
* @returns The mapped usage token counts attributes
|
|
70
|
+
*/
|
|
71
|
+
export declare const mapTokenCounts: (spanAttributes: Attributes) => Attributes;
|
|
72
|
+
/**
|
|
73
|
+
* Map tool execution to openinference attributes
|
|
74
|
+
* @see https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-spans/#execute-tool-span
|
|
75
|
+
* @param spanAttributes - The span attributes containing tool execution to map
|
|
76
|
+
* @returns The mapped tool execution attributes
|
|
77
|
+
*/
|
|
78
|
+
export declare const mapToolExecution: (spanAttributes: Attributes) => Attributes;
|
|
79
|
+
//# sourceMappingURL=attributes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../src/attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAiCrD,OAAO,KAAK,EAAE,WAAW,EAAe,MAAM,+CAA+C,CAAC;AAC9F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAapF,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC;AAC5C,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AACjE,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AACF,MAAM,MAAM,sBAAsB,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AA+GpE;;;;GAIG;AACH,eAAO,MAAM,uDAAuD,GAClE,gBAAgB,UAAU,KACzB,UAaF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,gBAAgB,UAAU,KAAG,UAKjE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,gBAAgB,UAAU,KAAG,UAOtD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,gBAAgB,UAAU,KAAG,UAgBxD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAAI,gBAAgB,UAAU,KAAG,UA+BpE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,gBAAgB,UAAU,KAAG,UAa1D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,gBAAgB,UAAU,KAAG,UAa3D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,gBAAgB,UAAU,KAAG,UAgB7D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,gBAAgB,UAAU,KAAG,UAiB9D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,gBAAgB,UAAU,KAAG,UAc3D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,gBAAgB,UAAU,KAAG,UAY7D,CAAC"}
|