Skip to content

Commit

Permalink
fix(openai): function + tool calling (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
nirga authored Apr 22, 2024
1 parent 085f4fb commit 790a2de
Show file tree
Hide file tree
Showing 14 changed files with 892 additions and 150 deletions.
9 changes: 4 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/ai-semantic-conventions/src/SemanticAttributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const SpanAttributes = {
LLM_PROMPTS: "llm.prompts",
LLM_COMPLETIONS: "llm.completions",
LLM_CHAT_STOP_SEQUENCES: "llm.chat.stop_sequences",

LLM_REQUEST_FUNCTIONS: "llm.request.functions",
// Vector DB
VECTOR_DB_VENDOR: "db.system",
VECTOR_DB_QUERY_TOP_K: "db.vector.query.top_k",
Expand Down
2 changes: 1 addition & 1 deletion packages/instrumentation-openai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@pollyjs/persister-fs": "^6.0.6",
"@types/mocha": "^10.0.6",
"mocha": "^10.2.0",
"openai": "^4.12.4",
"openai": "^4.38.3",
"ts-mocha": "^10.0.0"
},
"homepage": "https://github.com/traceloop/openllmetry-js/tree/main/packages/instrumentation-openai",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
{
"_fromType": "array",
"name": "user-agent",
"value": "OpenAI/JS 4.28.4"
"value": "OpenAI/JS 4.38.3"
},
{
"_fromType": "array",
Expand All @@ -43,7 +43,7 @@
{
"_fromType": "array",
"name": "x-stainless-package-version",
"value": "4.28.4"
"value": "4.38.3"
},
{
"_fromType": "array",
Expand All @@ -63,7 +63,7 @@
{
"_fromType": "array",
"name": "x-stainless-runtime-version",
"value": "v20.9.0"
"value": "v18.17.1"
},
{
"_fromType": "array",
Expand All @@ -75,7 +75,7 @@
"value": "api.openai.com"
}
],
"headersSize": 469,
"headersSize": 470,
"httpVersion": "HTTP/1.1",
"method": "POST",
"postData": {
Expand All @@ -87,23 +87,23 @@
"url": "https://api.openai.com/v1/chat/completions"
},
"response": {
"bodySize": 1275,
"bodySize": 1147,
"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+QVlNmdwbgVAvNsS8uIXyqmE8AtJUEfvyR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nDLPuW5tFbZDc5sx3XUCuDnEBIhCxPQuMdhzlNQdur3UCc4Lw8fyFMYuASmkTzwaRe34iVN4Y2hODOlwg5rofkBidd8jVVakVv8OxYOx49FJadTRu0wobOm3XbPHSHLzTIcqFfd1scAfr+oyX9+BWGC6ilCPyvm3NoqpL+SEZH7UzQuQ4hCC6T+3PkvINt97OeZx+ai8BHGNM5AkMuSnh5dlTeTP/OXBzcgU+odgjK25uR/2bDgOyoslut668ODAPolJwbD8mOYEabf4/1GZ6syiNivkkV16hK6sLo7PV6K/cVn0GLt7MKWGW6yQzkwpo+bHXkwC3Y9TtIlnHAhptvHgrp6X3KztgsSyMSiazKA1VnuXRasI5yyY+IdJVnHoB7L30/gMAAP//AwDW79xN6xUAAA==\"]"
},
"cookies": [
{
"domain": ".api.openai.com",
"expires": "2024-03-26T15:03:06.000Z",
"expires": "2024-04-22T19:42:40.000Z",
"httpOnly": true,
"name": "__cf_bm",
"path": "/",
"sameSite": "None",
"secure": true,
"value": "NSvtgcpHDAZH8AoO_Q3Fs891okiS7Q6hLT3SnrcOBwU-1711463586-1.0.1.1-V0N7G8e04Q6qGUM2kttPlubgExssnQCvgCLWNiMhYluTe977KL43Vod7W8BP6i1eHJfuqvmhP7rQvYHKbtd3oQ"
"value": "3S7nFjQIeVqiriw6xIQiXnrh5rNZGFk24qbLEosQImk-1713813160-1.0.1.1-A6uQAPUGKB0lMQ6lF.vwP3Dpgaa83WwhlZ0voEImwl3uAQmmYxkOou_a0wtblhj_6bd_CgTNgyYrVfhnSCOfCA"
},
{
"domain": ".api.openai.com",
Expand All @@ -112,13 +112,13 @@
"path": "/",
"sameSite": "None",
"secure": true,
"value": "Z6InQeWS_HG8r5P1wLAtd437vS85HwnVd_Ne.wam2No-1711463586368-0.0.1.1-604800000"
"value": "kbUq6yDBUrJ.tFnbx3NklUCqY.1oT7.eEDORno5hrYA-1713813160752-0.0.1.1-604800000"
}
],
"headers": [
{
"name": "date",
"value": "Tue, 26 Mar 2024 14:33:06 GMT"
"value": "Mon, 22 Apr 2024 19:12:40 GMT"
},
{
"name": "content-type",
Expand Down Expand Up @@ -150,7 +150,7 @@
},
{
"name": "openai-processing-ms",
"value": "1000"
"value": "657"
},
{
"name": "openai-version",
Expand Down Expand Up @@ -186,7 +186,7 @@
},
{
"name": "x-request-id",
"value": "req_422be004a8b88e2f5c7f0969d7d0edb6"
"value": "req_829d9c57bfc8c994a6d6f2b07b1a31c5"
},
{
"name": "cf-cache-status",
Expand All @@ -195,20 +195,20 @@
{
"_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"
"value": "__cf_bm=3S7nFjQIeVqiriw6xIQiXnrh5rNZGFk24qbLEosQImk-1713813160-1.0.1.1-A6uQAPUGKB0lMQ6lF.vwP3Dpgaa83WwhlZ0voEImwl3uAQmmYxkOou_a0wtblhj_6bd_CgTNgyYrVfhnSCOfCA; path=/; expires=Mon, 22-Apr-24 19:42:40 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"
"value": "_cfuvid=kbUq6yDBUrJ.tFnbx3NklUCqY.1oT7.eEDORno5hrYA-1713813160752-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None"
},
{
"name": "server",
"value": "cloudflare"
},
{
"name": "cf-ray",
"value": "86a7da8f1c1109c7-HFA"
"value": "8787ed3969e26d85-MUC"
},
{
"name": "content-encoding",
Expand All @@ -219,22 +219,22 @@
"value": "h3=\":443\"; ma=86400"
}
],
"headersSize": 1209,
"headersSize": 1208,
"httpVersion": "HTTP/1.1",
"redirectURL": "",
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2024-03-26T14:33:04.955Z",
"time": 1405,
"startedDateTime": "2024-04-22T19:12:39.832Z",
"time": 901,
"timings": {
"blocked": -1,
"connect": -1,
"dns": -1,
"receive": 0,
"send": 0,
"ssl": -1,
"wait": 1405
"wait": 901
}
}
],
Expand Down
Loading

0 comments on commit 790a2de

Please sign in to comment.