Skip to content

Commit 500097c

Browse files
authored
fix(sdk): api for manual logging of LLM calls (#264)
1 parent 0e5c3aa commit 500097c

File tree

4 files changed

+649
-6
lines changed
  • packages/traceloop-sdk
    • recordings
      • Test-SDK-Decorators_847855269/should-create-spans-for-manual-LLM-instrumentation_981493419
      • Test-SDK-Manual-Instrumentations_53777088/should-create-spans-for-manual-LLM-instrumentation_981493419
    • src/lib/tracing
    • test

4 files changed

+649
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
{
2+
"log": {
3+
"_recordingName": "Test SDK Decorators/should create spans for manual LLM instrumentation",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.6"
8+
},
9+
"entries": [
10+
{
11+
"_id": "80b48c70cae76a3c38b9af59d5273e33",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 139,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"_fromType": "array",
20+
"name": "content-length",
21+
"value": "139"
22+
},
23+
{
24+
"_fromType": "array",
25+
"name": "accept",
26+
"value": "application/json"
27+
},
28+
{
29+
"_fromType": "array",
30+
"name": "content-type",
31+
"value": "application/json"
32+
},
33+
{
34+
"_fromType": "array",
35+
"name": "user-agent",
36+
"value": "OpenAI/JS 4.38.3"
37+
},
38+
{
39+
"_fromType": "array",
40+
"name": "x-stainless-lang",
41+
"value": "js"
42+
},
43+
{
44+
"_fromType": "array",
45+
"name": "x-stainless-package-version",
46+
"value": "4.38.3"
47+
},
48+
{
49+
"_fromType": "array",
50+
"name": "x-stainless-os",
51+
"value": "MacOS"
52+
},
53+
{
54+
"_fromType": "array",
55+
"name": "x-stainless-arch",
56+
"value": "arm64"
57+
},
58+
{
59+
"_fromType": "array",
60+
"name": "x-stainless-runtime",
61+
"value": "node"
62+
},
63+
{
64+
"_fromType": "array",
65+
"name": "x-stainless-runtime-version",
66+
"value": "v18.17.1"
67+
},
68+
{
69+
"_fromType": "array",
70+
"name": "accept-encoding",
71+
"value": "gzip,deflate"
72+
},
73+
{
74+
"name": "host",
75+
"value": "api.openai.com"
76+
}
77+
],
78+
"headersSize": 470,
79+
"httpVersion": "HTTP/1.1",
80+
"method": "POST",
81+
"postData": {
82+
"mimeType": "application/json",
83+
"params": [],
84+
"text": "{\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Tell me a joke about OpenTelemetry\"\n }\n ],\n \"model\": \"gpt-3.5-turbo\"\n}"
85+
},
86+
"queryString": [],
87+
"url": "https://api.openai.com/v1/chat/completions"
88+
},
89+
"response": {
90+
"bodySize": 491,
91+
"content": {
92+
"encoding": "base64",
93+
"mimeType": "application/json",
94+
"size": 491,
95+
"text": "[\"H4sIAAAAAAAAA1SRT2vDMAzF7/kUms/taFpC017GxmAMBh3bSgtjFCdRE6+OZWxlbSj97sPpv+3iw3t68k/SPgIQqhBTEHklOa+t7k9el1t6vt+q5GmSLtP54/tuZtPSvmwW8zfRCwnKvjHnc+o2p9pqZEXmaOcOJWPoGo/jJB0n4+GwM2oqUIdYabk/uk363LiM+oN4mJySFakcvZjCZwQAsO/ewGgK3IkpDHpnpUbvZYlieikCEI50UIT0XnmWhkXvauZkGE2HvahaKFQBXCHMLJoP1FgjuxYK/EFNFh2UBJmjDd7BA+ay8RiqW9iiQ5B6K1sPXg==\",\"1lYrU8KaHLCjJtN4I04/Hi6omkrrKAtjmUbri75WRvlq5VB6MgHLM9lj/BABfHUraf5NKayj2vKKaYMmNIyTYztxPcIfMz2ZTCz1VR+NohOf8K1nrFdrZUp01qluP4EyOkS/AAAA//8DAMTz7T0eAgAA\"]"
96+
},
97+
"cookies": [
98+
{
99+
"domain": ".api.openai.com",
100+
"expires": "2024-05-16T16:38:43.000Z",
101+
"httpOnly": true,
102+
"name": "__cf_bm",
103+
"path": "/",
104+
"sameSite": "None",
105+
"secure": true,
106+
"value": "eAINKaQ0O3tdSzB.KOxjAHZ7AdV9qQHAOaBv2.3yn1k-1715875723-1.0.1.1-lJcLz_EuaF8Y01g9hzqDWo0bzCPfONiL0mogjqJhNdyyROSixq4FgyI2Cf2bakaQxuzIumKzXIS6oNw2p_AfHw"
107+
},
108+
{
109+
"domain": ".api.openai.com",
110+
"httpOnly": true,
111+
"name": "_cfuvid",
112+
"path": "/",
113+
"sameSite": "None",
114+
"secure": true,
115+
"value": "mnsAAZGFXU4qk2hW2DwDVg71nGu_MASZVL2AJqgEbv4-1715875723340-0.0.1.1-604800000"
116+
}
117+
],
118+
"headers": [
119+
{
120+
"name": "date",
121+
"value": "Thu, 16 May 2024 16:08:43 GMT"
122+
},
123+
{
124+
"name": "content-type",
125+
"value": "application/json"
126+
},
127+
{
128+
"name": "transfer-encoding",
129+
"value": "chunked"
130+
},
131+
{
132+
"name": "connection",
133+
"value": "keep-alive"
134+
},
135+
{
136+
"name": "openai-organization",
137+
"value": "traceloop"
138+
},
139+
{
140+
"name": "openai-processing-ms",
141+
"value": "804"
142+
},
143+
{
144+
"name": "openai-version",
145+
"value": "2020-10-01"
146+
},
147+
{
148+
"name": "strict-transport-security",
149+
"value": "max-age=15724800; includeSubDomains"
150+
},
151+
{
152+
"name": "x-ratelimit-limit-requests",
153+
"value": "5000"
154+
},
155+
{
156+
"name": "x-ratelimit-limit-tokens",
157+
"value": "160000"
158+
},
159+
{
160+
"name": "x-ratelimit-remaining-requests",
161+
"value": "4999"
162+
},
163+
{
164+
"name": "x-ratelimit-remaining-tokens",
165+
"value": "159974"
166+
},
167+
{
168+
"name": "x-ratelimit-reset-requests",
169+
"value": "12ms"
170+
},
171+
{
172+
"name": "x-ratelimit-reset-tokens",
173+
"value": "9ms"
174+
},
175+
{
176+
"name": "x-request-id",
177+
"value": "req_9d2a45908700e557bd9eaf0294dd79cc"
178+
},
179+
{
180+
"name": "cf-cache-status",
181+
"value": "DYNAMIC"
182+
},
183+
{
184+
"_fromType": "array",
185+
"name": "set-cookie",
186+
"value": "__cf_bm=eAINKaQ0O3tdSzB.KOxjAHZ7AdV9qQHAOaBv2.3yn1k-1715875723-1.0.1.1-lJcLz_EuaF8Y01g9hzqDWo0bzCPfONiL0mogjqJhNdyyROSixq4FgyI2Cf2bakaQxuzIumKzXIS6oNw2p_AfHw; path=/; expires=Thu, 16-May-24 16:38:43 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None"
187+
},
188+
{
189+
"_fromType": "array",
190+
"name": "set-cookie",
191+
"value": "_cfuvid=mnsAAZGFXU4qk2hW2DwDVg71nGu_MASZVL2AJqgEbv4-1715875723340-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None"
192+
},
193+
{
194+
"name": "server",
195+
"value": "cloudflare"
196+
},
197+
{
198+
"name": "cf-ray",
199+
"value": "884ca0c0989159ef-MXP"
200+
},
201+
{
202+
"name": "content-encoding",
203+
"value": "gzip"
204+
},
205+
{
206+
"name": "alt-svc",
207+
"value": "h3=\":443\"; ma=86400"
208+
}
209+
],
210+
"headersSize": 1100,
211+
"httpVersion": "HTTP/1.1",
212+
"redirectURL": "",
213+
"status": 200,
214+
"statusText": "OK"
215+
},
216+
"startedDateTime": "2024-05-16T16:08:42.253Z",
217+
"time": 1072,
218+
"timings": {
219+
"blocked": -1,
220+
"connect": -1,
221+
"dns": -1,
222+
"receive": 0,
223+
"send": 0,
224+
"ssl": -1,
225+
"wait": 1072
226+
}
227+
}
228+
],
229+
"pages": [],
230+
"version": "1.2"
231+
}
232+
}

0 commit comments

Comments
 (0)