UNPKG

arvo-core

Version:

The core Arvo package which provides application tier core primitives and contract system for building production-grade event-driven application. Provides ArvoEvent (CloudEvents-compliant), ArvoContract for type-safe service interfaces, event factories, O

103 lines (102 loc) 5.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OpenInferenceSpanKind = exports.OpenInference = void 0; /** * OpenInference class containing attribute constants for OpenTelemetry OpenInference. * These attribute names are defined as per the OpenInference specification: * @see https://github.com/Arize-ai/openinference/blob/main/spec/semantic_conventions.md */ // biome-ignore lint/complexity/noStaticOnlyClass: This needs to be a static class to group methods together var OpenInference = /** @class */ (function () { function OpenInference() { } OpenInference.ATTR_SPAN_KIND = 'openinference.span.kind'; // Document attributes OpenInference.ATTR_DOCUMENT_CONTENT = 'document.content'; OpenInference.ATTR_DOCUMENT_ID = 'document.id'; OpenInference.ATTR_DOCUMENT_METADATA = 'document.metadata'; OpenInference.ATTR_DOCUMENT_SCORE = 'document.score'; // Embedding attributes OpenInference.ATTR_EMBEDDING_EMBEDDINGS = 'embedding.embeddings'; OpenInference.ATTR_EMBEDDING_MODEL_NAME = 'embedding.model_name'; OpenInference.ATTR_EMBEDDING_TEXT = 'embedding.text'; OpenInference.ATTR_EMBEDDING_VECTOR = 'embedding.vector'; // Exception attributes OpenInference.ATTR_EXCEPTION_ESCAPED = 'exception.escaped'; OpenInference.ATTR_EXCEPTION_MESSAGE = 'exception.message'; OpenInference.ATTR_EXCEPTION_STACKTRACE = 'exception.stacktrace'; OpenInference.ATTR_EXCEPTION_TYPE = 'exception.type'; // Image attribute OpenInference.ATTR_IMAGE_URL = 'image.url'; // Input attributes OpenInference.ATTR_INPUT_MIME_TYPE = 'input.mime_type'; OpenInference.ATTR_INPUT_VALUE = 'input.value'; // LLM attributes OpenInference.ATTR_LLM_FUNCTION_CALL = 'llm.function_call'; OpenInference.ATTR_LLM_INPUT_MESSAGES = 'llm.input_messages'; OpenInference.ATTR_LLM_INVOCATION_PARAMETERS = 'llm.invocation_parameters'; OpenInference.ATTR_LLM_MODEL_NAME = 'llm.model_name'; OpenInference.ATTR_LLM_OUTPUT_MESSAGES = 'llm.output_messages'; OpenInference.ATTR_LLM_PROMPT_TEMPLATE_TEMPLATE = 'llm.prompt_template.template'; OpenInference.ATTR_LLM_PROMPT_TEMPLATE_VARIABLES = 'llm.prompt_template.variables'; OpenInference.ATTR_LLM_PROMPT_TEMPLATE_VERSION = 'llm.prompt_template.version'; OpenInference.ATTR_LLM_TOKEN_COUNT_COMPLETION = 'llm.token_count.completion'; OpenInference.ATTR_LLM_TOKEN_COUNT_PROMPT = 'llm.token_count.prompt'; OpenInference.ATTR_LLM_TOKEN_COUNT_TOTAL = 'llm.token_count.total'; OpenInference.ATTR_LLM_TOOLS = 'llm.tools'; // Message attributes OpenInference.ATTR_MESSAGE_CONTENT = 'message.content'; OpenInference.ATTR_MESSAGE_CONTENTS = 'message.contents'; OpenInference.ATTR_MESSAGE_FUNCTION_CALL_ARGUMENTS_JSON = 'message.function_call_arguments_json'; OpenInference.ATTR_MESSAGE_FUNCTION_CALL_NAME = 'message.function_call_name'; OpenInference.ATTR_MESSAGE_ROLE = 'message.role'; OpenInference.ATTR_MESSAGE_TOOL_CALLS = 'message.tool_calls'; // Message content attributes OpenInference.ATTR_MESSAGE_CONTENT_TYPE = 'messagecontent.type'; OpenInference.ATTR_MESSAGE_CONTENT_TEXT = 'messagecontent.text'; OpenInference.ATTR_MESSAGE_CONTENT_IMAGE = 'messagecontent.image'; // Metadata attribute OpenInference.ATTR_METADATA = 'metadata'; // Output attributes OpenInference.ATTR_OUTPUT_MIME_TYPE = 'output.mime_type'; OpenInference.ATTR_OUTPUT_VALUE = 'output.value'; // Reranker attributes OpenInference.ATTR_RERANKER_INPUT_DOCUMENTS = 'reranker.input_documents'; OpenInference.ATTR_RERANKER_MODEL_NAME = 'reranker.model_name'; OpenInference.ATTR_RERANKER_OUTPUT_DOCUMENTS = 'reranker.output_documents'; OpenInference.ATTR_RERANKER_QUERY = 'reranker.query'; OpenInference.ATTR_RERANKER_TOP_K = 'reranker.top_k'; // Retrieval attribute OpenInference.ATTR_RETRIEVAL_DOCUMENTS = 'retrieval.documents'; // Session attribute OpenInference.ATTR_SESSION_ID = 'session.id'; // Tag attribute OpenInference.ATTR_TAG_TAGS = 'tag.tags'; // Tool attributes OpenInference.ATTR_TOOL_DESCRIPTION = 'tool.description'; OpenInference.ATTR_TOOL_JSON_SCHEMA = 'tool.json_schema'; OpenInference.ATTR_TOOL_NAME = 'tool.name'; OpenInference.ATTR_TOOL_PARAMETERS = 'tool.parameters'; // Tool call attributes OpenInference.ATTR_TOOL_CALL_FUNCTION_ARGUMENTS = 'tool_call.function.arguments'; OpenInference.ATTR_TOOL_CALL_FUNCTION_NAME = 'tool_call.function.name'; // User attribute OpenInference.ATTR_USER_ID = 'user.id'; return OpenInference; }()); exports.OpenInference = OpenInference; /** * The open inference span kind as per * https://github.com/Arize-ai/openinference/blob/main/spec/traces.md#span-kind */ exports.OpenInferenceSpanKind = { CHAIN: 'CHAIN', RETRIEVER: 'RETRIEVER', RERANKER: 'RERANKER', LLM: 'LLM', EMBEDDING: 'EMBEDDING', TOOL: 'TOOL', GUARDRAIL: 'GUARDRAIL', EVALUATOR: 'EVALUATOR', INTERNAL: 'INTERNAL', };