Skip to content

Commit 2779129

Browse files
committed
pretty print test json data to reduce churn
1 parent 3569f39 commit 2779129

File tree

3 files changed

+171
-138
lines changed

3 files changed

+171
-138
lines changed

tests/generators/hf_inference.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
2-
"hf_inference": {
3-
"code": 200,
4-
"json": [{"generated_text": "restricted by their policy,"}]
5-
}
2+
"hf_inference" : {
3+
"code" : 200,
4+
"json" : [
5+
{
6+
"generated_text" : "restricted by their policy,"
7+
}
8+
]
9+
}
610
}

tests/generators/openai.json

Lines changed: 136 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,140 @@
11
{
2-
"azure_chat_default_generations": {
3-
"code": 200,
4-
"json": {
5-
"choices": [
6-
{
7-
"finish_reason": "stop",
8-
"index": 0,
9-
"logprobs": null,
10-
"message": {"content": "This is a test!", "role": "assistant"}
11-
}
12-
],
13-
"created": 1724052469,
14-
"id": "chatcmpl-9xr5pU1EE4XQw9Bd0QOgkFZ82cAS9",
15-
"model": "gpt-4o-2024-05-13",
16-
"object": "chat.completion",
17-
"prompt_filter_results": [
18-
{
19-
"prompt_index": 0,
20-
"content_filter_results": {
21-
"hate": {"filtered": false, "severity": "safe"},
22-
"jailbreak": {"filtered": false, "detected": false},
23-
"self_harm": {"filtered": false, "severity": "safe"},
24-
"sexual": {"filtered": false, "severity": "safe"},
25-
"violence": {"filtered": false, "severity": "safe"}
26-
}
27-
}
28-
],
29-
"system_fingerprint": "fp_abc28019ad",
30-
"usage": {
31-
"completion_tokens": 171,
32-
"prompt_tokens": 42,
33-
"total_tokens": 213
2+
"auth_fail" : {
3+
"code" : 401,
4+
"json" : {
5+
"error" : {
6+
"code" : "invalid_api_key",
7+
"message" : "Incorrect API key provided: invalid_***_key. You can find your API key at https://platform.openai.com/account/api-keys.",
8+
"param" : null,
9+
"type" : "invalid_request_error"
10+
}
11+
}
12+
},
13+
"azure_chat_default_generations" : {
14+
"code" : 200,
15+
"json" : {
16+
"choices" : [
17+
{
18+
"finish_reason" : "stop",
19+
"index" : 0,
20+
"logprobs" : null,
21+
"message" : {
22+
"content" : "This is a test!",
23+
"role" : "assistant"
24+
}
3425
}
35-
}
36-
},
37-
"completion": {
38-
"code": 200,
39-
"json": {
40-
"id": "cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7",
41-
"object": "text_completion",
42-
"created": 1589478378,
43-
"model": "gpt-3.5-turbo-instruct",
44-
"system_fingerprint": "fp_44709d6fcb",
45-
"choices": [
46-
{
47-
"text": "This is indeed a test",
48-
"index": 0,
49-
"logprobs": null,
50-
"finish_reason": "length"
51-
}
52-
],
53-
"usage": {"prompt_tokens": 5, "completion_tokens": 7, "total_tokens": 12}
54-
}
55-
},
56-
"chat": {
57-
"code": 200,
58-
"json": {
59-
"id": "chatcmpl-abc123",
60-
"object": "chat.completion",
61-
"created": 1677858242,
62-
"model": "gpt-3.5-turbo-0613",
63-
"usage": {"prompt_tokens": 13, "completion_tokens": 7, "total_tokens": 20},
64-
"choices": [
65-
{
66-
"message": {"role": "assistant", "content": "This is a test!"},
67-
"logprobs": null,
68-
"finish_reason": "stop",
69-
"index": 0
70-
}
71-
]
72-
}
73-
},
74-
"auth_fail": {
75-
"code": 401,
76-
"json": {
77-
"error": {
78-
"message": "Incorrect API key provided: invalid_***_key. You can find your API key at https://platform.openai.com/account/api-keys.",
79-
"type": "invalid_request_error",
80-
"param": null,
81-
"code": "invalid_api_key"
26+
],
27+
"created" : 1724052469,
28+
"id" : "chatcmpl-9xr5pU1EE4XQw9Bd0QOgkFZ82cAS9",
29+
"model" : "gpt-4o-2024-05-13",
30+
"object" : "chat.completion",
31+
"prompt_filter_results" : [
32+
{
33+
"content_filter_results" : {
34+
"hate" : {
35+
"filtered" : false,
36+
"severity" : "safe"
37+
},
38+
"jailbreak" : {
39+
"detected" : false,
40+
"filtered" : false
41+
},
42+
"self_harm" : {
43+
"filtered" : false,
44+
"severity" : "safe"
45+
},
46+
"sexual" : {
47+
"filtered" : false,
48+
"severity" : "safe"
49+
},
50+
"violence" : {
51+
"filtered" : false,
52+
"severity" : "safe"
53+
}
54+
},
55+
"prompt_index" : 0
8256
}
83-
}
84-
},
85-
"models": {
86-
"code": 200,
87-
"json": {
88-
"object": "list",
89-
"data": [
90-
{
91-
"id": "model-id-0",
92-
"object": "model",
93-
"created": 1686935002,
94-
"owned_by": "organization-owner"
95-
},
96-
{
97-
"id": "model-id-1",
98-
"object": "model",
99-
"created": 1686935002,
100-
"owned_by": "organization-owner"
101-
},
102-
{
103-
"id": "model-id-2",
104-
"object": "model",
105-
"created": 1686935002,
106-
"owned_by": "openai"
107-
}
108-
]
109-
}
110-
}
57+
],
58+
"system_fingerprint" : "fp_abc28019ad",
59+
"usage" : {
60+
"completion_tokens" : 171,
61+
"prompt_tokens" : 42,
62+
"total_tokens" : 213
63+
}
64+
}
65+
},
66+
"chat" : {
67+
"code" : 200,
68+
"json" : {
69+
"choices" : [
70+
{
71+
"finish_reason" : "stop",
72+
"index" : 0,
73+
"logprobs" : null,
74+
"message" : {
75+
"content" : "This is a test!",
76+
"role" : "assistant"
77+
}
78+
}
79+
],
80+
"created" : 1677858242,
81+
"id" : "chatcmpl-abc123",
82+
"model" : "gpt-3.5-turbo-0613",
83+
"object" : "chat.completion",
84+
"usage" : {
85+
"completion_tokens" : 7,
86+
"prompt_tokens" : 13,
87+
"total_tokens" : 20
88+
}
89+
}
90+
},
91+
"completion" : {
92+
"code" : 200,
93+
"json" : {
94+
"choices" : [
95+
{
96+
"finish_reason" : "length",
97+
"index" : 0,
98+
"logprobs" : null,
99+
"text" : "This is indeed a test"
100+
}
101+
],
102+
"created" : 1589478378,
103+
"id" : "cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7",
104+
"model" : "gpt-3.5-turbo-instruct",
105+
"object" : "text_completion",
106+
"system_fingerprint" : "fp_44709d6fcb",
107+
"usage" : {
108+
"completion_tokens" : 7,
109+
"prompt_tokens" : 5,
110+
"total_tokens" : 12
111+
}
112+
}
113+
},
114+
"models" : {
115+
"code" : 200,
116+
"json" : {
117+
"data" : [
118+
{
119+
"created" : 1686935002,
120+
"id" : "model-id-0",
121+
"object" : "model",
122+
"owned_by" : "organization-owner"
123+
},
124+
{
125+
"created" : 1686935002,
126+
"id" : "model-id-1",
127+
"object" : "model",
128+
"owned_by" : "organization-owner"
129+
},
130+
{
131+
"created" : 1686935002,
132+
"id" : "model-id-2",
133+
"object" : "model",
134+
"owned_by" : "openai"
135+
}
136+
],
137+
"object" : "list"
138+
}
139+
}
111140
}

tests/generators/watsonx.json

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
{
2-
"watsonx_bearer_token": {
3-
"code": 200,
4-
"json": {
5-
"access_token": "fake_token1231231231",
6-
"refresh_token": "not_supported",
7-
"token_type": "Bearer",
8-
"expires_in": 3600,
9-
"expiration": 1737754747,
10-
"scope": "ibm openid"
11-
}
12-
},
13-
"watsonx_generation": {
14-
"code": 200,
15-
"json": {
16-
"model_id": "ibm/granite-3-8b-instruct",
17-
"model_version": "1.1.0",
18-
"created_at": "2025-01-24T20:51:59.520Z",
19-
"results": [
20-
{
21-
"generated_text": "This is a test generation. :)",
22-
"generated_token_count": 32,
23-
"input_token_count": 6,
24-
"stop_reason": "eos_token"
25-
}
26-
]
27-
}
28-
}
2+
"watsonx_bearer_token" : {
3+
"code" : 200,
4+
"json" : {
5+
"access_token" : "fake_token1231231231",
6+
"expiration" : 1737754747,
7+
"expires_in" : 3600,
8+
"refresh_token" : "not_supported",
9+
"scope" : "ibm openid",
10+
"token_type" : "Bearer"
11+
}
12+
},
13+
"watsonx_generation" : {
14+
"code" : 200,
15+
"json" : {
16+
"created_at" : "2025-01-24T20:51:59.520Z",
17+
"model_id" : "ibm/granite-3-8b-instruct",
18+
"model_version" : "1.1.0",
19+
"results" : [
20+
{
21+
"generated_text" : "This is a test generation. :)",
22+
"generated_token_count" : 32,
23+
"input_token_count" : 6,
24+
"stop_reason" : "eos_token"
25+
}
26+
]
27+
}
28+
}
2929
}

0 commit comments

Comments
 (0)