Skip to content

Commit 1a854f5

Browse files
committed
added test
1 parent 7d1a5ce commit 1a854f5

File tree

6 files changed

+806
-2
lines changed
  • packages/traceloop-sdk
    • recordings/Test-AI-SDK-Integration-with-Recording_156038438
      • should-capture-Google-Gemini-provider-spans-correctly-with-recording_2671365066
      • should-capture-OpenAI-provider-spans-correctly-with-recording_3593617962
      • should-transform-Google-Gemini-provider-spans-correctly-with-recording_4162977752
      • should-transform-OpenAI-provider-spans-correctly-with-recording_3580644828
    • test

6 files changed

+806
-2
lines changed

packages/traceloop-sdk/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@
9090
"homepage": "https://github.com/traceloop/openllmetry-js/tree/main/packages/traceloop-sdk",
9191
"gitHead": "ef1e70d6037f7b5c061056ef2be16e3f55f02ed5",
9292
"devDependencies": {
93-
"@ai-sdk/openai": "^1.3.23",
93+
"@ai-sdk/amazon-bedrock": "^3.0.10",
94+
"@ai-sdk/google": "^2.0.8",
95+
"@ai-sdk/openai": "^2.0.19",
9496
"@anthropic-ai/sdk": "^0.56.0",
9597
"@aws-sdk/client-bedrock-runtime": "^3.848.0",
9698
"@google-cloud/aiplatform": "^4.4.0",
@@ -106,7 +108,7 @@
106108
"@types/node": "^24.0.15",
107109
"@types/papaparse": "^5.3.16",
108110
"@types/uuid": "^10.0.0",
109-
"ai": "^4.3.19",
111+
"ai": "^5.0.22",
110112
"chromadb": "^3.0.9",
111113
"cohere-ai": "^7.17.1",
112114
"esbuild": "^0.25.7",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
"log": {
3+
"_recordingName": "Test AI SDK Integration with Recording/should capture Google Gemini provider spans correctly with recording",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.6"
8+
},
9+
"entries": [
10+
{
11+
"_id": "72f2047452e235dc2c824101ce95f8c8",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 107,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"name": "content-type",
20+
"value": "application/json"
21+
}
22+
],
23+
"headersSize": 195,
24+
"httpVersion": "HTTP/1.1",
25+
"method": "POST",
26+
"postData": {
27+
"mimeType": "application/json",
28+
"params": [],
29+
"text": "{\"generationConfig\":{},\"contents\":[{\"role\":\"user\",\"parts\":[{\"text\":\"What is 2+2? Give a brief answer.\"}]}]}"
30+
},
31+
"queryString": [],
32+
"url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent"
33+
},
34+
"response": {
35+
"bodySize": 650,
36+
"content": {
37+
"mimeType": "application/json; charset=UTF-8",
38+
"size": 650,
39+
"text": "{\n \"candidates\": [\n {\n \"content\": {\n \"parts\": [\n {\n \"text\": \"4\\n\"\n }\n ],\n \"role\": \"model\"\n },\n \"finishReason\": \"STOP\",\n \"avgLogprobs\": -2.3841489849019126e-07\n }\n ],\n \"usageMetadata\": {\n \"promptTokenCount\": 12,\n \"candidatesTokenCount\": 2,\n \"totalTokenCount\": 14,\n \"promptTokensDetails\": [\n {\n \"modality\": \"TEXT\",\n \"tokenCount\": 12\n }\n ],\n \"candidatesTokensDetails\": [\n {\n \"modality\": \"TEXT\",\n \"tokenCount\": 2\n }\n ]\n },\n \"modelVersion\": \"gemini-1.5-flash\",\n \"responseId\": \"XT2raLLsJv2Fz7IP1YiRmAs\"\n}\n"
40+
},
41+
"cookies": [],
42+
"headers": [
43+
{
44+
"name": "alt-svc",
45+
"value": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"
46+
},
47+
{
48+
"name": "content-encoding",
49+
"value": "gzip"
50+
},
51+
{
52+
"name": "content-type",
53+
"value": "application/json; charset=UTF-8"
54+
},
55+
{
56+
"name": "date",
57+
"value": "Sun, 24 Aug 2025 16:27:09 GMT"
58+
},
59+
{
60+
"name": "server",
61+
"value": "scaffolding on HTTPServer2"
62+
},
63+
{
64+
"name": "server-timing",
65+
"value": "gfet4t7; dur=261"
66+
},
67+
{
68+
"name": "transfer-encoding",
69+
"value": "chunked"
70+
},
71+
{
72+
"name": "vary",
73+
"value": "Origin, X-Origin, Referer"
74+
},
75+
{
76+
"name": "x-content-type-options",
77+
"value": "nosniff"
78+
},
79+
{
80+
"name": "x-frame-options",
81+
"value": "SAMEORIGIN"
82+
},
83+
{
84+
"name": "x-xss-protection",
85+
"value": "0"
86+
}
87+
],
88+
"headersSize": 380,
89+
"httpVersion": "HTTP/1.1",
90+
"redirectURL": "",
91+
"status": 200,
92+
"statusText": "OK"
93+
},
94+
"startedDateTime": "2025-08-24T16:27:08.886Z",
95+
"time": 876,
96+
"timings": {
97+
"blocked": -1,
98+
"connect": -1,
99+
"dns": -1,
100+
"receive": 0,
101+
"send": 0,
102+
"ssl": -1,
103+
"wait": 876
104+
}
105+
}
106+
],
107+
"pages": [],
108+
"version": "1.2"
109+
}
110+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
{
2+
"log": {
3+
"_recordingName": "Test AI SDK Integration with Recording/should capture OpenAI provider spans correctly with recording",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.6"
8+
},
9+
"entries": [
10+
{
11+
"_id": "9e0d86c7cc2553331485a7095b7c79c7",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 128,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"name": "content-type",
20+
"value": "application/json"
21+
}
22+
],
23+
"headersSize": 165,
24+
"httpVersion": "HTTP/1.1",
25+
"method": "POST",
26+
"postData": {
27+
"mimeType": "application/json",
28+
"params": [],
29+
"text": "{\"model\":\"gpt-3.5-turbo\",\"input\":[{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"What is 2+2? Give a brief answer.\"}]}]}"
30+
},
31+
"queryString": [],
32+
"url": "https://api.openai.com/v1/responses"
33+
},
34+
"response": {
35+
"bodySize": 1370,
36+
"content": {
37+
"mimeType": "application/json",
38+
"size": 1370,
39+
"text": "{\n \"id\": \"resp_68ab3d5c4cd48195aecccfca085e0b7a01d618e6a5bb6307\",\n \"object\": \"response\",\n \"created_at\": 1756052828,\n \"status\": \"completed\",\n \"background\": false,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"max_tool_calls\": null,\n \"model\": \"gpt-3.5-turbo-0125\",\n \"output\": [\n {\n \"id\": \"msg_68ab3d5cc2c08195b6a66ea919a68e4501d618e6a5bb6307\",\n \"type\": \"message\",\n \"status\": \"completed\",\n \"content\": [\n {\n \"type\": \"output_text\",\n \"annotations\": [],\n \"logprobs\": [],\n \"text\": \"2 + 2 equals 4.\"\n }\n ],\n \"role\": \"assistant\"\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"prompt_cache_key\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"safety_identifier\": null,\n \"service_tier\": \"default\",\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n },\n \"verbosity\": \"medium\"\n },\n \"tool_choice\": \"auto\",\n \"tools\": [],\n \"top_logprobs\": 0,\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 19,\n \"input_tokens_details\": {\n \"cached_tokens\": 0\n },\n \"output_tokens\": 9,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 28\n },\n \"user\": null,\n \"metadata\": {}\n}"
40+
},
41+
"cookies": [
42+
{
43+
"domain": ".api.openai.com",
44+
"httpOnly": true,
45+
"name": "_cfuvid",
46+
"path": "/",
47+
"sameSite": "None",
48+
"secure": true,
49+
"value": "I8Z8fhJXU0H6bGKh_EisT_qj4AZM7q7qV8nY99J7PH4-1756052828945-0.0.1.1-604800000"
50+
}
51+
],
52+
"headers": [
53+
{
54+
"name": "alt-svc",
55+
"value": "h3=\":443\"; ma=86400"
56+
},
57+
{
58+
"name": "cf-cache-status",
59+
"value": "DYNAMIC"
60+
},
61+
{
62+
"name": "cf-ray",
63+
"value": "9744372038d144df-ATL"
64+
},
65+
{
66+
"name": "connection",
67+
"value": "keep-alive"
68+
},
69+
{
70+
"name": "content-encoding",
71+
"value": "br"
72+
},
73+
{
74+
"name": "content-type",
75+
"value": "application/json"
76+
},
77+
{
78+
"name": "date",
79+
"value": "Sun, 24 Aug 2025 16:27:08 GMT"
80+
},
81+
{
82+
"name": "openai-organization",
83+
"value": "traceloop"
84+
},
85+
{
86+
"name": "openai-processing-ms",
87+
"value": "631"
88+
},
89+
{
90+
"name": "openai-project",
91+
"value": "proj_tzz1TbPPOXaf6j9tEkVUBIAa"
92+
},
93+
{
94+
"name": "openai-version",
95+
"value": "2020-10-01"
96+
},
97+
{
98+
"name": "server",
99+
"value": "cloudflare"
100+
},
101+
{
102+
"name": "set-cookie",
103+
"value": "_cfuvid=I8Z8fhJXU0H6bGKh_EisT_qj4AZM7q7qV8nY99J7PH4-1756052828945-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None"
104+
},
105+
{
106+
"name": "strict-transport-security",
107+
"value": "max-age=31536000; includeSubDomains; preload"
108+
},
109+
{
110+
"name": "transfer-encoding",
111+
"value": "chunked"
112+
},
113+
{
114+
"name": "x-content-type-options",
115+
"value": "nosniff"
116+
},
117+
{
118+
"name": "x-envoy-upstream-service-time",
119+
"value": "633"
120+
},
121+
{
122+
"name": "x-ratelimit-limit-requests",
123+
"value": "10000"
124+
},
125+
{
126+
"name": "x-ratelimit-limit-tokens",
127+
"value": "50000000"
128+
},
129+
{
130+
"name": "x-ratelimit-remaining-requests",
131+
"value": "9999"
132+
},
133+
{
134+
"name": "x-ratelimit-remaining-tokens",
135+
"value": "49999975"
136+
},
137+
{
138+
"name": "x-ratelimit-reset-requests",
139+
"value": "6ms"
140+
},
141+
{
142+
"name": "x-ratelimit-reset-tokens",
143+
"value": "0s"
144+
},
145+
{
146+
"name": "x-request-id",
147+
"value": "req_65d8ef070ec98106122235bcee5d29dd"
148+
}
149+
],
150+
"headersSize": 953,
151+
"httpVersion": "HTTP/1.1",
152+
"redirectURL": "",
153+
"status": 200,
154+
"statusText": "OK"
155+
},
156+
"startedDateTime": "2025-08-24T16:27:07.321Z",
157+
"time": 1552,
158+
"timings": {
159+
"blocked": -1,
160+
"connect": -1,
161+
"dns": -1,
162+
"receive": 0,
163+
"send": 0,
164+
"ssl": -1,
165+
"wait": 1552
166+
}
167+
}
168+
],
169+
"pages": [],
170+
"version": "1.2"
171+
}
172+
}

0 commit comments

Comments
 (0)