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
|
@@ -6,55 +6,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const api_1 = require("@opentelemetry/api");
|
|
9
10
|
const wrapper_1 = __importDefault(require("../together/wrapper"));
|
|
10
11
|
const config_1 = __importDefault(require("../../config"));
|
|
11
12
|
const helpers_1 = __importDefault(require("../../helpers"));
|
|
12
13
|
const base_wrapper_1 = __importDefault(require("../base-wrapper"));
|
|
13
14
|
const semantic_convention_1 = __importDefault(require("../../semantic-convention"));
|
|
14
|
-
jest.mock('
|
|
15
|
-
jest.mock('
|
|
16
|
-
jest.mock('
|
|
15
|
+
jest.mock('../../../src/config');
|
|
16
|
+
jest.mock('../../../src/helpers');
|
|
17
|
+
jest.mock('../../../src/instrumentation/base-wrapper');
|
|
18
|
+
const mockTracer = api_1.trace.getTracer('test-tracer');
|
|
17
19
|
describe('Together AI Cross-Language Trace Comparison', () => {
|
|
18
|
-
let
|
|
20
|
+
let span;
|
|
19
21
|
beforeEach(() => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
end: jest.fn(),
|
|
25
|
-
setStatus: jest.fn(),
|
|
26
|
-
};
|
|
27
|
-
// Mock OpenlitConfig
|
|
22
|
+
span = mockTracer.startSpan('test-span');
|
|
23
|
+
span.setAttribute = jest.fn();
|
|
24
|
+
span.addEvent = jest.fn();
|
|
25
|
+
jest.clearAllMocks();
|
|
28
26
|
config_1.default.environment = 'openlit-testing';
|
|
29
27
|
config_1.default.applicationName = 'openlit-test';
|
|
30
|
-
config_1.default.
|
|
31
|
-
config_1.default.
|
|
32
|
-
config_1.default.
|
|
33
|
-
// Mock OpenLitHelper
|
|
34
|
-
helpers_1.default.getChatModelCost = jest.fn().mockReturnValue(0.001);
|
|
35
|
-
helpers_1.default.openaiTokens = jest.fn().mockReturnValue(5);
|
|
36
|
-
helpers_1.default.handleException = jest.fn();
|
|
37
|
-
helpers_1.default.createStreamProxy = jest.fn().mockImplementation((stream, generator) => stream);
|
|
38
|
-
// Mock BaseWrapper
|
|
39
|
-
base_wrapper_1.default.recordMetrics = jest.fn();
|
|
40
|
-
base_wrapper_1.default.setBaseSpanAttributes = jest.fn().mockImplementation((span, attrs) => {
|
|
41
|
-
span.setAttribute(semantic_convention_1.default.GEN_AI_PROVIDER_NAME, attrs.aiSystem);
|
|
42
|
-
span.setAttribute(semantic_convention_1.default.GEN_AI_ENDPOINT, attrs.genAIEndpoint);
|
|
43
|
-
span.setAttribute(semantic_convention_1.default.GEN_AI_REQUEST_MODEL, attrs.model);
|
|
44
|
-
if (attrs.cost !== undefined) {
|
|
45
|
-
span.setAttribute(semantic_convention_1.default.GEN_AI_USAGE_COST, attrs.cost);
|
|
46
|
-
}
|
|
47
|
-
if (attrs.serverAddress) {
|
|
48
|
-
span.setAttribute(semantic_convention_1.default.SERVER_ADDRESS, attrs.serverAddress);
|
|
49
|
-
}
|
|
50
|
-
if (attrs.serverPort !== undefined) {
|
|
51
|
-
span.setAttribute(semantic_convention_1.default.SERVER_PORT, attrs.serverPort);
|
|
52
|
-
}
|
|
53
|
-
span.setAttribute(semantic_convention_1.default.GEN_AI_SDK_VERSION, '1.9.0');
|
|
54
|
-
});
|
|
28
|
+
config_1.default.captureMessageContent = true;
|
|
29
|
+
config_1.default.pricingInfo = {};
|
|
30
|
+
config_1.default.disableEvents = false;
|
|
55
31
|
});
|
|
56
32
|
afterEach(() => {
|
|
57
|
-
|
|
33
|
+
span.end();
|
|
58
34
|
});
|
|
59
35
|
describe('Chat Completion Trace Consistency', () => {
|
|
60
36
|
it('should set same attributes as Python SDK', async () => {
|
|
@@ -85,24 +61,228 @@ describe('Together AI Cross-Language Trace Comparison', () => {
|
|
|
85
61
|
total_tokens: 21,
|
|
86
62
|
},
|
|
87
63
|
};
|
|
64
|
+
jest.spyOn(helpers_1.default, 'getChatModelCost').mockReturnValue(0.001);
|
|
88
65
|
await wrapper_1.default._chatCompletion({
|
|
89
66
|
args: mockArgs,
|
|
90
67
|
genAIEndpoint: 'together.chat.completions',
|
|
91
68
|
response: mockResponse,
|
|
92
|
-
span
|
|
69
|
+
span,
|
|
70
|
+
});
|
|
71
|
+
// setBaseSpanAttributes is mocked; verify it was called with Together-specific params
|
|
72
|
+
expect(base_wrapper_1.default.setBaseSpanAttributes).toHaveBeenCalledWith(span, expect.objectContaining({
|
|
73
|
+
model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
|
|
74
|
+
aiSystem: 'together',
|
|
75
|
+
serverAddress: 'api.together.xyz',
|
|
76
|
+
serverPort: 443,
|
|
77
|
+
}));
|
|
78
|
+
expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_RESPONSE_MODEL, 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo');
|
|
79
|
+
expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_USAGE_INPUT_TOKENS, 9);
|
|
80
|
+
expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_USAGE_OUTPUT_TOKENS, 12);
|
|
81
|
+
expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_RESPONSE_ID, 'together-test-id');
|
|
82
|
+
expect(span.setAttribute).not.toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_USAGE_TOTAL_TOKENS, expect.anything());
|
|
83
|
+
expect(span.setAttribute).not.toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_CLIENT_TOKEN_USAGE, expect.anything());
|
|
84
|
+
});
|
|
85
|
+
it('should set request parameters correctly with no sentinel values', async () => {
|
|
86
|
+
const mockArgs = [
|
|
87
|
+
{
|
|
88
|
+
model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
|
|
89
|
+
messages: [{ role: 'user', content: 'test message' }],
|
|
90
|
+
max_tokens: 100,
|
|
91
|
+
temperature: 0.7,
|
|
92
|
+
top_p: 0.9,
|
|
93
|
+
presence_penalty: 0.5,
|
|
94
|
+
frequency_penalty: 0.3,
|
|
95
|
+
seed: 42,
|
|
96
|
+
stream: false,
|
|
97
|
+
stop: ['STOP'],
|
|
98
|
+
n: 2,
|
|
99
|
+
},
|
|
100
|
+
];
|
|
101
|
+
const mockResult = {
|
|
102
|
+
id: 'test-123',
|
|
103
|
+
model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
|
|
104
|
+
usage: { prompt_tokens: 10, completion_tokens: 20, total_tokens: 30 },
|
|
105
|
+
choices: [
|
|
106
|
+
{
|
|
107
|
+
message: { content: 'response text', role: 'assistant' },
|
|
108
|
+
finish_reason: 'stop',
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
};
|
|
112
|
+
jest.spyOn(helpers_1.default, 'getChatModelCost').mockReturnValue(0.5);
|
|
113
|
+
const metricParams = await wrapper_1.default._chatCompletionCommonSetter({
|
|
114
|
+
args: mockArgs,
|
|
115
|
+
genAIEndpoint: 'together.chat.completions',
|
|
116
|
+
result: mockResult,
|
|
117
|
+
span,
|
|
118
|
+
});
|
|
119
|
+
expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_TOP_P, 0.9);
|
|
120
|
+
expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_MAX_TOKENS, 100);
|
|
121
|
+
expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_TEMPERATURE, 0.7);
|
|
122
|
+
expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_PRESENCE_PENALTY, 0.5);
|
|
123
|
+
expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_FREQUENCY_PENALTY, 0.3);
|
|
124
|
+
expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_SEED, 42);
|
|
125
|
+
expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_IS_STREAM, false);
|
|
126
|
+
expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_STOP_SEQUENCES, ['STOP']);
|
|
127
|
+
expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_CHOICE_COUNT, 2);
|
|
128
|
+
expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_RESPONSE_FINISH_REASON, ['stop']);
|
|
129
|
+
expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_OUTPUT_TYPE, 'text');
|
|
130
|
+
expect(metricParams).toEqual({
|
|
131
|
+
genAIEndpoint: 'together.chat.completions',
|
|
132
|
+
model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
|
|
133
|
+
user: undefined,
|
|
134
|
+
cost: 0.5,
|
|
135
|
+
aiSystem: 'together',
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
it('should not set sentinel values for optional attributes', async () => {
|
|
139
|
+
const mockArgs = [
|
|
140
|
+
{
|
|
141
|
+
model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
|
|
142
|
+
messages: [{ role: 'user', content: 'test' }],
|
|
143
|
+
stream: false,
|
|
144
|
+
},
|
|
145
|
+
];
|
|
146
|
+
const mockResult = {
|
|
147
|
+
id: 'test-123',
|
|
148
|
+
model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
|
|
149
|
+
usage: { prompt_tokens: 5, completion_tokens: 10, total_tokens: 15 },
|
|
150
|
+
choices: [
|
|
151
|
+
{
|
|
152
|
+
message: { content: 'response', role: 'assistant' },
|
|
153
|
+
finish_reason: 'stop',
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
};
|
|
157
|
+
jest.spyOn(helpers_1.default, 'getChatModelCost').mockReturnValue(0);
|
|
158
|
+
await wrapper_1.default._chatCompletionCommonSetter({
|
|
159
|
+
args: mockArgs,
|
|
160
|
+
genAIEndpoint: 'together.chat.completions',
|
|
161
|
+
result: mockResult,
|
|
162
|
+
span,
|
|
163
|
+
});
|
|
164
|
+
expect(span.setAttribute).not.toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_MAX_TOKENS, -1);
|
|
165
|
+
expect(span.setAttribute).not.toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_MAX_TOKENS, 0);
|
|
166
|
+
expect(span.setAttribute).not.toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_SEED, 0);
|
|
167
|
+
expect(span.setAttribute).not.toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_SEED, '');
|
|
168
|
+
expect(span.setAttribute).not.toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_PRESENCE_PENALTY, 0);
|
|
169
|
+
expect(span.setAttribute).not.toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_FREQUENCY_PENALTY, 0);
|
|
170
|
+
expect(span.setAttribute).not.toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_CHOICE_COUNT, 1);
|
|
171
|
+
});
|
|
172
|
+
it('should handle tool calls properly', async () => {
|
|
173
|
+
const mockArgs = [
|
|
174
|
+
{
|
|
175
|
+
messages: [{ role: 'user', content: 'test message' }],
|
|
176
|
+
model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
|
|
177
|
+
tools: [{ type: 'function', function: { name: 'get_weather' } }],
|
|
178
|
+
stream: false,
|
|
179
|
+
},
|
|
180
|
+
];
|
|
181
|
+
const mockResult = {
|
|
182
|
+
id: '123',
|
|
183
|
+
model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
|
|
184
|
+
usage: { prompt_tokens: 10, completion_tokens: 20, total_tokens: 30 },
|
|
185
|
+
choices: [
|
|
186
|
+
{
|
|
187
|
+
message: {
|
|
188
|
+
content: null,
|
|
189
|
+
role: 'assistant',
|
|
190
|
+
tool_calls: [
|
|
191
|
+
{
|
|
192
|
+
id: 'call_123',
|
|
193
|
+
type: 'function',
|
|
194
|
+
function: { name: 'get_weather', arguments: '{"location":"SF"}' },
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
},
|
|
198
|
+
finish_reason: 'tool_calls',
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
};
|
|
202
|
+
jest.spyOn(helpers_1.default, 'getChatModelCost').mockReturnValue(0.5);
|
|
203
|
+
await wrapper_1.default._chatCompletionCommonSetter({
|
|
204
|
+
args: mockArgs,
|
|
205
|
+
genAIEndpoint: 'together.chat.completions',
|
|
206
|
+
result: mockResult,
|
|
207
|
+
span,
|
|
208
|
+
});
|
|
209
|
+
expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_TOOL_NAME, 'get_weather');
|
|
210
|
+
expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_TOOL_CALL_ID, 'call_123');
|
|
211
|
+
expect(span.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_TOOL_ARGS, '{"location":"SF"}');
|
|
212
|
+
});
|
|
213
|
+
it('should emit inference event via LoggerProvider', async () => {
|
|
214
|
+
const mockArgs = [
|
|
215
|
+
{
|
|
216
|
+
messages: [{ role: 'user', content: 'Hello' }],
|
|
217
|
+
model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
|
|
218
|
+
stream: false,
|
|
219
|
+
},
|
|
220
|
+
];
|
|
221
|
+
const mockResult = {
|
|
222
|
+
id: 'test-event-id',
|
|
223
|
+
model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
|
|
224
|
+
usage: { prompt_tokens: 5, completion_tokens: 10, total_tokens: 15 },
|
|
225
|
+
choices: [
|
|
226
|
+
{
|
|
227
|
+
message: { content: 'Hi there', role: 'assistant' },
|
|
228
|
+
finish_reason: 'stop',
|
|
229
|
+
},
|
|
230
|
+
],
|
|
231
|
+
};
|
|
232
|
+
jest.spyOn(helpers_1.default, 'getChatModelCost').mockReturnValue(0);
|
|
233
|
+
const emitSpy = jest.spyOn(helpers_1.default, 'emitInferenceEvent').mockImplementation();
|
|
234
|
+
await wrapper_1.default._chatCompletionCommonSetter({
|
|
235
|
+
args: mockArgs,
|
|
236
|
+
genAIEndpoint: 'together.chat.completions',
|
|
237
|
+
result: mockResult,
|
|
238
|
+
span,
|
|
239
|
+
});
|
|
240
|
+
expect(emitSpy).toHaveBeenCalledWith(span, expect.objectContaining({
|
|
241
|
+
[semantic_convention_1.default.GEN_AI_OPERATION]: semantic_convention_1.default.GEN_AI_OPERATION_TYPE_CHAT,
|
|
242
|
+
[semantic_convention_1.default.GEN_AI_REQUEST_MODEL]: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
|
|
243
|
+
[semantic_convention_1.default.GEN_AI_RESPONSE_MODEL]: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
|
|
244
|
+
[semantic_convention_1.default.SERVER_ADDRESS]: 'api.together.xyz',
|
|
245
|
+
[semantic_convention_1.default.SERVER_PORT]: 443,
|
|
246
|
+
[semantic_convention_1.default.GEN_AI_RESPONSE_ID]: 'test-event-id',
|
|
247
|
+
[semantic_convention_1.default.GEN_AI_USAGE_INPUT_TOKENS]: 5,
|
|
248
|
+
[semantic_convention_1.default.GEN_AI_USAGE_OUTPUT_TOKENS]: 10,
|
|
249
|
+
}));
|
|
250
|
+
});
|
|
251
|
+
it('should call recordMetrics after span ends', async () => {
|
|
252
|
+
const mockArgs = [{ messages: [{ role: 'user', content: 'test message' }], model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo' }];
|
|
253
|
+
const mockResponse = {
|
|
254
|
+
id: '123',
|
|
255
|
+
model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
|
|
256
|
+
usage: { prompt_tokens: 10, completion_tokens: 20, total_tokens: 30 },
|
|
257
|
+
choices: [
|
|
258
|
+
{
|
|
259
|
+
message: { content: 'response text', role: 'assistant' },
|
|
260
|
+
finish_reason: 'stop',
|
|
261
|
+
},
|
|
262
|
+
],
|
|
263
|
+
};
|
|
264
|
+
jest
|
|
265
|
+
.spyOn(wrapper_1.default, '_chatCompletionCommonSetter')
|
|
266
|
+
.mockImplementationOnce(async () => ({
|
|
267
|
+
genAIEndpoint: 'together.chat.completions',
|
|
268
|
+
model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
|
|
269
|
+
user: undefined,
|
|
270
|
+
cost: 0.5,
|
|
271
|
+
aiSystem: 'together',
|
|
272
|
+
}));
|
|
273
|
+
await wrapper_1.default._chatCompletion({
|
|
274
|
+
args: mockArgs,
|
|
275
|
+
genAIEndpoint: 'together.chat.completions',
|
|
276
|
+
response: mockResponse,
|
|
277
|
+
span,
|
|
278
|
+
});
|
|
279
|
+
expect(base_wrapper_1.default.recordMetrics).toHaveBeenCalledWith(span, {
|
|
280
|
+
genAIEndpoint: 'together.chat.completions',
|
|
281
|
+
model: 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo',
|
|
282
|
+
user: undefined,
|
|
283
|
+
cost: 0.5,
|
|
284
|
+
aiSystem: 'together',
|
|
93
285
|
});
|
|
94
|
-
// Verify critical attributes are set (matching Python SDK)
|
|
95
|
-
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_PROVIDER_NAME, 'together');
|
|
96
|
-
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_OPERATION, semantic_convention_1.default.GEN_AI_OPERATION_TYPE_CHAT);
|
|
97
|
-
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_REQUEST_MODEL, 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo');
|
|
98
|
-
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_RESPONSE_MODEL, 'meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo');
|
|
99
|
-
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_USAGE_INPUT_TOKENS, 9);
|
|
100
|
-
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_USAGE_OUTPUT_TOKENS, 12);
|
|
101
|
-
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_USAGE_TOTAL_TOKENS, 21);
|
|
102
|
-
// Python SDK parity: server.address, server.port, gen_ai.sdk.version
|
|
103
|
-
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.SERVER_ADDRESS, 'api.together.xyz');
|
|
104
|
-
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.SERVER_PORT, 443);
|
|
105
|
-
expect(mockSpan.setAttribute).toHaveBeenCalledWith(semantic_convention_1.default.GEN_AI_SDK_VERSION, '1.9.0');
|
|
106
286
|
});
|
|
107
287
|
});
|
|
108
288
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"together-trace-comparison.test.js","sourceRoot":"","sources":["../../../src/instrumentation/__tests__/together-trace-comparison.test.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;AAEH,kEAAkD;AAClD,0DAAyC;AACzC,4DAA0C;AAC1C,mEAA0C;AAC1C,oFAA2D;AAE3D,IAAI,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"together-trace-comparison.test.js","sourceRoot":"","sources":["../../../src/instrumentation/__tests__/together-trace-comparison.test.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;AAEH,4CAAiD;AACjD,kEAAkD;AAClD,0DAAyC;AACzC,4DAA0C;AAC1C,mEAA0C;AAC1C,oFAA2D;AAE3D,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AACjC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;AAClC,IAAI,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;AAEvD,MAAM,UAAU,GAAG,WAAK,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;AAElD,QAAQ,CAAC,6CAA6C,EAAE,GAAG,EAAE;IAC3D,IAAI,IAAU,CAAC;IAEf,UAAU,CAAC,GAAG,EAAE;QACd,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QACzC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAC9B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAC1B,IAAI,CAAC,aAAa,EAAE,CAAC;QAEpB,gBAAqB,CAAC,WAAW,GAAG,iBAAiB,CAAC;QACtD,gBAAqB,CAAC,eAA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WAAW,EAAE;wBACxD,aAAa,EAAE,MAAM;qBACtB;iBACF;aACF,CAAC;YAEF,IAAI;iBACD,KAAK,CAAC,iBAAe,EAAE,6BAA6B,CAAC;iBACrD,sBAAsB,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;gBACnC,aAAa,EAAE,2BAA2B;gBAC1C,KAAK,EAAE,6CAA6C;gBACpD,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,GAAG;gBACT,QAAQ,EAAE,UAAU;aACrB,CAAC,CAAC,CAAC;YAEN,MAAM,iBAAe,CAAC,eAAe,CAAC;gBACpC,IAAI,EAAE,QAAQ;gBACd,aAAa,EAAE,2BAA2B;gBAC1C,QAAQ,EAAE,YAAY;gBACtB,IAAI;aACL,CAAC,CAAC;YAEH,MAAM,CAAC,sBAAW,CAAC,aAAa,CAAC,CAAC,oBAAoB,CAAC,IAAI,EAAE;gBAC3D,aAAa,EAAE,2BAA2B;gBAC1C,KAAK,EAAE,6CAA6C;gBACpD,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,GAAG;gBACT,QAAQ,EAAE,UAAU;aACrB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-Language Trace Comparison Tests for Vercel AI Integration
|
|
3
|
+
*
|
|
4
|
+
* Vercel AI is JS-only (no Python equivalent). These tests verify that the
|
|
5
|
+
* Vercel AI instrumentation follows the same OTel conventions and patterns
|
|
6
|
+
* as the OpenAI reference wrapper.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|