-
Notifications
You must be signed in to change notification settings - Fork 800
Add Support for Async openai instrumentation
#2984
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
Merged
lzchen
merged 23 commits into
open-telemetry:main
from
alizenhom:support-async-openai-instrumentation
Nov 14, 2024
Merged
Changes from 4 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
03b6c57
add myself to component owners
alizenhom 1be4a6b
add async support
alizenhom acdf2f2
add async tests
alizenhom 0dacda8
fix tests runtime warnings
alizenhom da7c1e5
add changelog
alizenhom accf17c
relax changelog & adjust conftest
alizenhom 97f8e87
opentelemetry-instrumentation-openai-v2: add codefromthecrypt and fix…
codefromthecrypt 07691c3
add myself to component owners
alizenhom ae905bd
component-owners
alizenhom 5e743b3
add myself to component owners
alizenhom b1b5a4a
add async support
alizenhom d2462bf
add async tests
alizenhom a377334
fix tests runtime warnings
alizenhom 2037ecc
add changelog
alizenhom dfe602d
relax changelog & adjust conftest
alizenhom b8b699e
opentelemetry-instrumentation-openai-v2: add codefromthecrypt and fix…
codefromthecrypt 75ab535
add myself to component owners
alizenhom c5e2507
component-owners
alizenhom 031c667
Merge branch 'support-async-openai-instrumentation' of https://github…
alizenhom c91cf73
Merge branch 'main' of https://github.com/open-telemetry/opentelemetr…
alizenhom 30eed05
Merge branch 'main' of https://github.com/open-telemetry/opentelemetr…
alizenhom cc5d604
scrub leaked cookies
alizenhom abdc9b6
Adjust changelog format
alizenhom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,3 +73,4 @@ components: | |
| - lzchen | ||
| - gyliu513 | ||
| - nirga | ||
| - alizenhom | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...entelemetry-instrumentation-openai-v2/tests/cassettes/test_async_chat_completion_404.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| interactions: | ||
| - request: | ||
| body: '{"messages": [{"role": "user", "content": "Say this is a test"}], "model": | ||
| "this-model-does-not-exist"}' | ||
| headers: | ||
| accept: | ||
| - application/json | ||
| accept-encoding: | ||
| - gzip, deflate | ||
| connection: | ||
| - keep-alive | ||
| content-length: | ||
| - '103' | ||
| content-type: | ||
| - application/json | ||
| host: | ||
| - api.openai.com | ||
| user-agent: | ||
| - AsyncOpenAI/Python 1.26.0 | ||
| x-stainless-arch: | ||
| - arm64 | ||
| x-stainless-async: | ||
| - async:asyncio | ||
| x-stainless-lang: | ||
| - python | ||
| x-stainless-os: | ||
| - MacOS | ||
| x-stainless-package-version: | ||
| - 1.26.0 | ||
| x-stainless-runtime: | ||
| - CPython | ||
| x-stainless-runtime-version: | ||
| - 3.12.5 | ||
| method: POST | ||
| uri: https://api.openai.com/v1/chat/completions | ||
| response: | ||
| body: | ||
| string: "{\n \"error\": {\n \"message\": \"The model `this-model-does-not-exist` | ||
alizenhom marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| does not exist or you do not have access to it.\",\n \"type\": \"invalid_request_error\",\n | ||
| \ \"param\": null,\n \"code\": \"model_not_found\"\n }\n}\n" | ||
| headers: | ||
| CF-Cache-Status: | ||
| - DYNAMIC | ||
| CF-RAY: | ||
| - 8df5e31d6e45e284-MRS | ||
| Connection: | ||
| - keep-alive | ||
| Content-Type: | ||
| - application/json; charset=utf-8 | ||
| Date: | ||
| - Fri, 08 Nov 2024 13:25:06 GMT | ||
| Server: | ||
| - cloudflare | ||
| Set-Cookie: test_set_cookie | ||
| Transfer-Encoding: | ||
| - chunked | ||
| X-Content-Type-Options: | ||
| - nosniff | ||
| alt-svc: | ||
| - h3=":443"; ma=86400 | ||
| content-length: | ||
| - '231' | ||
| openai-organization: test_organization | ||
| strict-transport-security: | ||
| - max-age=31536000; includeSubDomains; preload | ||
| vary: | ||
| - Origin | ||
| x-request-id: | ||
| - req_82c60ab486740fa07db9b846df2d532b | ||
| status: | ||
| code: 404 | ||
| message: Not Found | ||
| version: 1 | ||
98 changes: 98 additions & 0 deletions
98
...ry-instrumentation-openai-v2/tests/cassettes/test_async_chat_completion_extra_params.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| interactions: | ||
| - request: | ||
| body: '{"messages": [{"role": "user", "content": "Say this is a test"}], "model": | ||
| "gpt-4o-mini", "max_tokens": 50, "seed": 42, "stream": false, "temperature": | ||
| 0.5, "service_tier": "default"}' | ||
| headers: | ||
| accept: | ||
| - application/json | ||
| accept-encoding: | ||
| - gzip, deflate | ||
| connection: | ||
| - keep-alive | ||
| content-length: | ||
| - '183' | ||
| content-type: | ||
| - application/json | ||
| host: | ||
| - api.openai.com | ||
| user-agent: | ||
| - AsyncOpenAI/Python 1.26.0 | ||
| x-stainless-arch: | ||
| - arm64 | ||
| x-stainless-async: | ||
| - async:asyncio | ||
| x-stainless-lang: | ||
| - python | ||
| x-stainless-os: | ||
| - MacOS | ||
| x-stainless-package-version: | ||
| - 1.26.0 | ||
| x-stainless-runtime: | ||
| - CPython | ||
| x-stainless-runtime-version: | ||
| - 3.12.5 | ||
| method: POST | ||
| uri: https://api.openai.com/v1/chat/completions | ||
| response: | ||
| body: | ||
| string: "{\n \"id\": \"chatcmpl-ARJJHh1NYn4MAJ5vmO2u6MC0QWvS3\",\n \"object\": | ||
| \"chat.completion\",\n \"created\": 1731072447,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n | ||
| \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": | ||
| \"assistant\",\n \"content\": \"This is a test. How can I assist you | ||
| further?\",\n \"refusal\": null\n },\n \"logprobs\": null,\n | ||
| \ \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": | ||
| 12,\n \"completion_tokens\": 12,\n \"total_tokens\": 24,\n \"prompt_tokens_details\": | ||
| {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": | ||
| {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": | ||
| 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": | ||
| \"default\",\n \"system_fingerprint\": \"fp_0ba0d124f1\"\n}\n" | ||
| headers: | ||
| CF-Cache-Status: | ||
| - DYNAMIC | ||
| CF-RAY: | ||
| - 8df5e68e7df7e20d-MRS | ||
| Connection: | ||
| - keep-alive | ||
| Content-Type: | ||
| - application/json | ||
| Date: | ||
| - Fri, 08 Nov 2024 13:27:28 GMT | ||
| Server: | ||
| - cloudflare | ||
| Set-Cookie: test_set_cookie | ||
| Transfer-Encoding: | ||
| - chunked | ||
| X-Content-Type-Options: | ||
| - nosniff | ||
| access-control-expose-headers: | ||
| - X-Request-ID | ||
| alt-svc: | ||
| - h3=":443"; ma=86400 | ||
| content-length: | ||
| - '825' | ||
| openai-organization: test_organization | ||
| openai-processing-ms: | ||
| - '373' | ||
| openai-version: | ||
| - '2020-10-01' | ||
| strict-transport-security: | ||
| - max-age=31536000; includeSubDomains; preload | ||
| x-ratelimit-limit-requests: | ||
| - '30000' | ||
| x-ratelimit-limit-tokens: | ||
| - '150000000' | ||
| x-ratelimit-remaining-requests: | ||
| - '29999' | ||
| x-ratelimit-remaining-tokens: | ||
| - '149999943' | ||
| x-ratelimit-reset-requests: | ||
| - 2ms | ||
| x-ratelimit-reset-tokens: | ||
| - 0s | ||
| x-request-id: | ||
| - req_bea7292421fe218c0a9e158dbb7699d7 | ||
| status: | ||
| code: 200 | ||
| message: OK | ||
| version: 1 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.