Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(openai-instrumentation): logprobs reporting using span event #172

Merged
merged 10 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add tests recordings
  • Loading branch information
galkleinman committed Mar 26, 2024
commit 43f6d324891c14ff59cde17ce7dee3140c9784ed
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
{
"log": {
"_recordingName": "Test OpenAI instrumentation/should emit logprobs span event for chat completion",
"creator": {
"comment": "persister:fs",
"name": "Polly.JS",
"version": "6.0.6"
},
"entries": [
{
"_id": "2ead3a029e620e58580faf3ea60f891e",
"_order": 0,
"cache": {},
"request": {
"bodySize": 159,
"cookies": [],
"headers": [
{
"_fromType": "array",
"name": "content-length",
"value": "159"
},
{
"_fromType": "array",
"name": "accept",
"value": "application/json"
},
{
"_fromType": "array",
"name": "content-type",
"value": "application/json"
},
{
"_fromType": "array",
"name": "user-agent",
"value": "OpenAI/JS 4.28.4"
},
{
"_fromType": "array",
"name": "x-stainless-lang",
"value": "js"
},
{
"_fromType": "array",
"name": "x-stainless-package-version",
"value": "4.28.4"
},
{
"_fromType": "array",
"name": "x-stainless-os",
"value": "MacOS"
},
{
"_fromType": "array",
"name": "x-stainless-arch",
"value": "arm64"
},
{
"_fromType": "array",
"name": "x-stainless-runtime",
"value": "node"
},
{
"_fromType": "array",
"name": "x-stainless-runtime-version",
"value": "v20.9.0"
},
{
"_fromType": "array",
"name": "accept-encoding",
"value": "gzip,deflate"
},
{
"name": "host",
"value": "api.openai.com"
}
],
"headersSize": 469,
"httpVersion": "HTTP/1.1",
"method": "POST",
"postData": {
"mimeType": "application/json",
"params": [],
"text": "{\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Tell me a joke about OpenTelemetry\"\n }\n ],\n \"model\": \"gpt-3.5-turbo\",\n \"logprobs\": true\n}"
},
"queryString": [],
"url": "https://api.openai.com/v1/chat/completions"
},
"response": {
"bodySize": 1275,
"content": {
"encoding": "base64",
"mimeType": "application/json",
"size": 1275,
"text": "[\"H4sIAAAAAAAAA+RZS2/aQBC+8yu2e8kF0L4fXCIlh6a9VKoi9ZBEyJhNcGN7LXvdJo3y3ysbCARbZhNieigHhGZnzHwzO08/DQCA0RxOAAwXgQuTLB5pSfTXOEj5n3OndZmdffl+HtrPUl3cJxdwWEnY2U8TurXUOLRJFhsX2XR5HOYmcKZ6KpYY\",\"M0G54vVBYucmrsTuMjeiYz5yZT6zI4QJX0kubBSaAk7A1QAAAJ7q70rHdG4e4ASg4ZqSmKII7gycvDABAHMbVxQYFEVUuCB1cLg5DG3qTFqr/WPxCObRHLiFAd8yk16a2CTG5Y9gbn6Z2GYmB7PcBPegzMDvyC0qzigHYRCHZRw4m5+C6/Q6PTNhUBYGRA6Etozn6YkDiyCdx2YtUJvmASQmKMrcJCZ1xSe40un5BUxs77LczorXaDYKX70QwRZDzeTsvUlXmLbQbj8WTsAIjRFCSBNNGRI7bLNHt2XzzUfJ4Q4FI9YgEfyKcjPc1S+bbsG7utk6fh564Koc1Q0MS8wpk8wTFiVNWKhJ4i1cPSN1C9OJFFMppKD6/UCx8HEp6tulVcx1I2WUMcXej1TqJvYWv+MmV89OvuxysR4jpSgTzIykb5Ae332rXNmBg4+FFFphaka+yQYj5eMepL2c2Lzm+F9krnUx6b7rAnNOifjY9NViFD8DN7kwfm8ssZ4NXNfoTuMqLsWu/m8wrVY+F6kJXbeUTtmzMcpsb/2XjHHJDqkfsuUq9Iyr6r/2IiMSUyoYPgCa9ukBWgto/21B1J1CkKAECyn7bwy8bNS3QTZteIdVyBhxJPy73Zbg1z5hrfaLtYVNi5z0qmPHT7On3eULI8IR9Y08QXu+HNVc1qEwHiOtED8gVFqKbb+QVlNmdwbgVAvNsS8uIXyqmE8AtJUEfvyRInLd9iFSMr3bAr3J7W3FoO9EVy8VuoExyrnGlH1gmmtNMj4prK0T7Ts6Tty+5oBwxbX0dr0+vp+XO6M9sz9SXNED7i/zCWbkNVyo48f3/iaIUI6xxv9LD7TcLO6ZLJnCmtCeUwPy27V4jZ+k7x3b9ia2u3tERGl0yFSu3zcotlTPthrLPnBdgrw6T96vaz7taXCIZggx7uuQA/rMl983jU39bZRGxWKam6CwtdaFs9lyoV+J1X8Dy1dvJmCW2yRz0xpo9WdrB8PNi5PN4TpaobMuiDd0qgYrPWDxWDiTTG+j9M7kWR4t32ncZlM6C/GMSyZCOHge/AUAAP//AwBzJcGg3RkAAA==\"]"
},
"cookies": [
{
"domain": ".api.openai.com",
"expires": "2024-03-26T15:03:06.000Z",
"httpOnly": true,
"name": "__cf_bm",
"path": "/",
"sameSite": "None",
"secure": true,
"value": "NSvtgcpHDAZH8AoO_Q3Fs891okiS7Q6hLT3SnrcOBwU-1711463586-1.0.1.1-V0N7G8e04Q6qGUM2kttPlubgExssnQCvgCLWNiMhYluTe977KL43Vod7W8BP6i1eHJfuqvmhP7rQvYHKbtd3oQ"
},
{
"domain": ".api.openai.com",
"httpOnly": true,
"name": "_cfuvid",
"path": "/",
"sameSite": "None",
"secure": true,
"value": "Z6InQeWS_HG8r5P1wLAtd437vS85HwnVd_Ne.wam2No-1711463586368-0.0.1.1-604800000"
}
],
"headers": [
{
"name": "date",
"value": "Tue, 26 Mar 2024 14:33:06 GMT"
},
{
"name": "content-type",
"value": "application/json"
},
{
"name": "transfer-encoding",
"value": "chunked"
},
{
"name": "connection",
"value": "keep-alive"
},
{
"name": "access-control-allow-origin",
"value": "*"
},
{
"name": "cache-control",
"value": "no-cache, must-revalidate"
},
{
"name": "openai-model",
"value": "gpt-3.5-turbo-0125"
},
{
"name": "openai-organization",
"value": "traceloop"
},
{
"name": "openai-processing-ms",
"value": "1000"
},
{
"name": "openai-version",
"value": "2020-10-01"
},
{
"name": "strict-transport-security",
"value": "max-age=15724800; includeSubDomains"
},
{
"name": "x-ratelimit-limit-requests",
"value": "5000"
},
{
"name": "x-ratelimit-limit-tokens",
"value": "160000"
},
{
"name": "x-ratelimit-remaining-requests",
"value": "4999"
},
{
"name": "x-ratelimit-remaining-tokens",
"value": "159974"
},
{
"name": "x-ratelimit-reset-requests",
"value": "12ms"
},
{
"name": "x-ratelimit-reset-tokens",
"value": "9ms"
},
{
"name": "x-request-id",
"value": "req_422be004a8b88e2f5c7f0969d7d0edb6"
},
{
"name": "cf-cache-status",
"value": "DYNAMIC"
},
{
"_fromType": "array",
"name": "set-cookie",
"value": "__cf_bm=NSvtgcpHDAZH8AoO_Q3Fs891okiS7Q6hLT3SnrcOBwU-1711463586-1.0.1.1-V0N7G8e04Q6qGUM2kttPlubgExssnQCvgCLWNiMhYluTe977KL43Vod7W8BP6i1eHJfuqvmhP7rQvYHKbtd3oQ; path=/; expires=Tue, 26-Mar-24 15:03:06 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None"
},
{
"_fromType": "array",
"name": "set-cookie",
"value": "_cfuvid=Z6InQeWS_HG8r5P1wLAtd437vS85HwnVd_Ne.wam2No-1711463586368-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None"
},
{
"name": "server",
"value": "cloudflare"
},
{
"name": "cf-ray",
"value": "86a7da8f1c1109c7-HFA"
},
{
"name": "content-encoding",
"value": "gzip"
},
{
"name": "alt-svc",
"value": "h3=\":443\"; ma=86400"
}
],
"headersSize": 1209,
"httpVersion": "HTTP/1.1",
"redirectURL": "",
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2024-03-26T14:33:04.955Z",
"time": 1405,
"timings": {
"blocked": -1,
"connect": -1,
"dns": -1,
"receive": 0,
"send": 0,
"ssl": -1,
"wait": 1405
}
}
],
"pages": [],
"version": "1.2"
}
}
Loading
Loading