Skip to content

Commit

Permalink
pretty print test json data to reduce churn
Browse files Browse the repository at this point in the history
  • Loading branch information
leondz committed Feb 19, 2025
1 parent 3569f39 commit 2779129
Show file tree
Hide file tree
Showing 3 changed files with 171 additions and 138 deletions.
12 changes: 8 additions & 4 deletions tests/generators/hf_inference.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"hf_inference": {
"code": 200,
"json": [{"generated_text": "restricted by their policy,"}]
}
"hf_inference" : {
"code" : 200,
"json" : [
{
"generated_text" : "restricted by their policy,"
}
]
}
}
243 changes: 136 additions & 107 deletions tests/generators/openai.json
Original file line number Diff line number Diff line change
@@ -1,111 +1,140 @@
{
"azure_chat_default_generations": {
"code": 200,
"json": {
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {"content": "This is a test!", "role": "assistant"}
}
],
"created": 1724052469,
"id": "chatcmpl-9xr5pU1EE4XQw9Bd0QOgkFZ82cAS9",
"model": "gpt-4o-2024-05-13",
"object": "chat.completion",
"prompt_filter_results": [
{
"prompt_index": 0,
"content_filter_results": {
"hate": {"filtered": false, "severity": "safe"},
"jailbreak": {"filtered": false, "detected": false},
"self_harm": {"filtered": false, "severity": "safe"},
"sexual": {"filtered": false, "severity": "safe"},
"violence": {"filtered": false, "severity": "safe"}
}
}
],
"system_fingerprint": "fp_abc28019ad",
"usage": {
"completion_tokens": 171,
"prompt_tokens": 42,
"total_tokens": 213
"auth_fail" : {
"code" : 401,
"json" : {
"error" : {
"code" : "invalid_api_key",
"message" : "Incorrect API key provided: invalid_***_key. You can find your API key at https://platform.openai.com/account/api-keys.",
"param" : null,
"type" : "invalid_request_error"
}
}
},
"azure_chat_default_generations" : {
"code" : 200,
"json" : {
"choices" : [
{
"finish_reason" : "stop",
"index" : 0,
"logprobs" : null,
"message" : {
"content" : "This is a test!",
"role" : "assistant"
}
}
}
},
"completion": {
"code": 200,
"json": {
"id": "cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7",
"object": "text_completion",
"created": 1589478378,
"model": "gpt-3.5-turbo-instruct",
"system_fingerprint": "fp_44709d6fcb",
"choices": [
{
"text": "This is indeed a test",
"index": 0,
"logprobs": null,
"finish_reason": "length"
}
],
"usage": {"prompt_tokens": 5, "completion_tokens": 7, "total_tokens": 12}
}
},
"chat": {
"code": 200,
"json": {
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1677858242,
"model": "gpt-3.5-turbo-0613",
"usage": {"prompt_tokens": 13, "completion_tokens": 7, "total_tokens": 20},
"choices": [
{
"message": {"role": "assistant", "content": "This is a test!"},
"logprobs": null,
"finish_reason": "stop",
"index": 0
}
]
}
},
"auth_fail": {
"code": 401,
"json": {
"error": {
"message": "Incorrect API key provided: invalid_***_key. You can find your API key at https://platform.openai.com/account/api-keys.",
"type": "invalid_request_error",
"param": null,
"code": "invalid_api_key"
],
"created" : 1724052469,
"id" : "chatcmpl-9xr5pU1EE4XQw9Bd0QOgkFZ82cAS9",
"model" : "gpt-4o-2024-05-13",
"object" : "chat.completion",
"prompt_filter_results" : [
{
"content_filter_results" : {
"hate" : {
"filtered" : false,
"severity" : "safe"
},
"jailbreak" : {
"detected" : false,
"filtered" : false
},
"self_harm" : {
"filtered" : false,
"severity" : "safe"
},
"sexual" : {
"filtered" : false,
"severity" : "safe"
},
"violence" : {
"filtered" : false,
"severity" : "safe"
}
},
"prompt_index" : 0
}
}
},
"models": {
"code": 200,
"json": {
"object": "list",
"data": [
{
"id": "model-id-0",
"object": "model",
"created": 1686935002,
"owned_by": "organization-owner"
},
{
"id": "model-id-1",
"object": "model",
"created": 1686935002,
"owned_by": "organization-owner"
},
{
"id": "model-id-2",
"object": "model",
"created": 1686935002,
"owned_by": "openai"
}
]
}
}
],
"system_fingerprint" : "fp_abc28019ad",
"usage" : {
"completion_tokens" : 171,
"prompt_tokens" : 42,
"total_tokens" : 213
}
}
},
"chat" : {
"code" : 200,
"json" : {
"choices" : [
{
"finish_reason" : "stop",
"index" : 0,
"logprobs" : null,
"message" : {
"content" : "This is a test!",
"role" : "assistant"
}
}
],
"created" : 1677858242,
"id" : "chatcmpl-abc123",
"model" : "gpt-3.5-turbo-0613",
"object" : "chat.completion",
"usage" : {
"completion_tokens" : 7,
"prompt_tokens" : 13,
"total_tokens" : 20
}
}
},
"completion" : {
"code" : 200,
"json" : {
"choices" : [
{
"finish_reason" : "length",
"index" : 0,
"logprobs" : null,
"text" : "This is indeed a test"
}
],
"created" : 1589478378,
"id" : "cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7",
"model" : "gpt-3.5-turbo-instruct",
"object" : "text_completion",
"system_fingerprint" : "fp_44709d6fcb",
"usage" : {
"completion_tokens" : 7,
"prompt_tokens" : 5,
"total_tokens" : 12
}
}
},
"models" : {
"code" : 200,
"json" : {
"data" : [
{
"created" : 1686935002,
"id" : "model-id-0",
"object" : "model",
"owned_by" : "organization-owner"
},
{
"created" : 1686935002,
"id" : "model-id-1",
"object" : "model",
"owned_by" : "organization-owner"
},
{
"created" : 1686935002,
"id" : "model-id-2",
"object" : "model",
"owned_by" : "openai"
}
],
"object" : "list"
}
}
}
54 changes: 27 additions & 27 deletions tests/generators/watsonx.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
{
"watsonx_bearer_token": {
"code": 200,
"json": {
"access_token": "fake_token1231231231",
"refresh_token": "not_supported",
"token_type": "Bearer",
"expires_in": 3600,
"expiration": 1737754747,
"scope": "ibm openid"
}
},
"watsonx_generation": {
"code": 200,
"json": {
"model_id": "ibm/granite-3-8b-instruct",
"model_version": "1.1.0",
"created_at": "2025-01-24T20:51:59.520Z",
"results": [
{
"generated_text": "This is a test generation. :)",
"generated_token_count": 32,
"input_token_count": 6,
"stop_reason": "eos_token"
}
]
}
}
"watsonx_bearer_token" : {
"code" : 200,
"json" : {
"access_token" : "fake_token1231231231",
"expiration" : 1737754747,
"expires_in" : 3600,
"refresh_token" : "not_supported",
"scope" : "ibm openid",
"token_type" : "Bearer"
}
},
"watsonx_generation" : {
"code" : 200,
"json" : {
"created_at" : "2025-01-24T20:51:59.520Z",
"model_id" : "ibm/granite-3-8b-instruct",
"model_version" : "1.1.0",
"results" : [
{
"generated_text" : "This is a test generation. :)",
"generated_token_count" : 32,
"input_token_count" : 6,
"stop_reason" : "eos_token"
}
]
}
}
}

0 comments on commit 2779129

Please sign in to comment.