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.
- package/README.md +1 -1
- package/dist/config.d.ts +12 -4
- package/dist/config.js +7 -17
- package/dist/config.js.map +1 -1
- package/dist/evals/llm/anthropic.js +10 -6
- package/dist/evals/llm/anthropic.js.map +1 -1
- package/dist/evals/llm/openai.js +9 -5
- package/dist/evals/llm/openai.js.map +1 -1
- package/dist/features/vault.js +1 -1
- package/dist/features/vault.js.map +1 -1
- package/dist/helpers.d.ts +93 -1
- package/dist/helpers.js +271 -8
- package/dist/helpers.js.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.js +95 -50
- package/dist/index.js.map +1 -1
- package/dist/instrumentation/__tests__/anthropic-wrapper.test.js +215 -27
- package/dist/instrumentation/__tests__/anthropic-wrapper.test.js.map +1 -1
- package/dist/instrumentation/__tests__/base-wrapper.test.js +19 -23
- package/dist/instrumentation/__tests__/base-wrapper.test.js.map +1 -1
- package/dist/instrumentation/__tests__/bedrock-trace-comparison.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/bedrock-trace-comparison.test.js +422 -0
- package/dist/instrumentation/__tests__/bedrock-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/chroma-trace-comparison.test.js +1 -1
- package/dist/instrumentation/__tests__/chroma-trace-comparison.test.js.map +1 -1
- package/dist/instrumentation/__tests__/cohere-wrapper.test.js +150 -25
- package/dist/instrumentation/__tests__/cohere-wrapper.test.js.map +1 -1
- package/dist/instrumentation/__tests__/google-ai-trace-comparison.test.js +152 -33
- package/dist/instrumentation/__tests__/google-ai-trace-comparison.test.js.map +1 -1
- package/dist/instrumentation/__tests__/groq-trace-comparison.test.js +391 -45
- package/dist/instrumentation/__tests__/groq-trace-comparison.test.js.map +1 -1
- package/dist/instrumentation/__tests__/huggingface-trace-comparison.test.d.ts +2 -2
- package/dist/instrumentation/__tests__/huggingface-trace-comparison.test.js +323 -31
- package/dist/instrumentation/__tests__/huggingface-trace-comparison.test.js.map +1 -1
- package/dist/instrumentation/__tests__/langchain-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/langchain-wrapper.test.js +282 -0
- package/dist/instrumentation/__tests__/langchain-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/milvus-trace-comparison.test.js +1 -1
- package/dist/instrumentation/__tests__/milvus-trace-comparison.test.js.map +1 -1
- package/dist/instrumentation/__tests__/mistral-trace-comparison.test.d.ts +0 -3
- package/dist/instrumentation/__tests__/mistral-trace-comparison.test.js +275 -68
- package/dist/instrumentation/__tests__/mistral-trace-comparison.test.js.map +1 -1
- package/dist/instrumentation/__tests__/openai-wrapper.test.js +7 -9
- package/dist/instrumentation/__tests__/openai-wrapper.test.js.map +1 -1
- package/dist/instrumentation/__tests__/qdrant-trace-comparison.test.js +1 -1
- package/dist/instrumentation/__tests__/qdrant-trace-comparison.test.js.map +1 -1
- package/dist/instrumentation/__tests__/replicate-trace-comparison.test.d.ts +2 -1
- package/dist/instrumentation/__tests__/replicate-trace-comparison.test.js +209 -21
- package/dist/instrumentation/__tests__/replicate-trace-comparison.test.js.map +1 -1
- package/dist/instrumentation/__tests__/together-trace-comparison.test.js +231 -51
- package/dist/instrumentation/__tests__/together-trace-comparison.test.js.map +1 -1
- package/dist/instrumentation/__tests__/vercel-ai-trace-comparison.test.d.ts +8 -0
- package/dist/instrumentation/__tests__/vercel-ai-trace-comparison.test.js +446 -0
- package/dist/instrumentation/__tests__/vercel-ai-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/anthropic/index.d.ts +2 -3
- package/dist/instrumentation/anthropic/index.js.map +1 -1
- package/dist/instrumentation/anthropic/wrapper.d.ts +1 -3
- package/dist/instrumentation/anthropic/wrapper.js +211 -91
- package/dist/instrumentation/anthropic/wrapper.js.map +1 -1
- package/dist/instrumentation/azure-ai-inference/index.d.ts +11 -0
- package/dist/instrumentation/azure-ai-inference/index.js +76 -0
- package/dist/instrumentation/azure-ai-inference/index.js.map +1 -0
- package/dist/instrumentation/azure-ai-inference/wrapper.d.ts +42 -0
- package/dist/instrumentation/azure-ai-inference/wrapper.js +515 -0
- package/dist/instrumentation/azure-ai-inference/wrapper.js.map +1 -0
- package/dist/instrumentation/base-wrapper.d.ts +2 -1
- package/dist/instrumentation/base-wrapper.js +35 -23
- package/dist/instrumentation/base-wrapper.js.map +1 -1
- package/dist/instrumentation/bedrock/wrapper.d.ts +21 -3
- package/dist/instrumentation/bedrock/wrapper.js +318 -265
- package/dist/instrumentation/bedrock/wrapper.js.map +1 -1
- package/dist/instrumentation/chroma/wrapper.js +1 -1
- package/dist/instrumentation/chroma/wrapper.js.map +1 -1
- package/dist/instrumentation/claude-agent-sdk/index.d.ts +23 -0
- package/dist/instrumentation/claude-agent-sdk/index.js +83 -0
- package/dist/instrumentation/claude-agent-sdk/index.js.map +1 -0
- package/dist/instrumentation/claude-agent-sdk/wrapper.d.ts +13 -0
- package/dist/instrumentation/claude-agent-sdk/wrapper.js +1031 -0
- package/dist/instrumentation/claude-agent-sdk/wrapper.js.map +1 -0
- package/dist/instrumentation/cohere/index.d.ts +2 -3
- package/dist/instrumentation/cohere/index.js.map +1 -1
- package/dist/instrumentation/cohere/wrapper.d.ts +1 -1
- package/dist/instrumentation/cohere/wrapper.js +215 -56
- package/dist/instrumentation/cohere/wrapper.js.map +1 -1
- package/dist/instrumentation/cursor-sdk/index.d.ts +21 -0
- package/dist/instrumentation/cursor-sdk/index.js +58 -0
- package/dist/instrumentation/cursor-sdk/index.js.map +1 -0
- package/dist/instrumentation/cursor-sdk/wrapper.d.ts +17 -0
- package/dist/instrumentation/cursor-sdk/wrapper.js +689 -0
- package/dist/instrumentation/cursor-sdk/wrapper.js.map +1 -0
- package/dist/instrumentation/google-adk/index.d.ts +57 -0
- package/dist/instrumentation/google-adk/index.js +371 -0
- package/dist/instrumentation/google-adk/index.js.map +1 -0
- package/dist/instrumentation/google-adk/utils.d.ts +45 -0
- package/dist/instrumentation/google-adk/utils.js +663 -0
- package/dist/instrumentation/google-adk/utils.js.map +1 -0
- package/dist/instrumentation/google-adk/wrapper.d.ts +11 -0
- package/dist/instrumentation/google-adk/wrapper.js +391 -0
- package/dist/instrumentation/google-adk/wrapper.js.map +1 -0
- package/dist/instrumentation/google-ai/wrapper.d.ts +7 -4
- package/dist/instrumentation/google-ai/wrapper.js +197 -61
- package/dist/instrumentation/google-ai/wrapper.js.map +1 -1
- package/dist/instrumentation/groq/wrapper.js +137 -65
- package/dist/instrumentation/groq/wrapper.js.map +1 -1
- package/dist/instrumentation/huggingface/wrapper.js +241 -39
- package/dist/instrumentation/huggingface/wrapper.js.map +1 -1
- package/dist/instrumentation/index.d.ts +2 -2
- package/dist/instrumentation/index.js +66 -6
- package/dist/instrumentation/index.js.map +1 -1
- package/dist/instrumentation/langchain/index.d.ts +0 -7
- package/dist/instrumentation/langchain/index.js +2 -20
- package/dist/instrumentation/langchain/index.js.map +1 -1
- package/dist/instrumentation/langchain/wrapper.d.ts +35 -0
- package/dist/instrumentation/langchain/wrapper.js +1098 -184
- package/dist/instrumentation/langchain/wrapper.js.map +1 -1
- package/dist/instrumentation/langgraph/index.d.ts +12 -0
- package/dist/instrumentation/langgraph/index.js +99 -0
- package/dist/instrumentation/langgraph/index.js.map +1 -0
- package/dist/instrumentation/langgraph/wrapper.d.ts +20 -0
- package/dist/instrumentation/langgraph/wrapper.js +619 -0
- package/dist/instrumentation/langgraph/wrapper.js.map +1 -0
- package/dist/instrumentation/llamaindex/index.d.ts +31 -6
- package/dist/instrumentation/llamaindex/index.js +180 -61
- package/dist/instrumentation/llamaindex/index.js.map +1 -1
- package/dist/instrumentation/llamaindex/wrapper.d.ts +15 -3
- package/dist/instrumentation/llamaindex/wrapper.js +670 -179
- package/dist/instrumentation/llamaindex/wrapper.js.map +1 -1
- package/dist/instrumentation/milvus/wrapper.js +1 -1
- package/dist/instrumentation/milvus/wrapper.js.map +1 -1
- package/dist/instrumentation/mistral/wrapper.js +154 -79
- package/dist/instrumentation/mistral/wrapper.js.map +1 -1
- package/dist/instrumentation/ollama/index.js +33 -4
- package/dist/instrumentation/ollama/index.js.map +1 -1
- package/dist/instrumentation/ollama/wrapper.d.ts +28 -2
- package/dist/instrumentation/ollama/wrapper.js +432 -48
- package/dist/instrumentation/ollama/wrapper.js.map +1 -1
- package/dist/instrumentation/openai/index.d.ts +2 -3
- package/dist/instrumentation/openai/index.js.map +1 -1
- package/dist/instrumentation/openai/wrapper.js +293 -194
- package/dist/instrumentation/openai/wrapper.js.map +1 -1
- package/dist/instrumentation/openai-agents/index.d.ts +20 -0
- package/dist/instrumentation/openai-agents/index.js +174 -0
- package/dist/instrumentation/openai-agents/index.js.map +1 -0
- package/dist/instrumentation/openai-agents/processor.d.ts +35 -0
- package/dist/instrumentation/openai-agents/processor.js +249 -0
- package/dist/instrumentation/openai-agents/processor.js.map +1 -0
- package/dist/instrumentation/openai-agents/utils.d.ts +20 -0
- package/dist/instrumentation/openai-agents/utils.js +624 -0
- package/dist/instrumentation/openai-agents/utils.js.map +1 -0
- package/dist/instrumentation/pinecone/wrapper.js +2 -2
- package/dist/instrumentation/pinecone/wrapper.js.map +1 -1
- package/dist/instrumentation/qdrant/wrapper.js +1 -1
- package/dist/instrumentation/qdrant/wrapper.js.map +1 -1
- package/dist/instrumentation/replicate/wrapper.js +103 -21
- package/dist/instrumentation/replicate/wrapper.js.map +1 -1
- package/dist/instrumentation/strands/index.d.ts +21 -0
- package/dist/instrumentation/strands/index.js +83 -0
- package/dist/instrumentation/strands/index.js.map +1 -0
- package/dist/instrumentation/strands/processor.d.ts +45 -0
- package/dist/instrumentation/strands/processor.js +545 -0
- package/dist/instrumentation/strands/processor.js.map +1 -0
- package/dist/instrumentation/strands/utils.d.ts +24 -0
- package/dist/instrumentation/strands/utils.js +360 -0
- package/dist/instrumentation/strands/utils.js.map +1 -0
- package/dist/instrumentation/together/wrapper.js +125 -51
- package/dist/instrumentation/together/wrapper.js.map +1 -1
- package/dist/instrumentation/vercel-ai/wrapper.d.ts +28 -2
- package/dist/instrumentation/vercel-ai/wrapper.js +314 -164
- package/dist/instrumentation/vercel-ai/wrapper.js.map +1 -1
- package/dist/llm/anthropic.js +10 -6
- package/dist/llm/anthropic.js.map +1 -1
- package/dist/llm/openai.js +9 -5
- package/dist/llm/openai.js.map +1 -1
- package/dist/otel/__tests__/metrics.test.js +16 -27
- package/dist/otel/__tests__/metrics.test.js.map +1 -1
- package/dist/otel/events.d.ts +11 -0
- package/dist/otel/events.js +74 -0
- package/dist/otel/events.js.map +1 -0
- package/dist/otel/metrics.d.ts +5 -6
- package/dist/otel/metrics.js +66 -48
- package/dist/otel/metrics.js.map +1 -1
- package/dist/otel/tracing.d.ts +6 -2
- package/dist/otel/tracing.js +71 -24
- package/dist/otel/tracing.js.map +1 -1
- package/dist/otel/utils.d.ts +11 -0
- package/dist/otel/utils.js +34 -0
- package/dist/otel/utils.js.map +1 -0
- package/dist/semantic-convention.d.ts +49 -5
- package/dist/semantic-convention.js +56 -8
- package/dist/semantic-convention.js.map +1 -1
- package/dist/types.d.ts +58 -22
- package/package.json +41 -9
|
@@ -9,8 +9,9 @@ const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
|
|
|
9
9
|
const semantic_convention_1 = __importDefault(require("../semantic-convention"));
|
|
10
10
|
const api_1 = require("@opentelemetry/api");
|
|
11
11
|
const metrics_1 = __importDefault(require("../otel/metrics"));
|
|
12
|
+
const helpers_1 = require("../helpers");
|
|
12
13
|
class BaseWrapper {
|
|
13
|
-
static setBaseSpanAttributes(span, { genAIEndpoint, model, user, cost, aiSystem, serverAddress, serverPort }) {
|
|
14
|
+
static setBaseSpanAttributes(span, { genAIEndpoint: _genAIEndpoint, model, user, cost, aiSystem, serverAddress, serverPort }) {
|
|
14
15
|
const applicationName = config_1.default.applicationName;
|
|
15
16
|
const environment = config_1.default.environment;
|
|
16
17
|
if (!applicationName) {
|
|
@@ -19,11 +20,10 @@ class BaseWrapper {
|
|
|
19
20
|
if (!environment) {
|
|
20
21
|
throw new Error("[Openlit] OpenlitConfig.environment is not set. Please check your configuration.");
|
|
21
22
|
}
|
|
22
|
-
span.setAttribute(
|
|
23
|
+
span.setAttribute(semantic_conventions_1.ATTR_TELEMETRY_SDK_NAME, constant_1.SDK_NAME);
|
|
23
24
|
span.setAttribute(semantic_convention_1.default.GEN_AI_PROVIDER_NAME_OTEL, aiSystem);
|
|
24
|
-
span.setAttribute(semantic_convention_1.default.
|
|
25
|
-
span.setAttribute(
|
|
26
|
-
span.setAttribute(semantic_convention_1.default.GEN_AI_APPLICATION_NAME, applicationName);
|
|
25
|
+
span.setAttribute(semantic_convention_1.default.ATTR_DEPLOYMENT_ENVIRONMENT, environment);
|
|
26
|
+
span.setAttribute(semantic_conventions_1.ATTR_SERVICE_NAME, applicationName);
|
|
27
27
|
span.setAttribute(semantic_convention_1.default.GEN_AI_REQUEST_MODEL, model);
|
|
28
28
|
span.setAttribute(semantic_convention_1.default.GEN_AI_SDK_VERSION, constant_1.SDK_VERSION);
|
|
29
29
|
if (serverAddress) {
|
|
@@ -38,51 +38,63 @@ class BaseWrapper {
|
|
|
38
38
|
if (cost !== undefined) {
|
|
39
39
|
span.setAttribute(semantic_convention_1.default.GEN_AI_USAGE_COST, cost);
|
|
40
40
|
}
|
|
41
|
+
(0, helpers_1.applyCustomSpanAttributes)(span);
|
|
41
42
|
span.setStatus({ code: api_1.SpanStatusCode.OK });
|
|
42
43
|
}
|
|
43
44
|
static recordMetrics(span, baseAttributes) {
|
|
44
45
|
const applicationName = config_1.default.applicationName;
|
|
45
46
|
const environment = config_1.default.environment;
|
|
46
|
-
const {
|
|
47
|
+
const { model, aiSystem, cost, errorType } = baseAttributes;
|
|
47
48
|
const inputTokens = BaseWrapper.getSpanAttribute(span, semantic_convention_1.default.GEN_AI_USAGE_INPUT_TOKENS);
|
|
48
49
|
const outputTokens = BaseWrapper.getSpanAttribute(span, semantic_convention_1.default.GEN_AI_USAGE_OUTPUT_TOKENS);
|
|
49
50
|
const duration = BaseWrapper.getSpanAttribute(span, 'duration') ?? BaseWrapper.getSpanAttribute(span, semantic_convention_1.default.GEN_AI_DURATION_LEGACY);
|
|
51
|
+
const operationName = BaseWrapper.getSpanAttribute(span, semantic_convention_1.default.GEN_AI_OPERATION);
|
|
52
|
+
const responseModel = BaseWrapper.getSpanAttribute(span, semantic_convention_1.default.GEN_AI_RESPONSE_MODEL);
|
|
53
|
+
const serverAddress = BaseWrapper.getSpanAttribute(span, semantic_convention_1.default.SERVER_ADDRESS);
|
|
54
|
+
const serverPort = BaseWrapper.getSpanAttribute(span, semantic_convention_1.default.SERVER_PORT);
|
|
50
55
|
const attributes = {
|
|
56
|
+
[semantic_conventions_1.ATTR_TELEMETRY_SDK_NAME]: constant_1.SDK_NAME,
|
|
51
57
|
[semantic_conventions_1.ATTR_SERVICE_NAME]: applicationName,
|
|
52
|
-
[semantic_convention_1.default.GEN_AI_PROVIDER_NAME]: aiSystem,
|
|
53
|
-
[semantic_convention_1.default.GEN_AI_PROVIDER_NAME_OTEL]: aiSystem,
|
|
54
|
-
[semantic_convention_1.default.GEN_AI_ENDPOINT]: genAIEndpoint,
|
|
55
58
|
[semantic_convention_1.default.ATTR_DEPLOYMENT_ENVIRONMENT]: environment,
|
|
59
|
+
[semantic_convention_1.default.GEN_AI_PROVIDER_NAME_OTEL]: aiSystem,
|
|
56
60
|
[semantic_convention_1.default.GEN_AI_REQUEST_MODEL]: model,
|
|
57
|
-
[semantic_convention_1.default.GEN_AI_REQUEST_USER]: typeof user === 'string' || typeof user === 'number' ? user : String(user ?? ''),
|
|
58
61
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
if (operationName)
|
|
63
|
+
attributes[semantic_convention_1.default.GEN_AI_OPERATION] = operationName;
|
|
64
|
+
if (responseModel)
|
|
65
|
+
attributes[semantic_convention_1.default.GEN_AI_RESPONSE_MODEL] = responseModel;
|
|
66
|
+
if (serverAddress)
|
|
67
|
+
attributes[semantic_convention_1.default.SERVER_ADDRESS] = serverAddress;
|
|
68
|
+
if (serverPort !== undefined)
|
|
69
|
+
attributes[semantic_convention_1.default.SERVER_PORT] = serverPort;
|
|
70
|
+
if (errorType)
|
|
71
|
+
attributes[semantic_convention_1.default.ERROR_TYPE] = errorType;
|
|
72
|
+
if (Number.isFinite(inputTokens)) {
|
|
73
|
+
metrics_1.default.genaiClientUsageTokens?.record(inputTokens, {
|
|
74
|
+
...attributes,
|
|
75
|
+
[semantic_convention_1.default.GEN_AI_TOKEN_TYPE]: semantic_convention_1.default.GEN_AI_TOKEN_TYPE_INPUT,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
if (Number.isFinite(outputTokens)) {
|
|
79
|
+
metrics_1.default.genaiClientUsageTokens?.record(outputTokens, {
|
|
80
|
+
...attributes,
|
|
81
|
+
[semantic_convention_1.default.GEN_AI_TOKEN_TYPE]: semantic_convention_1.default.GEN_AI_TOKEN_TYPE_OUTPUT,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
64
84
|
if (Number.isFinite(duration)) {
|
|
65
85
|
metrics_1.default.genaiClientOperationDuration?.record(duration / 1e9, attributes);
|
|
66
86
|
}
|
|
67
|
-
const totalTokens = (Number.isFinite(inputTokens) ? inputTokens : 0) + (Number.isFinite(outputTokens) ? outputTokens : 0);
|
|
68
|
-
if (totalTokens > 0)
|
|
69
|
-
metrics_1.default.genaiClientUsageTokens?.record(totalTokens, attributes);
|
|
70
|
-
const reasoningTokens = BaseWrapper.getSpanAttribute(span, semantic_convention_1.default.GEN_AI_USAGE_REASONING_TOKENS);
|
|
71
|
-
if (Number.isFinite(reasoningTokens))
|
|
72
|
-
metrics_1.default.genaiReasoningTokens?.add(reasoningTokens, attributes);
|
|
73
87
|
const tbt = BaseWrapper.getSpanAttribute(span, semantic_convention_1.default.GEN_AI_SERVER_TBT);
|
|
74
88
|
if (Number.isFinite(tbt))
|
|
75
89
|
metrics_1.default.genaiServerTbt?.record(tbt, attributes);
|
|
76
90
|
const ttft = BaseWrapper.getSpanAttribute(span, semantic_convention_1.default.GEN_AI_SERVER_TTFT);
|
|
77
91
|
if (Number.isFinite(ttft))
|
|
78
92
|
metrics_1.default.genaiServerTtft?.record(ttft, attributes);
|
|
79
|
-
// Client-perspective streaming metrics (OTel semconv v1.29+)
|
|
80
93
|
if (Number.isFinite(ttft) && ttft > 0) {
|
|
81
94
|
metrics_1.default.genaiClientTimeToFirstChunk?.record(ttft, attributes);
|
|
82
95
|
}
|
|
83
96
|
if (Number.isFinite(tbt) && tbt > 0) {
|
|
84
97
|
metrics_1.default.genaiClientTimePerOutputChunk?.record(tbt, attributes);
|
|
85
|
-
// Server request duration = TTFT + TBT * max(output_tokens - 1, 0)
|
|
86
98
|
const outputTokensVal = Number.isFinite(outputTokens) ? outputTokens : 0;
|
|
87
99
|
const serverRequestDuration = ttft + tbt * Math.max(outputTokensVal - 1, 0);
|
|
88
100
|
metrics_1.default.genaiServerRequestDuration?.record(serverRequestDuration, attributes);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-wrapper.js","sourceRoot":"","sources":["../../src/instrumentation/base-wrapper.ts"],"names":[],"mappings":";;;;;AAAA,uDAAsC;AACtC,0CAAoD;AACpD,
|
|
1
|
+
{"version":3,"file":"base-wrapper.js","sourceRoot":"","sources":["../../src/instrumentation/base-wrapper.ts"],"names":[],"mappings":";;;;;AAAA,uDAAsC;AACtC,0CAAoD;AACpD,8EAAiG;AACjG,iFAAwD;AACxD,4CAAsE;AACtE,8DAAsC;AACtC,wCAAuD;AAavD,MAAqB,WAAW;IAC9B,MAAM,CAAC,qBAAqB,CAC1B,IAAU,EACV,EAAE,aAAa,EAAE,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAsB;QAE7G,MAAM,eAAe,GAAG,gBAAa,CAAC,eAAe,CAAC;QACtD,MAAM,WAAW,GA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C,IAAI,GAAG,GAAG,KAAK,EAAE,CAAC;oBAChB,OAAO,GAAG,GAAG,KAAK,CAAC;gBACrB,CAAC;YACH,CAAC;YACD,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,4FAA4F;QAC5F,OAAO,OAAO,IAAI,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAChF,CAAC;CACF;AAtID,8BAsIC"}
|
|
@@ -1,10 +1,28 @@
|
|
|
1
|
-
import { Tracer } from '@opentelemetry/api';
|
|
2
|
-
import BaseWrapper from '../base-wrapper';
|
|
1
|
+
import { Span, Tracer } from '@opentelemetry/api';
|
|
2
|
+
import BaseWrapper, { BaseSpanAttributes } from '../base-wrapper';
|
|
3
3
|
declare class BedrockWrapper extends BaseWrapper {
|
|
4
4
|
static aiSystem: string;
|
|
5
|
+
static serverAddress: string;
|
|
6
|
+
static serverPort: number;
|
|
5
7
|
static _patchSend(tracer: Tracer): any;
|
|
6
8
|
static _handleConverseCommand(tracer: Tracer, originalMethod: any, instance: any, args: any[]): Promise<any>;
|
|
9
|
+
static _converseComplete({ input, genAIEndpoint, response, span, modelId, }: {
|
|
10
|
+
input: any;
|
|
11
|
+
genAIEndpoint: string;
|
|
12
|
+
response: any;
|
|
13
|
+
span: Span;
|
|
14
|
+
modelId: string;
|
|
15
|
+
}): Promise<any>;
|
|
7
16
|
static _handleConverseStreamCommand(tracer: Tracer, originalMethod: any, instance: any, args: any[]): Promise<any>;
|
|
8
|
-
static
|
|
17
|
+
static _converseCommonSetter({ input, genAIEndpoint, result, span, modelId, isStream, ttft, tbt, }: {
|
|
18
|
+
input: any;
|
|
19
|
+
genAIEndpoint: string;
|
|
20
|
+
result: any;
|
|
21
|
+
span: Span;
|
|
22
|
+
modelId: string;
|
|
23
|
+
isStream: boolean;
|
|
24
|
+
ttft?: number;
|
|
25
|
+
tbt?: number;
|
|
26
|
+
}): BaseSpanAttributes;
|
|
9
27
|
}
|
|
10
28
|
export default BedrockWrapper;
|