Skip to content

Commit

Permalink
relax changelog & adjust conftest
Browse files Browse the repository at this point in the history
  • Loading branch information
alizenhom committed Nov 11, 2024
1 parent da7c1e5 commit accf17c
Show file tree
Hide file tree
Showing 13 changed files with 851 additions and 652 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

- Added a wrapper for `AsyncCompletions.create` inside `src/opentelemetry/instrumentation/openai_v2/__init__.py` to instrument async chat completions
- Created a new patch function for async chat completions
- Abstracted handling span exceptions into it's own function as it was getting used in multiple places
- Adjusted `StreamWrapper` to include async methods for supporting async streaming
- Added Tests using `pytest-asyncio` fixtures
- Support for `AsyncOpenAI/AsyncCompletions`

## Version 2.0b0 (2024-11-08)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
interactions:
- request:
body: '{"messages": [{"role": "user", "content": "Say this is a test"}], "model":
"this-model-does-not-exist"}'
body: |-
{
"messages": [
{
"role": "user",
"content": "Say this is a test"
}
],
"model": "this-model-does-not-exist"
}
headers:
accept:
- application/json
Expand Down Expand Up @@ -35,20 +43,26 @@ interactions:
uri: https://api.openai.com/v1/chat/completions
response:
body:
string: "{\n \"error\": {\n \"message\": \"The model `this-model-does-not-exist`
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"
string: |-
{
"error": {
"message": "The model `this-model-does-not-exist` does not exist or you do not have access to it.",
"type": "invalid_request_error",
"param": null,
"code": "model_not_found"
}
}
headers:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 8df5e31d6e45e284-MRS
- 8e0e20160ec6e17f-MRS
Connection:
- keep-alive
Content-Type:
- application/json; charset=utf-8
Date:
- Fri, 08 Nov 2024 13:25:06 GMT
- Mon, 11 Nov 2024 12:01:02 GMT
Server:
- cloudflare
Set-Cookie: test_set_cookie
Expand All @@ -66,7 +80,7 @@ interactions:
vary:
- Origin
x-request-id:
- req_82c60ab486740fa07db9b846df2d532b
- req_93d359c0eeba1f2be7308d9132e82bf5
status:
code: 404
message: Not Found
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
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"}'
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
Expand Down Expand Up @@ -36,28 +48,53 @@ interactions:
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"
string: |-
{
"id": "chatcmpl-ASNOJZk6WBJTYWmACy5zBiYnkvXAw",
"object": "chat.completion",
"created": 1731326463,
"model": "gpt-4o-mini-2024-07-18",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "This is a test. How can I assist you further?",
"refusal": null
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 12,
"total_tokens": 24,
"prompt_tokens_details": {
"cached_tokens": 0,
"audio_tokens": 0
},
"completion_tokens_details": {
"reasoning_tokens": 0,
"audio_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0
}
},
"service_tier": "default",
"system_fingerprint": "fp_0ba0d124f1"
}
headers:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 8df5e68e7df7e20d-MRS
- 8e0e20191e7670e7-MRS
Connection:
- keep-alive
Content-Type:
- application/json
Date:
- Fri, 08 Nov 2024 13:27:28 GMT
- Mon, 11 Nov 2024 12:01:03 GMT
Server:
- cloudflare
Set-Cookie: test_set_cookie
Expand All @@ -73,7 +110,7 @@ interactions:
- '825'
openai-organization: test_organization
openai-processing-ms:
- '373'
- '483'
openai-version:
- '2020-10-01'
strict-transport-security:
Expand All @@ -91,7 +128,7 @@ interactions:
x-ratelimit-reset-tokens:
- 0s
x-request-id:
- req_bea7292421fe218c0a9e158dbb7699d7
- req_bbcd55fb3044f058ea9f9ae8a388698d
status:
code: 200
message: OK
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
interactions:
- request:
body: '{"messages": [{"role": "user", "content": "Say this is a test"}], "model":
"gpt-4o-mini", "n": 2, "stream": false}'
body: |-
{
"messages": [
{
"role": "user",
"content": "Say this is a test"
}
],
"model": "gpt-4o-mini",
"n": 2,
"stream": false
}
headers:
accept:
- application/json
Expand Down Expand Up @@ -35,31 +45,62 @@ interactions:
uri: https://api.openai.com/v1/chat/completions
response:
body:
string: "{\n \"id\": \"chatcmpl-ARJJITAE6LSpkhJ4F6Lkgx1hjMWce\",\n \"object\":
\"chat.completion\",\n \"created\": 1731072448,\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.\",\n \"refusal\":
null\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n
\ },\n {\n \"index\": 1,\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\": 17,\n \"total_tokens\": 29,\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 \"system_fingerprint\":
\"fp_9b78b61c52\"\n}\n"
string: |-
{
"id": "chatcmpl-ASNOJmzXWHqTArL7xMAtIJhIuu46p",
"object": "chat.completion",
"created": 1731326463,
"model": "gpt-4o-mini-2024-07-18",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "This is a test! How can I assist you further?",
"refusal": null
},
"logprobs": null,
"finish_reason": "stop"
},
{
"index": 1,
"message": {
"role": "assistant",
"content": "This is a test. How can I assist you further?",
"refusal": null
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 24,
"total_tokens": 36,
"prompt_tokens_details": {
"cached_tokens": 0,
"audio_tokens": 0
},
"completion_tokens_details": {
"reasoning_tokens": 0,
"audio_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0
}
},
"system_fingerprint": "fp_0ba0d124f1"
}
headers:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 8df5e692e8c9129a-MRS
- 8e0e201e3de30771-MRS
Connection:
- keep-alive
Content-Type:
- application/json
Date:
- Fri, 08 Nov 2024 13:27:29 GMT
- Mon, 11 Nov 2024 12:01:04 GMT
Server:
- cloudflare
Set-Cookie: test_set_cookie
Expand All @@ -72,10 +113,10 @@ interactions:
alt-svc:
- h3=":443"; ma=86400
content-length:
- '1000'
- '1030'
openai-organization: test_organization
openai-processing-ms:
- '404'
- '373'
openai-version:
- '2020-10-01'
strict-transport-security:
Expand All @@ -93,7 +134,7 @@ interactions:
x-ratelimit-reset-tokens:
- 0s
x-request-id:
- req_7d77cf85328e6feb1d9c2d52f2a69cfb
- req_d1f29830c9ae2a48e896be67a1edcfd6
status:
code: 200
message: OK
Expand Down
Loading

0 comments on commit accf17c

Please sign in to comment.