arvo-core 1.0.25 → 1.0.26

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -44,3 +44,7 @@
44
44
 
45
45
  - Updated OpenTelemetry propagation and fixed propagation in the event factory
46
46
 
47
+ ## [1.0.26] - 2024-09-08
48
+
49
+ - Added OpenTelemetry attributes for Arvo and OpenInference
50
+
@@ -0,0 +1,6 @@
1
+ /**
2
+ * ArvoExection class containing attribute constants for OpenTelemetry.
3
+ */
4
+ export default class ArvoExecution {
5
+ static readonly ATTR_SPAN_KIND = "arvo.span.kind";
6
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * ArvoExection class containing attribute constants for OpenTelemetry.
5
+ */
6
+ var ArvoExecution = /** @class */ (function () {
7
+ function ArvoExecution() {
8
+ }
9
+ ArvoExecution.ATTR_SPAN_KIND = "arvo.span.kind";
10
+ return ArvoExecution;
11
+ }());
12
+ exports.default = ArvoExecution;
@@ -0,0 +1,4 @@
1
+ export declare enum ArvoExecutionSpanKind {
2
+ EVENT_HANDLER = "EVENT_HANDLER",
3
+ COMMANDER = "COMMANDER"
4
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ArvoExecutionSpanKind = void 0;
4
+ var ArvoExecutionSpanKind;
5
+ (function (ArvoExecutionSpanKind) {
6
+ ArvoExecutionSpanKind["EVENT_HANDLER"] = "EVENT_HANDLER";
7
+ ArvoExecutionSpanKind["COMMANDER"] = "COMMANDER";
8
+ })(ArvoExecutionSpanKind || (exports.ArvoExecutionSpanKind = ArvoExecutionSpanKind = {}));
@@ -0,0 +1,62 @@
1
+ /**
2
+ * OpenInference class containing attribute constants for OpenTelemetry OpenInference.
3
+ * These attribute names are defined as per the OpenInference specification:
4
+ * @see https://github.com/Arize-ai/openinference/blob/main/spec/semantic_conventions.md
5
+ */
6
+ export default class OpenInference {
7
+ static readonly ATTR_SPAN_KIND = "openinference.span.kind";
8
+ static readonly ATTR_DOCUMENT_CONTENT = "document.content";
9
+ static readonly ATTR_DOCUMENT_ID = "document.id";
10
+ static readonly ATTR_DOCUMENT_METADATA = "document.metadata";
11
+ static readonly ATTR_DOCUMENT_SCORE = "document.score";
12
+ static readonly ATTR_EMBEDDING_EMBEDDINGS = "embedding.embeddings";
13
+ static readonly ATTR_EMBEDDING_MODEL_NAME = "embedding.model_name";
14
+ static readonly ATTR_EMBEDDING_TEXT = "embedding.text";
15
+ static readonly ATTR_EMBEDDING_VECTOR = "embedding.vector";
16
+ static readonly ATTR_EXCEPTION_ESCAPED = "exception.escaped";
17
+ static readonly ATTR_EXCEPTION_MESSAGE = "exception.message";
18
+ static readonly ATTR_EXCEPTION_STACKTRACE = "exception.stacktrace";
19
+ static readonly ATTR_EXCEPTION_TYPE = "exception.type";
20
+ static readonly ATTR_IMAGE_URL = "image.url";
21
+ static readonly ATTR_INPUT_MIME_TYPE = "input.mime_type";
22
+ static readonly ATTR_INPUT_VALUE = "input.value";
23
+ static readonly ATTR_LLM_FUNCTION_CALL = "llm.function_call";
24
+ static readonly ATTR_LLM_INPUT_MESSAGES = "llm.input_messages";
25
+ static readonly ATTR_LLM_INVOCATION_PARAMETERS = "llm.invocation_parameters";
26
+ static readonly ATTR_LLM_MODEL_NAME = "llm.model_name";
27
+ static readonly ATTR_LLM_OUTPUT_MESSAGES = "llm.output_messages";
28
+ static readonly ATTR_LLM_PROMPT_TEMPLATE_TEMPLATE = "llm.prompt_template.template";
29
+ static readonly ATTR_LLM_PROMPT_TEMPLATE_VARIABLES = "llm.prompt_template.variables";
30
+ static readonly ATTR_LLM_PROMPT_TEMPLATE_VERSION = "llm.prompt_template.version";
31
+ static readonly ATTR_LLM_TOKEN_COUNT_COMPLETION = "llm.token_count.completion";
32
+ static readonly ATTR_LLM_TOKEN_COUNT_PROMPT = "llm.token_count.prompt";
33
+ static readonly ATTR_LLM_TOKEN_COUNT_TOTAL = "llm.token_count.total";
34
+ static readonly ATTR_LLM_TOOLS = "llm.tools";
35
+ static readonly ATTR_MESSAGE_CONTENT = "message.content";
36
+ static readonly ATTR_MESSAGE_CONTENTS = "message.contents";
37
+ static readonly ATTR_MESSAGE_FUNCTION_CALL_ARGUMENTS_JSON = "message.function_call_arguments_json";
38
+ static readonly ATTR_MESSAGE_FUNCTION_CALL_NAME = "message.function_call_name";
39
+ static readonly ATTR_MESSAGE_ROLE = "message.role";
40
+ static readonly ATTR_MESSAGE_TOOL_CALLS = "message.tool_calls";
41
+ static readonly ATTR_MESSAGE_CONTENT_TYPE = "messagecontent.type";
42
+ static readonly ATTR_MESSAGE_CONTENT_TEXT = "messagecontent.text";
43
+ static readonly ATTR_MESSAGE_CONTENT_IMAGE = "messagecontent.image";
44
+ static readonly ATTR_METADATA = "metadata";
45
+ static readonly ATTR_OUTPUT_MIME_TYPE = "output.mime_type";
46
+ static readonly ATTR_OUTPUT_VALUE = "output.value";
47
+ static readonly ATTR_RERANKER_INPUT_DOCUMENTS = "reranker.input_documents";
48
+ static readonly ATTR_RERANKER_MODEL_NAME = "reranker.model_name";
49
+ static readonly ATTR_RERANKER_OUTPUT_DOCUMENTS = "reranker.output_documents";
50
+ static readonly ATTR_RERANKER_QUERY = "reranker.query";
51
+ static readonly ATTR_RERANKER_TOP_K = "reranker.top_k";
52
+ static readonly ATTR_RETRIEVAL_DOCUMENTS = "retrieval.documents";
53
+ static readonly ATTR_SESSION_ID = "session.id";
54
+ static readonly ATTR_TAG_TAGS = "tag.tags";
55
+ static readonly ATTR_TOOL_DESCRIPTION = "tool.description";
56
+ static readonly ATTR_TOOL_JSON_SCHEMA = "tool.json_schema";
57
+ static readonly ATTR_TOOL_NAME = "tool.name";
58
+ static readonly ATTR_TOOL_PARAMETERS = "tool.parameters";
59
+ static readonly ATTR_TOOL_CALL_FUNCTION_ARGUMENTS = "tool_call.function.arguments";
60
+ static readonly ATTR_TOOL_CALL_FUNCTION_NAME = "tool_call.function.name";
61
+ static readonly ATTR_USER_ID = "user.id";
62
+ }
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * OpenInference class containing attribute constants for OpenTelemetry OpenInference.
5
+ * These attribute names are defined as per the OpenInference specification:
6
+ * @see https://github.com/Arize-ai/openinference/blob/main/spec/semantic_conventions.md
7
+ */
8
+ var OpenInference = /** @class */ (function () {
9
+ function OpenInference() {
10
+ }
11
+ OpenInference.ATTR_SPAN_KIND = "openinference.span.kind";
12
+ // Document attributes
13
+ OpenInference.ATTR_DOCUMENT_CONTENT = "document.content";
14
+ OpenInference.ATTR_DOCUMENT_ID = "document.id";
15
+ OpenInference.ATTR_DOCUMENT_METADATA = "document.metadata";
16
+ OpenInference.ATTR_DOCUMENT_SCORE = "document.score";
17
+ // Embedding attributes
18
+ OpenInference.ATTR_EMBEDDING_EMBEDDINGS = "embedding.embeddings";
19
+ OpenInference.ATTR_EMBEDDING_MODEL_NAME = "embedding.model_name";
20
+ OpenInference.ATTR_EMBEDDING_TEXT = "embedding.text";
21
+ OpenInference.ATTR_EMBEDDING_VECTOR = "embedding.vector";
22
+ // Exception attributes
23
+ OpenInference.ATTR_EXCEPTION_ESCAPED = "exception.escaped";
24
+ OpenInference.ATTR_EXCEPTION_MESSAGE = "exception.message";
25
+ OpenInference.ATTR_EXCEPTION_STACKTRACE = "exception.stacktrace";
26
+ OpenInference.ATTR_EXCEPTION_TYPE = "exception.type";
27
+ // Image attribute
28
+ OpenInference.ATTR_IMAGE_URL = "image.url";
29
+ // Input attributes
30
+ OpenInference.ATTR_INPUT_MIME_TYPE = "input.mime_type";
31
+ OpenInference.ATTR_INPUT_VALUE = "input.value";
32
+ // LLM attributes
33
+ OpenInference.ATTR_LLM_FUNCTION_CALL = "llm.function_call";
34
+ OpenInference.ATTR_LLM_INPUT_MESSAGES = "llm.input_messages";
35
+ OpenInference.ATTR_LLM_INVOCATION_PARAMETERS = "llm.invocation_parameters";
36
+ OpenInference.ATTR_LLM_MODEL_NAME = "llm.model_name";
37
+ OpenInference.ATTR_LLM_OUTPUT_MESSAGES = "llm.output_messages";
38
+ OpenInference.ATTR_LLM_PROMPT_TEMPLATE_TEMPLATE = "llm.prompt_template.template";
39
+ OpenInference.ATTR_LLM_PROMPT_TEMPLATE_VARIABLES = "llm.prompt_template.variables";
40
+ OpenInference.ATTR_LLM_PROMPT_TEMPLATE_VERSION = "llm.prompt_template.version";
41
+ OpenInference.ATTR_LLM_TOKEN_COUNT_COMPLETION = "llm.token_count.completion";
42
+ OpenInference.ATTR_LLM_TOKEN_COUNT_PROMPT = "llm.token_count.prompt";
43
+ OpenInference.ATTR_LLM_TOKEN_COUNT_TOTAL = "llm.token_count.total";
44
+ OpenInference.ATTR_LLM_TOOLS = "llm.tools";
45
+ // Message attributes
46
+ OpenInference.ATTR_MESSAGE_CONTENT = "message.content";
47
+ OpenInference.ATTR_MESSAGE_CONTENTS = "message.contents";
48
+ OpenInference.ATTR_MESSAGE_FUNCTION_CALL_ARGUMENTS_JSON = "message.function_call_arguments_json";
49
+ OpenInference.ATTR_MESSAGE_FUNCTION_CALL_NAME = "message.function_call_name";
50
+ OpenInference.ATTR_MESSAGE_ROLE = "message.role";
51
+ OpenInference.ATTR_MESSAGE_TOOL_CALLS = "message.tool_calls";
52
+ // Message content attributes
53
+ OpenInference.ATTR_MESSAGE_CONTENT_TYPE = "messagecontent.type";
54
+ OpenInference.ATTR_MESSAGE_CONTENT_TEXT = "messagecontent.text";
55
+ OpenInference.ATTR_MESSAGE_CONTENT_IMAGE = "messagecontent.image";
56
+ // Metadata attribute
57
+ OpenInference.ATTR_METADATA = "metadata";
58
+ // Output attributes
59
+ OpenInference.ATTR_OUTPUT_MIME_TYPE = "output.mime_type";
60
+ OpenInference.ATTR_OUTPUT_VALUE = "output.value";
61
+ // Reranker attributes
62
+ OpenInference.ATTR_RERANKER_INPUT_DOCUMENTS = "reranker.input_documents";
63
+ OpenInference.ATTR_RERANKER_MODEL_NAME = "reranker.model_name";
64
+ OpenInference.ATTR_RERANKER_OUTPUT_DOCUMENTS = "reranker.output_documents";
65
+ OpenInference.ATTR_RERANKER_QUERY = "reranker.query";
66
+ OpenInference.ATTR_RERANKER_TOP_K = "reranker.top_k";
67
+ // Retrieval attribute
68
+ OpenInference.ATTR_RETRIEVAL_DOCUMENTS = "retrieval.documents";
69
+ // Session attribute
70
+ OpenInference.ATTR_SESSION_ID = "session.id";
71
+ // Tag attribute
72
+ OpenInference.ATTR_TAG_TAGS = "tag.tags";
73
+ // Tool attributes
74
+ OpenInference.ATTR_TOOL_DESCRIPTION = "tool.description";
75
+ OpenInference.ATTR_TOOL_JSON_SCHEMA = "tool.json_schema";
76
+ OpenInference.ATTR_TOOL_NAME = "tool.name";
77
+ OpenInference.ATTR_TOOL_PARAMETERS = "tool.parameters";
78
+ // Tool call attributes
79
+ OpenInference.ATTR_TOOL_CALL_FUNCTION_ARGUMENTS = "tool_call.function.arguments";
80
+ OpenInference.ATTR_TOOL_CALL_FUNCTION_NAME = "tool_call.function.name";
81
+ // User attribute
82
+ OpenInference.ATTR_USER_ID = "user.id";
83
+ return OpenInference;
84
+ }());
85
+ exports.default = OpenInference;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The open inference span kind as per
3
+ * https://github.com/Arize-ai/openinference/blob/main/spec/traces.md#span-kind
4
+ */
5
+ export declare enum OpenInferenceSpanKind {
6
+ CHAIN = "CHAIN",
7
+ RETRIEVER = "RETRIEVER",
8
+ RERANKER = "RERANKER",
9
+ LLM = "LLM",
10
+ EMBEDDING = "EMBEDDING",
11
+ TOOL = "TOOL",
12
+ GUARDRAIL = "GUARDRAIL",
13
+ EVALUATOR = "EVALUATOR"
14
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpenInferenceSpanKind = void 0;
4
+ /**
5
+ * The open inference span kind as per
6
+ * https://github.com/Arize-ai/openinference/blob/main/spec/traces.md#span-kind
7
+ */
8
+ var OpenInferenceSpanKind;
9
+ (function (OpenInferenceSpanKind) {
10
+ OpenInferenceSpanKind["CHAIN"] = "CHAIN";
11
+ OpenInferenceSpanKind["RETRIEVER"] = "RETRIEVER";
12
+ OpenInferenceSpanKind["RERANKER"] = "RERANKER";
13
+ OpenInferenceSpanKind["LLM"] = "LLM";
14
+ OpenInferenceSpanKind["EMBEDDING"] = "EMBEDDING";
15
+ OpenInferenceSpanKind["TOOL"] = "TOOL";
16
+ OpenInferenceSpanKind["GUARDRAIL"] = "GUARDRAIL";
17
+ OpenInferenceSpanKind["EVALUATOR"] = "EVALUATOR";
18
+ })(OpenInferenceSpanKind || (exports.OpenInferenceSpanKind = OpenInferenceSpanKind = {}));
package/dist/index.d.ts CHANGED
@@ -14,6 +14,10 @@ import { createArvoContractLibrary } from './ArvoContractLibrary/helpers';
14
14
  import ArvoEventFactory from './ArvoEventFactory';
15
15
  import { createArvoEventFactory } from './ArvoEventFactory/helpers';
16
16
  import { ArvoErrorSchema } from './schema';
17
+ import OpenInference from './OpenTelemetry/OpenInference';
18
+ import ArvoExecution from './OpenTelemetry/ArvoExecution';
19
+ import { ArvoExecutionSpanKind } from './OpenTelemetry/ArvoExecution/types';
20
+ import { OpenInferenceSpanKind } from './OpenTelemetry/OpenInference/types';
17
21
  /**
18
22
  * Collection of Zod schemas for validating various aspects of Arvo events.
19
23
  * @property {z.ZodObject} CloudEventContextSchema - Schema for core CloudEvent properties.
@@ -80,4 +84,4 @@ declare const ArvoEventSchemas: {
80
84
  tracestate: string | null;
81
85
  }>;
82
86
  };
83
- export { ArvoEvent, createArvoEvent, ArvoDataContentType, ArvoEventData, CloudEventExtension, ArvoEventSchemas, CloudEventContext, ArvoExtension, OpenTelemetryExtension, CreateArvoEvent, exceptionToSpan, logToSpan, OpenTelemetryHeaders, TelemetryLogLevel, OTelNull, validateURI, cleanString, ArvoContract, createArvoContract, ArvoContractValidators, ArvoContractRecord, InferArvoContract, IArvoContract, ResolveArvoContractRecord, ArvoContractLibrary, createArvoContractLibrary, ArvoEventFactory, createArvoEventFactory, ArvoErrorSchema, currentOpenTelemetryHeaders, };
87
+ export { ArvoEvent, createArvoEvent, ArvoDataContentType, ArvoEventData, CloudEventExtension, ArvoEventSchemas, CloudEventContext, ArvoExtension, OpenTelemetryExtension, CreateArvoEvent, exceptionToSpan, logToSpan, OpenTelemetryHeaders, TelemetryLogLevel, OTelNull, validateURI, cleanString, ArvoContract, createArvoContract, ArvoContractValidators, ArvoContractRecord, InferArvoContract, IArvoContract, ResolveArvoContractRecord, ArvoContractLibrary, createArvoContractLibrary, ArvoEventFactory, createArvoEventFactory, ArvoErrorSchema, currentOpenTelemetryHeaders, OpenInference, OpenInferenceSpanKind, ArvoExecution, ArvoExecutionSpanKind, };
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.currentOpenTelemetryHeaders = exports.ArvoErrorSchema = exports.createArvoEventFactory = exports.ArvoEventFactory = exports.createArvoContractLibrary = exports.ArvoContractLibrary = exports.ArvoContractValidators = exports.createArvoContract = exports.ArvoContract = exports.cleanString = exports.validateURI = exports.OTelNull = exports.logToSpan = exports.exceptionToSpan = exports.ArvoEventSchemas = exports.ArvoDataContentType = exports.createArvoEvent = exports.ArvoEvent = void 0;
6
+ exports.ArvoExecutionSpanKind = exports.ArvoExecution = exports.OpenInferenceSpanKind = exports.OpenInference = exports.currentOpenTelemetryHeaders = exports.ArvoErrorSchema = exports.createArvoEventFactory = exports.ArvoEventFactory = exports.createArvoContractLibrary = exports.ArvoContractLibrary = exports.ArvoContractValidators = exports.createArvoContract = exports.ArvoContract = exports.cleanString = exports.validateURI = exports.OTelNull = exports.logToSpan = exports.exceptionToSpan = exports.ArvoEventSchemas = exports.ArvoDataContentType = exports.createArvoEvent = exports.ArvoEvent = void 0;
7
7
  var ArvoEvent_1 = __importDefault(require("./ArvoEvent"));
8
8
  exports.ArvoEvent = ArvoEvent_1.default;
9
9
  var schema_1 = require("./ArvoEvent/schema");
@@ -34,6 +34,14 @@ var helpers_4 = require("./ArvoEventFactory/helpers");
34
34
  Object.defineProperty(exports, "createArvoEventFactory", { enumerable: true, get: function () { return helpers_4.createArvoEventFactory; } });
35
35
  var schema_2 = require("./schema");
36
36
  Object.defineProperty(exports, "ArvoErrorSchema", { enumerable: true, get: function () { return schema_2.ArvoErrorSchema; } });
37
+ var OpenInference_1 = __importDefault(require("./OpenTelemetry/OpenInference"));
38
+ exports.OpenInference = OpenInference_1.default;
39
+ var ArvoExecution_1 = __importDefault(require("./OpenTelemetry/ArvoExecution"));
40
+ exports.ArvoExecution = ArvoExecution_1.default;
41
+ var types_1 = require("./OpenTelemetry/ArvoExecution/types");
42
+ Object.defineProperty(exports, "ArvoExecutionSpanKind", { enumerable: true, get: function () { return types_1.ArvoExecutionSpanKind; } });
43
+ var types_2 = require("./OpenTelemetry/OpenInference/types");
44
+ Object.defineProperty(exports, "OpenInferenceSpanKind", { enumerable: true, get: function () { return types_2.OpenInferenceSpanKind; } });
37
45
  /**
38
46
  * Collection of Zod schemas for validating various aspects of Arvo events.
39
47
  * @property {z.ZodObject} CloudEventContextSchema - Schema for core CloudEvent properties.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arvo-core",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "description": "This core package contains all the core classes and components of the Arvo Event Driven System",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {