From f02fa5599679b23ba1d760751d11a36a8a647d28 Mon Sep 17 00:00:00 2001 From: Raniery Date: Tue, 9 Dec 2025 11:09:13 -0300 Subject: [PATCH 01/10] spec: remove vcr and cassettes --- Gemfile | 1 - Gemfile.lock | 4 - .../handles_400_bad_request.yml | 927 ------------------ .../handles_401_unauthorized.yml | 859 ---------------- .../handles_429_rate_limit.yml | 927 ------------------ .../handles_500_server_error.yml | 927 ------------------ .../creates_session_with_all_params.yml | 795 --------------- .../creates_session_successfully.yml | 861 ---------------- .../uses_default_client.yml | 729 -------------- .../creates_and_updates_current_session.yml | 795 --------------- .../parses_response_correctly.yml | 795 --------------- .../all_disabled.yml | 795 --------------- .../all_enabled.yml | 795 --------------- .../minimal_config.yml | 795 --------------- .../mixed_settings.yml | 795 --------------- .../last_activity_anchor.yml | 795 --------------- .../long_expiry.yml | 795 --------------- .../short_expiry.yml | 795 --------------- .../high_limit.yml | 795 --------------- .../low_limit.yml | 795 --------------- .../no_limit.yml | 795 --------------- .../complex_state.yml | 673 ------------- .../empty_state.yml | 663 ------------- .../nil_state.yml | 663 ------------- .../nil_version.yml | 663 ------------- .../with_complex_state.yml | 137 --- .../with_empty_state.yml | 135 --- .../with_nil_state.yml | 135 --- .../with_nil_version.yml | 135 --- spec/spec_helper.rb | 4 - spec/support/vcr.rb | 138 --- 31 files changed, 18916 deletions(-) delete mode 100644 spec/cassettes/ChatKit_Session/_create_/with_API_error_responses/handles_400_bad_request.yml delete mode 100644 spec/cassettes/ChatKit_Session/_create_/with_API_error_responses/handles_401_unauthorized.yml delete mode 100644 spec/cassettes/ChatKit_Session/_create_/with_API_error_responses/handles_429_rate_limit.yml delete mode 100644 spec/cassettes/ChatKit_Session/_create_/with_API_error_responses/handles_500_server_error.yml delete mode 100644 spec/cassettes/ChatKit_Session/_create_/with_all_optional_parameters/creates_session_with_all_params.yml delete mode 100644 spec/cassettes/ChatKit_Session/_create_/with_minimal_required_parameters/creates_session_successfully.yml delete mode 100644 spec/cassettes/ChatKit_Session/_create_/with_minimal_required_parameters/uses_default_client.yml delete mode 100644 spec/cassettes/ChatKit_Session/_create_/with_successful_API_response/creates_and_updates_current_session.yml delete mode 100644 spec/cassettes/ChatKit_Session/_create_/with_successful_API_response/parses_response_correctly.yml delete mode 100644 spec/cassettes/ChatKit_Session/parameter_combinations/chatkit_configuration_parameter_variations/all_disabled.yml delete mode 100644 spec/cassettes/ChatKit_Session/parameter_combinations/chatkit_configuration_parameter_variations/all_enabled.yml delete mode 100644 spec/cassettes/ChatKit_Session/parameter_combinations/chatkit_configuration_parameter_variations/minimal_config.yml delete mode 100644 spec/cassettes/ChatKit_Session/parameter_combinations/chatkit_configuration_parameter_variations/mixed_settings.yml delete mode 100644 spec/cassettes/ChatKit_Session/parameter_combinations/expires_after_parameter_variations/last_activity_anchor.yml delete mode 100644 spec/cassettes/ChatKit_Session/parameter_combinations/expires_after_parameter_variations/long_expiry.yml delete mode 100644 spec/cassettes/ChatKit_Session/parameter_combinations/expires_after_parameter_variations/short_expiry.yml delete mode 100644 spec/cassettes/ChatKit_Session/parameter_combinations/rate_limits_parameter_variations/high_limit.yml delete mode 100644 spec/cassettes/ChatKit_Session/parameter_combinations/rate_limits_parameter_variations/low_limit.yml delete mode 100644 spec/cassettes/ChatKit_Session/parameter_combinations/rate_limits_parameter_variations/no_limit.yml delete mode 100644 spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/complex_state.yml delete mode 100644 spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/empty_state.yml delete mode 100644 spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/nil_state.yml delete mode 100644 spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/nil_version.yml delete mode 100644 spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/with_complex_state.yml delete mode 100644 spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/with_empty_state.yml delete mode 100644 spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/with_nil_state.yml delete mode 100644 spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/with_nil_version.yml delete mode 100644 spec/support/vcr.rb diff --git a/Gemfile b/Gemfile index a401e6d..146afd2 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,6 @@ gem "rake", "~> 13.3.1" gem "dotenv-rails" gem "factory_bot", "~> 6.5.6" gem "rspec", "~> 3.13.2" -gem "vcr", "~> 6.3.1" gem "webmock" gem "logger" diff --git a/Gemfile.lock b/Gemfile.lock index d38720b..c70c513 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -66,7 +66,6 @@ GEM event_stream_parser (1.0.0) factory_bot (6.5.6) activesupport (>= 6.1.0) - ffi (1.17.2) ffi (1.17.2-arm64-darwin) ffi-compiler (1.3.2) ffi (>= 1.15.5) @@ -205,8 +204,6 @@ GEM unicode-emoji (4.1.0) uri (1.1.1) useragent (0.16.11) - vcr (6.3.1) - base64 webmock (3.24.0) addressable (>= 2.8.0) crack (>= 0.3.2) @@ -232,7 +229,6 @@ DEPENDENCIES rubocop-rspec ruby-chatkit! shoulda-matchers (~> 7.0.1) - vcr (~> 6.3.1) webmock BUNDLED WITH diff --git a/spec/cassettes/ChatKit_Session/_create_/with_API_error_responses/handles_400_bad_request.yml b/spec/cassettes/ChatKit_Session/_create_/with_API_error_responses/handles_400_bad_request.yml deleted file mode 100644 index b85dfd8..0000000 --- a/spec/cassettes/ChatKit_Session/_create_/with_API_error_responses/handles_400_bad_request.yml +++ /dev/null @@ -1,927 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:55:10 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '12' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '13' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0697383f0c344f-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:55:10 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:57:10 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '14' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '15' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069a23f9ddff7c-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:57:10 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:02:28 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '15' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '16' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06f9cd9bae5e21-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:02:28 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:03:18 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '19' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '20' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fb03ad6201a7-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:03:18 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:23 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '16' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '18' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fc9a3d6cae1a-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:23 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:31 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '19' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '26' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fccddab85d2d-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:31 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:04 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '14' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '15' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06ff12fefd581b-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:04 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:53 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '23' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '24' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0700407b764f4d-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:53 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 09:42:45 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '20' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '21' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ec2648a58f435-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 09:42:45 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 10:08:46 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '16' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '17' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ee87f88a4a187-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 10:08:46 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:15:13 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '36' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '37' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa1bd9b147e8c-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:15:13 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:17:28 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa50ad8b33f20-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:17:28 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:41:25 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fc81bdbcd2df6-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:41:25 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 13:21:41 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a1003163b729ca9-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 13:21:41 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/_create_/with_API_error_responses/handles_401_unauthorized.yml b/spec/cassettes/ChatKit_Session/_create_/with_API_error_responses/handles_401_unauthorized.yml deleted file mode 100644 index d9956ea..0000000 --- a/spec/cassettes/ChatKit_Session/_create_/with_API_error_responses/handles_401_unauthorized.yml +++ /dev/null @@ -1,859 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 500 - message: Internal Server Error - headers: - Date: - - Tue, 18 Nov 2025 11:02:28 GMT - Content-Type: - - application/json - Content-Length: - - '175' - Connection: - - keep-alive - Openai-Processing-Ms: - - '310' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '311' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06f9c98e8e9f3d-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "The server had an error while processing your request. Sorry about that!", - "type": "server_error", - "param": null, - "code": null - } - } - recorded_at: Tue, 18 Nov 2025 11:02:28 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:03:18 GMT - Content-Type: - - application/json - Content-Length: - - '240' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '28' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '30' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fb01bcfcf191-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: . You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:03:18 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:03:36 GMT - Content-Type: - - application/json - Content-Length: - - '240' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '31' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '32' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fb730a1f6235-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: . You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:03:36 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:23 GMT - Content-Type: - - application/json - Content-Length: - - '240' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '15' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '17' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fc984d95a421-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: . You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:23 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:31 GMT - Content-Type: - - application/json - Content-Length: - - '240' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '30' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '31' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fccbeff3f235-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: . You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:31 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:04 GMT - Content-Type: - - application/json - Content-Length: - - '240' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '18' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '19' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06ff110ca9a4ab-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: . You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:04 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:52 GMT - Content-Type: - - application/json - Content-Length: - - '240' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '20' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '21' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a07003e8a301d2a-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: . You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:52 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 09:42:45 GMT - Content-Type: - - application/json - Content-Length: - - '240' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '33' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '35' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ec2629a8c4b4c-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: . You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 09:42:45 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 10:08:45 GMT - Content-Type: - - application/json - Content-Length: - - '240' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '36' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '39' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ee87d7855a463-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: . You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 10:08:45 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:15:13 GMT - Content-Type: - - application/json - Content-Length: - - '240' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '42' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '43' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa1bb8df3fc31-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: . You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:15:13 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:17:28 GMT - Content-Type: - - application/json - Content-Length: - - '240' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '31' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '32' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa508cff38913-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: . You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:17:28 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:41:24 GMT - Content-Type: - - application/json - Content-Length: - - '240' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '25' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '26' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fc819e850cd6d-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: . You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:41:24 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 13:21:40 GMT - Content-Type: - - application/json - Content-Length: - - '240' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '50' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '51' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a1003133d3f1ced-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: . You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 13:21:40 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/_create_/with_API_error_responses/handles_429_rate_limit.yml b/spec/cassettes/ChatKit_Session/_create_/with_API_error_responses/handles_429_rate_limit.yml deleted file mode 100644 index 9d5930d..0000000 --- a/spec/cassettes/ChatKit_Session/_create_/with_API_error_responses/handles_429_rate_limit.yml +++ /dev/null @@ -1,927 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:55:11 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '51' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '52' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06973a4e0faec6-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:55:11 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:57:10 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '12' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '13' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069a25db11f211-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:57:10 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:02:29 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '13' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '15' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06f9cf6f03abfb-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:02:29 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:03:18 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '3' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fb05a8a1a010-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:03:18 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:23 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '16' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '18' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fc9c0d8988b4-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:23 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:32 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fcd00f636d55-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:32 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:05 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '12' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '13' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06ff14d8a0cd6d-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:05 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:53 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '27' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '29' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0700427eef00fd-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:53 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 09:42:45 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '17' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '19' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ec266ce60ca0a-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 09:42:45 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 10:08:46 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '13' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '15' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ee881fcad0228-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 10:08:46 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:15:14 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '8' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa1c04ea7a09c-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:15:14 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:17:29 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa50c7f9c6265-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:17:29 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:41:25 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fc81dad738781-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:41:25 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 13:21:41 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '15' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '16' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a1003184a4e9a7f-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 13:21:41 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/_create_/with_API_error_responses/handles_500_server_error.yml b/spec/cassettes/ChatKit_Session/_create_/with_API_error_responses/handles_500_server_error.yml deleted file mode 100644 index 3a78aea..0000000 --- a/spec/cassettes/ChatKit_Session/_create_/with_API_error_responses/handles_500_server_error.yml +++ /dev/null @@ -1,927 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:55:12 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '20' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '21' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06973f3b09f24f-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:55:12 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:57:11 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '16' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '18' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069a27ff464568-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:57:11 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:02:29 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06f9d129aa01a5-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:02:29 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:03:19 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '16' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '18' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fb076e56f16d-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:03:19 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:24 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '21' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '23' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fc9dda2c0320-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:24 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:32 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '5' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '6' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fcd21f7bf20f-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:32 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:05 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '3' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06ff16ad996b20-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:05 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:53 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '3' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0700447e654cf7-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:53 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 09:42:46 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '38' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '40' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ec268adcfacbf-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 09:42:46 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 10:08:46 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '14' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '15' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ee883cfc11aca-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 10:08:46 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:15:14 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '3' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa1c20ce4b81e-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:15:14 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:17:29 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '13' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '15' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa50e5ef33e73-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:17:29 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:41:25 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '17' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '18' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fc81fdafe02fa-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:41:25 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 13:21:41 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a10031a487bf1f5-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 13:21:41 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/_create_/with_all_optional_parameters/creates_session_with_all_params.yml b/spec/cassettes/ChatKit_Session/_create_/with_all_optional_parameters/creates_session_with_all_params.yml deleted file mode 100644 index 5eadae3..0000000 --- a/spec/cassettes/ChatKit_Session/_create_/with_all_optional_parameters/creates_session_with_all_params.yml +++ /dev/null @@ -1,795 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:55:10 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '13' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '14' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0697355cd7f1fc-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:55:10 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:57:10 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '19' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '20' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069a221e09f19c-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:57:10 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:02:27 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '57' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '58' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06f9c738f70195-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:02:27 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:31 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fcc9cb875f30-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:31 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:04 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06ff0f2abe29ee-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:04 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:52 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '13' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '14' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a07003cca6ca188-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:52 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 09:42:44 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '12' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '13' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ec260bc08998e-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 09:42:44 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 10:08:45 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '31' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '33' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ee879bbb01d2a-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 10:08:45 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:15:13 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '13' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '14' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa1b9998e5b29-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:15:13 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:17:28 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '10' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '12' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa506ff16f237-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:17:28 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:41:24 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '16' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '17' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fc8181e5d1f69-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:41:24 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 13:21:40 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a100311298695ee-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 13:21:40 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/_create_/with_minimal_required_parameters/creates_session_successfully.yml b/spec/cassettes/ChatKit_Session/_create_/with_minimal_required_parameters/creates_session_successfully.yml deleted file mode 100644 index 069c078..0000000 --- a/spec/cassettes/ChatKit_Session/_create_/with_minimal_required_parameters/creates_session_successfully.yml +++ /dev/null @@ -1,861 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:55:09 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '24' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '25' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0697300b0624cd-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:55:09 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:57:09 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '19' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '20' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069a1d6c33ff14-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:57:09 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:02:21 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06f99c8da82538-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:02:21 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:02:27 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06f9c55e3b566f-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:02:27 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:30 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fcc6498da454-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:30 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:03 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06ff0b3dde7a2f-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:03 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:51 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '19' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '20' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a070038df4752d2-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:51 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 09:42:44 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '49' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '50' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ec25c8da13e73-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 09:42:44 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 10:08:44 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '31' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '33' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ee87598841aae-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 10:08:44 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:15:12 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa1b58b5fa432-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:15:12 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:17:27 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa5031add1a9d-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:17:27 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:41:24 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fc8146e16721c-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:41:24 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 13:21:39 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a10030cdbdf0117-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 13:21:39 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/_create_/with_minimal_required_parameters/uses_default_client.yml b/spec/cassettes/ChatKit_Session/_create_/with_minimal_required_parameters/uses_default_client.yml deleted file mode 100644 index 2500b6e..0000000 --- a/spec/cassettes/ChatKit_Session/_create_/with_minimal_required_parameters/uses_default_client.yml +++ /dev/null @@ -1,729 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:55:10 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '31' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '33' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069732dff0877b-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:55:10 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:57:09 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '14' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '16' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069a1f8ffe565d-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:57:09 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:30 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fcc80e7de967-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:30 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:03 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06ff0cfff04ceb-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:03 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:52 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a07003abf30b3a6-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:52 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 09:42:44 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '33' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '34' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ec25e9da46265-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 09:42:44 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 10:08:44 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '39' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '40' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ee877fe292788-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 10:08:44 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:15:12 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '33' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '34' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa1b74b1f1abc-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:15:12 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:17:28 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '16' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '17' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa505080270c6-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:17:28 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:41:24 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '6' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fc8164c9ca531-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:41:24 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 13:21:39 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a10030f1a261a98-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 13:21:39 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/_create_/with_successful_API_response/creates_and_updates_current_session.yml b/spec/cassettes/ChatKit_Session/_create_/with_successful_API_response/creates_and_updates_current_session.yml deleted file mode 100644 index 376d7d5..0000000 --- a/spec/cassettes/ChatKit_Session/_create_/with_successful_API_response/creates_and_updates_current_session.yml +++ /dev/null @@ -1,795 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:55:12 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '18' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '19' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0697413fd17a84-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:55:12 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:57:11 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '13' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '14' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069a2b0cfce022-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:57:11 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:02:29 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '48' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '49' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06f9d29e286237-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:02:29 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:32 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fcd3e8b8cdc3-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:32 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:05 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '23' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '25' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06ff186941e851-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:05 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:53 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0700464c91f266-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:53 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 09:42:46 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '20' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '21' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ec26a7e7e1cef-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 09:42:46 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 10:08:47 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '3' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ee885bdf600e5-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 10:08:47 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:15:14 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '12' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '14' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa1c3cc02f250-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:15:14 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:17:29 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '20' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '21' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa5104d88f254-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:17:29 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:41:26 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '6' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fc821be2daf6e-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:41:26 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 13:21:41 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a10031c4e94c683-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 13:21:41 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/_create_/with_successful_API_response/parses_response_correctly.yml b/spec/cassettes/ChatKit_Session/_create_/with_successful_API_response/parses_response_correctly.yml deleted file mode 100644 index b9eb5bd..0000000 --- a/spec/cassettes/ChatKit_Session/_create_/with_successful_API_response/parses_response_correctly.yml +++ /dev/null @@ -1,795 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:55:12 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '3' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0697431fc0de31-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:55:12 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:57:12 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '11' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '12' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069a2d2cc1a444-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:57:12 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:02:30 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '21' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '23' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06f9d4c94f181d-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:02:30 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:33 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fcd78b626286-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:33 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:05 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '6' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06ff1a3f4ea420-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:05 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:54 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a07004828d5f1d3-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:54 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 09:42:46 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '12' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '16' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ec26c6f580301-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 09:42:46 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 10:08:47 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '19' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '20' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ee887dd19f194-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 10:08:47 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:15:14 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '15' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '16' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa1c5989d03e5-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:15:15 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:17:30 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '5' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '7' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa5121f6ef250-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:17:30 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:41:26 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '19' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '20' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fc8239913af3e-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:41:26 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 13:21:42 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a10031e0e336e30-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 13:21:42 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/parameter_combinations/chatkit_configuration_parameter_variations/all_disabled.yml b/spec/cassettes/ChatKit_Session/parameter_combinations/chatkit_configuration_parameter_variations/all_disabled.yml deleted file mode 100644 index b809f26..0000000 --- a/spec/cassettes/ChatKit_Session/parameter_combinations/chatkit_configuration_parameter_variations/all_disabled.yml +++ /dev/null @@ -1,795 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:55:13 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '15' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '17' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069746ae074835-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:55:13 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:57:12 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '14' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '15' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069a30afe34d3b-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:57:12 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:02:30 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '17' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '19' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06f9d85bc71d09-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:02:30 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:35 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '1096' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '1097' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fcdb1dc36eb1-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:35 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:06 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '5' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '6' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06ff1ddd94f252-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:06 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:54 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a07004b5ef98e32-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:54 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 09:42:47 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '17' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '18' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ec270a93801a0-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 09:42:47 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 10:08:48 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '8' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '9' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ee88c2ee2502c-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 10:08:48 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:15:15 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '20' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '21' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa1c95a96f177-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:15:15 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:17:30 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '22' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '23' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa515e9d47a2f-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:17:30 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:41:27 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fc8277ccb4f4a-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:41:27 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 13:21:42 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '6' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a1003221e140d27-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 13:21:42 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/parameter_combinations/chatkit_configuration_parameter_variations/all_enabled.yml b/spec/cassettes/ChatKit_Session/parameter_combinations/chatkit_configuration_parameter_variations/all_enabled.yml deleted file mode 100644 index 18e2746..0000000 --- a/spec/cassettes/ChatKit_Session/parameter_combinations/chatkit_configuration_parameter_variations/all_enabled.yml +++ /dev/null @@ -1,795 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:55:12 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '16' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '17' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069744ca5a4f2b-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:55:12 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:57:12 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069a2ee85b7be8-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:57:12 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:02:30 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06f9d6abbda010-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:02:30 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:33 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fcd96f31c6a6-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:33 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:06 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '5' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '7' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06ff1bff72f1c1-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:06 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:54 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0700499b2677e8-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:54 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 09:42:47 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '24' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '25' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ec26ebbef03e5-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 09:42:47 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 10:08:47 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '37' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '38' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ee88a0ac2f250-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 10:08:47 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:15:15 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '16' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '17' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa1c7589cd48d-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:15:15 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:17:30 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa5140951af3e-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:17:30 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:41:26 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fc8258fc3a41b-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:41:26 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 13:21:42 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '5' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '6' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a1003201a5ba4a4-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 13:21:42 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/parameter_combinations/chatkit_configuration_parameter_variations/minimal_config.yml b/spec/cassettes/ChatKit_Session/parameter_combinations/chatkit_configuration_parameter_variations/minimal_config.yml deleted file mode 100644 index d061a37..0000000 --- a/spec/cassettes/ChatKit_Session/parameter_combinations/chatkit_configuration_parameter_variations/minimal_config.yml +++ /dev/null @@ -1,795 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:55:13 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '16' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '17' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06974b0b7dd28b-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:55:13 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:57:13 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069a346b6001c3-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:57:13 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:02:31 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06f9dc1e023522-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:02:31 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:35 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fce5b9e3d87c-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:35 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:07 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '15' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '16' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06ff214da66285-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:07 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:55 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a07004f1f834b35-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:55 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 09:42:47 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '19' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '21' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ec27468755e5b-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 09:42:47 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 10:08:48 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ee88fba595f30-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 10:08:48 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:15:16 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '15' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '17' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa1cd1b5436f4-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:15:16 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:17:31 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '3' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa519a8f60d0b-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:17:31 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:41:27 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '17' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '18' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fc82b29a09423-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:41:27 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 13:21:43 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a1003262dc055a8-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 13:21:43 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/parameter_combinations/chatkit_configuration_parameter_variations/mixed_settings.yml b/spec/cassettes/ChatKit_Session/parameter_combinations/chatkit_configuration_parameter_variations/mixed_settings.yml deleted file mode 100644 index d6d3c66..0000000 --- a/spec/cassettes/ChatKit_Session/parameter_combinations/chatkit_configuration_parameter_variations/mixed_settings.yml +++ /dev/null @@ -1,795 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:55:13 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '40' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '41' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0697486981721c-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:55:13 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:57:12 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '11' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '12' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069a328b68a4c0-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:57:12 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:02:30 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06f9da290600e3-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:02:30 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:35 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '6' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fce3fbe35573-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:35 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:06 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06ff1faa330cf1-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:06 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:55 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '20' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '21' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a07004d2bc21cdb-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:55 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 09:42:47 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '19' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '20' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ec2728a59f02f-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 09:42:47 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 10:08:48 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '10' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '11' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ee88dce346268-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 10:08:48 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:15:15 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '16' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '17' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa1cb2ebea593-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:15:15 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:17:31 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '2' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa517cc0237a6-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:17:31 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:41:27 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fc8294eb7aec0-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:41:27 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 13:21:43 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '15' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '16' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a1003243822c663-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 13:21:43 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/parameter_combinations/expires_after_parameter_variations/last_activity_anchor.yml b/spec/cassettes/ChatKit_Session/parameter_combinations/expires_after_parameter_variations/last_activity_anchor.yml deleted file mode 100644 index 8a4bb1c..0000000 --- a/spec/cassettes/ChatKit_Session/parameter_combinations/expires_after_parameter_variations/last_activity_anchor.yml +++ /dev/null @@ -1,795 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"last_activity","seconds":600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:55:16 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069757fb6c86c5-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:55:15 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"last_activity","seconds":600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:57:15 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '3' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069a411d3dd87c-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:57:15 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"last_activity","seconds":600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:02:33 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06f9e87f7cf1d5-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:02:33 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"last_activity","seconds":600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:37 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fcf21b77a4ed-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:37 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"last_activity","seconds":600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:09 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06ff2d5eb7f22d-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:08 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"last_activity","seconds":600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:57 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '21' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '24' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a07005bfda9877c-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:57 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"last_activity","seconds":600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 09:42:50 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '16' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '18' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ec2818e67f247-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 09:42:50 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"last_activity","seconds":600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 10:08:50 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ee89cdc9e346c-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 10:08:50 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"last_activity","seconds":600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:15:18 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa1da6e381a89-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:15:18 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"last_activity","seconds":600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:17:33 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '23' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '24' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa52749344b3f-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:17:33 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"last_activity","seconds":600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:41:29 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fc837eb105e5b-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:41:29 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"last_activity","seconds":600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 13:21:45 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a100333993d4ae8-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 13:21:45 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/parameter_combinations/expires_after_parameter_variations/long_expiry.yml b/spec/cassettes/ChatKit_Session/parameter_combinations/expires_after_parameter_variations/long_expiry.yml deleted file mode 100644 index 69d06de..0000000 --- a/spec/cassettes/ChatKit_Session/parameter_combinations/expires_after_parameter_variations/long_expiry.yml +++ /dev/null @@ -1,795 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:55:15 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0697562c8ae026-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:55:15 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:57:14 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069a3f58f300e5-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:57:14 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:02:32 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06f9e69f2f0cf1-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:02:32 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:37 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '3' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fcf03e59a463-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:37 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:08 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06ff2b89aea41a-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:08 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:57 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '22' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '23' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a07005a0e7a117d-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:57 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 09:42:49 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '3' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ec27f8db76d55-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 09:42:49 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 10:08:50 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ee89aeaf4f200-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 10:08:50 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:15:18 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '5' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '6' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa1d89cc0c14e-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:15:18 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:17:33 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '3' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa5256d2b6231-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:17:33 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:41:29 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '17' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '18' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fc835ff4c2829-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:41:29 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":3600},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 13:21:45 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '11' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '13' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a1003314bbf066a-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 13:21:45 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/parameter_combinations/expires_after_parameter_variations/short_expiry.yml b/spec/cassettes/ChatKit_Session/parameter_combinations/expires_after_parameter_variations/short_expiry.yml deleted file mode 100644 index fd05ee9..0000000 --- a/spec/cassettes/ChatKit_Session/parameter_combinations/expires_after_parameter_variations/short_expiry.yml +++ /dev/null @@ -1,795 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":60},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:55:15 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '19' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '20' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06975428a2ffa8-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:55:15 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":60},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:57:14 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069a3d7cca77c0-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:57:14 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":60},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:02:32 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06f9e4fa27da2e-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:02:32 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":60},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:37 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '16' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '17' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fcee5e9f1047-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:36 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":60},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:08 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06ff29c95c00c0-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:08 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":60},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:56 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0700583bc2066a-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:56 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":60},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 09:42:49 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '17' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '18' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ec27dbd2db81e-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 09:42:49 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":60},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 10:08:50 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '21' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '22' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ee8990dc1cccb-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 10:08:50 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":60},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:15:17 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa1d6ac33f1df-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:15:17 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":60},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:17:32 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '5' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '7' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa523ea2ac02b-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:17:32 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":60},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:41:29 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '21' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '22' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fc8342ed677ed-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:41:29 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"expires_after":{"anchor":"creation","seconds":60},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 13:21:45 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a10032f8d560137-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 13:21:45 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/parameter_combinations/rate_limits_parameter_variations/high_limit.yml b/spec/cassettes/ChatKit_Session/parameter_combinations/rate_limits_parameter_variations/high_limit.yml deleted file mode 100644 index ed6b9a1..0000000 --- a/spec/cassettes/ChatKit_Session/parameter_combinations/rate_limits_parameter_variations/high_limit.yml +++ /dev/null @@ -1,795 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:55:16 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '14' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '15' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069759785c6236-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:55:16 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:57:15 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '6' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069a42ffd7c93d-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:57:15 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:02:33 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '18' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '19' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06f9ea28ccb3a6-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:02:33 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:37 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '3' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fcf3d8f61cd3-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:37 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:09 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06ff2f1cd852d2-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:09 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:57 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '18' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '19' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a07005dfee7f195-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:57 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 09:42:50 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '26' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '28' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ec28368a8a480-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 09:42:50 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 10:08:51 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ee89e9943a417-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 10:08:51 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:15:18 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa1dc29eab816-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:15:18 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:17:33 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '32' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '33' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa5292a933289-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:17:33 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:41:30 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fc839bff3f1c1-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:41:30 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":100}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 13:21:46 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '23' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '25' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a100335886ea3f3-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 13:21:46 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/parameter_combinations/rate_limits_parameter_variations/low_limit.yml b/spec/cassettes/ChatKit_Session/parameter_combinations/rate_limits_parameter_variations/low_limit.yml deleted file mode 100644 index 10fc068..0000000 --- a/spec/cassettes/ChatKit_Session/parameter_combinations/rate_limits_parameter_variations/low_limit.yml +++ /dev/null @@ -1,795 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":5}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:55:16 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '17' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '20' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06975b7b9eb998-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:55:16 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":5}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:57:15 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '14' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '15' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069a44b8e1f17b-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:57:15 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":5}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:02:33 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '23' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '24' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06f9ebe9eba502-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:02:33 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":5}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:38 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fcf57b40a4f0-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:38 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":5}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:09 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06ff30def7dc3f-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:09 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":5}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:58 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a07005fcf1f5f0f-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:58 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":5}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 09:42:50 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '3' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ec2853abbb707-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 09:42:50 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":5}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 10:08:51 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '18' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '20' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ee8a06ca4f16d-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 10:08:51 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":5}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:15:18 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '19' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '20' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa1de184aa460-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:15:18 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":5}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:17:34 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa52b2a14fefc-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:17:34 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":5}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:41:30 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '18' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '19' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fc83b7c59a492-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:41:30 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{"max_requests_per_1_minute":5}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 13:21:46 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '6' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '7' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a100337fc6ef1cb-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 13:21:46 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/parameter_combinations/rate_limits_parameter_variations/no_limit.yml b/spec/cassettes/ChatKit_Session/parameter_combinations/rate_limits_parameter_variations/no_limit.yml deleted file mode 100644 index 17065cb..0000000 --- a/spec/cassettes/ChatKit_Session/parameter_combinations/rate_limits_parameter_variations/no_limit.yml +++ /dev/null @@ -1,795 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:55:16 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '16' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '17' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06975d6ea7a501-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:55:16 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:57:16 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '3' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069a469e681433-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:57:16 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:02:34 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06f9edca75f179-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:02:34 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:38 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fcf72b122550-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:38 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:09 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06ff329ae7f25e-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:09 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:58 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a070061a85af17b-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:58 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 09:42:50 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ec2872f64a195-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 09:42:50 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 10:08:51 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '14' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '15' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ee8a25af28dd8-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 10:08:51 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:15:19 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '15' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '16' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa1e00a3ef204-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:15:19 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:17:34 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa52cebe81b08-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:17:34 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:41:30 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '3' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fc83d5e57a5be-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:41:30 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 13:21:46 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '3' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a100339e838b559-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 13:21:46 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/complex_state.yml b/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/complex_state.yml deleted file mode 100644 index a5663ef..0000000 --- a/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/complex_state.yml +++ /dev/null @@ -1,673 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"config":{"timeout":30,"retries":3},"user_input":"Hello - world","flags":["debug","verbose"]},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:02:31 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '13' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '14' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06f9dddaf6ad09-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:02:31 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"config":{"timeout":30,"retries":3},"user_input":"Hello - world","flags":["debug","verbose"]},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:35 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fce77effcd6d-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:35 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"config":{"timeout":30,"retries":3},"user_input":"Hello - world","flags":["debug","verbose"]},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:07 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06ff231acd01aa-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:07 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"config":{"timeout":30,"retries":3},"user_input":"Hello - world","flags":["debug","verbose"]},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:55 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '18' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '19' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a070050edc1f1b5-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:55 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"config":{"timeout":30,"retries":3},"user_input":"Hello - world","flags":["debug","verbose"]},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 09:42:48 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '3' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ec2763ddd01cf-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 09:42:48 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"config":{"timeout":30,"retries":3},"user_input":"Hello - world","flags":["debug","verbose"]},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 10:08:49 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ee891995b346c-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 10:08:49 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"config":{"timeout":30,"retries":3},"user_input":"Hello - world","flags":["debug","verbose"]},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:15:16 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '16' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '17' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa1cf0b6a464c-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:15:16 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"config":{"timeout":30,"retries":3},"user_input":"Hello - world","flags":["debug","verbose"]},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:17:31 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '3' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa51b995400de-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:17:31 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"config":{"timeout":30,"retries":3},"user_input":"Hello - world","flags":["debug","verbose"]},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:41:27 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fc82cedd3c683-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:41:27 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"config":{"timeout":30,"retries":3},"user_input":"Hello - world","flags":["debug","verbose"]},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 13:21:43 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a1003280b6d2507-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 13:21:43 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/empty_state.yml b/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/empty_state.yml deleted file mode 100644 index 249e20f..0000000 --- a/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/empty_state.yml +++ /dev/null @@ -1,663 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:02:32 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '3' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06f9e15de657e6-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:02:32 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:36 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fceaddb1d94e-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:36 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:07 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06ff267ba1f1cd-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:07 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:56 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '17' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '19' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0700548ab44931-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:56 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 09:42:48 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '3' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ec27a0992f217-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 09:42:48 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 10:08:49 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '18' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '19' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ee8954948f1dd-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 10:08:49 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:15:17 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '13' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '15' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa1d2fc991a91-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:15:17 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:17:32 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '15' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '16' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa52009be6236-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:17:32 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:41:28 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '15' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '17' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fc830aeaaf217-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:41:28 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 13:21:44 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a10032bbc4a1ab6-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 13:21:44 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/nil_state.yml b/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/nil_state.yml deleted file mode 100644 index e013018..0000000 --- a/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/nil_state.yml +++ /dev/null @@ -1,663 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:02:31 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06f9df9a6a1cd3-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:02:31 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:36 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '22' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '23' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fce8e8941d13-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:36 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:07 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '6' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06ff24cffba531-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:07 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:55 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '6' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a070052bc5e00de-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:55 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 09:42:48 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '16' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '17' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ec2781e1ef258-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 09:42:48 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 10:08:49 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '21' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '21' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ee8935aa31fb4-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 10:08:49 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:15:16 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '27' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '28' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa1d0ef7e8dff-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:15:16 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:17:32 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '15' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '16' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa51e5916a423-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:17:32 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:41:28 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fc82ec9b1f225-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:41:28 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 13:21:44 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a100329dcce1c9c-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 13:21:44 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/nil_version.yml b/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/nil_version.yml deleted file mode 100644 index f24586b..0000000 --- a/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/nil_version.yml +++ /dev/null @@ -1,663 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:02:32 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '19' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '20' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06f9e31c2cf217-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:02:32 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:04:36 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '6' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06fcec9800a486-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:04:36 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:08 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06ff281fec1b08-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:08 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 11:06:56 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a070056780d4568-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 11:06:56 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 09:42:49 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '3' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ec27bda1c01b2-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 09:42:49 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 10:08:49 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '18' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '19' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0ee89738662d34-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 10:08:49 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:15:17 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '13' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '14' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa1d4ec51b490-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:15:17 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:17:32 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '13' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '14' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fa521fa8526ed-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:17:32 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 12:41:28 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0fc8329b54fd60-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 12:41:28 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Wed, 19 Nov 2025 13:21:44 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '5' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '6' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a10032d9f97d457-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Wed, 19 Nov 2025 13:21:44 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/with_complex_state.yml b/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/with_complex_state.yml deleted file mode 100644 index d21b44a..0000000 --- a/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/with_complex_state.yml +++ /dev/null @@ -1,137 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"config":{"timeout":30,"retries":3},"user_input":"Hello - world","flags":["debug","verbose"]},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:55:14 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06974cda7002e6-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:55:14 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"config":{"timeout":30,"retries":3},"user_input":"Hello - world","flags":["debug","verbose"]},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:57:13 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069a363b4daf8f-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:57:13 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/with_empty_state.yml b/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/with_empty_state.yml deleted file mode 100644 index e966ea5..0000000 --- a/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/with_empty_state.yml +++ /dev/null @@ -1,135 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:55:14 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '20' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '21' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069750abc5e90b-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:55:14 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{},"tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:57:14 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '23' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '24' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069a39f9211d0d-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:57:14 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/with_nil_state.yml b/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/with_nil_state.yml deleted file mode 100644 index d6428bc..0000000 --- a/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/with_nil_state.yml +++ /dev/null @@ -1,135 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:55:14 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '17' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '18' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a06974ec93dc02b-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:55:14 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","tracing":{},"version":"1.0.0"},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:57:13 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '4' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '5' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069a380fd71a9a-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:57:13 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/with_nil_version.yml b/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/with_nil_version.yml deleted file mode 100644 index 75a1403..0000000 --- a/spec/cassettes/ChatKit_Session/parameter_combinations/workflow_parameter_variations/with_nil_version.yml +++ /dev/null @@ -1,135 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:55:15 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '2' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '3' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a0697527d5a4bbe-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:55:15 GMT -- request: - method: post - uri: https://api.openai.com/v1/chatkit/sessions - body: - encoding: UTF-8 - string: '{"user":"","workflow":{"id":"","state_variables":{"variable1":"value1","variable2":"value2"},"tracing":{}},"chatkit_configuration":{"automatic_thread_titling":{},"file_upload":{},"history":{}},"rate_limits":{}}' - headers: - Authorization: - - Bearer - Accept: - - application/json - Content-Type: - - application/json - Openai-Beta: - - chatkit_beta=v1 - Connection: - - Keep-Alive - Host: - - api.openai.com - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Tue, 18 Nov 2025 09:57:14 GMT - Content-Type: - - application/json - Content-Length: - - '245' - Connection: - - keep-alive - Www-Authenticate: - - Bearer realm="OpenAI API" - Openai-Processing-Ms: - - '3' - Openai-Version: - - '2020-10-01' - X-Envoy-Upstream-Service-Time: - - '4' - X-Openai-Proxy-Wasm: - - v0.1 - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - Server: - - cloudflare - Cf-Ray: - - 9a069a3be81d1abf-GRU - Alt-Svc: - - h3=":443"; ma=86400 - body: - encoding: UTF-8 - string: |- - { - "error": { - "message": "Incorrect API key provided: test_api****_123. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - recorded_at: Tue, 18 Nov 2025 09:57:14 GMT -recorded_with: VCR 6.3.1 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index cd0b4cc..46899bd 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,12 +5,8 @@ require "chatkit" require "shoulda-matchers" require "factory_bot" -require "vcr" require "webmock/rspec" -# Load VCR configuration -Dir[File.expand_path("support/**/*.rb", __dir__)].each { |f| require f } - # Configure WebMock WebMock.disable_net_connect!(allow_localhost: true) diff --git a/spec/support/vcr.rb b/spec/support/vcr.rb deleted file mode 100644 index 10af5c8..0000000 --- a/spec/support/vcr.rb +++ /dev/null @@ -1,138 +0,0 @@ -# frozen_string_literal: true - -require "vcr" - -VCR.configure do |config| - # Use the cassettes directory under spec for storing recordings - config.cassette_library_dir = "spec/cassettes" - - # Use webmock to handle HTTP interactions - config.hook_into :webmock - - # Configure to record new episodes when no cassette exists - config.default_cassette_options = { - record: :new_episodes, - match_requests_on: %i[method uri headers body], - } - - # Filter sensitive data - replace API keys and secrets with placeholder values - config.filter_sensitive_data("") do |interaction| - # Extract API key from Authorization header - auth_header = interaction.request.headers["Authorization"]&.first - auth_header.split("Bearer ").last if auth_header&.include?("Bearer ") - end - - # Filter client secrets from response bodies - config.filter_sensitive_data("") do |interaction| - if interaction.response.body.include?("client_secret") - begin - response_body = JSON.parse(interaction.response.body) - response_body["client_secret"] if response_body.is_a?(Hash) - rescue JSON::ParserError - nil - end - end - end - - # Filter workflow ID from environment variable - config.filter_sensitive_data("") do |_interaction| - ENV.fetch("WORKFLOW_ID", nil) - end - - # Filter workflow IDs from request and response bodies - config.filter_sensitive_data("") do |interaction| - # From request body - if interaction.request.body&.include?("workflow") - begin - request_body = JSON.parse(interaction.request.body) - workflow_data = request_body["workflow"] - workflow_data["id"] if workflow_data.is_a?(Hash) - rescue JSON::ParserError - nil - end - end - end - - config.filter_sensitive_data("") do |interaction| - # From response body - if interaction.response.body&.include?("workflow") - begin - response_body = JSON.parse(interaction.response.body) - workflow_data = response_body["workflow"] - workflow_data["id"] if workflow_data.is_a?(Hash) - rescue JSON::ParserError - nil - end - end - end - - # Filter session IDs from responses - config.filter_sensitive_data("") do |interaction| - if interaction.response.body&.include?('"id"') - begin - response_body = JSON.parse(interaction.response.body) - response_body["id"] if response_body.is_a?(Hash) && response_body["object"] == "chatkit.session" - rescue JSON::ParserError - nil - end - end - end - - # Filter user IDs to protect user privacy - config.filter_sensitive_data("") do |interaction| - # From request body - if interaction.request.body&.include?("user") - begin - request_body = JSON.parse(interaction.request.body) - request_body["user"] if request_body.is_a?(Hash) - rescue JSON::ParserError - nil - end - end - end - - config.filter_sensitive_data("") do |interaction| - # From response body - if interaction.response.body&.include?("user") - begin - response_body = JSON.parse(interaction.response.body) - response_body["user"] if response_body.is_a?(Hash) - rescue JSON::ParserError - nil - end - end - end - - # Filter timestamps and dynamic values - config.filter_sensitive_data("") do |interaction| - if interaction.response.body&.include?("expires_at") - begin - response_body = JSON.parse(interaction.response.body) - response_body["expires_at"] if response_body.is_a?(Hash) - rescue JSON::ParserError - nil - end - end - end - - # Configure to ignore certain headers that might change between requests - config.ignore_request do |request| - # Ignore requests that don't match the OpenAI API - !request.uri.include?("api.openai.com") - end - - # Allow real HTTP connections for development/debugging when VCR_OFF is set - config.allow_http_connections_when_no_cassette = false - config.ignore_request { true } if ENV["VCR_OFF"] == "true" - - # Configure before_record hook to clean up responses - config.before_record do |interaction| - # Remove or modify headers that might contain sensitive information - interaction.request.headers.delete("User-Agent") - interaction.response.headers.delete("Set-Cookie") if interaction.response.headers["Set-Cookie"] - - # Clean up response timing headers - interaction.response.headers.delete("X-Request-Id") if interaction.response.headers["X-Request-Id"] - interaction.response.headers.delete("CF-Ray") if interaction.response.headers["CF-Ray"] - end -end From dd7fb7a2bfc95fd32f3d543e6b05565c6151d6cb Mon Sep 17 00:00:00 2001 From: Raniery Date: Thu, 11 Dec 2025 09:37:18 -0300 Subject: [PATCH 02/10] feat: add Create class for session also updates the specs --- lib/chatkit/request/endpoints.rb | 13 +- lib/chatkit/session.rb | 164 +-- .../session/{response.rb => base_response.rb} | 2 +- lib/chatkit/session/create.rb | 161 +++ lib/chatkit/session/create/response.rb | 11 + lib/chatkit/session/workflow.rb | 2 + spec/chatkit/request/endpoints_spec.rb | 4 +- spec/chatkit/session/base_response_spec.rb | 1146 +++++++++++++++++ .../automatic_thread_titling_spec.rb | 298 +++-- .../chatkit_configuration/file_upload_spec.rb | 795 +++++++----- .../chatkit_configuration/history_spec.rb | 710 +++++----- .../session/chatkit_configuration_spec.rb | 929 +++++++------ spec/chatkit/session/create_spec.rb | 811 ++++++++++++ spec/chatkit/session/expires_after_spec.rb | 534 +++++--- spec/chatkit/session/rate_limits_spec.rb | 406 ++++-- spec/chatkit/session/response_spec.rb | 541 -------- spec/chatkit/session/workflow/tracing_spec.rb | 346 ++--- spec/chatkit/session/workflow_spec.rb | 954 ++++++++------ spec/chatkit/session_spec.rb | 644 --------- spec/factories/chatkit_configuration.rb | 39 + spec/factories/response.rb | 52 + .../session/create/missing_header.json | 8 + .../fixtures/session/create/missing_user.json | 8 + .../session/create/missing_workflow.json | 8 + spec/fixtures/session/create/success.json | 35 + .../fixtures/session/create/unauthorized.json | 8 + .../session/create/workflow_not_found.json | 8 + spec/spec_helper.rb | 3 + spec/support/fixture_helper.rb | 23 + 29 files changed, 5300 insertions(+), 3363 deletions(-) rename lib/chatkit/session/{response.rb => base_response.rb} (99%) create mode 100644 lib/chatkit/session/create.rb create mode 100644 lib/chatkit/session/create/response.rb create mode 100644 spec/chatkit/session/base_response_spec.rb create mode 100644 spec/chatkit/session/create_spec.rb delete mode 100644 spec/chatkit/session/response_spec.rb delete mode 100644 spec/chatkit/session_spec.rb create mode 100644 spec/factories/response.rb create mode 100644 spec/fixtures/session/create/missing_header.json create mode 100644 spec/fixtures/session/create/missing_user.json create mode 100644 spec/fixtures/session/create/missing_workflow.json create mode 100644 spec/fixtures/session/create/success.json create mode 100644 spec/fixtures/session/create/unauthorized.json create mode 100644 spec/fixtures/session/create/workflow_not_found.json create mode 100644 spec/support/fixture_helper.rb diff --git a/lib/chatkit/request/endpoints.rb b/lib/chatkit/request/endpoints.rb index 2e24461..85f0f3b 100644 --- a/lib/chatkit/request/endpoints.rb +++ b/lib/chatkit/request/endpoints.rb @@ -9,7 +9,8 @@ module Request # etc. module Endpoints CONVERSATION = "/v1/chatkit/conversation" - SESSIONS = "/v1/chatkit/sessions" + CREATE_SESSION = "/v1/chatkit/sessions" + CANCEL_SESSION = "/v1/chatkit/sessions/%s/cancel" FILES = "/v1/chatkit/files" class << self @@ -18,8 +19,14 @@ class << self # # @return [String] The corresponding endpoint string ChatKit::Request::Endpoints.constants.each do |const_name| - define_method "#{const_name.to_s.downcase}_endpoint" do - ChatKit::Request::Endpoints.const_get(const_name) + define_method "#{const_name.to_s.downcase}_endpoint" do |path_params = {}| + if path_params + raise ArgumentError, "Path parameters must be provided as a Hash" unless path_params.is_a?(Hash) + + format(ChatKit::Request::Endpoints.const_get(const_name), **path_params) + else + ChatKit::Request::Endpoints.const_get(const_name) + end end end end diff --git a/lib/chatkit/session.rb b/lib/chatkit/session.rb index 20a63b8..72db025 100644 --- a/lib/chatkit/session.rb +++ b/lib/chatkit/session.rb @@ -17,54 +17,18 @@ module ChatKit # workflow: { id: "wf_68eeb857eaf8819089eb55d32f39a822050622537973ef99" } # ) class Session + class SessionError < StandardError; end + module Defaults ENABLED = true end - # @!attribute [rw] user_id - # @return [String] The ID of the user. - attr_accessor :user_id - - # @!attribute [rw] workflow - # @return [Workflow] The workflow for the session. - attr_accessor :workflow - - # @!attribute [rw] chatkit_configuration - # @return [ChatKitConfiguration] The ChatKit configuration. - attr_accessor :chatkit_configuration - - # @!attribute [rw] expires_after - # @return [ExpiresAfter] The expiration time for the session. - attr_accessor :expires_after + # @!attribute [rw] sesstion + # @return [Session::Create] + attr_accessor :session - # @!attribute [rw] rate_limits - # @return [RateLimits] The rate limits for the session. - attr_accessor :rate_limits - - # @!attribute [rw] response - # @return [Response] The session response data. - attr_accessor :response - - # @param workflow [Hash] The ID of the session. - # @param user_id [String] The ID of the user. - # @param chatkit_configuration [Hash, nil] - optional - The ChatKit configuration. - # @param expires_after [Hash, nil] - optional - The expiration time for the session. - # @param rate_limits [Hash, nil] - optional - The rate limits for the session. - # @param client [Ruby::ChatKit::Client] The ChatKit client instance. - def initialize( - user_id:, - workflow:, - chatkit_configuration: nil, - expires_after: nil, - rate_limits: nil, - client: Client.new - ) - @client = client - @user_id = user_id - @workflow = Workflow.build(**workflow.to_h) - @chatkit_configuration = ChatKitConfiguration.build(**chatkit_configuration.to_h) - @expires_after = ExpiresAfter.build(**expires_after) if expires_after.is_a?(Hash) - @rate_limits = RateLimits.build(**rate_limits.to_h) + def initialize + @session = nil end class << self @@ -76,103 +40,41 @@ def create!( rate_limits: nil, client: Client.new ) - new( - user_id:, - workflow:, - chatkit_configuration:, - expires_after:, - rate_limits:, - client: - ).create! + new.tap do |instance| + instance.session = Create.call( + user_id:, + workflow:, + chatkit_configuration:, + expires_after:, + rate_limits:, + client: + ) + end end - end - - # Creates a new ChatKit session. - # @return [Response] The created session data. - def create! - payload = build_payload - response = perform_request(payload) - - handle_response_errors(response) - - @response = parse_response(response) - - self - rescue StandardError => e - raise SessionError, "Session creation failed: #{e.message}" - end - - def refresh! - create! - end - - private - # @return [Hash] - def build_payload - { - user: user_id, - workflow: workflow.serialize, - chatkit_configuration: chatkit_configuration.serialize, - expires_after: expires_after&.serialize, - rate_limits: rate_limits.serialize, - }.compact - end - - # Performs the HTTP request to create a session. - # - # @param payload [Hash] The request payload. - # @return [Net::HTTPResponse] The HTTP response. - def perform_request(payload) - @client.connection.headers(sessions_header).post(sessions_endpoint, json: payload) - end - - # Handles HTTP response errors by raising appropriate exceptions. - # - # @param response [Net::HTTPResponse] The HTTP response to check. - # @raise [SessionError] If the response indicates an error. - def handle_response_errors(response) - return unless response.code >= 300 - - error_message = begin - response.parse["error"]["message"] - rescue StandardError - "Unknown error occurred" + def cancel!(session_id:, client: Client.new) + Cancel.call(session_id:, client:) end - - raise SessionError, error_message end - # Parses the HTTP response body. + # Cancel the current session. # - # @param response [Net::HTTPResponse] The HTTP response to parse. - # @return [Hash] The parsed response body. - def parse_response(response) - Response.deserialize(response.parse) + # @raise [SessionError] If there is no session to cancel. + # @return [void] + def cancel! + raise SessionError, "No session available to cancel" if @session.nil? + + Cancel.call(session_id: session.response.id) + ensure + @session = nil end - # Updates the current session with the provided data. - # - # @param data [Hash] The session data to store. - # @return [Response] The updated current session. - def update_current_session(session_response) - ChatKit.current_info.session = session_response - end - - # @param response [Net::HTTPResponse] The HTTP response to parse. - # @return [Hash] The parsed response body. - def parse!(response) - Response.deserialize(response.parse) - end - - # @return [String] The endpoint URL for sessions. - def sessions_endpoint - Request::Endpoints.sessions_endpoint - end + # Refresh the current session. + # @return [Session::Create] The refreshed session. + def refresh! + raise SessionError, "No session available to refresh" if @session.nil? - # @return [Hash] The headers for session requests. - def sessions_header - Request::Headers.sessions_header + session.call end end end diff --git a/lib/chatkit/session/response.rb b/lib/chatkit/session/base_response.rb similarity index 99% rename from lib/chatkit/session/response.rb rename to lib/chatkit/session/base_response.rb index c392775..b5e8df4 100644 --- a/lib/chatkit/session/response.rb +++ b/lib/chatkit/session/base_response.rb @@ -3,7 +3,7 @@ module ChatKit class Session # Represents a session response. - class Response + class BaseResponse # @!attribute [r] id # @return [String] attr_accessor :id diff --git a/lib/chatkit/session/create.rb b/lib/chatkit/session/create.rb new file mode 100644 index 0000000..43e183b --- /dev/null +++ b/lib/chatkit/session/create.rb @@ -0,0 +1,161 @@ +# frozen_string_literal: true + +module ChatKit + class Session + # Represents the creation of a ChatKit session. + # source: https://platform.openai.com/docs/api-reference/chatkit/sessions/create + class Create + class SessionCreateError < StandardError; end + + # @!attribute [rw] user_id + # @return [String] The ID of the user. + attr_accessor :user_id + + # @!attribute [rw] workflow + # @return [Workflow] The workflow for the session. + attr_accessor :workflow + + # @!attribute [rw] chatkit_configuration + # @return [ChatKitConfiguration] The ChatKit configuration. + attr_accessor :chatkit_configuration + + # @!attribute [rw] expires_after + # @return [ExpiresAfter] The expiration time for the session. + attr_accessor :expires_after + + # @!attribute [rw] rate_limits + # @return [RateLimits] The rate limits for the session. + attr_accessor :rate_limits + + # @!attribute [rw] response + # @return [Response] The session response data. + attr_accessor :response + + # @param user_id [String] The ID of the user. + # @param workflow [Hash] The ID of the session. + # @param chatkit_configuration [Hash, nil] - optional - The ChatKit configuration. + # @param expires_after [Hash, nil] - optional - The expiration time for the session. + # @param rate_limits [Hash, nil] - optional - The rate limits for the session. + # @param session_id [String, nil] - optional - The ID of the session. + # @param client [Ruby::ChatKit::Client] The ChatKit client instance. + def initialize( + user_id:, + workflow:, + chatkit_configuration: nil, + expires_after: nil, + rate_limits: nil, + client: Client.new + ) + @client = client + @user_id = user_id + @workflow = Session::Workflow.build(**workflow.to_h) + @chatkit_configuration = Session::ChatKitConfiguration.build(**chatkit_configuration.to_h) + @expires_after = Session::ExpiresAfter.build(**expires_after) if expires_after.is_a?(Hash) + @rate_limits = Session::RateLimits.build(**rate_limits.to_h) + end + + class << self + def call( + user_id:, + workflow:, + chatkit_configuration: nil, + expires_after: nil, + rate_limits: nil, + client: Client.new + ) + new(user_id:, workflow:, chatkit_configuration:, expires_after:, rate_limits:, client:).call + end + end + + # Executes the Create Session operation. + # + # @raise [SessionCreateError] If the session creation fails. + # @return [Session::Create] The created session instance. + def call + payload = build_payload + response = perform_request(payload) + + handle_response_errors(response) + + @response = parse_response(response) + + self + rescue StandardError => e + raise SessionCreateError, "Session creation failed: #{e.message}" + end + + def refresh! + call + end + + private + + # @return [Hash] + def build_payload + { + user: user_id, + workflow: workflow.serialize, + chatkit_configuration: chatkit_configuration.serialize, + expires_after: expires_after&.serialize, + rate_limits: rate_limits.serialize, + }.compact + end + + # Performs the HTTP request to create a session. + # + # @param payload [Hash] The request payload. + # @return [Net::HTTPResponse] The HTTP response. + def perform_request(payload) + @client.connection.headers(sessions_header).post(create_session_endpoint, json: payload) + end + + # Handles HTTP response errors by raising appropriate exceptions. + # + # @param response [Net::HTTPResponse] The HTTP response to check. + # @raise [SessionError] If the response indicates an error. + def handle_response_errors(response) + return unless response.code >= 300 + + error_message = begin + response.parse["error"]["message"] + rescue StandardError + "Unknown error occurred" + end + + raise SessionError, error_message + end + + # Parses the HTTP response body. + # + # @param response [Net::HTTPResponse] The HTTP response to parse. + # @return [Hash] The parsed response body. + def parse_response(response) + Response.deserialize(response.parse) + end + + # Updates the current session with the provided data. + # + # @param data [Hash] The session data to store. + # @return [Response] The updated current session. + def update_current_session(session_response) + ChatKit.current_info.session = session_response + end + + # @param response [Net::HTTPResponse] The HTTP response to parse. + # @return [Hash] The parsed response body. + def parse!(response) + Response.deserialize(response.parse) + end + + # @return [String] The endpoint URL for sessions. + def create_session_endpoint + Request::Endpoints.create_session_endpoint + end + + # @return [Hash] The headers for session requests. + def sessions_header + Request::Headers.sessions_header + end + end + end +end diff --git a/lib/chatkit/session/create/response.rb b/lib/chatkit/session/create/response.rb new file mode 100644 index 0000000..b044ac9 --- /dev/null +++ b/lib/chatkit/session/create/response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module ChatKit + class Session + class Create + # Represents a session response. + class Response < Session::BaseResponse + end + end + end +end diff --git a/lib/chatkit/session/workflow.rb b/lib/chatkit/session/workflow.rb index 87b80a3..f71438d 100644 --- a/lib/chatkit/session/workflow.rb +++ b/lib/chatkit/session/workflow.rb @@ -41,6 +41,8 @@ def build(id:, state_variables: nil, tracing: nil, version: nil) # @param data [Hash, nil] # @return [Workflow] def deserialize(data) + return data if data.is_a?(self) + tracing = Tracing.deserialize(data&.dig("tracing")) new( diff --git a/spec/chatkit/request/endpoints_spec.rb b/spec/chatkit/request/endpoints_spec.rb index 3d626eb..292592f 100644 --- a/spec/chatkit/request/endpoints_spec.rb +++ b/spec/chatkit/request/endpoints_spec.rb @@ -7,9 +7,9 @@ end end - describe ".sessions_endpoint" do + describe ".create_session_endpoint" do it "returns the correct sessions endpoint" do - expect(described_class.sessions_endpoint).to eq("/v1/chatkit/sessions") + expect(described_class.create_session_endpoint).to eq("/v1/chatkit/sessions") end end diff --git a/spec/chatkit/session/base_response_spec.rb b/spec/chatkit/session/base_response_spec.rb new file mode 100644 index 0000000..75e9a80 --- /dev/null +++ b/spec/chatkit/session/base_response_spec.rb @@ -0,0 +1,1146 @@ +# frozen_string_literal: true + +RSpec.describe ChatKit::Session::BaseResponse do + describe ".new" do + let(:chatkit_configuration) { build(:chatkit_configuration) } + let(:rate_limits) { build(:rate_limits) } + let(:workflow) { build(:workflow) } + + context "when all required arguments are provided" do + it "initializes with all attributes" do + instance = described_class.new( + id: "sess_123", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret_abc", + expires_at: "1234567890", + max_requests_per_1_minute: 10, + rate_limits:, + user: { "id" => "user_1" }, + workflow: + ) + + expect(instance.id).to eq("sess_123") + expect(instance.object).to eq("chatkit.session") + expect(instance.status).to eq("active") + expect(instance.chatkit_configuration).to eq(chatkit_configuration) + expect(instance.client_secret).to eq("secret_abc") + expect(instance.expires_at).to eq("1234567890") + expect(instance.max_requests_per_1_minute).to eq(10) + expect(instance.rate_limits).to eq(rate_limits) + expect(instance.user).to eq({ "id" => "user_1" }) + expect(instance.workflow).to eq(workflow) + end + end + + context "when any required argument is missing" do + it "raises ArgumentError" do + expect do + described_class.new( + id: "sess_123", + object: "chatkit.session", + status: "active" + ) + end.to raise_error(ArgumentError) + end + end + + context "with different status values" do + it "accepts active status" do + instance = described_class.new( + id: "sess_123", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: {}, + workflow: + ) + expect(instance.status).to eq("active") + end + + it "accepts expired status" do + instance = described_class.new( + id: "sess_123", + object: "chatkit.session", + status: "expired", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: {}, + workflow: + ) + expect(instance.status).to eq("expired") + end + end + + context "with different user values" do + it "accepts hash with user data" do + user_data = { "id" => "user_123", "name" => "John" } + instance = described_class.new( + id: "sess_123", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: user_data, + workflow: + ) + expect(instance.user).to eq(user_data) + end + + it "accepts empty hash" do + instance = described_class.new( + id: "sess_123", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: {}, + workflow: + ) + expect(instance.user).to eq({}) + end + + it "accepts nil value" do + instance = described_class.new( + id: "sess_123", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: nil, + workflow: + ) + expect(instance.user).to be_nil + end + end + + context "with different max_requests_per_1_minute values" do + it "accepts integer value" do + instance = described_class.new( + id: "sess_123", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 50, + rate_limits:, + user: {}, + workflow: + ) + expect(instance.max_requests_per_1_minute).to eq(50) + end + + it "accepts nil value" do + instance = described_class.new( + id: "sess_123", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: nil, + rate_limits:, + user: {}, + workflow: + ) + expect(instance.max_requests_per_1_minute).to be_nil + end + end + end + + describe ".deserialize" do + context "when data is nil" do + it "initializes with nil values" do + instance = described_class.deserialize(nil) + expect(instance.id).to be_nil + expect(instance.object).to be_nil + expect(instance.status).to be_nil + expect(instance.client_secret).to be_nil + expect(instance.expires_at).to be_nil + expect(instance.max_requests_per_1_minute).to be_nil + expect(instance.user).to be_nil + end + + it "creates nested objects from nil" do + instance = described_class.deserialize(nil) + expect(instance.chatkit_configuration).to be_a(ChatKit::Session::ChatKitConfiguration) + expect(instance.rate_limits).to be_a(ChatKit::Session::RateLimits) + expect(instance.workflow).to be_a(ChatKit::Session::Workflow) + end + + it "returns an instance of Response" do + instance = described_class.deserialize(nil) + expect(instance).to be_a(described_class) + end + end + + context "when data is an empty hash" do + it "initializes with nil values" do + instance = described_class.deserialize({}) + expect(instance.id).to be_nil + expect(instance.object).to be_nil + expect(instance.status).to be_nil + end + end + + context "when data contains all keys" do + it "deserializes complete response data" do + data = { + "id" => "sess_456", + "object" => "chatkit.session", + "status" => "active", + "chatkit_configuration" => { "history" => { "enabled" => true } }, + "client_secret" => "secret_def", + "expires_at" => "9876543210", + "max_requests_per_1_minute" => 20, + "rate_limits" => { "max_requests_per_1_minute" => 15 }, + "user" => { "id" => "user_456", "email" => "test@example.com" }, + "workflow" => { "id" => "wf_123", "version" => "1.0.0" }, + } + instance = described_class.deserialize(data) + + expect(instance.id).to eq("sess_456") + expect(instance.object).to eq("chatkit.session") + expect(instance.status).to eq("active") + expect(instance.chatkit_configuration).to be_a(ChatKit::Session::ChatKitConfiguration) + expect(instance.client_secret).to eq("secret_def") + expect(instance.expires_at).to eq("9876543210") + expect(instance.max_requests_per_1_minute).to eq(20) + expect(instance.rate_limits).to be_a(ChatKit::Session::RateLimits) + expect(instance.user).to eq({ "id" => "user_456", "email" => "test@example.com" }) + expect(instance.workflow).to be_a(ChatKit::Session::Workflow) + end + + it "deserializes nested chatkit_configuration" do + data = { + "id" => "sess_123", + "chatkit_configuration" => { + "history" => { "enabled" => true }, + "file_upload" => { "enabled" => false }, + }, + } + instance = described_class.deserialize(data) + expect(instance.chatkit_configuration).to be_a(ChatKit::Session::ChatKitConfiguration) + end + + it "deserializes nested rate_limits" do + data = { + "id" => "sess_123", + "rate_limits" => { "max_requests_per_1_minute" => 25 }, + } + instance = described_class.deserialize(data) + expect(instance.rate_limits).to be_a(ChatKit::Session::RateLimits) + expect(instance.rate_limits.max_requests_per_1_minute).to eq(25) + end + + it "deserializes nested workflow" do + data = { + "id" => "sess_123", + "workflow" => { + "id" => "wf_789", + "state_variables" => { "var" => "value" }, + }, + } + instance = described_class.deserialize(data) + expect(instance.workflow).to be_a(ChatKit::Session::Workflow) + expect(instance.workflow.id).to eq("wf_789") + end + + it "deserializes with nil user" do + data = { + "id" => "sess_123", + "user" => nil, + } + instance = described_class.deserialize(data) + expect(instance.user).to be_nil + end + + it "deserializes with empty user hash" do + data = { + "id" => "sess_123", + "user" => {}, + } + instance = described_class.deserialize(data) + expect(instance.user).to eq({}) + end + + it "deserializes with complex user data" do + data = { + "id" => "sess_123", + "user" => { + "id" => "user_123", + "name" => "Jane Doe", + "metadata" => { "role" => "admin" }, + }, + } + instance = described_class.deserialize(data) + expect(instance.user).to eq(data["user"]) + end + end + + context "when data contains extra keys" do + it "extracts only known keys using dig" do + data = { + "id" => "sess_extra", + "object" => "chatkit.session", + "status" => "active", + "extra_key" => "ignored", + "another_extra" => "also_ignored", + } + instance = described_class.deserialize(data) + expect(instance.id).to eq("sess_extra") + expect(instance.object).to eq("chatkit.session") + expect(instance.status).to eq("active") + end + end + + it "returns an instance of Response" do + instance = described_class.deserialize({ "id" => "sess_test" }) + expect(instance).to be_a(described_class) + end + end + + describe "#serialize" do + let(:chatkit_configuration) { build(:chatkit_configuration) } + let(:rate_limits) { build(:rate_limits) } + let(:workflow) { build(:workflow) } + + context "when all attributes have values" do + it "serializes to complete hash" do + instance = described_class.new( + id: "sess_serialize_123", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret_serialize", + expires_at: "1111111111", + max_requests_per_1_minute: 30, + rate_limits:, + user: { "id" => "user_serialize" }, + workflow: + ) + result = instance.serialize + + expect(result[:id]).to eq("sess_serialize_123") + expect(result[:object]).to eq("chatkit.session") + expect(result[:status]).to eq("active") + expect(result[:chatkit_configuration]).to be_a(Hash) + expect(result[:client_secret]).to eq("secret_serialize") + expect(result[:expires_at]).to eq("1111111111") + expect(result[:max_requests_per_1_minute]).to eq(30) + expect(result[:rate_limits]).to be_a(Hash) + expect(result[:user]).to eq({ "id" => "user_serialize" }) + expect(result[:workflow]).to be_a(Hash) + end + + it "calls serialize on chatkit_configuration object" do + instance = described_class.new( + id: "sess_123", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: {}, + workflow: + ) + result = instance.serialize + expect(result[:chatkit_configuration]).to eq(chatkit_configuration.serialize) + end + + it "calls serialize on rate_limits object" do + instance = described_class.new( + id: "sess_123", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: {}, + workflow: + ) + result = instance.serialize + expect(result[:rate_limits]).to eq(rate_limits.serialize) + end + + it "calls serialize on workflow object" do + instance = described_class.new( + id: "sess_123", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: {}, + workflow: + ) + result = instance.serialize + expect(result[:workflow]).to eq(workflow.serialize) + end + end + + context "when some attributes are nil" do + it "includes nil values (does not compact)" do + instance = described_class.new( + id: "sess_nil", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: nil, + expires_at: nil, + max_requests_per_1_minute: nil, + rate_limits:, + user: nil, + workflow: + ) + result = instance.serialize + + expect(result[:id]).to eq("sess_nil") + expect(result[:client_secret]).to be_nil + expect(result[:expires_at]).to be_nil + expect(result[:max_requests_per_1_minute]).to be_nil + expect(result[:user]).to be_nil + end + end + + context "when user is empty hash" do + it "includes empty hash in serialization" do + instance = described_class.new( + id: "sess_123", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: {}, + workflow: + ) + result = instance.serialize + expect(result[:user]).to eq({}) + end + end + + context "when user has complex structure" do + it "serializes complex user data" do + user_data = { + "id" => "user_123", + "profile" => { "name" => "John", "age" => 30 }, + "permissions" => %w[read write], + } + instance = described_class.new( + id: "sess_123", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: user_data, + workflow: + ) + result = instance.serialize + expect(result[:user]).to eq(user_data) + end + end + + it "returns a hash" do + instance = described_class.new( + id: "sess_test", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: {}, + workflow: + ) + result = instance.serialize + expect(result).to be_a(Hash) + end + end + + describe "attribute accessors" do + let(:chatkit_configuration) { build(:chatkit_configuration) } + let(:rate_limits) { build(:rate_limits) } + let(:workflow) { build(:workflow) } + let(:instance) do + described_class.new( + id: "sess_accessor", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: {}, + workflow: + ) + end + + describe "#id" do + it "allows reading the id value" do + expect(instance.id).to eq("sess_accessor") + end + + it "allows writing new id value" do + instance.id = "sess_new" + expect(instance.id).to eq("sess_new") + end + end + + describe "#object" do + it "allows reading the object value" do + expect(instance.object).to eq("chatkit.session") + end + + it "allows writing new object value" do + instance.object = "new.object" + expect(instance.object).to eq("new.object") + end + end + + describe "#status" do + it "allows reading the status value" do + expect(instance.status).to eq("active") + end + + it "allows writing new status value" do + instance.status = "expired" + expect(instance.status).to eq("expired") + end + end + + describe "#chatkit_configuration" do + it "allows reading the chatkit_configuration value" do + expect(instance.chatkit_configuration).to eq(chatkit_configuration) + end + + it "allows writing new chatkit_configuration value" do + new_config = build(:chatkit_configuration) + instance.chatkit_configuration = new_config + expect(instance.chatkit_configuration).to eq(new_config) + end + end + + describe "#client_secret" do + it "allows reading the client_secret value" do + expect(instance.client_secret).to eq("secret") + end + + it "allows writing new client_secret value" do + instance.client_secret = "new_secret" + expect(instance.client_secret).to eq("new_secret") + end + end + + describe "#expires_at" do + it "allows reading the expires_at value" do + expect(instance.expires_at).to eq("123") + end + + it "allows writing new expires_at value" do + instance.expires_at = "456" + expect(instance.expires_at).to eq("456") + end + end + + describe "#max_requests_per_1_minute" do + it "allows reading the max_requests_per_1_minute value" do + expect(instance.max_requests_per_1_minute).to eq(10) + end + + it "allows writing new max_requests_per_1_minute value" do + instance.max_requests_per_1_minute = 50 + expect(instance.max_requests_per_1_minute).to eq(50) + end + end + + describe "#rate_limits" do + it "allows reading the rate_limits value" do + expect(instance.rate_limits).to eq(rate_limits) + end + + it "allows writing new rate_limits value" do + new_limits = build(:rate_limits, max_requests_per_1_minute: 100) + instance.rate_limits = new_limits + expect(instance.rate_limits).to eq(new_limits) + end + end + + describe "#user" do + it "allows reading the user value" do + expect(instance.user).to eq({}) + end + + it "allows writing new user value" do + new_user = { "id" => "user_new" } + instance.user = new_user + expect(instance.user).to eq(new_user) + end + end + + describe "#workflow" do + it "allows reading the workflow value" do + expect(instance.workflow).to eq(workflow) + end + + it "allows writing new workflow value" do + new_workflow = build(:workflow, id: "wf_new") + instance.workflow = new_workflow + expect(instance.workflow).to eq(new_workflow) + end + end + end + + describe "integration with FactoryBot" do + context "using default factory" do + it "creates valid instance" do + instance = build(:base_response) + expect(instance).to be_a(described_class) + expect(instance.id).to eq("sess_abc123") + expect(instance.object).to eq("chatkit.session") + expect(instance.status).to eq("active") + expect(instance.chatkit_configuration).to be_a(ChatKit::Session::ChatKitConfiguration) + expect(instance.client_secret).to eq("secret_xyz789") + expect(instance.rate_limits).to be_a(ChatKit::Session::RateLimits) + expect(instance.workflow).to be_a(ChatKit::Session::Workflow) + end + end + + context "using :expired trait" do + it "creates instance with expired status" do + instance = build(:base_response, :expired) + expect(instance.status).to eq("expired") + end + end + + context "using :with_nil_user trait" do + it "creates instance with nil user" do + instance = build(:base_response, :with_nil_user) + expect(instance.user).to be_nil + end + end + + context "using :with_empty_user trait" do + it "creates instance with empty user hash" do + instance = build(:base_response, :with_empty_user) + expect(instance.user).to eq({}) + end + end + + context "using :high_rate_limit trait" do + it "creates instance with high rate limit" do + instance = build(:base_response, :high_rate_limit) + expect(instance.max_requests_per_1_minute).to eq(100) + end + end + + context "using :low_rate_limit trait" do + it "creates instance with low rate limit" do + instance = build(:base_response, :low_rate_limit) + expect(instance.max_requests_per_1_minute).to eq(1) + end + end + + context "overriding attributes" do + it "allows custom id" do + instance = build(:base_response, id: "sess_custom") + expect(instance.id).to eq("sess_custom") + end + + it "allows custom status" do + instance = build(:base_response, status: "pending") + expect(instance.status).to eq("pending") + end + + it "allows custom user" do + instance = build(:base_response, user: { "id" => "custom_user" }) + expect(instance.user).to eq({ "id" => "custom_user" }) + end + end + end + + describe "round-trip serialization" do + let(:chatkit_configuration) { build(:chatkit_configuration) } + let(:rate_limits) { build(:rate_limits) } + let(:workflow) { build(:workflow) } + + it "maintains data integrity with all attributes" do + original = described_class.new( + id: "sess_roundtrip", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret_roundtrip", + expires_at: "2222222222", + max_requests_per_1_minute: 40, + rate_limits:, + user: { "id" => "user_rt", "name" => "Test" }, + workflow: + ) + serialized = original.serialize + deserialized = described_class.deserialize(JSON.parse(serialized.to_json)) + + expect(deserialized.id).to eq(original.id) + expect(deserialized.object).to eq(original.object) + expect(deserialized.status).to eq(original.status) + expect(deserialized.client_secret).to eq(original.client_secret) + expect(deserialized.expires_at).to eq(original.expires_at) + expect(deserialized.max_requests_per_1_minute).to eq(original.max_requests_per_1_minute) + expect(deserialized.user).to eq(original.user) + end + + it "maintains chatkit_configuration data integrity" do + original = described_class.new( + id: "sess_config", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: {}, + workflow: + ) + serialized = original.serialize + deserialized = described_class.deserialize(JSON.parse(serialized.to_json)) + + expect(deserialized.chatkit_configuration).to be_a(ChatKit::Session::ChatKitConfiguration) + end + + it "maintains rate_limits data integrity" do + original = described_class.new( + id: "sess_limits", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: {}, + workflow: + ) + serialized = original.serialize + deserialized = described_class.deserialize(JSON.parse(serialized.to_json)) + + expect(deserialized.rate_limits).to be_a(ChatKit::Session::RateLimits) + end + + it "maintains workflow data integrity" do + original = described_class.new( + id: "sess_wf", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: {}, + workflow: + ) + serialized = original.serialize + deserialized = described_class.deserialize(JSON.parse(serialized.to_json)) + + expect(deserialized.workflow).to be_a(ChatKit::Session::Workflow) + expect(deserialized.workflow.id).to eq(workflow.id) + end + + it "maintains data integrity with nil user" do + original = described_class.new( + id: "sess_nil_user", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: nil, + workflow: + ) + serialized = original.serialize + deserialized = described_class.deserialize(JSON.parse(serialized.to_json)) + + expect(deserialized.user).to be_nil + end + + it "maintains data integrity with complex user" do + complex_user = { + "id" => "user_complex", + "metadata" => { "role" => "admin", "department" => "IT" }, + "tags" => %w[vip beta_tester], + } + original = described_class.new( + id: "sess_complex", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: complex_user, + workflow: + ) + serialized = original.serialize + deserialized = described_class.deserialize(JSON.parse(serialized.to_json)) + + expect(deserialized.user).to eq(complex_user) + end + end + + describe "edge cases" do + let(:chatkit_configuration) { build(:chatkit_configuration) } + let(:rate_limits) { build(:rate_limits) } + let(:workflow) { build(:workflow) } + + context "when modifying attributes after initialization" do + it "allows changing all attributes" do + instance = described_class.new( + id: "sess_original", + object: "original.object", + status: "active", + chatkit_configuration:, + client_secret: "original_secret", + expires_at: "111", + max_requests_per_1_minute: 5, + rate_limits:, + user: { "id" => "original_user" }, + workflow: + ) + + instance.id = "sess_modified" + instance.object = "modified.object" + instance.status = "expired" + instance.client_secret = "modified_secret" + instance.expires_at = "999" + instance.max_requests_per_1_minute = 100 + instance.user = { "id" => "modified_user" } + + expect(instance.id).to eq("sess_modified") + expect(instance.object).to eq("modified.object") + expect(instance.status).to eq("expired") + expect(instance.client_secret).to eq("modified_secret") + expect(instance.expires_at).to eq("999") + expect(instance.max_requests_per_1_minute).to eq(100) + expect(instance.user).to eq({ "id" => "modified_user" }) + end + end + + context "when serializing multiple times" do + it "produces consistent results" do + instance = described_class.new( + id: "sess_consistent", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: {}, + workflow: + ) + first_serialization = instance.serialize + second_serialization = instance.serialize + + expect(first_serialization).to eq(second_serialization) + end + end + + context "when modifying after serialization" do + it "subsequent serializations reflect modifications" do + instance = described_class.new( + id: "sess_123", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret1", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: {}, + workflow: + ) + first_result = instance.serialize + expect(first_result[:client_secret]).to eq("secret1") + + instance.client_secret = "secret2" + second_result = instance.serialize + expect(second_result[:client_secret]).to eq("secret2") + end + end + + context "when deserializing with unexpected data types" do + it "handles numeric id" do + data = { "id" => 12_345 } + instance = described_class.deserialize(data) + expect(instance.id).to eq(12_345) + end + + it "handles numeric max_requests_per_1_minute as string" do + data = { "max_requests_per_1_minute" => "50" } + instance = described_class.deserialize(data) + expect(instance.max_requests_per_1_minute).to eq("50") + end + + it "handles string user instead of hash" do + data = { "user" => "string_value" } + instance = described_class.deserialize(data) + expect(instance.user).to eq("string_value") + end + end + + context "when working with timestamps" do + it "handles future expiration time" do + future_time = (Time.now + 7200).to_i.to_s + instance = described_class.new( + id: "sess_future", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: future_time, + max_requests_per_1_minute: 10, + rate_limits:, + user: {}, + workflow: + ) + expect(instance.expires_at).to eq(future_time) + end + + it "handles past expiration time" do + past_time = (Time.now - 7200).to_i.to_s + instance = described_class.new( + id: "sess_past", + object: "chatkit.session", + status: "expired", + chatkit_configuration:, + client_secret: "secret", + expires_at: past_time, + max_requests_per_1_minute: 10, + rate_limits:, + user: {}, + workflow: + ) + expect(instance.expires_at).to eq(past_time) + end + end + + context "when working with nested objects" do + it "can replace chatkit_configuration" do + instance = described_class.new( + id: "sess_123", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: {}, + workflow: + ) + + new_config = build(:chatkit_configuration, :with_objects) + instance.chatkit_configuration = new_config + expect(instance.chatkit_configuration).to eq(new_config) + end + + it "can replace rate_limits" do + instance = described_class.new( + id: "sess_123", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: {}, + workflow: + ) + + new_limits = build(:rate_limits, :high_limit) + instance.rate_limits = new_limits + expect(instance.rate_limits).to eq(new_limits) + end + + it "can replace workflow" do + instance = described_class.new( + id: "sess_123", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: {}, + workflow: + ) + + new_workflow = build(:workflow, :minimal) + instance.workflow = new_workflow + expect(instance.workflow).to eq(new_workflow) + end + end + end + + describe "required parameters validation" do + let(:chatkit_configuration) { build(:chatkit_configuration) } + let(:rate_limits) { build(:rate_limits) } + let(:workflow) { build(:workflow) } + + it "requires id parameter" do + expect do + described_class.new( + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: {}, + workflow: + ) + end.to raise_error(ArgumentError) + end + + it "requires object parameter" do + expect do + described_class.new( + id: "sess_123", + status: "active", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: {}, + workflow: + ) + end.to raise_error(ArgumentError) + end + + it "requires status parameter" do + expect do + described_class.new( + id: "sess_123", + object: "chatkit.session", + chatkit_configuration:, + client_secret: "secret", + expires_at: "123", + max_requests_per_1_minute: 10, + rate_limits:, + user: {}, + workflow: + ) + end.to raise_error(ArgumentError) + end + + it "requires all 10 parameters" do + expect do + described_class.new( + id: "sess_123", + object: "chatkit.session", + status: "active" + ) + end.to raise_error(ArgumentError) + end + end + + describe "common use cases" do + let(:chatkit_configuration) { build(:chatkit_configuration) } + let(:rate_limits) { build(:rate_limits) } + let(:workflow) { build(:workflow) } + + context "session creation scenarios" do + it "creates active session with user data" do + session = described_class.new( + id: "sess_user_123", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret_abc", + expires_at: (Time.now + 3600).to_i.to_s, + max_requests_per_1_minute: 10, + rate_limits:, + user: { "id" => "user_123", "email" => "user@example.com" }, + workflow: + ) + + expect(session.status).to eq("active") + expect(session.user).to include("id", "email") + end + + it "creates expired session" do + session = described_class.new( + id: "sess_expired", + object: "chatkit.session", + status: "expired", + chatkit_configuration:, + client_secret: "secret_old", + expires_at: (Time.now - 3600).to_i.to_s, + max_requests_per_1_minute: 10, + rate_limits:, + user: nil, + workflow: + ) + + expect(session.status).to eq("expired") + end + + it "creates session with high rate limits" do + session = described_class.new( + id: "sess_premium", + object: "chatkit.session", + status: "active", + chatkit_configuration:, + client_secret: "secret_premium", + expires_at: (Time.now + 7200).to_i.to_s, + max_requests_per_1_minute: 100, + rate_limits: build(:rate_limits, :high_limit), + user: { "id" => "premium_user", "tier" => "premium" }, + workflow: + ) + + expect(session.max_requests_per_1_minute).to eq(100) + end + end + end +end diff --git a/spec/chatkit/session/chatkit_configuration/automatic_thread_titling_spec.rb b/spec/chatkit/session/chatkit_configuration/automatic_thread_titling_spec.rb index e9086c1..48786d5 100644 --- a/spec/chatkit/session/chatkit_configuration/automatic_thread_titling_spec.rb +++ b/spec/chatkit/session/chatkit_configuration/automatic_thread_titling_spec.rb @@ -10,16 +10,16 @@ end context "when enabled is provided" do - it "initializes with the provided enabled value" do - instance = described_class.new(enabled: false) - expect(instance.enabled).to be(false) - end - - it "accepts true value" do + it "initializes with true value" do instance = described_class.new(enabled: true) expect(instance.enabled).to be(true) end + it "initializes with false value" do + instance = described_class.new(enabled: false) + expect(instance.enabled).to be(false) + end + it "accepts nil value" do instance = described_class.new(enabled: nil) expect(instance.enabled).to be_nil @@ -29,204 +29,268 @@ describe ".build" do context "when no arguments are provided" do - it "creates an instance with nil enabled value" do + it "creates instance with nil enabled value" do instance = described_class.build expect(instance.enabled).to be_nil end end context "when enabled is provided" do - it "creates an instance with the provided enabled value" do - instance = described_class.build(enabled: false) - expect(instance.enabled).to be(false) - end - - it "accepts true value" do + it "creates instance with true value" do instance = described_class.build(enabled: true) expect(instance.enabled).to be(true) end - it "accepts nil value" do + it "creates instance with false value" do + instance = described_class.build(enabled: false) + expect(instance.enabled).to be(false) + end + + it "creates instance with nil value" do instance = described_class.build(enabled: nil) expect(instance.enabled).to be_nil end end + + it "returns an instance of AutomaticThreadTitling" do + instance = described_class.build + expect(instance).to be_a(described_class) + end end describe ".deserialize" do + context "when data is nil" do + it "initializes with nil enabled value" do + instance = described_class.deserialize(nil) + expect(instance.enabled).to be_nil + end + + it "returns an instance of AutomaticThreadTitling" do + instance = described_class.deserialize(nil) + expect(instance).to be_a(described_class) + end + end + + context "when data is an empty hash" do + it "initializes with nil enabled value" do + instance = described_class.deserialize({}) + expect(instance.enabled).to be_nil + end + end + context "when data contains enabled key" do - it "creates an instance with enabled true" do + it "deserializes with true value" do data = { "enabled" => true } instance = described_class.deserialize(data) - expect(instance.enabled).to be(true) end - it "creates an instance with enabled false" do + it "deserializes with false value" do data = { "enabled" => false } instance = described_class.deserialize(data) - expect(instance.enabled).to be(false) end - it "creates an instance with enabled nil" do + it "deserializes with nil value" do data = { "enabled" => nil } instance = described_class.deserialize(data) - expect(instance.enabled).to be_nil end end - context "when data does not contain enabled key" do - it "creates an instance with nil enabled value" do - data = {} + context "when data contains nested keys" do + it "extracts enabled using dig" do + data = { "enabled" => true, "other_key" => "value" } instance = described_class.deserialize(data) - - expect(instance.enabled).to be_nil + expect(instance.enabled).to be(true) end + end - it "ignores other keys in data" do - data = { "other_key" => "other_value", "another_key" => 123 } - instance = described_class.deserialize(data) + it "returns an instance of AutomaticThreadTitling" do + instance = described_class.deserialize({ "enabled" => true }) + expect(instance).to be_a(described_class) + end + end - expect(instance.enabled).to be_nil + describe "#serialize" do + context "when enabled is true" do + it "serializes to hash with enabled key" do + instance = described_class.new(enabled: true) + result = instance.serialize + expect(result).to eq({ enabled: true }) end end - context "when data contains enabled key with other keys" do - it "only uses the enabled key and ignores others" do - data = { - "enabled" => true, - "extra_field" => "ignored", - "another_field" => 456, - } - instance = described_class.deserialize(data) - - expect(instance.enabled).to be(true) + context "when enabled is false" do + it "serializes to hash with enabled key" do + instance = described_class.new(enabled: false) + result = instance.serialize + expect(result).to eq({ enabled: false }) end end - context "with edge cases" do - it "handles nil data" do - instance = described_class.deserialize(nil) + context "when enabled is nil" do + it "serializes to empty hash (compacts nil values)" do + instance = described_class.new(enabled: nil) + result = instance.serialize + expect(result).to eq({}) + end + end - expect(instance.enabled).to be_nil + context "when enabled is default value" do + it "serializes to hash with default enabled value" do + instance = described_class.new + result = instance.serialize + expect(result).to eq({ enabled: ChatKit::Session::Defaults::ENABLED }) end + end - it "handles empty data hash" do - data = {} - instance = described_class.deserialize(data) + it "returns a hash" do + instance = described_class.new(enabled: true) + result = instance.serialize + expect(result).to be_a(Hash) + end + end - expect(instance.enabled).to be_nil + describe "attribute accessors" do + let(:instance) { described_class.new } + + describe "#enabled" do + it "allows reading the enabled value" do + expect(instance.enabled).to eq(ChatKit::Session::Defaults::ENABLED) end - it "handles data with string keys" do - data = { "enabled" => false } - instance = described_class.deserialize(data) + it "allows writing true value" do + instance.enabled = true + expect(instance.enabled).to be(true) + end + it "allows writing false value" do + instance.enabled = false expect(instance.enabled).to be(false) end - it "returns a new instance each time" do - data = { "enabled" => true } - instance1 = described_class.deserialize(data) - instance2 = described_class.deserialize(data) - - expect(instance1).not_to be(instance2) - expect(instance1.enabled).to eq(instance2.enabled) + it "allows writing nil value" do + instance.enabled = nil + expect(instance.enabled).to be_nil end end + end - context "round-trip serialization" do - it "can deserialize what was serialized" do - original = described_class.new(enabled: true) - serialized = original.serialize - # Convert keys to strings to simulate JSON parsing - string_keyed_data = serialized.transform_keys(&:to_s) - deserialized = described_class.deserialize(string_keyed_data) - - expect(deserialized.enabled).to eq(original.enabled) + describe "integration with FactoryBot" do + context "using default factory" do + it "creates valid instance" do + instance = build(:automatic_thread_titling) + expect(instance).to be_a(described_class) + expect(instance.enabled).to be(true) end + end - it "handles nil values in round-trip" do - original = described_class.new(enabled: nil) - serialized = original.serialize - # Since serialize uses compact, nil values are removed - # so deserializing an empty hash should give nil - string_keyed_data = serialized.transform_keys(&:to_s) - deserialized = described_class.deserialize(string_keyed_data) - - expect(deserialized.enabled).to be_nil + context "using :enabled trait" do + it "creates instance with enabled true" do + instance = build(:automatic_thread_titling, :enabled) + expect(instance.enabled).to be(true) end + end - it "handles false values in round-trip" do - original = described_class.new(enabled: false) - serialized = original.serialize - string_keyed_data = serialized.transform_keys(&:to_s) - deserialized = described_class.deserialize(string_keyed_data) + context "using :disabled trait" do + it "creates instance with enabled false" do + instance = build(:automatic_thread_titling, :disabled) + expect(instance.enabled).to be(false) + end + end - expect(deserialized.enabled).to eq(original.enabled) + context "using :nil_enabled trait" do + it "creates instance with nil enabled" do + instance = build(:automatic_thread_titling, :nil_enabled) + expect(instance.enabled).to be_nil end + end - it "handles default values in round-trip" do - original = described_class.new # Uses default value - serialized = original.serialize - string_keyed_data = serialized.transform_keys(&:to_s) - deserialized = described_class.deserialize(string_keyed_data) + context "using :default_enabled trait" do + it "creates instance with default enabled value" do + instance = build(:automatic_thread_titling, :default_enabled) + expect(instance.enabled).to eq(ChatKit::Session::Defaults::ENABLED) + end + end - expect(deserialized.enabled).to eq(ChatKit::Session::Defaults::ENABLED) + context "overriding enabled value" do + it "allows custom enabled value" do + instance = build(:automatic_thread_titling, enabled: false) + expect(instance.enabled).to be(false) end end end - describe "#enabled" do - it "is readable" do - instance = described_class.new(enabled: false) - expect(instance.enabled).to be(false) + describe "round-trip serialization" do + it "maintains data integrity when serializing and deserializing with true" do + original = described_class.new(enabled: true) + serialized = original.serialize + deserialized = described_class.deserialize(serialized.transform_keys(&:to_s)) + expect(deserialized.enabled).to eq(original.enabled) end - it "is writable" do - instance = described_class.new(enabled: true) - instance.enabled = false - expect(instance.enabled).to be(false) + it "maintains data integrity when serializing and deserializing with false" do + original = described_class.new(enabled: false) + serialized = original.serialize + deserialized = described_class.deserialize(serialized.transform_keys(&:to_s)) + expect(deserialized.enabled).to eq(original.enabled) + end + + it "handles nil values in round-trip" do + original = described_class.new(enabled: nil) + serialized = original.serialize + deserialized = described_class.deserialize(serialized.transform_keys(&:to_s)) + expect(deserialized.enabled).to eq(original.enabled) end end - describe "#serialize" do - context "when enabled is true" do - it "returns a hash with enabled key" do + describe "edge cases" do + context "when modifying enabled after initialization" do + it "allows toggling enabled state" do instance = described_class.new(enabled: true) - result = instance.serialize + expect(instance.enabled).to be(true) - expect(result).to eq({ enabled: true }) + instance.enabled = false + expect(instance.enabled).to be(false) + + instance.enabled = true + expect(instance.enabled).to be(true) end end - context "when enabled is false" do - it "returns a hash with enabled key" do - instance = described_class.new(enabled: false) - result = instance.serialize - - expect(result).to eq({ enabled: false }) + context "when serializing multiple times" do + it "produces consistent results" do + instance = described_class.new(enabled: true) + first_serialization = instance.serialize + second_serialization = instance.serialize + expect(first_serialization).to eq(second_serialization) end end - context "when enabled is nil" do - it "returns an empty hash due to compact" do - instance = described_class.new(enabled: nil) - result = instance.serialize + context "when deserializing with unexpected data types" do + it "handles string values in hash" do + data = { "enabled" => "true" } + instance = described_class.deserialize(data) + expect(instance.enabled).to eq("true") + end - expect(result).to eq({}) + it "handles integer values in hash" do + data = { "enabled" => 1 } + instance = described_class.deserialize(data) + expect(instance.enabled).to eq(1) end end + end - context "when using default value" do - it "returns a hash with the default enabled value" do - instance = described_class.new - result = instance.serialize + describe "constants and defaults" do + it "uses Session::Create::Defaults::ENABLED as default value" do + instance = described_class.new + expect(instance.enabled).to eq(ChatKit::Session::Defaults::ENABLED) + end - expect(result).to eq({ enabled: ChatKit::Session::Defaults::ENABLED }) - end + it "Session::Create::Defaults::ENABLED is true" do + expect(ChatKit::Session::Defaults::ENABLED).to be(true) end end end diff --git a/spec/chatkit/session/chatkit_configuration/file_upload_spec.rb b/spec/chatkit/session/chatkit_configuration/file_upload_spec.rb index 5f4b720..870f372 100644 --- a/spec/chatkit/session/chatkit_configuration/file_upload_spec.rb +++ b/spec/chatkit/session/chatkit_configuration/file_upload_spec.rb @@ -11,428 +11,635 @@ end end - context "when all arguments are provided" do - it "initializes with the provided values" do - instance = described_class.new( - enabled: false, - max_file_size: 256, - max_files: 5 - ) - - expect(instance.enabled).to be(false) - expect(instance.max_file_size).to eq(256) - expect(instance.max_files).to eq(5) + context "when enabled is provided" do + it "initializes with true value" do + instance = described_class.new(enabled: true) + expect(instance.enabled).to be(true) end - end - context "when partial arguments are provided" do - it "uses defaults for missing arguments" do + it "initializes with false value" do instance = described_class.new(enabled: false) expect(instance.enabled).to be(false) - expect(instance.max_file_size).to eq(described_class::Defaults::MAX_FILE_SIZE) - expect(instance.max_files).to eq(described_class::Defaults::MAX_FILES) + end + + it "accepts nil value" do + instance = described_class.new(enabled: nil) + expect(instance.enabled).to be_nil end end - context "when nil values are provided" do - it "accepts nil values" do - instance = described_class.new( - enabled: nil, - max_file_size: nil, - max_files: nil - ) + context "when max_file_size is provided" do + it "initializes with custom value" do + instance = described_class.new(max_file_size: 1024) + expect(instance.max_file_size).to eq(1024) + end - expect(instance.enabled).to be_nil + it "accepts zero value" do + instance = described_class.new(max_file_size: 0) + expect(instance.max_file_size).to eq(0) + end + + it "accepts nil value" do + instance = described_class.new(max_file_size: nil) expect(instance.max_file_size).to be_nil + end + end + + context "when max_files is provided" do + it "initializes with custom value" do + instance = described_class.new(max_files: 20) + expect(instance.max_files).to eq(20) + end + + it "accepts zero value" do + instance = described_class.new(max_files: 0) + expect(instance.max_files).to eq(0) + end + + it "accepts nil value" do + instance = described_class.new(max_files: nil) expect(instance.max_files).to be_nil end end + + context "when all parameters are provided" do + it "initializes with all custom values" do + instance = described_class.new(enabled: false, max_file_size: 256, max_files: 15) + expect(instance.enabled).to be(false) + expect(instance.max_file_size).to eq(256) + expect(instance.max_files).to eq(15) + end + end end describe ".build" do - it "creates an instance with provided values" do - instance = described_class.build( - enabled: false, - max_file_size: 128, - max_files: 3 - ) - - expect(instance.enabled).to be(false) - expect(instance.max_file_size).to eq(128) - expect(instance.max_files).to eq(3) + context "when no arguments are provided" do + it "creates instance with nil values" do + instance = described_class.build + expect(instance.enabled).to be_nil + expect(instance.max_file_size).to be_nil + expect(instance.max_files).to be_nil + end end - it "uses nil for missing parameters" do - instance = described_class.build( - max_file_size: 128, - max_files: 3 - ) + context "when enabled is provided" do + it "creates instance with true value" do + instance = described_class.build(enabled: true) + expect(instance.enabled).to be(true) + end + + it "creates instance with false value" do + instance = described_class.build(enabled: false) + expect(instance.enabled).to be(false) + end - expect(instance.enabled).to be_nil - expect(instance.max_file_size).to eq(128) - expect(instance.max_files).to eq(3) + it "creates instance with nil value" do + instance = described_class.build(enabled: nil) + expect(instance.enabled).to be_nil + end end - it "creates instance with all nil values when no arguments provided" do - instance = described_class.build + context "when max_file_size is provided" do + it "creates instance with custom value" do + instance = described_class.build(max_file_size: 1024) + expect(instance.max_file_size).to eq(1024) + end - expect(instance.enabled).to be_nil - expect(instance.max_file_size).to be_nil - expect(instance.max_files).to be_nil + it "creates instance with nil value" do + instance = described_class.build(max_file_size: nil) + expect(instance.max_file_size).to be_nil + end end - end - describe ".deserialize" do - context "when data contains all keys" do - it "creates an instance with all provided values" do - data = { - "enabled" => true, - "max_file_size" => 256, - "max_files" => 15, - } - instance = described_class.deserialize(data) - - expect(instance.enabled).to be(true) - expect(instance.max_file_size).to eq(256) - expect(instance.max_files).to eq(15) + context "when max_files is provided" do + it "creates instance with custom value" do + instance = described_class.build(max_files: 25) + expect(instance.max_files).to eq(25) end - it "handles false and zero values correctly" do - data = { - "enabled" => false, - "max_file_size" => 0, - "max_files" => 0, - } - instance = described_class.deserialize(data) + it "creates instance with nil value" do + instance = described_class.build(max_files: nil) + expect(instance.max_files).to be_nil + end + end - expect(instance.enabled).to be(false) - expect(instance.max_file_size).to eq(0) - expect(instance.max_files).to eq(0) + context "when all parameters are provided" do + it "creates instance with all custom values" do + instance = described_class.build(enabled: true, max_file_size: 2048, max_files: 50) + expect(instance.enabled).to be(true) + expect(instance.max_file_size).to eq(2048) + expect(instance.max_files).to eq(50) end + end - it "handles nil values in data" do - data = { - "enabled" => nil, - "max_file_size" => nil, - "max_files" => nil, - } - instance = described_class.deserialize(data) + it "returns an instance of FileUpload" do + instance = described_class.build + expect(instance).to be_a(described_class) + end + end + describe ".deserialize" do + context "when data is nil" do + it "initializes with nil values for all attributes" do + instance = described_class.deserialize(nil) expect(instance.enabled).to be_nil expect(instance.max_file_size).to be_nil expect(instance.max_files).to be_nil end - end - context "when data contains partial keys" do - it "handles missing enabled key" do - data = { - "max_file_size" => 128, - "max_files" => 5, - } - instance = described_class.deserialize(data) + it "returns an instance of FileUpload" do + instance = described_class.deserialize(nil) + expect(instance).to be_a(described_class) + end + end + context "when data is an empty hash" do + it "initializes with nil values for all attributes" do + instance = described_class.deserialize({}) expect(instance.enabled).to be_nil - expect(instance.max_file_size).to eq(128) - expect(instance.max_files).to eq(5) + expect(instance.max_file_size).to be_nil + expect(instance.max_files).to be_nil end + end - it "handles missing max_file_size key" do - data = { - "enabled" => true, - "max_files" => 20, - } + context "when data contains enabled key" do + it "deserializes with true value" do + data = { "enabled" => true } instance = described_class.deserialize(data) - expect(instance.enabled).to be(true) - expect(instance.max_file_size).to be_nil - expect(instance.max_files).to eq(20) end - it "handles missing max_files key" do - data = { - "enabled" => false, - "max_file_size" => 1024, - } + it "deserializes with false value" do + data = { "enabled" => false } instance = described_class.deserialize(data) - expect(instance.enabled).to be(false) - expect(instance.max_file_size).to eq(1024) - expect(instance.max_files).to be_nil end - it "handles only one key present" do - data = { "enabled" => true } + it "deserializes with nil value" do + data = { "enabled" => nil } instance = described_class.deserialize(data) - - expect(instance.enabled).to be(true) - expect(instance.max_file_size).to be_nil - expect(instance.max_files).to be_nil + expect(instance.enabled).to be_nil end end - context "when data does not contain relevant keys" do - it "creates an instance with all nil values for empty data" do - data = {} + context "when data contains max_file_size key" do + it "deserializes with integer value" do + data = { "max_file_size" => 1024 } instance = described_class.deserialize(data) + expect(instance.max_file_size).to eq(1024) + end - expect(instance.enabled).to be_nil + it "deserializes with nil value" do + data = { "max_file_size" => nil } + instance = described_class.deserialize(data) expect(instance.max_file_size).to be_nil - expect(instance.max_files).to be_nil end + end - it "ignores unknown keys in data" do - data = { - "unknown_key" => "value", - "another_key" => 123, - "random_field" => true, - } + context "when data contains max_files key" do + it "deserializes with integer value" do + data = { "max_files" => 20 } instance = described_class.deserialize(data) + expect(instance.max_files).to eq(20) + end - expect(instance.enabled).to be_nil - expect(instance.max_file_size).to be_nil + it "deserializes with nil value" do + data = { "max_files" => nil } + instance = described_class.deserialize(data) expect(instance.max_files).to be_nil end + end - it "uses relevant keys and ignores unknown ones" do + context "when data contains all keys" do + it "deserializes all values correctly" do data = { "enabled" => true, - "max_file_size" => 512, - "unknown_field" => "ignored", - "max_files" => 8, - "extra_data" => { "nested" => "value" }, + "max_file_size" => 2048, + "max_files" => 30, } instance = described_class.deserialize(data) - expect(instance.enabled).to be(true) - expect(instance.max_file_size).to eq(512) - expect(instance.max_files).to eq(8) + expect(instance.max_file_size).to eq(2048) + expect(instance.max_files).to eq(30) end end - context "with edge cases" do - it "handles nil data" do - instance = described_class.deserialize(nil) - - expect(instance.enabled).to be_nil - expect(instance.max_file_size).to be_nil - expect(instance.max_files).to be_nil - end - - it "handles data with string keys" do + context "when data contains extra keys" do + it "extracts only relevant keys using dig" do data = { "enabled" => false, - "max_file_size" => 256, - "max_files" => 12, + "max_file_size" => 512, + "max_files" => 10, + "extra_key" => "ignored", } instance = described_class.deserialize(data) - expect(instance.enabled).to be(false) - expect(instance.max_file_size).to eq(256) - expect(instance.max_files).to eq(12) + expect(instance.max_file_size).to eq(512) + expect(instance.max_files).to eq(10) end + end - it "returns a new instance each time" do - data = { - "enabled" => true, - "max_file_size" => 128, - "max_files" => 5, - } - instance1 = described_class.deserialize(data) - instance2 = described_class.deserialize(data) + it "returns an instance of FileUpload" do + instance = described_class.deserialize({ "enabled" => true }) + expect(instance).to be_a(described_class) + end + end - expect(instance1).not_to be(instance2) - expect(instance1.enabled).to eq(instance2.enabled) - expect(instance1.max_file_size).to eq(instance2.max_file_size) - expect(instance1.max_files).to eq(instance2.max_files) + describe "#serialize" do + context "when all attributes have values" do + it "serializes to hash with all keys" do + instance = described_class.new(enabled: true, max_file_size: 1024, max_files: 20) + result = instance.serialize + expect(result).to eq({ + enabled: true, + max_file_size: 1024, + max_files: 20, + }) end + end - it "handles large numeric values" do - data = { - "enabled" => true, - "max_file_size" => 99_999, - "max_files" => 1_000_000, - } - instance = described_class.deserialize(data) + context "when enabled is true" do + it "serializes enabled key" do + instance = described_class.new(enabled: true, max_file_size: 512, max_files: 10) + result = instance.serialize + expect(result[:enabled]).to be(true) + end + end - expect(instance.enabled).to be(true) - expect(instance.max_file_size).to eq(99_999) - expect(instance.max_files).to eq(1_000_000) + context "when enabled is false" do + it "serializes enabled key" do + instance = described_class.new(enabled: false, max_file_size: 512, max_files: 10) + result = instance.serialize + expect(result[:enabled]).to be(false) end end - context "round-trip serialization" do - it "can deserialize what was serialized" do - original = described_class.new( - enabled: true, - max_file_size: 256, - max_files: 7 - ) - serialized = original.serialize - # Convert keys to strings to simulate JSON parsing - string_keyed_data = serialized.transform_keys(&:to_s) - deserialized = described_class.deserialize(string_keyed_data) - - expect(deserialized.enabled).to eq(original.enabled) - expect(deserialized.max_file_size).to eq(original.max_file_size) - expect(deserialized.max_files).to eq(original.max_files) - end - - it "handles nil values in round-trip" do - original = described_class.new( - enabled: nil, - max_file_size: nil, - max_files: nil - ) - serialized = original.serialize - # Since serialize uses compact, nil values are removed - string_keyed_data = serialized.transform_keys(&:to_s) - deserialized = described_class.deserialize(string_keyed_data) - - expect(deserialized.enabled).to be_nil - expect(deserialized.max_file_size).to be_nil - expect(deserialized.max_files).to be_nil - end - - it "handles partial nil values in round-trip" do - original = described_class.new( - enabled: false, - max_file_size: nil, - max_files: 15 - ) - serialized = original.serialize - string_keyed_data = serialized.transform_keys(&:to_s) - deserialized = described_class.deserialize(string_keyed_data) - - expect(deserialized.enabled).to eq(original.enabled) - expect(deserialized.max_file_size).to be_nil # Was nil, remains nil - expect(deserialized.max_files).to eq(original.max_files) - end - - it "handles default values in round-trip" do - original = described_class.new # Uses default values - serialized = original.serialize - string_keyed_data = serialized.transform_keys(&:to_s) - deserialized = described_class.deserialize(string_keyed_data) - - expect(deserialized.enabled).to eq(ChatKit::Session::Defaults::ENABLED) - expect(deserialized.max_file_size).to eq(described_class::Defaults::MAX_FILE_SIZE) - expect(deserialized.max_files).to eq(described_class::Defaults::MAX_FILES) - end - - it "maintains data integrity through multiple round-trips" do - original_data = { - "enabled" => false, - "max_file_size" => 1024, - "max_files" => 25, - } + context "when enabled is nil" do + it "omits enabled from serialized hash (compacts nil values)" do + instance = described_class.new(enabled: nil, max_file_size: 512, max_files: 10) + result = instance.serialize + expect(result).not_to have_key(:enabled) + end + end - # First round-trip - instance1 = described_class.deserialize(original_data) - serialized1 = instance1.serialize.transform_keys(&:to_s) + context "when max_file_size is nil" do + it "omits max_file_size from serialized hash" do + instance = described_class.new(enabled: true, max_file_size: nil, max_files: 10) + result = instance.serialize + expect(result).not_to have_key(:max_file_size) + end + end - # Second round-trip - instance2 = described_class.deserialize(serialized1) - serialized2 = instance2.serialize.transform_keys(&:to_s) + context "when max_files is nil" do + it "omits max_files from serialized hash" do + instance = described_class.new(enabled: true, max_file_size: 512, max_files: nil) + result = instance.serialize + expect(result).not_to have_key(:max_files) + end + end - expect(serialized1).to eq(serialized2) - expect(instance2.enabled).to eq(original_data["enabled"]) - expect(instance2.max_file_size).to eq(original_data["max_file_size"]) - expect(instance2.max_files).to eq(original_data["max_files"]) + context "when all attributes are nil" do + it "serializes to empty hash" do + instance = described_class.new(enabled: nil, max_file_size: nil, max_files: nil) + result = instance.serialize + expect(result).to eq({}) end end + + context "when using default values" do + it "serializes with default values" do + instance = described_class.new + result = instance.serialize + expect(result).to eq({ + enabled: ChatKit::Session::Defaults::ENABLED, + max_file_size: described_class::Defaults::MAX_FILE_SIZE, + max_files: described_class::Defaults::MAX_FILES, + }) + end + end + + it "returns a hash" do + instance = described_class.new(enabled: true, max_file_size: 512, max_files: 10) + result = instance.serialize + expect(result).to be_a(Hash) + end end describe "attribute accessors" do let(:instance) { described_class.new } describe "#enabled" do - it "is readable and writable" do + it "allows reading the enabled value" do + expect(instance.enabled).to eq(ChatKit::Session::Defaults::ENABLED) + end + + it "allows writing true value" do + instance.enabled = true + expect(instance.enabled).to be(true) + end + + it "allows writing false value" do instance.enabled = false expect(instance.enabled).to be(false) end + + it "allows writing nil value" do + instance.enabled = nil + expect(instance.enabled).to be_nil + end end describe "#max_file_size" do - it "is readable and writable" do - instance.max_file_size = 1024 - expect(instance.max_file_size).to eq(1024) + it "allows reading the max_file_size value" do + expect(instance.max_file_size).to eq(described_class::Defaults::MAX_FILE_SIZE) + end + + it "allows writing integer value" do + instance.max_file_size = 2048 + expect(instance.max_file_size).to eq(2048) + end + + it "allows writing nil value" do + instance.max_file_size = nil + expect(instance.max_file_size).to be_nil + end + + it "allows writing zero value" do + instance.max_file_size = 0 + expect(instance.max_file_size).to eq(0) end end describe "#max_files" do - it "is readable and writable" do - instance.max_files = 20 - expect(instance.max_files).to eq(20) + it "allows reading the max_files value" do + expect(instance.max_files).to eq(described_class::Defaults::MAX_FILES) + end + + it "allows writing integer value" do + instance.max_files = 50 + expect(instance.max_files).to eq(50) + end + + it "allows writing nil value" do + instance.max_files = nil + expect(instance.max_files).to be_nil + end + + it "allows writing zero value" do + instance.max_files = 0 + expect(instance.max_files).to eq(0) end end end - describe "#serialize" do - context "when all values are present" do - it "returns a hash with all keys" do - instance = described_class.new( - enabled: true, - max_file_size: 256, - max_files: 8 - ) - result = instance.serialize + describe "integration with FactoryBot" do + context "using default factory" do + it "creates valid instance" do + instance = build(:file_upload) + expect(instance).to be_a(described_class) + expect(instance.enabled).to be(true) + expect(instance.max_file_size).to eq(256) + expect(instance.max_files).to eq(5) + end + end - expect(result).to eq({ - enabled: true, - max_file_size: 256, - max_files: 8, - }) + context "using :enabled trait" do + it "creates instance with enabled true" do + instance = build(:file_upload, :enabled) + expect(instance.enabled).to be(true) end end - context "when some values are nil" do - it "returns a hash without nil values due to compact" do - instance = described_class.new( - enabled: nil, - max_file_size: 256, - max_files: nil - ) - result = instance.serialize + context "using :disabled trait" do + it "creates instance with enabled false" do + instance = build(:file_upload, :disabled) + expect(instance.enabled).to be(false) + end + end - expect(result).to eq({ max_file_size: 256 }) + context "using :nil_enabled trait" do + it "creates instance with nil enabled" do + instance = build(:file_upload, :nil_enabled) + expect(instance.enabled).to be_nil end end - context "when all values are nil" do - it "returns an empty hash due to compact" do - instance = described_class.new( - enabled: nil, - max_file_size: nil, - max_files: nil - ) - result = instance.serialize + context "using :default_enabled trait" do + it "creates instance with default enabled value" do + instance = build(:file_upload, :default_enabled) + expect(instance.enabled).to eq(ChatKit::Session::Defaults::ENABLED) + end + end - expect(result).to eq({}) + context "using :large_files trait" do + it "creates instance with large file limits" do + instance = build(:file_upload, :large_files) + expect(instance.max_file_size).to eq(1024) + expect(instance.max_files).to eq(20) end end - context "when using default values" do - it "returns a hash with default values" do - instance = described_class.new - result = instance.serialize + context "using :small_files trait" do + it "creates instance with small file limits" do + instance = build(:file_upload, :small_files) + expect(instance.max_file_size).to eq(64) + expect(instance.max_files).to eq(2) + end + end - expect(result).to eq({ - enabled: ChatKit::Session::Defaults::ENABLED, - max_file_size: described_class::Defaults::MAX_FILE_SIZE, - max_files: described_class::Defaults::MAX_FILES, - }) + context "using :default_limits trait" do + it "creates instance with default file limits" do + instance = build(:file_upload, :default_limits) + expect(instance.max_file_size).to eq(described_class::Defaults::MAX_FILE_SIZE) + expect(instance.max_files).to eq(described_class::Defaults::MAX_FILES) + end + end + + context "using :nil_limits trait" do + it "creates instance with nil file limits" do + instance = build(:file_upload, :nil_limits) + expect(instance.max_file_size).to be_nil + expect(instance.max_files).to be_nil + end + end + + context "overriding values" do + it "allows custom enabled value" do + instance = build(:file_upload, enabled: false) + expect(instance.enabled).to be(false) + end + + it "allows custom max_file_size value" do + instance = build(:file_upload, max_file_size: 4096) + expect(instance.max_file_size).to eq(4096) + end + + it "allows custom max_files value" do + instance = build(:file_upload, max_files: 100) + expect(instance.max_files).to eq(100) + end + end + + context "combining traits" do + it "allows combining :disabled with :large_files" do + instance = build(:file_upload, :disabled, :large_files) + expect(instance.enabled).to be(false) + expect(instance.max_file_size).to eq(1024) + expect(instance.max_files).to eq(20) + end + end + end + + describe "round-trip serialization" do + it "maintains data integrity when serializing and deserializing" do + original = described_class.new(enabled: true, max_file_size: 1024, max_files: 25) + serialized = original.serialize + deserialized = described_class.deserialize(serialized.transform_keys(&:to_s)) + expect(deserialized.enabled).to eq(original.enabled) + expect(deserialized.max_file_size).to eq(original.max_file_size) + expect(deserialized.max_files).to eq(original.max_files) + end + + it "maintains data integrity with false enabled" do + original = described_class.new(enabled: false, max_file_size: 512, max_files: 10) + serialized = original.serialize + deserialized = described_class.deserialize(serialized.transform_keys(&:to_s)) + expect(deserialized.enabled).to eq(original.enabled) + expect(deserialized.max_file_size).to eq(original.max_file_size) + expect(deserialized.max_files).to eq(original.max_files) + end + + it "handles nil values in round-trip" do + original = described_class.new(enabled: nil, max_file_size: nil, max_files: nil) + serialized = original.serialize + deserialized = described_class.deserialize(serialized.transform_keys(&:to_s)) + expect(deserialized.enabled).to eq(original.enabled) + expect(deserialized.max_file_size).to eq(original.max_file_size) + expect(deserialized.max_files).to eq(original.max_files) + end + + it "handles partial nil values in round-trip" do + original = described_class.new(enabled: true, max_file_size: nil, max_files: 10) + serialized = original.serialize + deserialized = described_class.deserialize(serialized.transform_keys(&:to_s)) + expect(deserialized.enabled).to eq(original.enabled) + expect(deserialized.max_file_size).to eq(original.max_file_size) + expect(deserialized.max_files).to eq(original.max_files) + end + end + + describe "edge cases" do + context "when modifying attributes after initialization" do + it "allows toggling enabled state" do + instance = described_class.new(enabled: true, max_file_size: 512, max_files: 10) + expect(instance.enabled).to be(true) + + instance.enabled = false + expect(instance.enabled).to be(false) + + instance.enabled = true + expect(instance.enabled).to be(true) + end + + it "allows changing file size limits" do + instance = described_class.new(enabled: true, max_file_size: 512, max_files: 10) + expect(instance.max_file_size).to eq(512) + + instance.max_file_size = 2048 + expect(instance.max_file_size).to eq(2048) + end + + it "allows changing file count limits" do + instance = described_class.new(enabled: true, max_file_size: 512, max_files: 10) + expect(instance.max_files).to eq(10) + + instance.max_files = 50 + expect(instance.max_files).to eq(50) + end + end + + context "when serializing multiple times" do + it "produces consistent results" do + instance = described_class.new(enabled: true, max_file_size: 1024, max_files: 20) + first_serialization = instance.serialize + second_serialization = instance.serialize + expect(first_serialization).to eq(second_serialization) + end + end + + context "when deserializing with unexpected data types" do + it "handles string values for enabled" do + data = { "enabled" => "true" } + instance = described_class.deserialize(data) + expect(instance.enabled).to eq("true") + end + + it "handles string values for max_file_size" do + data = { "max_file_size" => "1024" } + instance = described_class.deserialize(data) + expect(instance.max_file_size).to eq("1024") + end + + it "handles string values for max_files" do + data = { "max_files" => "20" } + instance = described_class.deserialize(data) + expect(instance.max_files).to eq("20") + end + end + + context "when working with boundary values" do + it "handles very large file sizes" do + instance = described_class.new(max_file_size: 999_999) + expect(instance.max_file_size).to eq(999_999) + serialized = instance.serialize + expect(serialized[:max_file_size]).to eq(999_999) + end + + it "handles very large file counts" do + instance = described_class.new(max_files: 10_000) + expect(instance.max_files).to eq(10_000) + serialized = instance.serialize + expect(serialized[:max_files]).to eq(10_000) + end + + it "handles zero file size" do + instance = described_class.new(max_file_size: 0) + expect(instance.max_file_size).to eq(0) + serialized = instance.serialize + expect(serialized[:max_file_size]).to eq(0) + end + + it "handles zero file count" do + instance = described_class.new(max_files: 0) + expect(instance.max_files).to eq(0) + serialized = instance.serialize + expect(serialized[:max_files]).to eq(0) end end end - describe "::Defaults" do - it "defines MAX_FILE_SIZE constant" do + describe "constants and defaults" do + it "has correct MAX_FILE_SIZE default" do expect(described_class::Defaults::MAX_FILE_SIZE).to eq(512) end - it "defines MAX_FILES constant" do + it "has correct MAX_FILES default" do expect(described_class::Defaults::MAX_FILES).to eq(10) end + + it "uses Session::Create::Defaults::ENABLED as enabled default" do + instance = described_class.new + expect(instance.enabled).to eq(ChatKit::Session::Defaults::ENABLED) + end + + it "uses Defaults::MAX_FILE_SIZE as max_file_size default" do + instance = described_class.new + expect(instance.max_file_size).to eq(described_class::Defaults::MAX_FILE_SIZE) + end + + it "uses Defaults::MAX_FILES as max_files default" do + instance = described_class.new + expect(instance.max_files).to eq(described_class::Defaults::MAX_FILES) + end end end diff --git a/spec/chatkit/session/chatkit_configuration/history_spec.rb b/spec/chatkit/session/chatkit_configuration/history_spec.rb index 9a179ca..bab5abd 100644 --- a/spec/chatkit/session/chatkit_configuration/history_spec.rb +++ b/spec/chatkit/session/chatkit_configuration/history_spec.rb @@ -10,330 +10,278 @@ end end - context "when all arguments are provided" do - it "initializes with the provided values" do - instance = described_class.new( - enabled: false, - recent_threads: 50 - ) - - expect(instance.enabled).to be(false) - expect(instance.recent_threads).to eq(50) + context "when enabled is provided" do + it "initializes with true value" do + instance = described_class.new(enabled: true) + expect(instance.enabled).to be(true) end - end - context "when partial arguments are provided" do - it "uses defaults for missing arguments" do + it "initializes with false value" do instance = described_class.new(enabled: false) expect(instance.enabled).to be(false) - expect(instance.recent_threads).to be_nil end - it "accepts recent_threads without enabled" do - instance = described_class.new(recent_threads: 25) - expect(instance.enabled).to eq(ChatKit::Session::Defaults::ENABLED) - expect(instance.recent_threads).to eq(25) + it "accepts nil value" do + instance = described_class.new(enabled: nil) + expect(instance.enabled).to be_nil end end - context "when nil values are provided" do - it "accepts nil values" do - instance = described_class.new( - enabled: nil, - recent_threads: nil - ) + context "when recent_threads is provided" do + it "initializes with custom value" do + instance = described_class.new(recent_threads: 50) + expect(instance.recent_threads).to eq(50) + end - expect(instance.enabled).to be_nil + it "accepts zero value" do + instance = described_class.new(recent_threads: 0) + expect(instance.recent_threads).to eq(0) + end + + it "accepts nil value" do + instance = described_class.new(recent_threads: nil) expect(instance.recent_threads).to be_nil end + + it "accepts large values" do + instance = described_class.new(recent_threads: 1000) + expect(instance.recent_threads).to eq(1000) + end + end + + context "when both parameters are provided" do + it "initializes with all custom values" do + instance = described_class.new(enabled: false, recent_threads: 25) + expect(instance.enabled).to be(false) + expect(instance.recent_threads).to eq(25) + end end end describe ".build" do context "when no arguments are provided" do - it "creates an instance with nil values" do + it "creates instance with nil values" do instance = described_class.build expect(instance.enabled).to be_nil expect(instance.recent_threads).to be_nil end end - context "when all arguments are provided" do - it "creates an instance with provided values" do - instance = described_class.build( - enabled: false, - recent_threads: 100 - ) + context "when enabled is provided" do + it "creates instance with true value" do + instance = described_class.build(enabled: true) + expect(instance.enabled).to be(true) + end + it "creates instance with false value" do + instance = described_class.build(enabled: false) expect(instance.enabled).to be(false) - expect(instance.recent_threads).to eq(100) end - end - context "when partial arguments are provided" do - it "uses nil for missing arguments" do - instance = described_class.build(recent_threads: 75) + it "creates instance with nil value" do + instance = described_class.build(enabled: nil) expect(instance.enabled).to be_nil - expect(instance.recent_threads).to eq(75) end end - context "when nil values are provided" do - it "accepts nil values" do - instance = described_class.build( - enabled: nil, - recent_threads: nil - ) + context "when recent_threads is provided" do + it "creates instance with custom value" do + instance = described_class.build(recent_threads: 100) + expect(instance.recent_threads).to eq(100) + end - expect(instance.enabled).to be_nil + it "creates instance with nil value" do + instance = described_class.build(recent_threads: nil) expect(instance.recent_threads).to be_nil end - end - end - - describe ".deserialize" do - context "when data contains all keys" do - it "creates an instance with all provided values" do - data = { - "enabled" => true, - "recent_threads" => 50, - } - instance = described_class.deserialize(data) - expect(instance.enabled).to be(true) - expect(instance.recent_threads).to eq(50) + it "creates instance with zero value" do + instance = described_class.build(recent_threads: 0) + expect(instance.recent_threads).to eq(0) end + end - it "handles false and zero values correctly" do - data = { - "enabled" => false, - "recent_threads" => 0, - } - instance = described_class.deserialize(data) - - expect(instance.enabled).to be(false) - expect(instance.recent_threads).to eq(0) + context "when both parameters are provided" do + it "creates instance with all custom values" do + instance = described_class.build(enabled: true, recent_threads: 75) + expect(instance.enabled).to be(true) + expect(instance.recent_threads).to eq(75) end + end - it "handles nil values in data" do - data = { - "enabled" => nil, - "recent_threads" => nil, - } - instance = described_class.deserialize(data) + it "returns an instance of History" do + instance = described_class.build + expect(instance).to be_a(described_class) + end + end + describe ".deserialize" do + context "when data is nil" do + it "initializes with nil values for all attributes" do + instance = described_class.deserialize(nil) expect(instance.enabled).to be_nil expect(instance.recent_threads).to be_nil end - end - context "when data contains partial keys" do - it "handles missing enabled key" do - data = { "recent_threads" => 25 } - instance = described_class.deserialize(data) + it "returns an instance of History" do + instance = described_class.deserialize(nil) + expect(instance).to be_a(described_class) + end + end + context "when data is an empty hash" do + it "initializes with nil values for all attributes" do + instance = described_class.deserialize({}) expect(instance.enabled).to be_nil - expect(instance.recent_threads).to eq(25) + expect(instance.recent_threads).to be_nil end + end - it "handles missing recent_threads key" do + context "when data contains enabled key" do + it "deserializes with true value" do data = { "enabled" => true } instance = described_class.deserialize(data) - expect(instance.enabled).to be(true) - expect(instance.recent_threads).to be_nil end - it "handles only enabled key with false value" do + it "deserializes with false value" do data = { "enabled" => false } instance = described_class.deserialize(data) - expect(instance.enabled).to be(false) - expect(instance.recent_threads).to be_nil end - it "handles only recent_threads key with zero value" do - data = { "recent_threads" => 0 } + it "deserializes with nil value" do + data = { "enabled" => nil } instance = described_class.deserialize(data) - expect(instance.enabled).to be_nil - expect(instance.recent_threads).to eq(0) end end - context "when data does not contain relevant keys" do - it "creates an instance with all nil values for empty data" do - data = {} + context "when data contains recent_threads key" do + it "deserializes with integer value" do + data = { "recent_threads" => 50 } instance = described_class.deserialize(data) + expect(instance.recent_threads).to eq(50) + end - expect(instance.enabled).to be_nil + it "deserializes with nil value" do + data = { "recent_threads" => nil } + instance = described_class.deserialize(data) expect(instance.recent_threads).to be_nil end - it "ignores unknown keys in data" do - data = { - "unknown_key" => "value", - "another_key" => 123, - "random_field" => true, - } + it "deserializes with zero value" do + data = { "recent_threads" => 0 } instance = described_class.deserialize(data) - - expect(instance.enabled).to be_nil - expect(instance.recent_threads).to be_nil + expect(instance.recent_threads).to eq(0) end + end - it "uses relevant keys and ignores unknown ones" do + context "when data contains all keys" do + it "deserializes all values correctly" do data = { "enabled" => true, - "recent_threads" => 30, - "unknown_field" => "ignored", - "extra_data" => { "nested" => "value" }, + "recent_threads" => 100, } instance = described_class.deserialize(data) - expect(instance.enabled).to be(true) - expect(instance.recent_threads).to eq(30) + expect(instance.recent_threads).to eq(100) end end - context "with edge cases" do - it "handles nil data" do - instance = described_class.deserialize(nil) - - expect(instance.enabled).to be_nil - expect(instance.recent_threads).to be_nil - end - - it "handles data with string keys" do + context "when data contains extra keys" do + it "extracts only relevant keys using dig" do data = { "enabled" => false, - "recent_threads" => 15, + "recent_threads" => 75, + "extra_key" => "ignored", } instance = described_class.deserialize(data) - expect(instance.enabled).to be(false) - expect(instance.recent_threads).to eq(15) + expect(instance.recent_threads).to eq(75) end + end - it "returns a new instance each time" do - data = { - "enabled" => true, - "recent_threads" => 40, - } - instance1 = described_class.deserialize(data) - instance2 = described_class.deserialize(data) + it "returns an instance of History" do + instance = described_class.deserialize({ "enabled" => true }) + expect(instance).to be_a(described_class) + end + end - expect(instance1).not_to be(instance2) - expect(instance1.enabled).to eq(instance2.enabled) - expect(instance1.recent_threads).to eq(instance2.recent_threads) + describe "#serialize" do + context "when all attributes have values" do + it "serializes to hash with all keys" do + instance = described_class.new(enabled: true, recent_threads: 50) + result = instance.serialize + expect(result).to eq({ + enabled: true, + recent_threads: 50, + }) end + end - it "handles large numeric values for recent_threads" do - data = { - "enabled" => true, - "recent_threads" => 999_999, - } - instance = described_class.deserialize(data) - - expect(instance.enabled).to be(true) - expect(instance.recent_threads).to eq(999_999) + context "when enabled is true" do + it "serializes enabled key" do + instance = described_class.new(enabled: true, recent_threads: 25) + result = instance.serialize + expect(result[:enabled]).to be(true) end + end - it "handles negative values for recent_threads" do - data = { - "enabled" => true, - "recent_threads" => -5, - } - instance = described_class.deserialize(data) - - expect(instance.enabled).to be(true) - expect(instance.recent_threads).to eq(-5) + context "when enabled is false" do + it "serializes enabled key" do + instance = described_class.new(enabled: false, recent_threads: 25) + result = instance.serialize + expect(result[:enabled]).to be(false) end end - context "round-trip serialization" do - it "can deserialize what was serialized" do - original = described_class.new( - enabled: true, - recent_threads: 35 - ) - serialized = original.serialize - # Convert keys to strings to simulate JSON parsing - string_keyed_data = serialized.transform_keys(&:to_s) - deserialized = described_class.deserialize(string_keyed_data) - - expect(deserialized.enabled).to eq(original.enabled) - expect(deserialized.recent_threads).to eq(original.recent_threads) + context "when enabled is nil" do + it "omits enabled from serialized hash (compacts nil values)" do + instance = described_class.new(enabled: nil, recent_threads: 25) + result = instance.serialize + expect(result).not_to have_key(:enabled) end + end - it "handles nil values in round-trip" do - original = described_class.new( - enabled: nil, - recent_threads: nil - ) - serialized = original.serialize - # Since serialize uses compact, nil values are removed - string_keyed_data = serialized.transform_keys(&:to_s) - deserialized = described_class.deserialize(string_keyed_data) - - expect(deserialized.enabled).to be_nil - expect(deserialized.recent_threads).to be_nil + context "when recent_threads is nil" do + it "omits recent_threads from serialized hash" do + instance = described_class.new(enabled: true, recent_threads: nil) + result = instance.serialize + expect(result).not_to have_key(:recent_threads) end + end - it "handles partial nil values in round-trip" do - original = described_class.new( - enabled: false, - recent_threads: nil - ) - serialized = original.serialize - string_keyed_data = serialized.transform_keys(&:to_s) - deserialized = described_class.deserialize(string_keyed_data) - - expect(deserialized.enabled).to eq(original.enabled) - expect(deserialized.recent_threads).to be_nil # Was nil, remains nil + context "when recent_threads is zero" do + it "includes recent_threads in serialized hash" do + instance = described_class.new(enabled: true, recent_threads: 0) + result = instance.serialize + expect(result[:recent_threads]).to eq(0) end + end - it "handles default values in round-trip" do - original = described_class.new # Uses default enabled value - serialized = original.serialize - string_keyed_data = serialized.transform_keys(&:to_s) - deserialized = described_class.deserialize(string_keyed_data) - - expect(deserialized.enabled).to eq(ChatKit::Session::Defaults::ENABLED) - expect(deserialized.recent_threads).to be_nil # Default is nil + context "when all attributes are nil" do + it "serializes to empty hash" do + instance = described_class.new(enabled: nil, recent_threads: nil) + result = instance.serialize + expect(result).to eq({}) end + end - it "handles zero values in round-trip" do - original = described_class.new( - enabled: false, - recent_threads: 0 - ) - serialized = original.serialize - string_keyed_data = serialized.transform_keys(&:to_s) - deserialized = described_class.deserialize(string_keyed_data) - - expect(deserialized.enabled).to eq(original.enabled) - expect(deserialized.recent_threads).to eq(original.recent_threads) + context "when using default values" do + it "serializes with default enabled value and nil recent_threads" do + instance = described_class.new + result = instance.serialize + expect(result).to eq({ + enabled: ChatKit::Session::Defaults::ENABLED, + }) end + end - it "maintains data integrity through multiple round-trips" do - original_data = { - "enabled" => false, - "recent_threads" => 75, - } - - # First round-trip - instance1 = described_class.deserialize(original_data) - serialized1 = instance1.serialize.transform_keys(&:to_s) - - # Second round-trip - instance2 = described_class.deserialize(serialized1) - serialized2 = instance2.serialize.transform_keys(&:to_s) - - expect(serialized1).to eq(serialized2) - expect(instance2.enabled).to eq(original_data["enabled"]) - expect(instance2.recent_threads).to eq(original_data["recent_threads"]) - end + it "returns a hash" do + instance = described_class.new(enabled: true, recent_threads: 50) + result = instance.serialize + expect(result).to be_a(Hash) end end @@ -341,141 +289,299 @@ let(:instance) { described_class.new } describe "#enabled" do - it "is readable and writable" do - instance.enabled = false - expect(instance.enabled).to be(false) + it "allows reading the enabled value" do + expect(instance.enabled).to eq(ChatKit::Session::Defaults::ENABLED) end - it "accepts boolean values" do + it "allows writing true value" do instance.enabled = true expect(instance.enabled).to be(true) + end + it "allows writing false value" do instance.enabled = false expect(instance.enabled).to be(false) end - it "accepts nil value" do + it "allows writing nil value" do instance.enabled = nil expect(instance.enabled).to be_nil end end describe "#recent_threads" do - it "is readable and writable" do - instance.recent_threads = 42 - expect(instance.recent_threads).to eq(42) + it "allows reading the recent_threads value" do + expect(instance.recent_threads).to be_nil end - it "accepts integer values" do + it "allows writing integer value" do + instance.recent_threads = 100 + expect(instance.recent_threads).to eq(100) + end + + it "allows writing nil value" do + instance.recent_threads = nil + expect(instance.recent_threads).to be_nil + end + + it "allows writing zero value" do instance.recent_threads = 0 expect(instance.recent_threads).to eq(0) + end + end + end - instance.recent_threads = 999 - expect(instance.recent_threads).to eq(999) + describe "integration with FactoryBot" do + context "using default factory" do + it "creates valid instance" do + instance = build(:history) + expect(instance).to be_a(described_class) + expect(instance.enabled).to be(true) + expect(instance.recent_threads).to eq(50) end + end - it "accepts nil value" do - instance.recent_threads = nil + context "using :enabled trait" do + it "creates instance with enabled true" do + instance = build(:history, :enabled) + expect(instance.enabled).to be(true) + end + end + + context "using :disabled trait" do + it "creates instance with enabled false" do + instance = build(:history, :disabled) + expect(instance.enabled).to be(false) + end + end + + context "using :nil_enabled trait" do + it "creates instance with nil enabled" do + instance = build(:history, :nil_enabled) + expect(instance.enabled).to be_nil + end + end + + context "using :default_enabled trait" do + it "creates instance with default enabled value" do + instance = build(:history, :default_enabled) + expect(instance.enabled).to eq(ChatKit::Session::Defaults::ENABLED) + end + end + + context "using :no_thread_limit trait" do + it "creates instance with nil recent_threads" do + instance = build(:history, :no_thread_limit) expect(instance.recent_threads).to be_nil end end - end - describe "#serialize" do - context "when all values are present" do - it "returns a hash with all keys" do - instance = described_class.new( - enabled: true, - recent_threads: 30 - ) - result = instance.serialize + context "using :limited_threads trait" do + it "creates instance with limited recent_threads" do + instance = build(:history, :limited_threads) + expect(instance.recent_threads).to eq(10) + end + end - expect(result).to eq({ - enabled: true, - recent_threads: 30, - }) + context "using :unlimited_threads trait" do + it "creates instance with large recent_threads value" do + instance = build(:history, :unlimited_threads) + expect(instance.recent_threads).to eq(1000) end end - context "when enabled is false" do - it "returns a hash with enabled false" do - instance = described_class.new( - enabled: false, - recent_threads: 15 - ) - result = instance.serialize + context "using :default_recent_threads trait" do + it "creates instance with nil recent_threads" do + instance = build(:history, :default_recent_threads) + expect(instance.recent_threads).to be_nil + end + end - expect(result).to eq({ - enabled: false, - recent_threads: 15, - }) + context "overriding values" do + it "allows custom enabled value" do + instance = build(:history, enabled: false) + expect(instance.enabled).to be(false) + end + + it "allows custom recent_threads value" do + instance = build(:history, recent_threads: 200) + expect(instance.recent_threads).to eq(200) end end - context "when some values are nil" do - it "returns a hash without nil values due to compact" do - instance = described_class.new( - enabled: nil, - recent_threads: 20 - ) - result = instance.serialize + context "combining traits" do + it "allows combining :disabled with :limited_threads" do + instance = build(:history, :disabled, :limited_threads) + expect(instance.enabled).to be(false) + expect(instance.recent_threads).to eq(10) + end + + it "allows combining :enabled with :no_thread_limit" do + instance = build(:history, :enabled, :no_thread_limit) + expect(instance.enabled).to be(true) + expect(instance.recent_threads).to be_nil + end + end + end + + describe "round-trip serialization" do + it "maintains data integrity when serializing and deserializing" do + original = described_class.new(enabled: true, recent_threads: 50) + serialized = original.serialize + deserialized = described_class.deserialize(serialized.transform_keys(&:to_s)) + expect(deserialized.enabled).to eq(original.enabled) + expect(deserialized.recent_threads).to eq(original.recent_threads) + end + + it "maintains data integrity with false enabled" do + original = described_class.new(enabled: false, recent_threads: 100) + serialized = original.serialize + deserialized = described_class.deserialize(serialized.transform_keys(&:to_s)) + expect(deserialized.enabled).to eq(original.enabled) + expect(deserialized.recent_threads).to eq(original.recent_threads) + end + + it "handles nil values in round-trip" do + original = described_class.new(enabled: nil, recent_threads: nil) + serialized = original.serialize + deserialized = described_class.deserialize(serialized.transform_keys(&:to_s)) + expect(deserialized.enabled).to eq(original.enabled) + expect(deserialized.recent_threads).to eq(original.recent_threads) + end - expect(result).to eq({ recent_threads: 20 }) + it "handles partial nil values in round-trip" do + original = described_class.new(enabled: true, recent_threads: nil) + serialized = original.serialize + deserialized = described_class.deserialize(serialized.transform_keys(&:to_s)) + expect(deserialized.enabled).to eq(original.enabled) + expect(deserialized.recent_threads).to eq(original.recent_threads) + end + + it "handles zero recent_threads in round-trip" do + original = described_class.new(enabled: true, recent_threads: 0) + serialized = original.serialize + deserialized = described_class.deserialize(serialized.transform_keys(&:to_s)) + expect(deserialized.enabled).to eq(original.enabled) + expect(deserialized.recent_threads).to eq(original.recent_threads) + end + end + + describe "edge cases" do + context "when modifying attributes after initialization" do + it "allows toggling enabled state" do + instance = described_class.new(enabled: true, recent_threads: 50) + expect(instance.enabled).to be(true) + + instance.enabled = false + expect(instance.enabled).to be(false) + + instance.enabled = true + expect(instance.enabled).to be(true) end - it "excludes nil recent_threads" do - instance = described_class.new( - enabled: true, - recent_threads: nil - ) - result = instance.serialize + it "allows changing recent_threads value" do + instance = described_class.new(enabled: true, recent_threads: 50) + expect(instance.recent_threads).to eq(50) + + instance.recent_threads = 100 + expect(instance.recent_threads).to eq(100) + + instance.recent_threads = nil + expect(instance.recent_threads).to be_nil + end + end - expect(result).to eq({ enabled: true }) + context "when serializing multiple times" do + it "produces consistent results" do + instance = described_class.new(enabled: true, recent_threads: 75) + first_serialization = instance.serialize + second_serialization = instance.serialize + expect(first_serialization).to eq(second_serialization) end end - context "when all values are nil" do - it "returns an empty hash due to compact" do - instance = described_class.new( - enabled: nil, - recent_threads: nil - ) - result = instance.serialize + context "when deserializing with unexpected data types" do + it "handles string values for enabled" do + data = { "enabled" => "true" } + instance = described_class.deserialize(data) + expect(instance.enabled).to eq("true") + end - expect(result).to eq({}) + it "handles string values for recent_threads" do + data = { "recent_threads" => "50" } + instance = described_class.deserialize(data) + expect(instance.recent_threads).to eq("50") + end + + it "handles float values for recent_threads" do + data = { "recent_threads" => 50.5 } + instance = described_class.deserialize(data) + expect(instance.recent_threads).to eq(50.5) end end - context "when using default values" do - it "returns a hash with default enabled value" do - instance = described_class.new - result = instance.serialize + context "when working with boundary values" do + it "handles very large recent_threads values" do + instance = described_class.new(recent_threads: 999_999) + expect(instance.recent_threads).to eq(999_999) + serialized = instance.serialize + expect(serialized[:recent_threads]).to eq(999_999) + end - expect(result).to eq({ - enabled: ChatKit::Session::Defaults::ENABLED, - }) + it "handles zero recent_threads" do + instance = described_class.new(recent_threads: 0) + expect(instance.recent_threads).to eq(0) + serialized = instance.serialize + expect(serialized[:recent_threads]).to eq(0) end - it "excludes nil recent_threads from default initialization" do - instance = described_class.new - result = instance.serialize + it "handles negative recent_threads" do + instance = described_class.new(recent_threads: -1) + expect(instance.recent_threads).to eq(-1) + serialized = instance.serialize + expect(serialized[:recent_threads]).to eq(-1) + end + end - expect(result).not_to have_key(:recent_threads) + context "when modifying after serialization" do + it "subsequent serializations reflect modifications" do + instance = described_class.new(enabled: true, recent_threads: 50) + first_result = instance.serialize + expect(first_result[:recent_threads]).to eq(50) + + instance.recent_threads = 100 + second_result = instance.serialize + expect(second_result[:recent_threads]).to eq(100) end end + end - context "when recent_threads is zero" do - it "includes zero value in the result" do - instance = described_class.new( - enabled: true, - recent_threads: 0 - ) - result = instance.serialize + describe "constants and defaults" do + it "uses Session::Create::Defaults::ENABLED as enabled default" do + instance = described_class.new + expect(instance.enabled).to eq(ChatKit::Session::Defaults::ENABLED) + end - expect(result).to eq({ - enabled: true, - recent_threads: 0, - }) + it "uses nil as recent_threads default" do + instance = described_class.new + expect(instance.recent_threads).to be_nil + end + + it "Session::Create::Defaults::ENABLED is true" do + expect(ChatKit::Session::Defaults::ENABLED).to be(true) + end + end + + describe "documentation compliance" do + context "according to the class documentation" do + it "history is enabled by default" do + instance = described_class.new + expect(instance.enabled).to be(true) + end + + it "recent_threads has no limit (nil) by default" do + instance = described_class.new + expect(instance.recent_threads).to be_nil end end end diff --git a/spec/chatkit/session/chatkit_configuration_spec.rb b/spec/chatkit/session/chatkit_configuration_spec.rb index d345419..aad7677 100644 --- a/spec/chatkit/session/chatkit_configuration_spec.rb +++ b/spec/chatkit/session/chatkit_configuration_spec.rb @@ -2,642 +2,587 @@ RSpec.describe ChatKit::Session::ChatKitConfiguration do describe ".new" do - context "when all required arguments are provided" do - it "initializes with provided configuration hashes" do - config = described_class.new( - file_upload: { enabled: false, max_file_size: 256, max_files: 5 }, - history: { enabled: true, recent_threads: 25 }, - automatic_thread_titling: { enabled: true } - ) + context "when no arguments are provided" do + it "initializes all nested configurations with default values" do + instance = described_class.new + expect(instance.automatic_thread_titling).to be_a(described_class::AutomaticThreadTitling) + expect(instance.file_upload).to be_a(described_class::FileUpload) + expect(instance.history).to be_a(described_class::History) + end + end - expect(config.automatic_thread_titling).to be_a(ChatKit::Session::ChatKitConfiguration::AutomaticThreadTitling) - expect(config.file_upload).to be_a(ChatKit::Session::ChatKitConfiguration::FileUpload) - expect(config.history).to be_a(ChatKit::Session::ChatKitConfiguration::History) + context "when hash parameters are provided" do + it "initializes automatic_thread_titling from hash" do + instance = described_class.new(automatic_thread_titling: { enabled: false }) + expect(instance.automatic_thread_titling).to be_a(described_class::AutomaticThreadTitling) + expect(instance.automatic_thread_titling.enabled).to be(false) end - it "properly initializes nested objects with provided values" do - config = described_class.new( - file_upload: { enabled: true, max_file_size: 512, max_files: 10 }, - history: { enabled: false, recent_threads: 50 }, - automatic_thread_titling: { enabled: false } - ) + it "initializes file_upload from hash" do + instance = described_class.new(file_upload: { enabled: true, max_file_size: 1024, max_files: 20 }) + expect(instance.file_upload).to be_a(described_class::FileUpload) + expect(instance.file_upload.enabled).to be(true) + expect(instance.file_upload.max_file_size).to eq(1024) + expect(instance.file_upload.max_files).to eq(20) + end - expect(config.automatic_thread_titling.enabled).to be(false) - expect(config.file_upload.enabled).to be(true) - expect(config.file_upload.max_file_size).to eq(512) - expect(config.file_upload.max_files).to eq(10) - expect(config.history.enabled).to be(false) - expect(config.history.recent_threads).to eq(50) + it "initializes history from hash" do + instance = described_class.new(history: { enabled: false, recent_threads: 100 }) + expect(instance.history).to be_a(described_class::History) + expect(instance.history.enabled).to be(false) + expect(instance.history.recent_threads).to eq(100) end - end - context "when optional automatic_thread_titling is nil" do - it "creates AutomaticThreadTitling with nil enabled" do - config = described_class.new( - file_upload: { enabled: true, max_file_size: 256, max_files: 5 }, - history: { enabled: true, recent_threads: 25 }, - automatic_thread_titling: nil + it "initializes all nested configurations from hashes" do + instance = described_class.new( + automatic_thread_titling: { enabled: true }, + file_upload: { enabled: false, max_file_size: 256, max_files: 5 }, + history: { enabled: true, recent_threads: 50 } ) - - expect(config.automatic_thread_titling.enabled).to be_nil + expect(instance.automatic_thread_titling.enabled).to be(true) + expect(instance.file_upload.enabled).to be(false) + expect(instance.file_upload.max_file_size).to eq(256) + expect(instance.history.enabled).to be(true) + expect(instance.history.recent_threads).to eq(50) end end - context "when empty hashes are provided for all components" do - it "uses build method defaults for all components" do - config = described_class.new( - file_upload: {}, - history: {}, - automatic_thread_titling: {} - ) - - # All components should have nil values when built with empty hashes - expect(config.automatic_thread_titling.enabled).to be_nil - expect(config.file_upload.enabled).to be_nil - expect(config.file_upload.max_file_size).to be_nil - expect(config.file_upload.max_files).to be_nil - expect(config.history.enabled).to be_nil - expect(config.history.recent_threads).to be_nil + context "when object parameters are provided" do + it "accepts AutomaticThreadTitling object" do + auto_title = described_class::AutomaticThreadTitling.new(enabled: false) + instance = described_class.new(automatic_thread_titling: auto_title) + expect(instance.automatic_thread_titling).to eq(auto_title) end - end - context "when dealing with FileUpload optional parameters" do - it "handles FileUpload build properly with optional parameters" do - config = described_class.new( - file_upload: { max_file_size: 128, max_files: 3 }, - history: { enabled: true }, - automatic_thread_titling: { enabled: true } - ) + it "accepts FileUpload object" do + file_upload = described_class::FileUpload.new(enabled: true, max_file_size: 2048, max_files: 30) + instance = described_class.new(file_upload:) + expect(instance.file_upload).to eq(file_upload) + end - expect(config.file_upload.enabled).to be_nil # build defaults to nil - expect(config.file_upload.max_file_size).to eq(128) - expect(config.file_upload.max_files).to eq(3) + it "accepts History object" do + history = described_class::History.new(enabled: false, recent_threads: 25) + instance = described_class.new(history:) + expect(instance.history).to eq(history) end - it "handles FileUpload with only enabled parameter" do - config = described_class.new( - file_upload: { enabled: false } + it "accepts all objects" do + auto_title = described_class::AutomaticThreadTitling.new(enabled: true) + file_upload = described_class::FileUpload.new(enabled: false, max_file_size: 512, max_files: 10) + history = described_class::History.new(enabled: true, recent_threads: nil) + + instance = described_class.new( + automatic_thread_titling: auto_title, + file_upload:, + history: ) - expect(config.file_upload.enabled).to be(false) - expect(config.file_upload.max_file_size).to be_nil - expect(config.file_upload.max_files).to be_nil + expect(instance.automatic_thread_titling).to eq(auto_title) + expect(instance.file_upload).to eq(file_upload) + expect(instance.history).to eq(history) end end - end - describe ".build" do - context "when no arguments are provided" do - it "creates instance with all components having nil values" do - config = described_class.build - - expect(config.automatic_thread_titling.enabled).to be_nil - expect(config.file_upload.enabled).to be_nil - expect(config.file_upload.max_file_size).to be_nil - expect(config.file_upload.max_files).to be_nil - expect(config.history.enabled).to be_nil - expect(config.history.recent_threads).to be_nil + context "when nil parameters are provided" do + it "initializes with nil automatic_thread_titling" do + instance = described_class.new(automatic_thread_titling: nil) + expect(instance.automatic_thread_titling).to be_a(described_class::AutomaticThreadTitling) end - end - context "when all arguments are provided" do - it "creates instance with provided configurations" do - config = described_class.build( - file_upload: { enabled: false, max_file_size: 256, max_files: 8 }, - history: { enabled: true, recent_threads: 100 }, - automatic_thread_titling: { enabled: true } - ) + it "initializes with nil file_upload" do + instance = described_class.new(file_upload: nil) + expect(instance.file_upload).to be_a(described_class::FileUpload) + end - expect(config.automatic_thread_titling.enabled).to be(true) - expect(config.file_upload.enabled).to be(false) - expect(config.file_upload.max_file_size).to eq(256) - expect(config.file_upload.max_files).to eq(8) - expect(config.history.enabled).to be(true) - expect(config.history.recent_threads).to eq(100) + it "initializes with nil history" do + instance = described_class.new(history: nil) + expect(instance.history).to be_a(described_class::History) end end - context "when partial arguments are provided" do - it "uses nil for missing arguments" do - config = described_class.build( - file_upload: { max_file_size: 128, max_files: 3 }, - automatic_thread_titling: { enabled: false } - ) - - expect(config.automatic_thread_titling.enabled).to be(false) - expect(config.file_upload.enabled).to be_nil # build default - expect(config.file_upload.max_file_size).to eq(128) - expect(config.file_upload.max_files).to eq(3) - expect(config.history.enabled).to be_nil # nil argument becomes nil values - expect(config.history.recent_threads).to be_nil + context "when empty hash parameters are provided" do + it "initializes with empty automatic_thread_titling hash" do + instance = described_class.new(automatic_thread_titling: {}) + expect(instance.automatic_thread_titling).to be_a(described_class::AutomaticThreadTitling) end - it "can build with minimal parameters" do - config = described_class.build( - automatic_thread_titling: { enabled: true } - ) + it "initializes with empty file_upload hash" do + instance = described_class.new(file_upload: {}) + expect(instance.file_upload).to be_a(described_class::FileUpload) + end - expect(config.automatic_thread_titling.enabled).to be(true) - expect(config.file_upload.enabled).to be_nil - expect(config.file_upload.max_file_size).to be_nil - expect(config.file_upload.max_files).to be_nil - expect(config.history.enabled).to be_nil - expect(config.history.recent_threads).to be_nil + it "initializes with empty history hash" do + instance = described_class.new(history: {}) + expect(instance.history).to be_a(described_class::History) end end end - describe ".deserialize" do - context "when data contains all component configurations" do - it "creates instance with all components populated" do - data = { - "automatic_thread_titling" => { "enabled" => true }, - "file_upload" => { "enabled" => false, "max_file_size" => 256, "max_files" => 8 }, - "history" => { "enabled" => true, "recent_threads" => 50 }, - } - config = described_class.deserialize(data) - - expect(config.automatic_thread_titling).to be_a(ChatKit::Session::ChatKitConfiguration::AutomaticThreadTitling) - expect(config.automatic_thread_titling.enabled).to be(true) - expect(config.file_upload).to be_a(ChatKit::Session::ChatKitConfiguration::FileUpload) - expect(config.file_upload.enabled).to be(false) - expect(config.file_upload.max_file_size).to eq(256) - expect(config.file_upload.max_files).to eq(8) - expect(config.history).to be_a(ChatKit::Session::ChatKitConfiguration::History) - expect(config.history.enabled).to be(true) - expect(config.history.recent_threads).to eq(50) + describe ".build" do + context "when no arguments are provided" do + it "creates instance with default nested configurations" do + instance = described_class.build + expect(instance.automatic_thread_titling).to be_a(described_class::AutomaticThreadTitling) + expect(instance.file_upload).to be_a(described_class::FileUpload) + expect(instance.history).to be_a(described_class::History) end + end - it "handles false and zero values correctly" do - data = { - "automatic_thread_titling" => { "enabled" => false }, - "file_upload" => { "enabled" => false, "max_file_size" => 0, "max_files" => 0 }, - "history" => { "enabled" => false, "recent_threads" => 0 }, - } - config = described_class.deserialize(data) - - expect(config.automatic_thread_titling.enabled).to be(false) - expect(config.file_upload.enabled).to be(false) - expect(config.file_upload.max_file_size).to eq(0) - expect(config.file_upload.max_files).to eq(0) - expect(config.history.enabled).to be(false) - expect(config.history.recent_threads).to eq(0) + context "when hash parameters are provided" do + it "builds with automatic_thread_titling hash" do + instance = described_class.build(automatic_thread_titling: { enabled: false }) + expect(instance.automatic_thread_titling.enabled).to be(false) end - it "handles nil values in nested data" do - data = { - "automatic_thread_titling" => { "enabled" => nil }, - "file_upload" => { "enabled" => nil, "max_file_size" => nil, "max_files" => nil }, - "history" => { "enabled" => nil, "recent_threads" => nil }, - } - config = described_class.deserialize(data) - - expect(config.automatic_thread_titling.enabled).to be_nil - expect(config.file_upload.enabled).to be_nil - expect(config.file_upload.max_file_size).to be_nil - expect(config.file_upload.max_files).to be_nil - expect(config.history.enabled).to be_nil - expect(config.history.recent_threads).to be_nil + it "builds with file_upload hash" do + instance = described_class.build(file_upload: { enabled: true, max_file_size: 128, max_files: 3 }) + expect(instance.file_upload.enabled).to be(true) + expect(instance.file_upload.max_file_size).to eq(128) + expect(instance.file_upload.max_files).to eq(3) end - end - context "when data contains partial component configurations" do - it "handles missing automatic_thread_titling" do - data = { - "file_upload" => { "enabled" => true, "max_file_size" => 128 }, - "history" => { "enabled" => false }, - } - config = described_class.deserialize(data) - - expect(config.automatic_thread_titling.enabled).to be_nil - expect(config.file_upload.enabled).to be(true) - expect(config.file_upload.max_file_size).to eq(128) - expect(config.history.enabled).to be(false) + it "builds with history hash" do + instance = described_class.build(history: { enabled: true, recent_threads: 75 }) + expect(instance.history.enabled).to be(true) + expect(instance.history.recent_threads).to eq(75) end - it "handles missing file_upload" do - data = { - "automatic_thread_titling" => { "enabled" => true }, - "history" => { "enabled" => true, "recent_threads" => 75 }, - } - config = described_class.deserialize(data) - - expect(config.automatic_thread_titling.enabled).to be(true) - expect(config.file_upload.enabled).to be_nil - expect(config.file_upload.max_file_size).to be_nil - expect(config.file_upload.max_files).to be_nil - expect(config.history.enabled).to be(true) - expect(config.history.recent_threads).to eq(75) + it "builds with all hash parameters" do + instance = described_class.build( + automatic_thread_titling: { enabled: false }, + file_upload: { enabled: true, max_file_size: 4096, max_files: 100 }, + history: { enabled: false, recent_threads: 10 } + ) + expect(instance.automatic_thread_titling.enabled).to be(false) + expect(instance.file_upload.enabled).to be(true) + expect(instance.history.enabled).to be(false) end + end - it "handles missing history" do - data = { - "automatic_thread_titling" => { "enabled" => false }, - "file_upload" => { "enabled" => true, "max_files" => 15 }, - } - config = described_class.deserialize(data) + it "returns an instance of ChatKitConfiguration" do + instance = described_class.build + expect(instance).to be_a(described_class) + end + end - expect(config.automatic_thread_titling.enabled).to be(false) - expect(config.file_upload.enabled).to be(true) - expect(config.file_upload.max_files).to eq(15) - expect(config.history.enabled).to be_nil - expect(config.history.recent_threads).to be_nil + describe ".deserialize" do + context "when data is nil" do + it "initializes with default nested configurations" do + instance = described_class.deserialize(nil) + expect(instance.automatic_thread_titling).to be_a(described_class::AutomaticThreadTitling) + expect(instance.file_upload).to be_a(described_class::FileUpload) + expect(instance.history).to be_a(described_class::History) end + end - it "handles only one component present" do - data = { - "automatic_thread_titling" => { "enabled" => true }, - } - config = described_class.deserialize(data) - - expect(config.automatic_thread_titling.enabled).to be(true) - expect(config.file_upload.enabled).to be_nil - expect(config.history.enabled).to be_nil + context "when data is an empty hash" do + it "initializes with default nested configurations" do + instance = described_class.deserialize({}) + expect(instance.automatic_thread_titling).to be_a(described_class::AutomaticThreadTitling) + expect(instance.file_upload).to be_a(described_class::FileUpload) + expect(instance.history).to be_a(described_class::History) end end - context "when data is empty or contains no relevant keys" do - it "creates instance with all nil values for empty data" do - data = {} - config = described_class.deserialize(data) - - expect(config.automatic_thread_titling.enabled).to be_nil - expect(config.file_upload.enabled).to be_nil - expect(config.file_upload.max_file_size).to be_nil - expect(config.file_upload.max_files).to be_nil - expect(config.history.enabled).to be_nil - expect(config.history.recent_threads).to be_nil + context "when data contains nested configurations" do + it "deserializes automatic_thread_titling" do + data = { "automatic_thread_titling" => { "enabled" => false } } + instance = described_class.deserialize(data) + expect(instance.automatic_thread_titling.enabled).to be(false) end - it "ignores unknown keys in data" do + it "deserializes file_upload" do data = { - "unknown_config" => { "some" => "value" }, - "random_field" => "ignored", - "nested_unknown" => { "deep" => { "value" => 123 } }, + "file_upload" => { + "enabled" => true, + "max_file_size" => 2048, + "max_files" => 50, + }, } - config = described_class.deserialize(data) - - expect(config.automatic_thread_titling.enabled).to be_nil - expect(config.file_upload.enabled).to be_nil - expect(config.history.enabled).to be_nil + instance = described_class.deserialize(data) + expect(instance.file_upload.enabled).to be(true) + expect(instance.file_upload.max_file_size).to eq(2048) + expect(instance.file_upload.max_files).to eq(50) end - it "uses relevant keys and ignores unknown ones" do + it "deserializes history" do data = { - "automatic_thread_titling" => { "enabled" => true }, - "unknown_config" => { "ignored" => "value" }, - "file_upload" => { "enabled" => false, "max_file_size" => 512 }, - "random_field" => "also ignored", - "history" => { "enabled" => true, "recent_threads" => 25 }, + "history" => { + "enabled" => false, + "recent_threads" => 200, + }, } - config = described_class.deserialize(data) - - expect(config.automatic_thread_titling.enabled).to be(true) - expect(config.file_upload.enabled).to be(false) - expect(config.file_upload.max_file_size).to eq(512) - expect(config.history.enabled).to be(true) - expect(config.history.recent_threads).to eq(25) + instance = described_class.deserialize(data) + expect(instance.history.enabled).to be(false) + expect(instance.history.recent_threads).to eq(200) end - end - - context "with edge cases" do - it "handles nil data" do - config = described_class.deserialize(nil) - expect(config.automatic_thread_titling.enabled).to be_nil - expect(config.file_upload.enabled).to be_nil - expect(config.file_upload.max_file_size).to be_nil - expect(config.file_upload.max_files).to be_nil - expect(config.history.enabled).to be_nil - expect(config.history.recent_threads).to be_nil - end - - it "handles empty nested hashes" do + it "deserializes all nested configurations" do data = { - "automatic_thread_titling" => {}, - "file_upload" => {}, - "history" => {}, + "automatic_thread_titling" => { "enabled" => true }, + "file_upload" => { + "enabled" => false, + "max_file_size" => 1024, + "max_files" => 15, + }, + "history" => { + "enabled" => true, + "recent_threads" => 100, + }, } - config = described_class.deserialize(data) - - expect(config.automatic_thread_titling.enabled).to be_nil - expect(config.file_upload.enabled).to be_nil - expect(config.file_upload.max_file_size).to be_nil - expect(config.file_upload.max_files).to be_nil - expect(config.history.enabled).to be_nil - expect(config.history.recent_threads).to be_nil + instance = described_class.deserialize(data) + expect(instance.automatic_thread_titling.enabled).to be(true) + expect(instance.file_upload.enabled).to be(false) + expect(instance.file_upload.max_file_size).to eq(1024) + expect(instance.file_upload.max_files).to eq(15) + expect(instance.history.enabled).to be(true) + expect(instance.history.recent_threads).to eq(100) end + end - it "returns a new instance each time" do + context "when data contains extra keys" do + it "ignores extra keys" do data = { "automatic_thread_titling" => { "enabled" => true }, "file_upload" => { "enabled" => false }, "history" => { "enabled" => true }, + "extra_key" => "ignored", } - config1 = described_class.deserialize(data) - config2 = described_class.deserialize(data) - - expect(config1).not_to be(config2) - expect(config1.automatic_thread_titling).not_to be(config2.automatic_thread_titling) - expect(config1.file_upload).not_to be(config2.file_upload) - expect(config1.history).not_to be(config2.history) - # But values should be equal - expect(config1.automatic_thread_titling.enabled).to eq(config2.automatic_thread_titling.enabled) + instance = described_class.deserialize(data) + expect(instance.automatic_thread_titling.enabled).to be(true) + expect(instance.file_upload.enabled).to be(false) + expect(instance.history.enabled).to be(true) end + end - it "handles partial nested data gracefully" do - data = { - "automatic_thread_titling" => { "enabled" => true }, - "file_upload" => { "max_file_size" => 256 }, # missing enabled and max_files - "history" => { "recent_threads" => 100 }, # missing enabled - } - config = described_class.deserialize(data) - - expect(config.automatic_thread_titling.enabled).to be(true) - expect(config.file_upload.enabled).to be_nil - expect(config.file_upload.max_file_size).to eq(256) - expect(config.file_upload.max_files).to be_nil - expect(config.history.enabled).to be_nil - expect(config.history.recent_threads).to eq(100) - end + it "returns an instance of ChatKitConfiguration" do + instance = described_class.deserialize({ "automatic_thread_titling" => { "enabled" => true } }) + expect(instance).to be_a(described_class) end + end - context "round-trip serialization" do - it "can deserialize what was serialized" do - original = described_class.new( + describe "#serialize" do + context "when all nested configurations have values" do + it "serializes all nested configurations" do + instance = described_class.new( automatic_thread_titling: { enabled: true }, - file_upload: { enabled: false, max_file_size: 256, max_files: 8 }, + file_upload: { enabled: false, max_file_size: 512, max_files: 10 }, history: { enabled: true, recent_threads: 50 } ) - serialized = original.serialize - # Convert keys to strings to simulate JSON parsing - string_keyed_data = deep_stringify_keys(serialized) - deserialized = described_class.deserialize(string_keyed_data) - - expect(deserialized.automatic_thread_titling.enabled).to eq(original.automatic_thread_titling.enabled) - expect(deserialized.file_upload.enabled).to eq(original.file_upload.enabled) - expect(deserialized.file_upload.max_file_size).to eq(original.file_upload.max_file_size) - expect(deserialized.file_upload.max_files).to eq(original.file_upload.max_files) - expect(deserialized.history.enabled).to eq(original.history.enabled) - expect(deserialized.history.recent_threads).to eq(original.history.recent_threads) + result = instance.serialize + expect(result[:automatic_thread_titling]).to eq({ enabled: true }) + expect(result[:file_upload]).to eq({ enabled: false, max_file_size: 512, max_files: 10 }) + expect(result[:history]).to eq({ enabled: true, recent_threads: 50 }) end + end - it "handles nil values in round-trip" do - original = described_class.new( + context "when nested configurations have nil values" do + it "omits nil values from serialized hash" do + instance = described_class.new( automatic_thread_titling: { enabled: nil }, file_upload: { enabled: nil, max_file_size: nil, max_files: nil }, history: { enabled: nil, recent_threads: nil } ) - serialized = original.serialize - string_keyed_data = deep_stringify_keys(serialized) - deserialized = described_class.deserialize(string_keyed_data) - - expect(deserialized.automatic_thread_titling.enabled).to be_nil - expect(deserialized.file_upload.enabled).to be_nil - expect(deserialized.file_upload.max_file_size).to be_nil - expect(deserialized.file_upload.max_files).to be_nil - expect(deserialized.history.enabled).to be_nil - expect(deserialized.history.recent_threads).to be_nil + result = instance.serialize + expect(result[:automatic_thread_titling]).to eq({}) + expect(result[:file_upload]).to eq({}) + expect(result[:history]).to eq({}) end + end - it "handles partial nil values in round-trip" do - original = described_class.new( + context "when nested configurations have mixed values" do + it "serializes only non-nil values" do + instance = described_class.new( automatic_thread_titling: { enabled: true }, - file_upload: { enabled: false, max_file_size: nil, max_files: 5 }, - history: { enabled: nil, recent_threads: 30 } + file_upload: { enabled: nil, max_file_size: 1024, max_files: nil }, + history: { enabled: false, recent_threads: nil } ) - serialized = original.serialize - string_keyed_data = deep_stringify_keys(serialized) - deserialized = described_class.deserialize(string_keyed_data) - - expect(deserialized.automatic_thread_titling.enabled).to be(true) - expect(deserialized.file_upload.enabled).to be(false) - expect(deserialized.file_upload.max_file_size).to be_nil # Was nil, remains nil - expect(deserialized.file_upload.max_files).to eq(5) - expect(deserialized.history.enabled).to be_nil # Was nil, remains nil - expect(deserialized.history.recent_threads).to eq(30) - end - - it "maintains data integrity through multiple round-trips" do - original_data = { - "automatic_thread_titling" => { "enabled" => false }, - "file_upload" => { "enabled" => true, "max_file_size" => 1024, "max_files" => 25 }, - "history" => { "enabled" => true, "recent_threads" => 75 }, - } - - # First round-trip - config1 = described_class.deserialize(original_data) - serialized1 = deep_stringify_keys(config1.serialize) - - # Second round-trip - config2 = described_class.deserialize(serialized1) - serialized2 = deep_stringify_keys(config2.serialize) - - expect(serialized1).to eq(serialized2) - expect(config2.automatic_thread_titling.enabled).to eq(original_data["automatic_thread_titling"]["enabled"]) - expect(config2.file_upload.enabled).to eq(original_data["file_upload"]["enabled"]) - expect(config2.file_upload.max_file_size).to eq(original_data["file_upload"]["max_file_size"]) - expect(config2.file_upload.max_files).to eq(original_data["file_upload"]["max_files"]) - expect(config2.history.enabled).to eq(original_data["history"]["enabled"]) - expect(config2.history.recent_threads).to eq(original_data["history"]["recent_threads"]) + result = instance.serialize + expect(result[:automatic_thread_titling]).to eq({ enabled: true }) + expect(result[:file_upload]).to eq({ max_file_size: 1024 }) + expect(result[:history]).to eq({ enabled: false }) end end - # Helper method for deep key conversion - def deep_stringify_keys(hash) - case hash - when Hash - hash.each_with_object({}) do |(key, value), result| - result[key.to_s] = deep_stringify_keys(value) - end - when Array - hash.map { |item| deep_stringify_keys(item) } - else - hash - end + it "returns a hash" do + instance = described_class.new + result = instance.serialize + expect(result).to be_a(Hash) end end describe "attribute accessors" do - let(:config) do - described_class.new( - file_upload: { enabled: true, max_file_size: 256, max_files: 5 }, - history: { enabled: true, recent_threads: 50 }, - automatic_thread_titling: { enabled: true } - ) - end + let(:instance) { described_class.new } describe "#automatic_thread_titling" do - it "is readable and writable" do - new_titling = build(:automatic_thread_titling, :disabled) - config.automatic_thread_titling = new_titling - expect(config.automatic_thread_titling).to eq(new_titling) + it "allows reading the automatic_thread_titling value" do + expect(instance.automatic_thread_titling).to be_a(described_class::AutomaticThreadTitling) + end + + it "allows writing AutomaticThreadTitling object" do + new_config = described_class::AutomaticThreadTitling.new(enabled: false) + instance.automatic_thread_titling = new_config + expect(instance.automatic_thread_titling).to eq(new_config) end end describe "#file_upload" do - it "is readable and writable" do - new_file_upload = build(:file_upload, :large_files) - config.file_upload = new_file_upload - expect(config.file_upload).to eq(new_file_upload) + it "allows reading the file_upload value" do + expect(instance.file_upload).to be_a(described_class::FileUpload) + end + + it "allows writing FileUpload object" do + new_config = described_class::FileUpload.new(enabled: false, max_file_size: 128, max_files: 2) + instance.file_upload = new_config + expect(instance.file_upload).to eq(new_config) end end describe "#history" do - it "is readable and writable" do - new_history = build(:history, :limited_threads) - config.history = new_history - expect(config.history).to eq(new_history) + it "allows reading the history value" do + expect(instance.history).to be_a(described_class::History) + end + + it "allows writing History object" do + new_config = described_class::History.new(enabled: false, recent_threads: 25) + instance.history = new_config + expect(instance.history).to eq(new_config) end end end - describe "#serialize" do - context "when all components have values" do - it "returns a hash with all component serializations" do - config = described_class.new( - file_upload: { enabled: false, max_file_size: 256, max_files: 5 }, - history: { enabled: true, recent_threads: 25 }, - automatic_thread_titling: { enabled: true } - ) + describe "integration with FactoryBot" do + context "using default factory" do + it "creates valid instance" do + instance = build(:chatkit_configuration) + expect(instance).to be_a(described_class) + expect(instance.automatic_thread_titling.enabled).to be(true) + expect(instance.file_upload.enabled).to be(true) + expect(instance.history.enabled).to be(true) + end + end - result = config.serialize + context "using :all_enabled trait" do + it "creates instance with all features enabled" do + instance = build(:chatkit_configuration, :all_enabled) + expect(instance.automatic_thread_titling.enabled).to be(true) + expect(instance.file_upload.enabled).to be(true) + expect(instance.file_upload.max_file_size).to eq(512) + expect(instance.file_upload.max_files).to eq(10) + expect(instance.history.enabled).to be(true) + expect(instance.history.recent_threads).to eq(100) + end + end - expect(result).to have_key(:automatic_thread_titling) - expect(result).to have_key(:file_upload) - expect(result).to have_key(:history) - expect(result[:automatic_thread_titling]).to eq({ enabled: true }) - expect(result[:file_upload]).to eq({ enabled: false, max_file_size: 256, max_files: 5 }) - expect(result[:history]).to eq({ enabled: true, recent_threads: 25 }) + context "using :all_disabled trait" do + it "creates instance with all features disabled" do + instance = build(:chatkit_configuration, :all_disabled) + expect(instance.automatic_thread_titling.enabled).to be(false) + expect(instance.file_upload.enabled).to be(false) + expect(instance.history.enabled).to be(false) end end - context "when some components have nil values" do - it "includes components with empty hashes due to compact behavior" do - config = described_class.new( - file_upload: { enabled: nil, max_file_size: 256, max_files: 5 }, - history: { enabled: true, recent_threads: nil }, - automatic_thread_titling: { enabled: nil } - ) + context "using :mixed_settings trait" do + it "creates instance with mixed settings" do + instance = build(:chatkit_configuration, :mixed_settings) + expect(instance.automatic_thread_titling.enabled).to be(true) + expect(instance.file_upload.enabled).to be(false) + expect(instance.history.enabled).to be(true) + end + end - result = config.serialize + context "using :minimal_config trait" do + it "creates instance with minimal configuration" do + instance = build(:chatkit_configuration, :minimal_config) + expect(instance.automatic_thread_titling.enabled).to be_nil + expect(instance.file_upload.enabled).to be_nil + expect(instance.history.enabled).to be_nil + end + end - # Each component's serialize method uses compact, so nil values are removed - expect(result[:automatic_thread_titling]).to eq({}) - expect(result[:file_upload]).to eq({ max_file_size: 256, max_files: 5 }) - expect(result[:history]).to eq({ enabled: true }) + context "using :with_objects trait" do + it "creates instance with object parameters" do + instance = build(:chatkit_configuration, :with_objects) + expect(instance.automatic_thread_titling).to be_a(described_class::AutomaticThreadTitling) + expect(instance.file_upload).to be_a(described_class::FileUpload) + expect(instance.history).to be_a(described_class::History) end end - context "when all components have all nil values" do - it "returns hash with empty nested hashes" do - config = described_class.new( - file_upload: { enabled: nil, max_file_size: nil, max_files: nil }, - history: { enabled: nil, recent_threads: nil }, - automatic_thread_titling: { enabled: nil } - ) + context "overriding values" do + it "allows custom automatic_thread_titling params" do + instance = build(:chatkit_configuration, automatic_thread_titling_params: { enabled: false }) + expect(instance.automatic_thread_titling.enabled).to be(false) + end - result = config.serialize + it "allows custom file_upload params" do + instance = build(:chatkit_configuration, + file_upload_params: { enabled: false, max_file_size: 64, max_files: 1 }) + expect(instance.file_upload.enabled).to be(false) + expect(instance.file_upload.max_file_size).to eq(64) + expect(instance.file_upload.max_files).to eq(1) + end - expect(result).to eq({ - automatic_thread_titling: {}, - file_upload: {}, - history: {}, - }) + it "allows custom history params" do + instance = build(:chatkit_configuration, history_params: { enabled: false, recent_threads: 10 }) + expect(instance.history.enabled).to be(false) + expect(instance.history.recent_threads).to eq(10) end end + end + + describe "round-trip serialization" do + it "maintains data integrity when serializing and deserializing" do + original = described_class.new( + automatic_thread_titling: { enabled: true }, + file_upload: { enabled: false, max_file_size: 1024, max_files: 20 }, + history: { enabled: true, recent_threads: 75 } + ) + serialized = original.serialize + # The serialize method returns symbols as keys, but deserialize expects strings + string_keyed = JSON.parse(serialized.to_json) + deserialized = described_class.deserialize(string_keyed) + + expect(deserialized.automatic_thread_titling.enabled).to eq(original.automatic_thread_titling.enabled) + expect(deserialized.file_upload.enabled).to eq(original.file_upload.enabled) + expect(deserialized.file_upload.max_file_size).to eq(original.file_upload.max_file_size) + expect(deserialized.file_upload.max_files).to eq(original.file_upload.max_files) + expect(deserialized.history.enabled).to eq(original.history.enabled) + expect(deserialized.history.recent_threads).to eq(original.history.recent_threads) + end - context "when using factory bot objects" do - it "properly serializes factory-created objects" do - config = build(:chatkit_configuration, :all_enabled) - result = config.serialize + it "handles nil values in round-trip" do + original = described_class.new( + automatic_thread_titling: { enabled: nil }, + file_upload: { enabled: nil, max_file_size: nil, max_files: nil }, + history: { enabled: nil, recent_threads: nil } + ) + serialized = original.serialize + string_keyed = JSON.parse(serialized.to_json) + deserialized = described_class.deserialize(string_keyed) - expect(result[:automatic_thread_titling]).to eq({ enabled: true }) - expect(result[:file_upload]).to include(:enabled, :max_file_size, :max_files) - expect(result[:history]).to include(:enabled, :recent_threads) + expect(deserialized.automatic_thread_titling.enabled).to be_nil + expect(deserialized.file_upload.enabled).to be_nil + expect(deserialized.history.enabled).to be_nil + end + end + + describe "edge cases" do + context "when modifying nested configurations after initialization" do + it "allows modifying automatic_thread_titling" do + instance = described_class.new(automatic_thread_titling: { enabled: true }) + expect(instance.automatic_thread_titling.enabled).to be(true) + + instance.automatic_thread_titling.enabled = false + expect(instance.automatic_thread_titling.enabled).to be(false) end - it "handles mixed settings from factories" do - config = build(:chatkit_configuration, :mixed_settings) - result = config.serialize + it "allows modifying file_upload" do + instance = described_class.new(file_upload: { enabled: true, max_file_size: 512, max_files: 10 }) + expect(instance.file_upload.max_file_size).to eq(512) - expect(result[:automatic_thread_titling]).to eq({ enabled: true }) - expect(result[:file_upload][:enabled]).to be(false) - expect(result[:history][:enabled]).to be(true) - expect(result[:history]).not_to have_key(:recent_threads) # nil was compacted + instance.file_upload.max_file_size = 2048 + expect(instance.file_upload.max_file_size).to eq(2048) end - it "handles minimal config from factories" do - config = build(:chatkit_configuration, :minimal_config) - result = config.serialize + it "allows modifying history" do + instance = described_class.new(history: { enabled: true, recent_threads: 50 }) + expect(instance.history.recent_threads).to eq(50) - expect(result).to eq({ - automatic_thread_titling: {}, - file_upload: {}, - history: {}, - }) + instance.history.recent_threads = 100 + expect(instance.history.recent_threads).to eq(100) end end - end - describe "integration with individual component factories" do - it "works with AutomaticThreadTitling factory" do - titling = build(:automatic_thread_titling, :disabled) - expect(titling.enabled).to be(false) + context "when serializing multiple times" do + it "produces consistent results" do + instance = described_class.new( + automatic_thread_titling: { enabled: true }, + file_upload: { enabled: false, max_file_size: 256, max_files: 5 }, + history: { enabled: true, recent_threads: 25 } + ) + first_serialization = instance.serialize + second_serialization = instance.serialize + expect(first_serialization).to eq(second_serialization) + end end - it "works with FileUpload factory" do - upload = build(:file_upload, :large_files) - expect(upload.max_file_size).to eq(1024) - expect(upload.max_files).to eq(20) - end + context "when replacing entire nested configuration objects" do + it "allows replacing automatic_thread_titling object" do + instance = described_class.new(automatic_thread_titling: { enabled: true }) + new_config = described_class::AutomaticThreadTitling.new(enabled: false) + instance.automatic_thread_titling = new_config + expect(instance.automatic_thread_titling).to eq(new_config) + end - it "works with History factory" do - history = build(:history, :no_thread_limit) - expect(history.recent_threads).to be_nil + it "serialization reflects replaced objects" do + instance = described_class.new(automatic_thread_titling: { enabled: true }) + new_config = described_class::AutomaticThreadTitling.new(enabled: false) + instance.automatic_thread_titling = new_config + result = instance.serialize + expect(result[:automatic_thread_titling]).to eq({ enabled: false }) + end end + end - it "can create complex configurations using individual factories" do - config = described_class.new( - file_upload: attributes_for(:file_upload, :small_files), - history: attributes_for(:history, :unlimited_threads), - automatic_thread_titling: attributes_for(:automatic_thread_titling) - ) + describe "private methods" do + describe "#setup_automatic_thread_titling" do + it "returns the object if it's already an AutomaticThreadTitling instance" do + auto_title = described_class::AutomaticThreadTitling.new(enabled: false) + instance = described_class.new(automatic_thread_titling: auto_title) + expect(instance.automatic_thread_titling).to eq(auto_title) + end - expect(config.automatic_thread_titling.enabled).to be(true) - expect(config.file_upload.max_file_size).to eq(64) - expect(config.file_upload.max_files).to eq(2) - expect(config.history.recent_threads).to eq(1000) + it "builds from hash if parameter is a hash" do + instance = described_class.new(automatic_thread_titling: { enabled: false }) + expect(instance.automatic_thread_titling).to be_a(described_class::AutomaticThreadTitling) + expect(instance.automatic_thread_titling.enabled).to be(false) + end + + it "handles nil parameter" do + instance = described_class.new(automatic_thread_titling: nil) + expect(instance.automatic_thread_titling).to be_a(described_class::AutomaticThreadTitling) + end end - end - describe "error handling" do - context "when FileUpload has only some parameters" do - it "handles missing max_file_size and max_files gracefully" do - config = described_class.new( - file_upload: { enabled: true }, # max_file_size and max_files will be nil - history: { enabled: true }, - automatic_thread_titling: { enabled: true } - ) + describe "#setup_file_upload" do + it "returns the object if it's already a FileUpload instance" do + file_upload = described_class::FileUpload.new(enabled: false, max_file_size: 128, max_files: 2) + instance = described_class.new(file_upload:) + expect(instance.file_upload).to eq(file_upload) + end + + it "builds from hash if parameter is a hash" do + instance = described_class.new(file_upload: { enabled: false, max_file_size: 256, max_files: 5 }) + expect(instance.file_upload).to be_a(described_class::FileUpload) + expect(instance.file_upload.enabled).to be(false) + expect(instance.file_upload.max_file_size).to eq(256) + end - expect(config.file_upload.enabled).to be(true) - expect(config.file_upload.max_file_size).to be_nil - expect(config.file_upload.max_files).to be_nil + it "handles nil parameter" do + instance = described_class.new(file_upload: nil) + expect(instance.file_upload).to be_a(described_class::FileUpload) end end - context "when components are not hashes" do - it "handles non-hash inputs by calling to_h" do - # This tests the .to_h call in the initializer - config = described_class.new( - file_upload: { max_file_size: 256, max_files: 5 }, - history: nil, - automatic_thread_titling: nil - ) + describe "#setup_history" do + it "returns the object if it's already a History instance" do + history = described_class::History.new(enabled: false, recent_threads: 25) + instance = described_class.new(history:) + expect(instance.history).to eq(history) + end + + it "builds from hash if parameter is a hash" do + instance = described_class.new(history: { enabled: false, recent_threads: 50 }) + expect(instance.history).to be_a(described_class::History) + expect(instance.history.enabled).to be(false) + expect(instance.history.recent_threads).to eq(50) + end - # Should not raise error due to .to_h conversion - expect(config.automatic_thread_titling).to be_a(ChatKit::Session::ChatKitConfiguration::AutomaticThreadTitling) - expect(config.history).to be_a(ChatKit::Session::ChatKitConfiguration::History) + it "handles nil parameter" do + instance = described_class.new(history: nil) + expect(instance.history).to be_a(described_class::History) end end end diff --git a/spec/chatkit/session/create_spec.rb b/spec/chatkit/session/create_spec.rb new file mode 100644 index 0000000..9eda698 --- /dev/null +++ b/spec/chatkit/session/create_spec.rb @@ -0,0 +1,811 @@ +# frozen_string_literal: true + +RSpec.describe ChatKit::Session::Create do + let(:api_key) { "test_api_key_123" } + let(:host) { "https://api.openai.com" } + let(:user_id) { "user_123" } + let(:workflow_params) { { id: "workflow_alpha", version: "2024-10-01" } } + let(:chatkit_configuration_params) do + { + history: { enabled: true }, + file_upload: { enabled: true, max_file_size: 10, max_files: 5 }, + automatic_thread_titling: { enabled: false }, + } + end + let(:expires_after_params) { { anchor: "created_at", seconds: 1800 } } + let(:rate_limits_params) { { max_requests_per_1_minute: 60 } } + let(:client) { ChatKit::Client.new(api_key:, host:) } + + before do + # Configure ChatKit with API key + ChatKit.configure do |config| + config.api_key = api_key + config.host = host + end + end + + describe ".new" do + context "when all required arguments are provided" do + it "initializes with user_id and workflow" do + instance = described_class.new( + user_id:, + workflow: workflow_params, + client: + ) + + expect(instance.user_id).to eq(user_id) + expect(instance.workflow).to be_a(ChatKit::Session::Workflow) + expect(instance.workflow.id).to eq("workflow_alpha") + end + + it "converts workflow hash to Workflow object" do + instance = described_class.new( + user_id:, + workflow: workflow_params, + client: + ) + + expect(instance.workflow).to be_a(ChatKit::Session::Workflow) + end + + it "converts chatkit_configuration hash to ChatKitConfiguration object" do + instance = described_class.new( + user_id:, + workflow: workflow_params, + chatkit_configuration: chatkit_configuration_params, + client: + ) + + expect(instance.chatkit_configuration).to be_a(ChatKit::Session::ChatKitConfiguration) + end + + it "converts rate_limits hash to RateLimits object" do + instance = described_class.new( + user_id:, + workflow: workflow_params, + rate_limits: rate_limits_params, + client: + ) + + expect(instance.rate_limits).to be_a(ChatKit::Session::RateLimits) + end + end + + context "when optional arguments are provided" do + it "initializes with all parameters" do + instance = described_class.new( + user_id:, + workflow: workflow_params, + chatkit_configuration: chatkit_configuration_params, + expires_after: expires_after_params, + rate_limits: rate_limits_params, + client: + ) + + expect(instance.user_id).to eq(user_id) + expect(instance.workflow).to be_a(ChatKit::Session::Workflow) + expect(instance.chatkit_configuration).to be_a(ChatKit::Session::ChatKitConfiguration) + expect(instance.expires_after).to be_a(ChatKit::Session::ExpiresAfter) + expect(instance.rate_limits).to be_a(ChatKit::Session::RateLimits) + end + + it "accepts nil for chatkit_configuration" do + instance = described_class.new( + user_id:, + workflow: workflow_params, + chatkit_configuration: nil, + client: + ) + + expect(instance.chatkit_configuration).to be_a(ChatKit::Session::ChatKitConfiguration) + end + + it "accepts nil for expires_after" do + instance = described_class.new( + user_id:, + workflow: workflow_params, + expires_after: nil, + client: + ) + + expect(instance.expires_after).to be_nil + end + + it "accepts nil for rate_limits" do + instance = described_class.new( + user_id:, + workflow: workflow_params, + rate_limits: nil, + client: + ) + + expect(instance.rate_limits).to be_a(ChatKit::Session::RateLimits) + end + end + + context "when client is not provided" do + it "creates a new default client" do + instance = described_class.new( + user_id:, + workflow: workflow_params + ) + + expect(instance.instance_variable_get(:@client)).to be_a(ChatKit::Client) + end + end + + context "when required argument is missing" do + it "raises ArgumentError without user_id" do + expect do + described_class.new(workflow: workflow_params) + end.to raise_error(ArgumentError) + end + + it "raises ArgumentError without workflow" do + expect do + described_class.new(user_id:) + end.to raise_error(ArgumentError) + end + end + end + + describe ".call" do + let(:success_response) { load_fixture("success.json", subdir: "session/create") } + + it "creates a new instance and calls #call" do + stub_request(:post, "#{host}/v1/chatkit/sessions") + .with( + headers: { + "Authorization" => "Bearer #{api_key}", + "Accept" => "application/json", + "Content-Type" => "application/json", + "OpenAI-Beta" => "chatkit_beta=v1", + } + ) + .to_return(status: 200, body: success_response, headers: { "Content-Type" => "application/json" }) + + result = described_class.call( + user_id:, + workflow: workflow_params, + client: + ) + + expect(result).to be_a(described_class) + expect(result.response).to be_a(ChatKit::Session::Create::Response) + end + end + + describe "#call" do + let(:success_response) { load_fixture("success.json", subdir: "session/create") } + + context "when API request is successful" do + before do + stub_request(:post, "#{host}/v1/chatkit/sessions") + .with( + headers: { + "Authorization" => "Bearer #{api_key}", + "Accept" => "application/json", + "Content-Type" => "application/json", + "OpenAI-Beta" => "chatkit_beta=v1", + } + ) + .to_return(status: 200, body: success_response, headers: { "Content-Type" => "application/json" }) + end + + it "returns self" do + instance = described_class.new( + user_id:, + workflow: workflow_params, + client: + ) + + result = instance.call + expect(result).to eq(instance) + end + + it "sets response attribute" do + instance = described_class.new( + user_id:, + workflow: workflow_params, + client: + ) + + instance.call + expect(instance.response).to be_a(ChatKit::Session::Create::Response) + expect(instance.response.id).to eq("sess_abc123") + expect(instance.response.status).to eq("active") + expect(instance.response.client_secret).to eq("chatkit_token_123") + end + + it "sends correct payload" do + request_stub = stub_request(:post, "#{host}/v1/chatkit/sessions") + .with( + headers: { + "Authorization" => "Bearer #{api_key}", + "Accept" => "application/json", + "Content-Type" => "application/json", + "OpenAI-Beta" => "chatkit_beta=v1", + }, + body: hash_including( + "user" => user_id, + "workflow" => hash_including("id" => "workflow_alpha") + ) + ) + .to_return(status: 200, body: success_response, headers: { "Content-Type" => "application/json" }) + + instance = described_class.new( + user_id:, + workflow: workflow_params, + client: + ) + + instance.call + expect(request_stub).to have_been_requested + end + + it "includes chatkit_configuration in payload when provided" do + request_stub = stub_request(:post, "#{host}/v1/chatkit/sessions") + .with( + body: hash_including( + "chatkit_configuration" => hash_including("history" => { "enabled" => true }) + ) + ) + .to_return(status: 200, body: success_response, headers: { "Content-Type" => "application/json" }) + + instance = described_class.new( + user_id:, + workflow: workflow_params, + chatkit_configuration: chatkit_configuration_params, + client: + ) + + instance.call + expect(request_stub).to have_been_requested + end + + it "includes expires_after in payload when provided" do + request_stub = stub_request(:post, "#{host}/v1/chatkit/sessions") + .with( + body: hash_including( + "expires_after" => hash_including("anchor" => "created_at", "seconds" => 1800) + ) + ) + .to_return(status: 200, body: success_response, headers: { "Content-Type" => "application/json" }) + + instance = described_class.new( + user_id:, + workflow: workflow_params, + expires_after: expires_after_params, + client: + ) + + instance.call + expect(request_stub).to have_been_requested + end + + it "includes rate_limits in payload when provided" do + request_stub = stub_request(:post, "#{host}/v1/chatkit/sessions") + .with( + body: hash_including( + "rate_limits" => { "max_requests_per_1_minute" => 60 } + ) + ) + .to_return(status: 200, body: success_response, headers: { "Content-Type" => "application/json" }) + + instance = described_class.new( + user_id:, + workflow: workflow_params, + rate_limits: rate_limits_params, + client: + ) + + instance.call + expect(request_stub).to have_been_requested + end + + it "compacts nil values from payload" do + request_stub = stub_request(:post, "#{host}/v1/chatkit/sessions") + .with( + body: lambda { |body| + parsed = JSON.parse(body) + !parsed.key?("expires_after") + } + ) + .to_return(status: 200, body: success_response, headers: { "Content-Type" => "application/json" }) + + instance = described_class.new( + user_id:, + workflow: workflow_params, + expires_after: nil, + client: + ) + + instance.call + expect(request_stub).to have_been_requested + end + end + + context "when API returns 401 Unauthorized" do + let(:unauthorized_response) { load_fixture("unauthorized.json", subdir: "session/create") } + + before do + stub_request(:post, "#{host}/v1/chatkit/sessions") + .to_return(status: 401, body: unauthorized_response, headers: { "Content-Type" => "application/json" }) + end + + it "raises SessionError with authentication error message" do + instance = described_class.new( + user_id:, + workflow: workflow_params, + client: + ) + + expect { instance.call }.to raise_error( + ChatKit::Session::Create::SessionCreateError, + "Session creation failed: Missing bearer or basic authentication in header" + ) + end + end + + context "when API returns 400 with missing header" do + let(:missing_header_response) { load_fixture("missing_header.json", subdir: "session/create") } + + before do + stub_request(:post, "#{host}/v1/chatkit/sessions") + .to_return(status: 400, body: missing_header_response, headers: { "Content-Type" => "application/json" }) + end + + it "raises SessionError with header error message" do + instance = described_class.new( + user_id:, + workflow: workflow_params, + client: + ) + + expect { instance.call }.to raise_error( + ChatKit::Session::Create::SessionCreateError, + /OpenAI-Beta.*chatkit_beta=v1/ + ) + end + end + + context "when API returns 400 with missing user" do + let(:missing_user_response) { load_fixture("missing_user.json", subdir: "session/create") } + + before do + stub_request(:post, "#{host}/v1/chatkit/sessions") + .to_return(status: 400, body: missing_user_response, headers: { "Content-Type" => "application/json" }) + end + + it "raises SessionError with missing user message" do + instance = described_class.new( + user_id:, + workflow: workflow_params, + client: + ) + + expect { instance.call }.to raise_error( + ChatKit::Session::Create::SessionCreateError, + "Session creation failed: Missing required parameter: 'user'." + ) + end + end + + context "when API returns 400 with missing workflow" do + let(:missing_workflow_response) { load_fixture("missing_workflow.json", subdir: "session/create") } + + before do + stub_request(:post, "#{host}/v1/chatkit/sessions") + .to_return(status: 400, body: missing_workflow_response, headers: { "Content-Type" => "application/json" }) + end + + it "raises SessionError with missing workflow message" do + instance = described_class.new( + user_id:, + workflow: workflow_params, + client: + ) + + expect { instance.call }.to raise_error( + ChatKit::Session::Create::SessionCreateError, + "Session creation failed: Missing required parameter: 'workflow'." + ) + end + end + + context "when API returns 404 with workflow not found" do + let(:workflow_not_found_response) { load_fixture("workflow_not_found.json", subdir: "session/create") } + + before do + stub_request(:post, "#{host}/v1/chatkit/sessions") + .to_return(status: 404, body: workflow_not_found_response, headers: { "Content-Type" => "application/json" }) + end + + it "raises SessionError with workflow not found message" do + instance = described_class.new( + user_id:, + workflow: workflow_params, + client: + ) + + expect { instance.call }.to raise_error( + ChatKit::Session::Create::SessionCreateError, + /Workflow with id.*not found/ + ) + end + end + + context "when API returns error without proper JSON structure" do + before do + stub_request(:post, "#{host}/v1/chatkit/sessions") + .to_return(status: 500, body: "Internal Server Error", headers: { "Content-Type" => "text/plain" }) + end + + it "raises SessionError with unknown error message" do + instance = described_class.new( + user_id:, + workflow: workflow_params, + client: + ) + + expect { instance.call }.to raise_error( + ChatKit::Session::Create::SessionCreateError, + "Session creation failed: Unknown error occurred" + ) + end + end + + context "when network error occurs" do + before do + stub_request(:post, "#{host}/v1/chatkit/sessions") + .to_raise(StandardError.new("Connection refused")) + end + + it "raises SessionError with network error message" do + instance = described_class.new( + user_id:, + workflow: workflow_params, + client: + ) + + expect { instance.call }.to raise_error( + ChatKit::Session::Create::SessionCreateError, + "Session creation failed: Connection refused" + ) + end + end + end + + describe "#refresh!" do + let(:success_response) { load_fixture("success.json", subdir: "session/create") } + + before do + stub_request(:post, "#{host}/v1/chatkit/sessions") + .to_return(status: 200, body: success_response, headers: { "Content-Type" => "application/json" }) + end + + it "calls #call method" do + instance = described_class.new( + user_id:, + workflow: workflow_params, + client: + ) + + expect(instance).to receive(:call).and_call_original + instance.refresh! + end + + it "updates the response" do + instance = described_class.new( + user_id:, + workflow: workflow_params, + client: + ) + + instance.refresh! + first_response = instance.response + + # Stub with different response + new_response = success_response.gsub("sess_abc123", "sess_xyz789") + stub_request(:post, "#{host}/v1/chatkit/sessions") + .to_return(status: 200, body: new_response, headers: { "Content-Type" => "application/json" }) + + instance.refresh! + expect(instance.response.id).to eq("sess_xyz789") + end + end + + describe "attribute accessors" do + let(:instance) do + described_class.new( + user_id:, + workflow: workflow_params, + client: + ) + end + + describe "#user_id" do + it "allows reading the user_id value" do + expect(instance.user_id).to eq(user_id) + end + + it "allows writing new user_id value" do + instance.user_id = "user_456" + expect(instance.user_id).to eq("user_456") + end + end + + describe "#workflow" do + it "allows reading the workflow value" do + expect(instance.workflow).to be_a(ChatKit::Session::Workflow) + end + + it "allows writing new workflow value" do + new_workflow = ChatKit::Session::Workflow.new(id: "wf_new") + instance.workflow = new_workflow + expect(instance.workflow).to eq(new_workflow) + end + end + + describe "#chatkit_configuration" do + it "allows reading the chatkit_configuration value" do + expect(instance.chatkit_configuration).to be_a(ChatKit::Session::ChatKitConfiguration) + end + + it "allows writing new chatkit_configuration value" do + new_config = ChatKit::Session::ChatKitConfiguration.new + instance.chatkit_configuration = new_config + expect(instance.chatkit_configuration).to eq(new_config) + end + end + + describe "#expires_after" do + it "allows reading the expires_after value" do + expect(instance.expires_after).to be_nil + end + + it "allows writing new expires_after value" do + new_expires = ChatKit::Session::ExpiresAfter.new(anchor: "created_at", seconds: 3600) + instance.expires_after = new_expires + expect(instance.expires_after).to eq(new_expires) + end + end + + describe "#rate_limits" do + it "allows reading the rate_limits value" do + expect(instance.rate_limits).to be_a(ChatKit::Session::RateLimits) + end + + it "allows writing new rate_limits value" do + new_limits = ChatKit::Session::RateLimits.new(max_requests_per_1_minute: 100) + instance.rate_limits = new_limits + expect(instance.rate_limits).to eq(new_limits) + end + end + + describe "#response" do + let(:success_response) { load_fixture("success.json", subdir: "session/create") } + + before do + stub_request(:post, "#{host}/v1/chatkit/sessions") + .to_return(status: 200, body: success_response, headers: { "Content-Type" => "application/json" }) + + instance.call + end + + it "allows reading the response value after call" do + expect(instance.response).to be_a(ChatKit::Session::Create::Response) + end + + it "allows writing new response value" do + new_response = build(:base_response) + instance.response = new_response + expect(instance.response).to eq(new_response) + end + end + end + + describe "private methods" do + let(:instance) do + described_class.new( + user_id:, + workflow: workflow_params, + chatkit_configuration: chatkit_configuration_params, + expires_after: expires_after_params, + rate_limits: rate_limits_params, + client: + ) + end + + describe "#build_payload" do + it "builds correct payload with all parameters" do + payload = instance.send(:build_payload) + + expect(payload).to include(:user, :workflow, :chatkit_configuration, :rate_limits) + expect(payload[:user]).to eq(user_id) + expect(payload[:workflow]).to be_a(Hash) + expect(payload[:workflow]).to include(:id) + expect(payload[:chatkit_configuration]).to be_a(Hash) + expect(payload[:rate_limits]).to be_a(Hash) + end + + it "includes expires_after when present" do + payload = instance.send(:build_payload) + expect(payload).to have_key(:expires_after) + end + + it "excludes expires_after when nil" do + instance_without_expires = described_class.new( + user_id:, + workflow: workflow_params, + expires_after: nil, + client: + ) + + payload = instance_without_expires.send(:build_payload) + expect(payload).not_to have_key(:expires_after) + end + + it "serializes nested objects" do + payload = instance.send(:build_payload) + + expect(payload[:workflow]).to be_a(Hash) + expect(payload[:chatkit_configuration]).to be_a(Hash) + expect(payload[:rate_limits]).to be_a(Hash) + end + end + + describe "#create_session_endpoint" do + it "returns correct endpoint" do + endpoint = instance.send(:create_session_endpoint) + expect(endpoint).to eq("/v1/chatkit/sessions") + end + end + + describe "#sessions_header" do + it "returns correct headers" do + headers = instance.send(:sessions_header) + expect(headers).to include( + "Accept" => "application/json", + "Content-Type" => "application/json", + "OpenAI-Beta" => "chatkit_beta=v1" + ) + end + end + end + + describe "integration scenarios" do + let(:success_response) { load_fixture("success.json", subdir: "session/create") } + + context "creating a minimal session" do + before do + stub_request(:post, "#{host}/v1/chatkit/sessions") + .to_return(status: 200, body: success_response, headers: { "Content-Type" => "application/json" }) + end + + it "creates session with only required parameters" do + session = described_class.new( + user_id: "user_minimal", + workflow: { id: "wf_simple" }, + client: + ) + + result = session.call + + expect(result.response).to be_a(ChatKit::Session::Create::Response) + expect(result.response.status).to eq("active") + end + end + + context "creating a fully configured session" do + before do + stub_request(:post, "#{host}/v1/chatkit/sessions") + .to_return(status: 200, body: success_response, headers: { "Content-Type" => "application/json" }) + end + + it "creates session with all parameters" do + session = described_class.new( + user_id: "user_full", + workflow: { id: "wf_full", version: "1.0.0" }, + chatkit_configuration: { + history: { enabled: true }, + file_upload: { enabled: true }, + }, + expires_after: { anchor: "created_at", seconds: 3600 }, + rate_limits: { max_requests_per_1_minute: 100 }, + client: + ) + + result = session.call + + expect(result.response).to be_a(ChatKit::Session::Create::Response) + expect(result.user_id).to eq("user_full") + expect(result.workflow.id).to eq("wf_full") + end + end + + context "refreshing an existing session" do + before do + stub_request(:post, "#{host}/v1/chatkit/sessions") + .to_return(status: 200, body: success_response, headers: { "Content-Type" => "application/json" }) + end + + it "can refresh session multiple times" do + session = described_class.new( + user_id:, + workflow: workflow_params, + client: + ) + + session.call + first_response_id = session.response.id + + session.refresh! + second_response_id = session.response.id + + expect(first_response_id).to eq(second_response_id) + end + end + end + + describe "error handling edge cases" do + context "when response has malformed JSON" do + before do + stub_request(:post, "#{host}/v1/chatkit/sessions") + .to_return(status: 400, body: "Not a JSON", headers: { "Content-Type" => "text/plain" }) + end + + it "raises SessionError with unknown error" do + instance = described_class.new( + user_id:, + workflow: workflow_params, + client: + ) + + expect { instance.call }.to raise_error( + ChatKit::Session::Create::SessionCreateError, + /Session creation failed/ + ) + end + end + + context "when response has error without message field" do + before do + stub_request(:post, "#{host}/v1/chatkit/sessions") + .to_return( + status: 500, + body: '{"error": {"type": "server_error"}}', + headers: { "Content-Type" => "application/json" } + ) + end + + it "raises SessionError with unknown error" do + instance = described_class.new( + user_id:, + workflow: workflow_params, + client: + ) + + expect { instance.call }.to raise_error( + ChatKit::Session::Create::SessionCreateError + ) do |error| + expect(error.message).to match(/Session creation failed/) + end + end + end + end + + describe "class constant" do + describe "Defaults::ENABLED" do + it "has correct value" do + expect(ChatKit::Session::Defaults::ENABLED).to eq(true) + end + end + end + + describe "SessionCreateError" do + it "is defined as a StandardError subclass" do + expect(described_class::SessionCreateError).to be < StandardError + end + end +end diff --git a/spec/chatkit/session/expires_after_spec.rb b/spec/chatkit/session/expires_after_spec.rb index 3053706..f34158b 100644 --- a/spec/chatkit/session/expires_after_spec.rb +++ b/spec/chatkit/session/expires_after_spec.rb @@ -1,307 +1,481 @@ # frozen_string_literal: true -require "spec_helper" - RSpec.describe ChatKit::Session::ExpiresAfter do describe ".new" do - context "when both required parameters are provided" do + context "when both required arguments are provided" do it "initializes with anchor and seconds" do - expires_after = described_class.new(anchor: "creation", seconds: 600) + instance = described_class.new(anchor: "creation", seconds: 600) + expect(instance.anchor).to eq("creation") + expect(instance.seconds).to eq(600) + end - expect(expires_after.anchor).to eq("creation") - expect(expires_after.seconds).to eq(600) + it "accepts last_activity anchor" do + instance = described_class.new(anchor: "last_activity", seconds: 3600) + expect(instance.anchor).to eq("last_activity") + expect(instance.seconds).to eq(3600) end - end - context "when different anchor types are provided" do - it "accepts creation anchor" do - expires_after = described_class.new(anchor: "creation", seconds: 300) + it "accepts custom anchor values" do + instance = described_class.new(anchor: "custom_timestamp", seconds: 1200) + expect(instance.anchor).to eq("custom_timestamp") + expect(instance.seconds).to eq(1200) + end - expect(expires_after.anchor).to eq("creation") - expect(expires_after.seconds).to eq(300) + it "accepts various second values" do + instance = described_class.new(anchor: "creation", seconds: 86_400) + expect(instance.seconds).to eq(86_400) end - it "accepts last_activity anchor" do - expires_after = described_class.new(anchor: "last_activity", seconds: 1800) + it "accepts zero seconds" do + instance = described_class.new(anchor: "creation", seconds: 0) + expect(instance.seconds).to eq(0) + end - expect(expires_after.anchor).to eq("last_activity") - expect(expires_after.seconds).to eq(1800) + it "accepts large second values" do + instance = described_class.new(anchor: "creation", seconds: 999_999) + expect(instance.seconds).to eq(999_999) end + end - it "accepts custom anchor values" do - expires_after = described_class.new(anchor: "custom_timestamp", seconds: 7200) + context "when arguments are missing" do + it "raises ArgumentError when anchor is missing" do + expect { described_class.new(seconds: 600) }.to raise_error(ArgumentError) + end - expect(expires_after.anchor).to eq("custom_timestamp") - expect(expires_after.seconds).to eq(7200) + it "raises ArgumentError when seconds is missing" do + expect { described_class.new(anchor: "creation") }.to raise_error(ArgumentError) + end + + it "raises ArgumentError when both are missing" do + expect { described_class.new }.to raise_error(ArgumentError) end end - context "when different time durations are provided" do - it "accepts short duration (1 minute)" do - expires_after = described_class.new(anchor: "creation", seconds: 60) + context "when nil values are provided" do + it "accepts nil anchor" do + instance = described_class.new(anchor: nil, seconds: 600) + expect(instance.anchor).to be_nil + end + + it "accepts nil seconds" do + instance = described_class.new(anchor: "creation", seconds: nil) + expect(instance.seconds).to be_nil + end - expect(expires_after.seconds).to eq(60) + it "accepts both nil values" do + instance = described_class.new(anchor: nil, seconds: nil) + expect(instance.anchor).to be_nil + expect(instance.seconds).to be_nil end + end + end - it "accepts standard duration (10 minutes)" do - expires_after = described_class.new(anchor: "creation", seconds: 600) + describe ".build" do + context "when both required arguments are provided" do + it "builds with anchor and seconds" do + instance = described_class.build(anchor: "creation", seconds: 600) + expect(instance.anchor).to eq("creation") + expect(instance.seconds).to eq(600) + end - expect(expires_after.seconds).to eq(600) + it "builds with last_activity anchor" do + instance = described_class.build(anchor: "last_activity", seconds: 1800) + expect(instance.anchor).to eq("last_activity") + expect(instance.seconds).to eq(1800) end - it "accepts long duration (1 hour)" do - expires_after = described_class.new(anchor: "creation", seconds: 3600) + it "builds with custom values" do + instance = described_class.build(anchor: "custom", seconds: 7200) + expect(instance.anchor).to eq("custom") + expect(instance.seconds).to eq(7200) + end + end - expect(expires_after.seconds).to eq(3600) + context "when arguments are missing" do + it "raises ArgumentError when anchor is missing" do + expect { described_class.build(seconds: 600) }.to raise_error(ArgumentError) end - it "accepts very long duration (24 hours)" do - expires_after = described_class.new(anchor: "creation", seconds: 86_400) + it "raises ArgumentError when seconds is missing" do + expect { described_class.build(anchor: "creation") }.to raise_error(ArgumentError) + end - expect(expires_after.seconds).to eq(86_400) + it "raises ArgumentError when both are missing" do + expect { described_class.build }.to raise_error(ArgumentError) end end - context "when zero or negative values are provided" do - it "accepts zero seconds" do - expires_after = described_class.new(anchor: "creation", seconds: 0) + it "returns an instance of ExpiresAfter" do + instance = described_class.build(anchor: "creation", seconds: 600) + expect(instance).to be_a(described_class) + end + end - expect(expires_after.seconds).to eq(0) + describe "#serialize" do + context "when both attributes have values" do + it "serializes to hash with both keys" do + instance = described_class.new(anchor: "creation", seconds: 600) + result = instance.serialize + expect(result).to eq({ anchor: "creation", seconds: 600 }) end - it "accepts negative seconds" do - expires_after = described_class.new(anchor: "creation", seconds: -100) + it "serializes with last_activity anchor" do + instance = described_class.new(anchor: "last_activity", seconds: 3600) + result = instance.serialize + expect(result).to eq({ anchor: "last_activity", seconds: 3600 }) + end - expect(expires_after.seconds).to eq(-100) + it "serializes with large seconds value" do + instance = described_class.new(anchor: "creation", seconds: 86_400) + result = instance.serialize + expect(result).to eq({ anchor: "creation", seconds: 86_400 }) end end - end - describe ".build" do - context "when both parameters are provided" do - it "creates instance with provided values" do - expires_after = described_class.build(anchor: "last_activity", seconds: 1200) + context "when attributes have nil values" do + it "omits nil anchor from serialized hash" do + instance = described_class.new(anchor: nil, seconds: 600) + result = instance.serialize + expect(result).to eq({ seconds: 600 }) + expect(result).not_to have_key(:anchor) + end - expect(expires_after.anchor).to eq("last_activity") - expect(expires_after.seconds).to eq(1200) + it "omits nil seconds from serialized hash" do + instance = described_class.new(anchor: "creation", seconds: nil) + result = instance.serialize + expect(result).to eq({ anchor: "creation" }) + expect(result).not_to have_key(:seconds) end - end - context "when comparing with .new method" do - it "produces identical results" do - params = { anchor: "creation", seconds: 900 } + it "serializes to empty hash when both are nil" do + instance = described_class.new(anchor: nil, seconds: nil) + result = instance.serialize + expect(result).to eq({}) + end + end - expires_new = described_class.new(**params) - expires_build = described_class.build(**params) + context "when attributes have edge case values" do + it "includes zero seconds in serialized hash" do + instance = described_class.new(anchor: "creation", seconds: 0) + result = instance.serialize + expect(result[:seconds]).to eq(0) + end - expect(expires_new.anchor).to eq(expires_build.anchor) - expect(expires_new.seconds).to eq(expires_build.seconds) - expect(expires_new.serialize).to eq(expires_build.serialize) + it "includes empty string anchor in serialized hash" do + instance = described_class.new(anchor: "", seconds: 600) + result = instance.serialize + expect(result[:anchor]).to eq("") end end + + it "returns a hash" do + instance = described_class.new(anchor: "creation", seconds: 600) + result = instance.serialize + expect(result).to be_a(Hash) + end end describe "attribute accessors" do - let(:expires_after) { described_class.new(anchor: "creation", seconds: 600) } + let(:instance) { described_class.new(anchor: "creation", seconds: 600) } describe "#anchor" do - it "is readable and writable" do - expect(expires_after.anchor).to eq("creation") - expires_after.anchor = "last_activity" - expect(expires_after.anchor).to eq("last_activity") + it "allows reading the anchor value" do + expect(instance.anchor).to eq("creation") end - it "accepts string values" do - expires_after.anchor = "custom_anchor" - expect(expires_after.anchor).to eq("custom_anchor") + it "allows writing string value" do + instance.anchor = "last_activity" + expect(instance.anchor).to eq("last_activity") end - it "accepts nil value" do - expires_after.anchor = nil - expect(expires_after.anchor).to be_nil + it "allows writing nil value" do + instance.anchor = nil + expect(instance.anchor).to be_nil + end + + it "allows writing custom values" do + instance.anchor = "custom_timestamp" + expect(instance.anchor).to eq("custom_timestamp") end end describe "#seconds" do - it "is readable and writable" do - expect(expires_after.seconds).to eq(600) - expires_after.seconds = 1800 - expect(expires_after.seconds).to eq(1800) + it "allows reading the seconds value" do + expect(instance.seconds).to eq(600) end - it "accepts integer values" do - expires_after.seconds = 42 - expect(expires_after.seconds).to eq(42) + it "allows writing integer value" do + instance.seconds = 3600 + expect(instance.seconds).to eq(3600) end - it "accepts zero value" do - expires_after.seconds = 0 - expect(expires_after.seconds).to eq(0) + it "allows writing nil value" do + instance.seconds = nil + expect(instance.seconds).to be_nil end - it "accepts negative values" do - expires_after.seconds = -500 - expect(expires_after.seconds).to eq(-500) + it "allows writing zero value" do + instance.seconds = 0 + expect(instance.seconds).to eq(0) end - it "accepts nil value" do - expires_after.seconds = nil - expect(expires_after.seconds).to be_nil + it "allows writing large values" do + instance.seconds = 999_999 + expect(instance.seconds).to eq(999_999) end end end - describe "#serialize" do - context "when both attributes have values" do - let(:expires_after) { described_class.new(anchor: "creation", seconds: 1200) } - - it "returns hash with both attributes" do - result = expires_after.serialize + describe "integration with FactoryBot" do + context "using default factory" do + it "creates valid instance" do + instance = build(:expires_after) + expect(instance).to be_a(described_class) + expect(instance.anchor).to eq("creation") + expect(instance.seconds).to eq(600) + end + end - expect(result).to eq({ - anchor: "creation", - seconds: 1200, - }) + context "using :short_expiry trait" do + it "creates instance with short expiry" do + instance = build(:expires_after, :short_expiry) + expect(instance.seconds).to eq(60) end end - context "when attributes have different combinations" do - it "includes both anchor and seconds when set" do - expires_after = described_class.new(anchor: "last_activity", seconds: 300) - result = expires_after.serialize + context "using :long_expiry trait" do + it "creates instance with long expiry" do + instance = build(:expires_after, :long_expiry) + expect(instance.seconds).to eq(3600) + end + end - expect(result).to have_key(:anchor) - expect(result).to have_key(:seconds) - expect(result[:anchor]).to eq("last_activity") - expect(result[:seconds]).to eq(300) + context "using :ten_minutes trait" do + it "creates instance with ten minutes expiry" do + instance = build(:expires_after, :ten_minutes) + expect(instance.seconds).to eq(600) end + end - it "includes zero seconds in serialization" do - expires_after = described_class.new(anchor: "creation", seconds: 0) - result = expires_after.serialize + context "using :one_hour trait" do + it "creates instance with one hour expiry" do + instance = build(:expires_after, :one_hour) + expect(instance.seconds).to eq(3600) + end + end - expect(result[:seconds]).to eq(0) - expect(result).to have_key(:seconds) + context "using :one_day trait" do + it "creates instance with one day expiry" do + instance = build(:expires_after, :one_day) + expect(instance.seconds).to eq(86_400) end + end - it "includes negative seconds in serialization" do - expires_after = described_class.new(anchor: "creation", seconds: -100) - result = expires_after.serialize + context "using :last_activity_anchor trait" do + it "creates instance with last_activity anchor" do + instance = build(:expires_after, :last_activity_anchor) + expect(instance.anchor).to eq("last_activity") + end + end - expect(result[:seconds]).to eq(-100) + context "using :creation_anchor trait" do + it "creates instance with creation anchor" do + instance = build(:expires_after, :creation_anchor) + expect(instance.anchor).to eq("creation") end end - context "when attributes are set to nil" do - it "excludes nil anchor due to compact" do - expires_after = described_class.new(anchor: "creation", seconds: 600) - expires_after.anchor = nil - result = expires_after.serialize + context "using :custom_anchor trait" do + it "creates instance with custom anchor" do + instance = build(:expires_after, :custom_anchor) + expect(instance.anchor).to eq("custom_timestamp") + end + end - expect(result).not_to have_key(:anchor) - expect(result[:seconds]).to eq(600) + context "overriding values" do + it "allows custom anchor value" do + instance = build(:expires_after, anchor: "custom") + expect(instance.anchor).to eq("custom") end - it "excludes nil seconds due to compact" do - expires_after = described_class.new(anchor: "creation", seconds: 600) - expires_after.seconds = nil - result = expires_after.serialize + it "allows custom seconds value" do + instance = build(:expires_after, seconds: 1200) + expect(instance.seconds).to eq(1200) + end - expect(result).not_to have_key(:seconds) - expect(result[:anchor]).to eq("creation") + it "allows overriding both values" do + instance = build(:expires_after, anchor: "last_activity", seconds: 7200) + expect(instance.anchor).to eq("last_activity") + expect(instance.seconds).to eq(7200) end + end - it "returns empty hash when both are nil" do - expires_after = described_class.new(anchor: "creation", seconds: 600) - expires_after.anchor = nil - expires_after.seconds = nil - result = expires_after.serialize + context "combining traits" do + it "allows combining anchor and expiry traits" do + instance = build(:expires_after, :last_activity_anchor, :one_hour) + expect(instance.anchor).to eq("last_activity") + expect(instance.seconds).to eq(3600) + end - expect(result).to eq({}) + it "allows combining creation_anchor with one_day" do + instance = build(:expires_after, :creation_anchor, :one_day) + expect(instance.anchor).to eq("creation") + expect(instance.seconds).to eq(86_400) end end end - describe "edge cases and validation" do - context "with boundary values" do - it "handles empty string anchor" do - expires_after = described_class.new(anchor: "", seconds: 600) - expect(expires_after.anchor).to eq("") + describe "edge cases" do + context "when modifying attributes after initialization" do + it "allows changing anchor" do + instance = described_class.new(anchor: "creation", seconds: 600) + expect(instance.anchor).to eq("creation") + + instance.anchor = "last_activity" + expect(instance.anchor).to eq("last_activity") end - it "handles very long anchor string" do - long_anchor = "anchor_#{'x' * 1000}" - expires_after = described_class.new(anchor: long_anchor, seconds: 600) - expect(expires_after.anchor).to eq(long_anchor) + it "allows changing seconds" do + instance = described_class.new(anchor: "creation", seconds: 600) + expect(instance.seconds).to eq(600) + + instance.seconds = 3600 + expect(instance.seconds).to eq(3600) end - it "handles maximum integer seconds" do - max_seconds = (2**31) - 1 # Maximum 32-bit signed integer - expires_after = described_class.new(anchor: "creation", seconds: max_seconds) - expect(expires_after.seconds).to eq(max_seconds) + it "allows changing both attributes" do + instance = described_class.new(anchor: "creation", seconds: 600) + + instance.anchor = "custom" + instance.seconds = 1200 + + expect(instance.anchor).to eq("custom") + expect(instance.seconds).to eq(1200) end + end - it "handles minimum integer seconds" do - min_seconds = -2**31 # Minimum 32-bit signed integer - expires_after = described_class.new(anchor: "creation", seconds: min_seconds) - expect(expires_after.seconds).to eq(min_seconds) + context "when serializing multiple times" do + it "produces consistent results" do + instance = described_class.new(anchor: "creation", seconds: 600) + first_serialization = instance.serialize + second_serialization = instance.serialize + expect(first_serialization).to eq(second_serialization) end end - context "when checking serialization consistency" do - it "maintains consistent serialization across multiple calls" do - expires_after = described_class.new(anchor: "creation", seconds: 1800) + context "when working with unexpected data types" do + it "accepts string seconds value" do + instance = described_class.new(anchor: "creation", seconds: "600") + expect(instance.seconds).to eq("600") + end - first_serialize = expires_after.serialize - second_serialize = expires_after.serialize + it "accepts symbol anchor value" do + instance = described_class.new(anchor: :creation, seconds: 600) + expect(instance.anchor).to eq(:creation) + end - expect(first_serialize).to eq(second_serialize) + it "accepts float seconds value" do + instance = described_class.new(anchor: "creation", seconds: 600.5) + expect(instance.seconds).to eq(600.5) end + end - it "reflects changes in subsequent serializations" do - expires_after = described_class.new(anchor: "creation", seconds: 600) + context "when working with boundary values" do + it "handles very large seconds values" do + instance = described_class.new(anchor: "creation", seconds: 99_999_999) + expect(instance.seconds).to eq(99_999_999) + serialized = instance.serialize + expect(serialized[:seconds]).to eq(99_999_999) + end - original_serialize = expires_after.serialize - expires_after.seconds = 1200 - updated_serialize = expires_after.serialize + it "handles negative seconds values" do + instance = described_class.new(anchor: "creation", seconds: -100) + expect(instance.seconds).to eq(-100) + serialized = instance.serialize + expect(serialized[:seconds]).to eq(-100) + end - expect(original_serialize[:seconds]).to eq(600) - expect(updated_serialize[:seconds]).to eq(1200) + it "handles very long anchor strings" do + long_anchor = "a" * 1000 + instance = described_class.new(anchor: long_anchor, seconds: 600) + expect(instance.anchor).to eq(long_anchor) + serialized = instance.serialize + expect(serialized[:anchor]).to eq(long_anchor) end + end + + context "when modifying after serialization" do + it "subsequent serializations reflect modifications" do + instance = described_class.new(anchor: "creation", seconds: 600) + first_result = instance.serialize + expect(first_result[:seconds]).to eq(600) - it "reflects anchor changes in serializations" do - expires_after = described_class.new(anchor: "creation", seconds: 600) + instance.seconds = 1200 + second_result = instance.serialize + expect(second_result[:seconds]).to eq(1200) + end - original_serialize = expires_after.serialize - expires_after.anchor = "last_activity" - updated_serialize = expires_after.serialize + it "reflects anchor changes in serialization" do + instance = described_class.new(anchor: "creation", seconds: 600) + first_result = instance.serialize + expect(first_result[:anchor]).to eq("creation") - expect(original_serialize[:anchor]).to eq("creation") - expect(updated_serialize[:anchor]).to eq("last_activity") + instance.anchor = "last_activity" + second_result = instance.serialize + expect(second_result[:anchor]).to eq("last_activity") end end + end - context "with common expiration scenarios" do - it "handles default 10-minute expiration" do - expires_after = described_class.new(anchor: "creation", seconds: 600) - result = expires_after.serialize + describe "common use cases" do + context "default 10 minute expiration" do + it "creates instance with 600 seconds" do + instance = described_class.new(anchor: "creation", seconds: 600) + expect(instance.seconds).to eq(600) + expect(instance.anchor).to eq("creation") + end + end - expect(result).to eq({ anchor: "creation", seconds: 600 }) + context "session expiration from creation" do + it "uses creation anchor" do + instance = described_class.new(anchor: "creation", seconds: 3600) + expect(instance.anchor).to eq("creation") + expect(instance.seconds).to eq(3600) end + end - it "handles session timeout scenarios" do - expires_after = described_class.new(anchor: "last_activity", seconds: 1800) - result = expires_after.serialize + context "session expiration from last activity" do + it "uses last_activity anchor" do + instance = described_class.new(anchor: "last_activity", seconds: 1800) + expect(instance.anchor).to eq("last_activity") + expect(instance.seconds).to eq(1800) + end + end - expect(result[:anchor]).to eq("last_activity") - expect(result[:seconds]).to eq(1800) + context "various time durations" do + it "represents 1 minute" do + instance = described_class.new(anchor: "creation", seconds: 60) + expect(instance.seconds).to eq(60) end - it "handles immediate expiration" do - expires_after = described_class.new(anchor: "creation", seconds: 0) - result = expires_after.serialize + it "represents 5 minutes" do + instance = described_class.new(anchor: "creation", seconds: 300) + expect(instance.seconds).to eq(300) + end - expect(result[:seconds]).to eq(0) + it "represents 30 minutes" do + instance = described_class.new(anchor: "creation", seconds: 1800) + expect(instance.seconds).to eq(1800) + end + + it "represents 1 hour" do + instance = described_class.new(anchor: "creation", seconds: 3600) + expect(instance.seconds).to eq(3600) + end + + it "represents 24 hours" do + instance = described_class.new(anchor: "creation", seconds: 86_400) + expect(instance.seconds).to eq(86_400) end end end diff --git a/spec/chatkit/session/rate_limits_spec.rb b/spec/chatkit/session/rate_limits_spec.rb index 1daf3a3..c562b67 100644 --- a/spec/chatkit/session/rate_limits_spec.rb +++ b/spec/chatkit/session/rate_limits_spec.rb @@ -10,9 +10,9 @@ end context "when max_requests_per_1_minute is provided" do - it "initializes with the provided value" do - instance = described_class.new(max_requests_per_1_minute: 25) - expect(instance.max_requests_per_1_minute).to eq(25) + it "initializes with custom integer value" do + instance = described_class.new(max_requests_per_1_minute: 20) + expect(instance.max_requests_per_1_minute).to eq(20) end it "accepts zero value" do @@ -20,207 +20,415 @@ expect(instance.max_requests_per_1_minute).to eq(0) end + it "accepts nil value" do + instance = described_class.new(max_requests_per_1_minute: nil) + expect(instance.max_requests_per_1_minute).to be_nil + end + it "accepts large values" do instance = described_class.new(max_requests_per_1_minute: 1000) expect(instance.max_requests_per_1_minute).to eq(1000) end - it "accepts nil value" do - instance = described_class.new(max_requests_per_1_minute: nil) - expect(instance.max_requests_per_1_minute).to be_nil + it "accepts small values" do + instance = described_class.new(max_requests_per_1_minute: 1) + expect(instance.max_requests_per_1_minute).to eq(1) end end end describe ".build" do context "when no arguments are provided" do - it "creates an instance with nil max_requests_per_1_minute value" do + it "creates instance with nil max_requests_per_1_minute value" do instance = described_class.build expect(instance.max_requests_per_1_minute).to be_nil end end context "when max_requests_per_1_minute is provided" do - it "creates an instance with the provided value" do + it "creates instance with custom value" do instance = described_class.build(max_requests_per_1_minute: 50) expect(instance.max_requests_per_1_minute).to eq(50) end - it "accepts zero value" do + it "creates instance with nil value" do + instance = described_class.build(max_requests_per_1_minute: nil) + expect(instance.max_requests_per_1_minute).to be_nil + end + + it "creates instance with zero value" do instance = described_class.build(max_requests_per_1_minute: 0) expect(instance.max_requests_per_1_minute).to eq(0) end - it "accepts nil value explicitly" do - instance = described_class.build(max_requests_per_1_minute: nil) - expect(instance.max_requests_per_1_minute).to be_nil + it "creates instance with large value" do + instance = described_class.build(max_requests_per_1_minute: 500) + expect(instance.max_requests_per_1_minute).to eq(500) end end + + it "returns an instance of RateLimits" do + instance = described_class.build + expect(instance).to be_a(described_class) + end end - describe "#max_requests_per_1_minute" do - it "is readable" do - instance = described_class.new(max_requests_per_1_minute: 15) - expect(instance.max_requests_per_1_minute).to eq(15) + describe ".deserialize" do + context "when data is nil" do + it "initializes with nil max_requests_per_1_minute value" do + instance = described_class.deserialize(nil) + expect(instance.max_requests_per_1_minute).to be_nil + end + + it "returns an instance of RateLimits" do + instance = described_class.deserialize(nil) + expect(instance).to be_a(described_class) + end end - it "is writable" do - instance = described_class.new(max_requests_per_1_minute: 10) - instance.max_requests_per_1_minute = 20 - expect(instance.max_requests_per_1_minute).to eq(20) + context "when data is an empty hash" do + it "initializes with nil max_requests_per_1_minute value" do + instance = described_class.deserialize({}) + expect(instance.max_requests_per_1_minute).to be_nil + end end - it "accepts integer values" do - instance = described_class.new + context "when data contains max_requests_per_1_minute key" do + it "deserializes with integer value" do + data = { "max_requests_per_1_minute" => 30 } + instance = described_class.deserialize(data) + expect(instance.max_requests_per_1_minute).to eq(30) + end - instance.max_requests_per_1_minute = 5 - expect(instance.max_requests_per_1_minute).to eq(5) + it "deserializes with nil value" do + data = { "max_requests_per_1_minute" => nil } + instance = described_class.deserialize(data) + expect(instance.max_requests_per_1_minute).to be_nil + end - instance.max_requests_per_1_minute = 100 - expect(instance.max_requests_per_1_minute).to eq(100) + it "deserializes with zero value" do + data = { "max_requests_per_1_minute" => 0 } + instance = described_class.deserialize(data) + expect(instance.max_requests_per_1_minute).to eq(0) + end + + it "deserializes with large value" do + data = { "max_requests_per_1_minute" => 999 } + instance = described_class.deserialize(data) + expect(instance.max_requests_per_1_minute).to eq(999) + end end - it "accepts nil value" do - instance = described_class.new(max_requests_per_1_minute: 10) - instance.max_requests_per_1_minute = nil - expect(instance.max_requests_per_1_minute).to be_nil + context "when data contains extra keys" do + it "extracts only max_requests_per_1_minute using dig" do + data = { + "max_requests_per_1_minute" => 25, + "extra_key" => "ignored", + } + instance = described_class.deserialize(data) + expect(instance.max_requests_per_1_minute).to eq(25) + end end - it "accepts zero value" do - instance = described_class.new - instance.max_requests_per_1_minute = 0 - expect(instance.max_requests_per_1_minute).to eq(0) + it "returns an instance of RateLimits" do + instance = described_class.deserialize({ "max_requests_per_1_minute" => 15 }) + expect(instance).to be_a(described_class) end end describe "#serialize" do context "when max_requests_per_1_minute has a value" do - it "returns a hash with max_requests_per_1_minute key" do - instance = described_class.new(max_requests_per_1_minute: 30) + it "serializes to hash with max_requests_per_1_minute key" do + instance = described_class.new(max_requests_per_1_minute: 20) result = instance.serialize - - expect(result).to eq({ max_requests_per_1_minute: 30 }) + expect(result).to eq({ max_requests_per_1_minute: 20 }) end - it "includes zero values" do + it "serializes with zero value" do instance = described_class.new(max_requests_per_1_minute: 0) result = instance.serialize + expect(result[:max_requests_per_1_minute]).to eq(0) + end - expect(result).to eq({ max_requests_per_1_minute: 0 }) + it "serializes with large value" do + instance = described_class.new(max_requests_per_1_minute: 1000) + result = instance.serialize + expect(result[:max_requests_per_1_minute]).to eq(1000) end end context "when max_requests_per_1_minute is nil" do - it "returns an empty hash due to compact" do + it "serializes to empty hash (compacts nil values)" do instance = described_class.new(max_requests_per_1_minute: nil) result = instance.serialize - expect(result).to eq({}) end end context "when using default value" do - it "returns a hash with the default max_requests_per_1_minute value" do + it "serializes with default max_requests_per_1_minute value" do instance = described_class.new result = instance.serialize - expect(result).to eq({ max_requests_per_1_minute: described_class::Defaults::MAX_REQUESTS_PER_1_MINUTE }) end end - context "when value is changed after initialization" do - it "returns the updated value" do - instance = described_class.new(max_requests_per_1_minute: 10) - instance.max_requests_per_1_minute = 25 - result = instance.serialize + it "returns a hash" do + instance = described_class.new(max_requests_per_1_minute: 15) + result = instance.serialize + expect(result).to be_a(Hash) + end + end - expect(result).to eq({ max_requests_per_1_minute: 25 }) + describe "attribute accessors" do + let(:instance) { described_class.new } + + describe "#max_requests_per_1_minute" do + it "allows reading the max_requests_per_1_minute value" do + expect(instance.max_requests_per_1_minute).to eq(described_class::Defaults::MAX_REQUESTS_PER_1_MINUTE) end - it "returns empty hash when changed to nil" do - instance = described_class.new(max_requests_per_1_minute: 10) + it "allows writing integer value" do + instance.max_requests_per_1_minute = 50 + expect(instance.max_requests_per_1_minute).to eq(50) + end + + it "allows writing nil value" do instance.max_requests_per_1_minute = nil - result = instance.serialize + expect(instance.max_requests_per_1_minute).to be_nil + end - expect(result).to eq({}) + it "allows writing zero value" do + instance.max_requests_per_1_minute = 0 + expect(instance.max_requests_per_1_minute).to eq(0) + end + + it "allows writing large value" do + instance.max_requests_per_1_minute = 999 + expect(instance.max_requests_per_1_minute).to eq(999) end end + end - context "when built with build method" do - it "returns empty hash for default build" do - instance = described_class.build - result = instance.serialize + describe "integration with FactoryBot" do + context "using default factory" do + it "creates valid instance" do + instance = build(:rate_limits) + expect(instance).to be_a(described_class) + expect(instance.max_requests_per_1_minute).to eq(20) + end + end - expect(result).to eq({}) + context "using :default_limit trait" do + it "creates instance with default limit value" do + instance = build(:rate_limits, :default_limit) + expect(instance.max_requests_per_1_minute).to eq(described_class::Defaults::MAX_REQUESTS_PER_1_MINUTE) end + end - it "returns hash with value when provided to build" do - instance = described_class.build(max_requests_per_1_minute: 15) - result = instance.serialize + context "using :no_limit trait" do + it "creates instance with nil max_requests_per_1_minute" do + instance = build(:rate_limits, :no_limit) + expect(instance.max_requests_per_1_minute).to be_nil + end + end + + context "using :low_limit trait" do + it "creates instance with low limit" do + instance = build(:rate_limits, :low_limit) + expect(instance.max_requests_per_1_minute).to eq(5) + end + end + + context "using :high_limit trait" do + it "creates instance with high limit" do + instance = build(:rate_limits, :high_limit) + expect(instance.max_requests_per_1_minute).to eq(100) + end + end - expect(result).to eq({ max_requests_per_1_minute: 15 }) + context "using :zero_limit trait" do + it "creates instance with zero limit" do + instance = build(:rate_limits, :zero_limit) + expect(instance.max_requests_per_1_minute).to eq(0) + end + end + + context "overriding max_requests_per_1_minute value" do + it "allows custom value" do + instance = build(:rate_limits, max_requests_per_1_minute: 75) + expect(instance.max_requests_per_1_minute).to eq(75) end end end - describe "::Defaults" do - it "defines MAX_REQUESTS_PER_1_MINUTE constant" do - expect(described_class::Defaults::MAX_REQUESTS_PER_1_MINUTE).to eq(10) + describe "round-trip serialization" do + it "maintains data integrity when serializing and deserializing" do + original = described_class.new(max_requests_per_1_minute: 30) + serialized = original.serialize + deserialized = described_class.deserialize(serialized.transform_keys(&:to_s)) + expect(deserialized.max_requests_per_1_minute).to eq(original.max_requests_per_1_minute) + end + + it "handles nil values in round-trip" do + original = described_class.new(max_requests_per_1_minute: nil) + serialized = original.serialize + deserialized = described_class.deserialize(serialized.transform_keys(&:to_s)) + expect(deserialized.max_requests_per_1_minute).to eq(original.max_requests_per_1_minute) + end + + it "handles zero values in round-trip" do + original = described_class.new(max_requests_per_1_minute: 0) + serialized = original.serialize + deserialized = described_class.deserialize(serialized.transform_keys(&:to_s)) + expect(deserialized.max_requests_per_1_minute).to eq(original.max_requests_per_1_minute) end end - describe "edge cases and validation" do - context "with boundary values" do - it "handles minimum positive value" do - instance = described_class.new(max_requests_per_1_minute: 1) - expect(instance.max_requests_per_1_minute).to eq(1) - expect(instance.serialize).to eq({ max_requests_per_1_minute: 1 }) + describe "edge cases" do + context "when modifying max_requests_per_1_minute after initialization" do + it "allows changing the value" do + instance = described_class.new(max_requests_per_1_minute: 10) + expect(instance.max_requests_per_1_minute).to eq(10) + + instance.max_requests_per_1_minute = 50 + expect(instance.max_requests_per_1_minute).to eq(50) + + instance.max_requests_per_1_minute = 100 + expect(instance.max_requests_per_1_minute).to eq(100) + end + + it "allows setting to nil" do + instance = described_class.new(max_requests_per_1_minute: 20) + instance.max_requests_per_1_minute = nil + expect(instance.max_requests_per_1_minute).to be_nil end + end - it "handles large values" do - instance = described_class.new(max_requests_per_1_minute: 9999) - expect(instance.max_requests_per_1_minute).to eq(9999) - expect(instance.serialize).to eq({ max_requests_per_1_minute: 9999 }) + context "when serializing multiple times" do + it "produces consistent results" do + instance = described_class.new(max_requests_per_1_minute: 25) + first_serialization = instance.serialize + second_serialization = instance.serialize + expect(first_serialization).to eq(second_serialization) end end - context "when comparing new vs build methods" do - it "shows different default behaviors" do - new_instance = described_class.new - build_instance = described_class.build + context "when deserializing with unexpected data types" do + it "handles string values" do + data = { "max_requests_per_1_minute" => "20" } + instance = described_class.deserialize(data) + expect(instance.max_requests_per_1_minute).to eq("20") + end - expect(new_instance.max_requests_per_1_minute).to eq(10) # default - expect(build_instance.max_requests_per_1_minute).to be_nil # nil + it "handles float values" do + data = { "max_requests_per_1_minute" => 20.5 } + instance = described_class.deserialize(data) + expect(instance.max_requests_per_1_minute).to eq(20.5) end + end - it "produces same result when same value is provided" do - new_instance = described_class.new(max_requests_per_1_minute: 20) - build_instance = described_class.build(max_requests_per_1_minute: 20) + context "when working with boundary values" do + it "handles very large values" do + instance = described_class.new(max_requests_per_1_minute: 999_999) + expect(instance.max_requests_per_1_minute).to eq(999_999) + serialized = instance.serialize + expect(serialized[:max_requests_per_1_minute]).to eq(999_999) + end - expect(new_instance.max_requests_per_1_minute).to eq(build_instance.max_requests_per_1_minute) - expect(new_instance.serialize).to eq(build_instance.serialize) + it "handles negative values" do + instance = described_class.new(max_requests_per_1_minute: -1) + expect(instance.max_requests_per_1_minute).to eq(-1) + serialized = instance.serialize + expect(serialized[:max_requests_per_1_minute]).to eq(-1) + end + + it "handles single request limit" do + instance = described_class.new(max_requests_per_1_minute: 1) + expect(instance.max_requests_per_1_minute).to eq(1) + serialized = instance.serialize + expect(serialized[:max_requests_per_1_minute]).to eq(1) + end + end + + context "when modifying after serialization" do + it "subsequent serializations reflect modifications" do + instance = described_class.new(max_requests_per_1_minute: 15) + first_result = instance.serialize + expect(first_result[:max_requests_per_1_minute]).to eq(15) + + instance.max_requests_per_1_minute = 30 + second_result = instance.serialize + expect(second_result[:max_requests_per_1_minute]).to eq(30) + end + + it "handles transition to nil" do + instance = described_class.new(max_requests_per_1_minute: 20) + first_result = instance.serialize + expect(first_result).to have_key(:max_requests_per_1_minute) + + instance.max_requests_per_1_minute = nil + second_result = instance.serialize + expect(second_result).not_to have_key(:max_requests_per_1_minute) end end + end - context "when checking serialization consistency" do - it "maintains consistency across multiple serialize calls" do - instance = described_class.new(max_requests_per_1_minute: 42) + describe "constants and defaults" do + it "has correct MAX_REQUESTS_PER_1_MINUTE default" do + expect(described_class::Defaults::MAX_REQUESTS_PER_1_MINUTE).to eq(10) + end - first_serialize = instance.serialize - second_serialize = instance.serialize + it "uses Defaults::MAX_REQUESTS_PER_1_MINUTE as default value" do + instance = described_class.new + expect(instance.max_requests_per_1_minute).to eq(described_class::Defaults::MAX_REQUESTS_PER_1_MINUTE) + end + end - expect(first_serialize).to eq(second_serialize) + describe "documentation compliance" do + context "according to the class documentation" do + it "defaults to 10 requests per minute when omitted" do + instance = described_class.new + expect(instance.max_requests_per_1_minute).to eq(10) end + end + end - it "reflects changes in subsequent serializations" do + describe "common use cases" do + context "rate limiting scenarios" do + it "represents no rate limiting (nil)" do + instance = described_class.new(max_requests_per_1_minute: nil) + expect(instance.max_requests_per_1_minute).to be_nil + end + + it "represents very restrictive rate limiting" do + instance = described_class.new(max_requests_per_1_minute: 1) + expect(instance.max_requests_per_1_minute).to eq(1) + end + + it "represents conservative rate limiting" do instance = described_class.new(max_requests_per_1_minute: 5) + expect(instance.max_requests_per_1_minute).to eq(5) + end - original_serialize = instance.serialize - instance.max_requests_per_1_minute = 10 - updated_serialize = instance.serialize + it "represents default rate limiting" do + instance = described_class.new(max_requests_per_1_minute: 10) + expect(instance.max_requests_per_1_minute).to eq(10) + end + + it "represents moderate rate limiting" do + instance = described_class.new(max_requests_per_1_minute: 20) + expect(instance.max_requests_per_1_minute).to eq(20) + end - expect(original_serialize).to eq({ max_requests_per_1_minute: 5 }) - expect(updated_serialize).to eq({ max_requests_per_1_minute: 10 }) + it "represents generous rate limiting" do + instance = described_class.new(max_requests_per_1_minute: 100) + expect(instance.max_requests_per_1_minute).to eq(100) + end + + it "represents high throughput rate limiting" do + instance = described_class.new(max_requests_per_1_minute: 1000) + expect(instance.max_requests_per_1_minute).to eq(1000) end end end diff --git a/spec/chatkit/session/response_spec.rb b/spec/chatkit/session/response_spec.rb deleted file mode 100644 index c44def7..0000000 --- a/spec/chatkit/session/response_spec.rb +++ /dev/null @@ -1,541 +0,0 @@ -# frozen_string_literal: true - -require "spec_helper" - -RSpec.describe ChatKit::Session::Response do - # Helper method to create sample data - def sample_response_data - { - "id" => "sess_abc123", - "object" => "session", - "status" => "active", - "chatkit_configuration" => { - "automatic_thread_titling" => { "enabled" => true }, - "file_upload" => { "enabled" => false, "max_file_size" => 256, "max_files" => 5 }, - "history" => { "enabled" => true, "recent_threads" => 50 }, - }, - "client_secret" => "sk_test_secret_123", - "expires_at" => "2025-12-01T00:00:00Z", - "max_requests_per_1_minute" => 60, - "rate_limits" => { - "max_requests_per_1_minute" => 100, - }, - "user" => { - "id" => "user_123", - "name" => "Test User", - "email" => "test@example.com", - }, - "workflow" => { - "id" => "wf_workflow123", - "state_variables" => { "key" => "value" }, - "tracing" => { "enabled" => true }, - "version" => "1.0.0", - }, - } - end - - describe ".new" do - let(:workflow) { build(:workflow) } - let(:chatkit_configuration) { build(:chatkit_configuration) } - let(:rate_limits) { build(:rate_limits) } - let(:user_data) { { "id" => "user_123", "name" => "Test User" } } - - context "when all required arguments are provided" do - it "initializes with all provided values" do - response = described_class.new( - id: "sess_test123", - object: "session", - status: "active", - chatkit_configuration:, - client_secret: "sk_secret123", - expires_at: "2025-12-01T00:00:00Z", - max_requests_per_1_minute: 60, - rate_limits:, - user: user_data, - workflow: - ) - - expect(response.id).to eq("sess_test123") - expect(response.object).to eq("session") - expect(response.status).to eq("active") - expect(response.chatkit_configuration).to eq(chatkit_configuration) - expect(response.client_secret).to eq("sk_secret123") - expect(response.expires_at).to eq("2025-12-01T00:00:00Z") - expect(response.max_requests_per_1_minute).to eq(60) - expect(response.rate_limits).to eq(rate_limits) - expect(response.user).to eq(user_data) - expect(response.workflow).to eq(workflow) - end - end - - context "when handling different data types" do - it "accepts string values for basic fields" do - response = described_class.new( - id: "sess_string_test", - object: "custom_object", - status: "pending", - chatkit_configuration:, - client_secret: "sk_different_secret", - expires_at: "2026-01-01T12:00:00Z", - max_requests_per_1_minute: 120, - rate_limits:, - user: user_data, - workflow: - ) - - expect(response.id).to eq("sess_string_test") - expect(response.object).to eq("custom_object") - expect(response.status).to eq("pending") - expect(response.client_secret).to eq("sk_different_secret") - expect(response.expires_at).to eq("2026-01-01T12:00:00Z") - expect(response.max_requests_per_1_minute).to eq(120) - end - - it "accepts integer values for numeric fields" do - response = described_class.new( - id: "sess_numeric_test", - object: "session", - status: "active", - chatkit_configuration:, - client_secret: "sk_secret", - expires_at: "2025-12-01T00:00:00Z", - max_requests_per_1_minute: 0, - rate_limits:, - user: user_data, - workflow: - ) - - expect(response.max_requests_per_1_minute).to eq(0) - end - - it "accepts complex hash for user data" do - complex_user = { - "id" => "user_complex", - "name" => "Complex User", - "email" => "complex@example.com", - "metadata" => { "role" => "admin", "permissions" => %w[read write] }, - } - - response = described_class.new( - id: "sess_complex_user", - object: "session", - status: "active", - chatkit_configuration:, - client_secret: "sk_secret", - expires_at: "2025-12-01T00:00:00Z", - max_requests_per_1_minute: 60, - rate_limits:, - user: complex_user, - workflow: - ) - - expect(response.user).to eq(complex_user) - expect(response.user["metadata"]["role"]).to eq("admin") - end - end - end - - describe "attribute accessors" do - let(:response) do - described_class.new( - id: "sess_accessor_test", - object: "session", - status: "active", - chatkit_configuration: build(:chatkit_configuration), - client_secret: "sk_secret", - expires_at: "2025-12-01T00:00:00Z", - max_requests_per_1_minute: 60, - rate_limits: build(:rate_limits), - user: { "id" => "user_123" }, - workflow: build(:workflow) - ) - end - - describe "#id" do - it "is readable and writable" do - expect(response.id).to eq("sess_accessor_test") - response.id = "sess_new_id" - expect(response.id).to eq("sess_new_id") - end - end - - describe "#object" do - it "is readable and writable" do - expect(response.object).to eq("session") - response.object = "custom_session" - expect(response.object).to eq("custom_session") - end - end - - describe "#status" do - it "is readable and writable" do - expect(response.status).to eq("active") - response.status = "expired" - expect(response.status).to eq("expired") - end - end - - describe "#client_secret" do - it "is readable and writable" do - expect(response.client_secret).to eq("sk_secret") - response.client_secret = "sk_new_secret" - expect(response.client_secret).to eq("sk_new_secret") - end - end - - describe "#expires_at" do - it "is readable and writable" do - expect(response.expires_at).to eq("2025-12-01T00:00:00Z") - response.expires_at = "2026-01-01T00:00:00Z" - expect(response.expires_at).to eq("2026-01-01T00:00:00Z") - end - end - - describe "#max_requests_per_1_minute" do - it "is readable and writable" do - expect(response.max_requests_per_1_minute).to eq(60) - response.max_requests_per_1_minute = 120 - expect(response.max_requests_per_1_minute).to eq(120) - end - end - - describe "#user" do - it "is readable and writable" do - new_user = { "id" => "user_new", "name" => "New User" } - response.user = new_user - expect(response.user).to eq(new_user) - end - end - - describe "#chatkit_configuration" do - it "is readable and writable" do - new_config = build(:chatkit_configuration, :all_enabled) - response.chatkit_configuration = new_config - expect(response.chatkit_configuration).to eq(new_config) - end - end - - describe "#rate_limits" do - it "is readable and writable" do - new_limits = build(:rate_limits, :high_limit) - response.rate_limits = new_limits - expect(response.rate_limits).to eq(new_limits) - end - end - - describe "#workflow" do - it "is readable and writable" do - new_workflow = build(:workflow, :with_complex_state) - response.workflow = new_workflow - expect(response.workflow).to eq(new_workflow) - end - end - end - - describe ".deserialize" do - context "when data contains all required fields" do - it "creates a response instance with all fields populated" do - data = sample_response_data - response = described_class.deserialize(data) - - expect(response).to be_a(described_class) - expect(response.id).to eq("sess_abc123") - expect(response.object).to eq("session") - expect(response.status).to eq("active") - expect(response.client_secret).to eq("sk_test_secret_123") - expect(response.expires_at).to eq("2025-12-01T00:00:00Z") - expect(response.max_requests_per_1_minute).to eq(60) - expect(response.user).to eq(data["user"]) - end - - it "properly deserializes nested objects" do - data = sample_response_data - response = described_class.deserialize(data) - - expect(response.chatkit_configuration).to be_a(ChatKit::Session::ChatKitConfiguration) - expect(response.chatkit_configuration.automatic_thread_titling.enabled).to be(true) - expect(response.chatkit_configuration.file_upload.enabled).to be(false) - expect(response.chatkit_configuration.history.enabled).to be(true) - - expect(response.rate_limits).to be_a(ChatKit::Session::RateLimits) - expect(response.rate_limits.max_requests_per_1_minute).to eq(100) - - expect(response.workflow).to be_a(ChatKit::Session::Workflow) - expect(response.workflow.id).to eq("wf_workflow123") - expect(response.workflow.version).to eq("1.0.0") - end - end - - context "when data contains nil nested objects" do - it "handles nil nested data gracefully" do - data = sample_response_data.merge( - "chatkit_configuration" => nil, - "rate_limits" => nil, - "workflow" => nil - ) - response = described_class.deserialize(data) - - expect(response.chatkit_configuration).to be_a(ChatKit::Session::ChatKitConfiguration) - expect(response.chatkit_configuration.automatic_thread_titling.enabled).to be_nil - expect(response.rate_limits).to be_a(ChatKit::Session::RateLimits) - expect(response.workflow).to be_a(ChatKit::Session::Workflow) - end - end - - context "when data contains partial nested objects" do - it "handles partial nested configurations" do - data = sample_response_data - data["chatkit_configuration"] = { "automatic_thread_titling" => { "enabled" => false } } - data["rate_limits"] = { "max_requests_per_1_minute" => 50 } - data["workflow"] = { "id" => "wf_partial" } - - response = described_class.deserialize(data) - - expect(response.chatkit_configuration.automatic_thread_titling.enabled).to be(false) - expect(response.chatkit_configuration.file_upload.enabled).to be_nil - expect(response.rate_limits.max_requests_per_1_minute).to eq(50) - expect(response.workflow.id).to eq("wf_partial") - expect(response.workflow.version).to be_nil - end - end - - context "with edge cases" do - it "handles empty user data" do - data = sample_response_data - data["user"] = {} - response = described_class.deserialize(data) - - expect(response.user).to eq({}) - end - - it "handles nil user data" do - data = sample_response_data - data["user"] = nil - response = described_class.deserialize(data) - - expect(response.user).to be_nil - end - - it "handles zero values for numeric fields" do - data = sample_response_data - data["max_requests_per_1_minute"] = 0 - response = described_class.deserialize(data) - - expect(response.max_requests_per_1_minute).to eq(0) - end - - it "handles complex user data structures" do - data = sample_response_data - data["user"] = { - "id" => "user_complex", - "profile" => { - "name" => "Complex User", - "settings" => { "theme" => "dark", "notifications" => true }, - }, - "roles" => %w[admin user], - } - response = described_class.deserialize(data) - - expect(response.user["profile"]["name"]).to eq("Complex User") - expect(response.user["roles"]).to contain_exactly("admin", "user") - end - - it "returns a new instance each time" do - data = sample_response_data - response1 = described_class.deserialize(data) - response2 = described_class.deserialize(data) - - expect(response1).not_to be(response2) - expect(response1.id).to eq(response2.id) - expect(response1.chatkit_configuration).not_to be(response2.chatkit_configuration) - end - end - end - - describe "#serialize" do - context "when all fields have values" do - it "returns a hash with all fields" do - response = described_class.new( - id: "sess_serialize_test", - object: "session", - status: "active", - chatkit_configuration: build(:chatkit_configuration, :all_enabled), - client_secret: "sk_serialize_secret", - expires_at: "2025-12-01T00:00:00Z", - max_requests_per_1_minute: 100, - rate_limits: build(:rate_limits), - user: { "id" => "user_serialize", "name" => "Serialize User" }, - workflow: build(:workflow) - ) - - result = response.serialize - - expect(result).to have_key(:id) - expect(result).to have_key(:object) - expect(result).to have_key(:status) - expect(result).to have_key(:chatkit_configuration) - expect(result).to have_key(:client_secret) - expect(result).to have_key(:expires_at) - expect(result).to have_key(:max_requests_per_1_minute) - expect(result).to have_key(:rate_limits) - expect(result).to have_key(:user) - expect(result).to have_key(:workflow) - - expect(result[:id]).to eq("sess_serialize_test") - expect(result[:object]).to eq("session") - expect(result[:status]).to eq("active") - expect(result[:client_secret]).to eq("sk_serialize_secret") - expect(result[:expires_at]).to eq("2025-12-01T00:00:00Z") - expect(result[:max_requests_per_1_minute]).to eq(100) - expect(result[:user]).to eq({ "id" => "user_serialize", "name" => "Serialize User" }) - end - - it "properly serializes nested objects" do - chatkit_config = build(:chatkit_configuration, :mixed_settings) - rate_limits = build(:rate_limits, :low_limit) - workflow = build(:workflow, :with_complex_state) - - response = described_class.new( - id: "sess_nested_test", - object: "session", - status: "active", - chatkit_configuration: chatkit_config, - client_secret: "sk_secret", - expires_at: "2025-12-01T00:00:00Z", - max_requests_per_1_minute: 60, - rate_limits:, - user: { "id" => "user_nested" }, - workflow: - ) - - result = response.serialize - - expect(result[:chatkit_configuration]).to be_a(Hash) - expect(result[:chatkit_configuration]).to have_key(:automatic_thread_titling) - expect(result[:rate_limits]).to be_a(Hash) - expect(result[:workflow]).to be_a(Hash) - expect(result[:workflow]).to have_key(:id) - end - end - - context "when nested objects have nil values" do - it "includes serialized nested objects even with nil values" do - response = described_class.new( - id: "sess_nil_test", - object: "session", - status: "active", - chatkit_configuration: build(:chatkit_configuration, :minimal_config), - client_secret: "sk_secret", - expires_at: "2025-12-01T00:00:00Z", - max_requests_per_1_minute: 60, - rate_limits: build(:rate_limits, :low_limit), - user: nil, - workflow: build(:workflow, :minimal) - ) - - result = response.serialize - - expect(result[:user]).to be_nil - expect(result[:chatkit_configuration]).to be_a(Hash) # Even with nil values, nested objects serialize to hashes - expect(result[:rate_limits]).to be_a(Hash) - expect(result[:workflow]).to be_a(Hash) - end - end - end - - describe "round-trip serialization" do - it "can deserialize what was serialized" do - original_data = sample_response_data - response = described_class.deserialize(original_data) - serialized = response.serialize - # Convert keys to strings to simulate JSON parsing - string_keyed_data = deep_stringify_keys(serialized) - deserialized = described_class.deserialize(string_keyed_data) - - expect(deserialized.id).to eq(response.id) - expect(deserialized.object).to eq(response.object) - expect(deserialized.status).to eq(response.status) - expect(deserialized.client_secret).to eq(response.client_secret) - expect(deserialized.expires_at).to eq(response.expires_at) - expect(deserialized.max_requests_per_1_minute).to eq(response.max_requests_per_1_minute) - expect(deserialized.user).to eq(response.user) - expect(deserialized.chatkit_configuration.automatic_thread_titling.enabled).to eq( - response.chatkit_configuration.automatic_thread_titling.enabled - ) - end - - it "maintains data integrity through multiple round-trips" do - original_data = sample_response_data - - # First round-trip - response1 = described_class.deserialize(original_data) - serialized1 = deep_stringify_keys(response1.serialize) - - # Second round-trip - response2 = described_class.deserialize(serialized1) - serialized2 = deep_stringify_keys(response2.serialize) - - expect(serialized1["id"]).to eq(serialized2["id"]) - expect(serialized1["status"]).to eq(serialized2["status"]) - expect(serialized1["user"]).to eq(serialized2["user"]) - expect(serialized1["chatkit_configuration"]["automatic_thread_titling"]).to eq( - serialized2["chatkit_configuration"]["automatic_thread_titling"] - ) - end - - # Helper method for deep key conversion - def deep_stringify_keys(hash) - case hash - when Hash - hash.each_with_object({}) do |(key, value), result| - result[key.to_s] = deep_stringify_keys(value) - end - when Array - hash.map { |item| deep_stringify_keys(item) } - else - hash - end - end - end - - describe "integration with other components" do - it "works with factory-created nested objects" do - response = described_class.new( - id: "sess_factory_test", - object: "session", - status: "active", - chatkit_configuration: build(:chatkit_configuration, :all_enabled), - client_secret: "sk_factory_secret", - expires_at: "2025-12-01T00:00:00Z", - max_requests_per_1_minute: 80, - rate_limits: build(:rate_limits, :high_limit), - user: { "id" => "user_factory" }, - workflow: build(:workflow, :with_complex_state) - ) - - expect(response.chatkit_configuration.automatic_thread_titling.enabled).to be(true) - expect(response.rate_limits.max_requests_per_1_minute).to be > 0 - expect(response.workflow.tracing.enabled).to be(true) - end - - it "handles complex nested factory configurations" do - complex_workflow = build(:workflow, :with_complex_state) - response = described_class.new( - id: "sess_complex_test", - object: "session", - status: "active", - chatkit_configuration: build(:chatkit_configuration, :mixed_settings), - client_secret: "sk_complex_secret", - expires_at: "2025-12-01T00:00:00Z", - max_requests_per_1_minute: 60, - rate_limits: build(:rate_limits, :high_limit), - user: { "id" => "user_complex", "metadata" => { "role" => "admin" } }, - workflow: complex_workflow - ) - - serialized = response.serialize - expect(serialized[:workflow][:state_variables]).to be_a(Hash) - expect(serialized[:user]["metadata"]["role"]).to eq("admin") - end - end -end diff --git a/spec/chatkit/session/workflow/tracing_spec.rb b/spec/chatkit/session/workflow/tracing_spec.rb index 402c7c3..440d5a6 100644 --- a/spec/chatkit/session/workflow/tracing_spec.rb +++ b/spec/chatkit/session/workflow/tracing_spec.rb @@ -10,16 +10,16 @@ end context "when enabled is provided" do - it "initializes with the provided enabled value" do - instance = described_class.new(enabled: false) - expect(instance.enabled).to be(false) - end - - it "accepts true value" do + it "initializes with true value" do instance = described_class.new(enabled: true) expect(instance.enabled).to be(true) end + it "initializes with false value" do + instance = described_class.new(enabled: false) + expect(instance.enabled).to be(false) + end + it "accepts nil value" do instance = described_class.new(enabled: nil) expect(instance.enabled).to be_nil @@ -29,244 +29,294 @@ describe ".build" do context "when no arguments are provided" do - it "creates an instance with nil enabled value" do + it "creates instance with nil enabled value" do instance = described_class.build expect(instance.enabled).to be_nil end end context "when enabled is provided" do - it "creates an instance with the provided enabled value" do - instance = described_class.build(enabled: false) - expect(instance.enabled).to be(false) - end - - it "accepts true value" do + it "creates instance with true value" do instance = described_class.build(enabled: true) expect(instance.enabled).to be(true) end - it "accepts nil value" do + it "creates instance with false value" do + instance = described_class.build(enabled: false) + expect(instance.enabled).to be(false) + end + + it "creates instance with nil value" do instance = described_class.build(enabled: nil) expect(instance.enabled).to be_nil end end + + it "returns an instance of Tracing" do + instance = described_class.build + expect(instance).to be_a(described_class) + end end describe ".deserialize" do + context "when data is nil" do + it "initializes with nil enabled value" do + instance = described_class.deserialize(nil) + expect(instance.enabled).to be_nil + end + + it "returns an instance of Tracing" do + instance = described_class.deserialize(nil) + expect(instance).to be_a(described_class) + end + end + + context "when data is an empty hash" do + it "initializes with nil enabled value" do + instance = described_class.deserialize({}) + expect(instance.enabled).to be_nil + end + end + context "when data contains enabled key" do - it "creates an instance with enabled true" do + it "deserializes with true value" do data = { "enabled" => true } instance = described_class.deserialize(data) - expect(instance.enabled).to be(true) end - it "creates an instance with enabled false" do + it "deserializes with false value" do data = { "enabled" => false } instance = described_class.deserialize(data) - expect(instance.enabled).to be(false) end - it "creates an instance with enabled nil" do + it "deserializes with nil value" do data = { "enabled" => nil } instance = described_class.deserialize(data) - expect(instance.enabled).to be_nil end end - context "when data does not contain enabled key" do - it "creates an instance with nil enabled value" do - data = {} + context "when data contains nested keys" do + it "extracts enabled using dig" do + data = { "enabled" => true, "other_key" => "value" } instance = described_class.deserialize(data) - - expect(instance.enabled).to be_nil + expect(instance.enabled).to be(true) end + end - it "ignores other keys in data" do - data = { "other_key" => "other_value", "another_key" => 123 } - instance = described_class.deserialize(data) + it "returns an instance of Tracing" do + instance = described_class.deserialize({ "enabled" => true }) + expect(instance).to be_a(described_class) + end + end - expect(instance.enabled).to be_nil + describe "#serialize" do + context "when enabled is true" do + it "serializes to hash with enabled key" do + instance = described_class.new(enabled: true) + result = instance.serialize + expect(result).to eq({ enabled: true }) end end - context "when data contains enabled key with other keys" do - it "only uses the enabled key and ignores others" do - data = { - "enabled" => true, - "extra_field" => "ignored", - "another_field" => 456, - } - instance = described_class.deserialize(data) - - expect(instance.enabled).to be(true) + context "when enabled is false" do + it "serializes to hash with enabled key" do + instance = described_class.new(enabled: false) + result = instance.serialize + expect(result).to eq({ enabled: false }) end end - context "with edge cases" do - it "handles nil data" do - instance = described_class.deserialize(nil) + context "when enabled is nil" do + it "serializes to empty hash (compacts nil values)" do + instance = described_class.new(enabled: nil) + result = instance.serialize + expect(result).to eq({}) + end + end - expect(instance.enabled).to be_nil + context "when enabled is default value" do + it "serializes to hash with default enabled value" do + instance = described_class.new + result = instance.serialize + expect(result).to eq({ enabled: ChatKit::Session::Defaults::ENABLED }) end + end - it "handles empty data hash" do - data = {} - instance = described_class.deserialize(data) + it "returns a hash" do + instance = described_class.new(enabled: true) + result = instance.serialize + expect(result).to be_a(Hash) + end + end - expect(instance.enabled).to be_nil + describe "attribute accessors" do + let(:instance) { described_class.new } + + describe "#enabled" do + it "allows reading the enabled value" do + expect(instance.enabled).to eq(ChatKit::Session::Defaults::ENABLED) end - it "handles data with string keys" do - data = { "enabled" => false } - instance = described_class.deserialize(data) + it "allows writing true value" do + instance.enabled = true + expect(instance.enabled).to be(true) + end + it "allows writing false value" do + instance.enabled = false expect(instance.enabled).to be(false) end - it "returns a new instance each time" do - data = { "enabled" => true } - instance1 = described_class.deserialize(data) - instance2 = described_class.deserialize(data) - - expect(instance1).not_to be(instance2) - expect(instance1.enabled).to eq(instance2.enabled) + it "allows writing nil value" do + instance.enabled = nil + expect(instance.enabled).to be_nil end end + end - context "round-trip serialization" do - it "can deserialize what was serialized" do - original = described_class.new(enabled: true) - serialized = original.serialize - # Convert keys to strings to simulate JSON parsing - string_keyed_data = serialized.transform_keys(&:to_s) - deserialized = described_class.deserialize(string_keyed_data) - - expect(deserialized.enabled).to eq(original.enabled) + describe "integration with FactoryBot" do + context "using default factory" do + it "creates valid instance" do + instance = build(:tracing) + expect(instance).to be_a(described_class) + expect(instance.enabled).to be(true) end + end - it "handles nil values in round-trip" do - original = described_class.new(enabled: nil) - serialized = original.serialize - # Since serialize uses compact, nil values are removed - # so deserializing an empty hash should give nil - string_keyed_data = serialized.transform_keys(&:to_s) - deserialized = described_class.deserialize(string_keyed_data) - - expect(deserialized.enabled).to be_nil + context "using :enabled trait" do + it "creates instance with enabled true" do + instance = build(:tracing, :enabled) + expect(instance.enabled).to be(true) end + end - it "handles false values in round-trip" do - original = described_class.new(enabled: false) - serialized = original.serialize - string_keyed_data = serialized.transform_keys(&:to_s) - deserialized = described_class.deserialize(string_keyed_data) - - expect(deserialized.enabled).to eq(original.enabled) + context "using :disabled trait" do + it "creates instance with enabled false" do + instance = build(:tracing, :disabled) + expect(instance.enabled).to be(false) end end - end - describe "#enabled" do - it "is readable" do - instance = described_class.new(enabled: false) - expect(instance.enabled).to be(false) + context "using :nil_enabled trait" do + it "creates instance with nil enabled" do + instance = build(:tracing, :nil_enabled) + expect(instance.enabled).to be_nil + end end - it "is writable" do - instance = described_class.new(enabled: true) - instance.enabled = false - expect(instance.enabled).to be(false) + context "using :default_enabled trait" do + it "creates instance with default enabled value" do + instance = build(:tracing, :default_enabled) + expect(instance.enabled).to eq(ChatKit::Session::Defaults::ENABLED) + end end - it "accepts boolean values" do - instance = described_class.new + context "overriding enabled value" do + it "allows custom enabled value" do + instance = build(:tracing, enabled: false) + expect(instance.enabled).to be(false) + end + end + end - instance.enabled = true - expect(instance.enabled).to be(true) + describe "round-trip serialization" do + it "maintains data integrity when serializing and deserializing with true" do + original = described_class.new(enabled: true) + serialized = original.serialize + deserialized = described_class.deserialize(serialized.transform_keys(&:to_s)) + expect(deserialized.enabled).to eq(original.enabled) + end - instance.enabled = false - expect(instance.enabled).to be(false) + it "maintains data integrity when serializing and deserializing with false" do + original = described_class.new(enabled: false) + serialized = original.serialize + deserialized = described_class.deserialize(serialized.transform_keys(&:to_s)) + expect(deserialized.enabled).to eq(original.enabled) end - it "accepts nil value" do - instance = described_class.new(enabled: true) - instance.enabled = nil - expect(instance.enabled).to be_nil + it "handles nil values in round-trip" do + original = described_class.new(enabled: nil) + serialized = original.serialize + deserialized = described_class.deserialize(serialized.transform_keys(&:to_s)) + expect(deserialized.enabled).to eq(original.enabled) end end - describe "#serialize" do - context "when enabled is true" do - it "returns a hash with enabled key" do + describe "edge cases" do + context "when modifying enabled after initialization" do + it "allows toggling enabled state" do instance = described_class.new(enabled: true) - result = instance.serialize - - expect(result).to eq({ enabled: true }) - end - end + expect(instance.enabled).to be(true) - context "when enabled is false" do - it "returns a hash with enabled key" do - instance = described_class.new(enabled: false) - result = instance.serialize + instance.enabled = false + expect(instance.enabled).to be(false) - expect(result).to eq({ enabled: false }) + instance.enabled = true + expect(instance.enabled).to be(true) end end - context "when enabled is nil" do - it "returns an empty hash due to compact" do - instance = described_class.new(enabled: nil) - result = instance.serialize - - expect(result).to eq({}) + context "when serializing multiple times" do + it "produces consistent results" do + instance = described_class.new(enabled: true) + first_serialization = instance.serialize + second_serialization = instance.serialize + expect(first_serialization).to eq(second_serialization) end end - context "when using default value" do - it "returns a hash with the default enabled value" do - instance = described_class.new - result = instance.serialize - - expect(result).to eq({ enabled: ChatKit::Session::Defaults::ENABLED }) + context "when deserializing with unexpected data types" do + it "handles string values in hash" do + data = { "enabled" => "true" } + instance = described_class.deserialize(data) + expect(instance.enabled).to eq("true") end - end - context "when enabled value is changed after initialization" do - it "returns the updated value" do - instance = described_class.new(enabled: true) - instance.enabled = false - result = instance.serialize + it "handles integer values in hash" do + data = { "enabled" => 1 } + instance = described_class.deserialize(data) + expect(instance.enabled).to eq(1) + end - expect(result).to eq({ enabled: false }) + it "handles zero as false-like value" do + data = { "enabled" => 0 } + instance = described_class.deserialize(data) + expect(instance.enabled).to eq(0) end + end - it "returns empty hash when changed to nil" do + context "when modifying after serialization" do + it "subsequent serializations reflect modifications" do instance = described_class.new(enabled: true) - instance.enabled = nil - result = instance.serialize + first_result = instance.serialize + expect(first_result[:enabled]).to be(true) - expect(result).to eq({}) + instance.enabled = false + second_result = instance.serialize + expect(second_result[:enabled]).to be(false) end end + end - context "when built with build method" do - it "returns empty hash for default build" do - instance = described_class.build - result = instance.serialize - - expect(result).to eq({}) - end + describe "constants and defaults" do + it "uses Session::Create::Defaults::ENABLED as default value" do + instance = described_class.new + expect(instance.enabled).to eq(ChatKit::Session::Defaults::ENABLED) + end - it "returns hash with enabled value when provided to build" do - instance = described_class.build(enabled: true) - result = instance.serialize + it "Session::Create::Defaults::ENABLED is true" do + expect(ChatKit::Session::Defaults::ENABLED).to be(true) + end + end - expect(result).to eq({ enabled: true }) + describe "documentation compliance" do + context "according to the class documentation" do + it "tracing is enabled by default" do + instance = described_class.new + expect(instance.enabled).to be(true) end end end diff --git a/spec/chatkit/session/workflow_spec.rb b/spec/chatkit/session/workflow_spec.rb index e6f9fe0..4f2071f 100644 --- a/spec/chatkit/session/workflow_spec.rb +++ b/spec/chatkit/session/workflow_spec.rb @@ -1,588 +1,724 @@ # frozen_string_literal: true -require "spec_helper" - RSpec.describe ChatKit::Session::Workflow do describe ".new" do - context "when only id is provided" do - it "initializes with required id parameter" do - workflow = described_class.new(id: "wf_test123") - - expect(workflow.id).to eq("wf_test123") - expect(workflow.state_variables).to be_nil - expect(workflow.tracing).to be_a(ChatKit::Session::Workflow::Tracing) - expect(workflow.version).to be_nil + context "when only required arguments are provided" do + it "initializes with id" do + instance = described_class.new(id: "wf_123") + expect(instance.id).to eq("wf_123") end - end - context "when all parameters are provided" do - let(:state_vars) { { "key1" => "value1", "key2" => "value2" } } - let(:tracing_params) { { enabled: true } } + it "sets state_variables to nil by default" do + instance = described_class.new(id: "wf_123") + expect(instance.state_variables).to be_nil + end - it "initializes with all provided values" do - workflow = described_class.new( - id: "wf_full123", - state_variables: state_vars, - tracing: tracing_params, - version: "2.0.0" - ) + it "sets tracing to Tracing instance by default" do + instance = described_class.new(id: "wf_123") + expect(instance.tracing).to be_a(ChatKit::Session::Workflow::Tracing) + end - expect(workflow.id).to eq("wf_full123") - expect(workflow.state_variables).to eq(state_vars) - expect(workflow.tracing).to be_a(ChatKit::Session::Workflow::Tracing) - expect(workflow.tracing.enabled).to be(true) - expect(workflow.version).to eq("2.0.0") + it "sets version to nil by default" do + instance = described_class.new(id: "wf_123") + expect(instance.version).to be_nil end end - context "when tracing parameter is nil" do - it "creates tracing object from empty hash" do - workflow = described_class.new(id: "wf_nil_tracing", tracing: nil) + context "when all arguments are provided" do + it "initializes with all values" do + tracing_hash = { enabled: true } + instance = described_class.new( + id: "wf_456", + state_variables: { "key" => "value" }, + tracing: tracing_hash, + version: "2.0.0" + ) - expect(workflow.tracing).to be_a(ChatKit::Session::Workflow::Tracing) - expect(workflow.tracing.enabled).to be_nil + expect(instance.id).to eq("wf_456") + expect(instance.state_variables).to eq({ "key" => "value" }) + expect(instance.tracing).to be_a(ChatKit::Session::Workflow::Tracing) + expect(instance.version).to eq("2.0.0") end - end - - context "when tracing parameter is empty hash" do - it "creates tracing object with default values" do - workflow = described_class.new(id: "wf_empty_tracing", tracing: {}) - expect(workflow.tracing).to be_a(ChatKit::Session::Workflow::Tracing) - expect(workflow.tracing.enabled).to be_nil + it "accepts Tracing instance directly" do + tracing_instance = ChatKit::Session::Workflow::Tracing.new(enabled: true) + instance = described_class.new(id: "wf_789", tracing: tracing_instance) + expect(instance.tracing).to eq(tracing_instance) end - end - context "when state_variables is complex nested hash" do - let(:complex_state) do - { - "config" => { "timeout" => 30, "retries" => 3 }, - "user_data" => %w[item1 item2], - "flags" => { "debug" => true, "verbose" => false }, - } + it "accepts nil state_variables explicitly" do + instance = described_class.new(id: "wf_123", state_variables: nil) + expect(instance.state_variables).to be_nil end - it "preserves complex state structure" do - workflow = described_class.new(id: "wf_complex", state_variables: complex_state) + it "accepts empty hash for state_variables" do + instance = described_class.new(id: "wf_123", state_variables: {}) + expect(instance.state_variables).to eq({}) + end - expect(workflow.state_variables).to eq(complex_state) - expect(workflow.state_variables["config"]["timeout"]).to eq(30) - expect(workflow.state_variables["user_data"]).to contain_exactly("item1", "item2") + it "accepts complex nested state_variables" do + state = { + "config" => { "timeout" => 30 }, + "flags" => ["debug"], + } + instance = described_class.new(id: "wf_123", state_variables: state) + expect(instance.state_variables).to eq(state) end end end describe ".build" do - context "when no parameters provided except id" do - it "creates instance with nil optional values" do - workflow = described_class.build(id: "wf_build_minimal") + context "when only id is provided" do + it "creates instance with id" do + instance = described_class.build(id: "wf_build_123") + expect(instance).to be_a(described_class) + expect(instance.id).to eq("wf_build_123") + end - expect(workflow.id).to eq("wf_build_minimal") - expect(workflow.state_variables).to be_nil - expect(workflow.tracing).to be_a(ChatKit::Session::Workflow::Tracing) - expect(workflow.version).to be_nil + it "sets state_variables to nil" do + instance = described_class.build(id: "wf_build_123") + expect(instance.state_variables).to be_nil + end + + it "sets version to nil" do + instance = described_class.build(id: "wf_build_123") + expect(instance.version).to be_nil + end + + it "creates Tracing instance" do + instance = described_class.build(id: "wf_build_123") + expect(instance.tracing).to be_a(ChatKit::Session::Workflow::Tracing) end end context "when all parameters are provided" do - let(:state_vars) { { "build_key" => "build_value" } } - let(:tracing_params) { { enabled: false } } - - it "creates instance with all provided values" do - workflow = described_class.build( - id: "wf_build_full", - state_variables: state_vars, - tracing: tracing_params, - version: "1.5.0" + it "creates instance with all values" do + instance = described_class.build( + id: "wf_build_456", + state_variables: { "var" => "val" }, + tracing: { enabled: false }, + version: "3.0.0" ) - expect(workflow.id).to eq("wf_build_full") - expect(workflow.state_variables).to eq(state_vars) - expect(workflow.tracing.enabled).to be(false) - expect(workflow.version).to eq("1.5.0") + expect(instance.id).to eq("wf_build_456") + expect(instance.state_variables).to eq({ "var" => "val" }) + expect(instance.tracing.enabled).to eq(false) + expect(instance.version).to eq("3.0.0") end end + + it "returns an instance of Workflow" do + instance = described_class.build(id: "wf_test") + expect(instance).to be_a(described_class) + end end describe ".deserialize" do - context "when data contains all required fields" do - it "creates an instance with id only" do - data = { "id" => "wf_deserialize_minimal" } - workflow = described_class.deserialize(data) - - expect(workflow.id).to eq("wf_deserialize_minimal") - expect(workflow.state_variables).to be_nil - expect(workflow.tracing).to be_a(ChatKit::Session::Workflow::Tracing) - expect(workflow.tracing.enabled).to be_nil - expect(workflow.version).to be_nil + context "when data is nil" do + it "initializes with nil id" do + instance = described_class.deserialize(nil) + expect(instance.id).to be_nil end - it "creates an instance with all fields populated" do - data = { - "id" => "wf_deserialize_full", - "state_variables" => { "key1" => "value1", "key2" => "value2" }, - "tracing" => { "enabled" => true }, - "version" => "2.5.0", - } - workflow = described_class.deserialize(data) - - expect(workflow.id).to eq("wf_deserialize_full") - expect(workflow.state_variables).to eq({ "key1" => "value1", "key2" => "value2" }) - expect(workflow.tracing).to be_a(ChatKit::Session::Workflow::Tracing) - expect(workflow.tracing.enabled).to be(true) - expect(workflow.version).to eq("2.5.0") + it "initializes with nil state_variables" do + instance = described_class.deserialize(nil) + expect(instance.state_variables).to be_nil end - end - - context "when data contains partial fields" do - it "handles missing state_variables" do - data = { - "id" => "wf_no_state", - "tracing" => { "enabled" => false }, - "version" => "1.0.0", - } - workflow = described_class.deserialize(data) - expect(workflow.id).to eq("wf_no_state") - expect(workflow.state_variables).to be_nil - expect(workflow.tracing.enabled).to be(false) - expect(workflow.version).to eq("1.0.0") + it "initializes with nil version" do + instance = described_class.deserialize(nil) + expect(instance.version).to be_nil end - it "handles missing tracing field" do - data = { - "id" => "wf_no_tracing", - "state_variables" => { "test" => "value" }, - "version" => "3.0.0", - } - workflow = described_class.deserialize(data) - - expect(workflow.id).to eq("wf_no_tracing") - expect(workflow.state_variables).to eq({ "test" => "value" }) - expect(workflow.tracing).to be_a(ChatKit::Session::Workflow::Tracing) - expect(workflow.tracing.enabled).to be_nil - expect(workflow.version).to eq("3.0.0") + it "creates Tracing instance from nil" do + instance = described_class.deserialize(nil) + expect(instance.tracing).to be_a(ChatKit::Session::Workflow::Tracing) end - it "handles missing version field" do - data = { - "id" => "wf_no_version", - "state_variables" => { "config" => { "timeout" => 30 } }, - "tracing" => { "enabled" => true }, - } - workflow = described_class.deserialize(data) + it "returns an instance of Workflow" do + instance = described_class.deserialize(nil) + expect(instance).to be_a(described_class) + end + end - expect(workflow.id).to eq("wf_no_version") - expect(workflow.state_variables).to eq({ "config" => { "timeout" => 30 } }) - expect(workflow.tracing.enabled).to be(true) - expect(workflow.version).to be_nil + context "when data is an empty hash" do + it "initializes with nil values" do + instance = described_class.deserialize({}) + expect(instance.id).to be_nil + expect(instance.state_variables).to be_nil + expect(instance.version).to be_nil end end - context "when tracing data has various values" do - it "handles tracing with enabled true" do + context "when data contains all keys" do + it "deserializes complete workflow data" do data = { - "id" => "wf_tracing_true", + "id" => "wf_deserialize_123", + "state_variables" => { "key" => "value" }, "tracing" => { "enabled" => true }, + "version" => "4.0.0", } - workflow = described_class.deserialize(data) + instance = described_class.deserialize(data) - expect(workflow.tracing.enabled).to be(true) + expect(instance.id).to eq("wf_deserialize_123") + expect(instance.state_variables).to eq({ "key" => "value" }) + expect(instance.tracing.enabled).to eq(true) + expect(instance.version).to eq("4.0.0") end - it "handles tracing with enabled false" do + it "deserializes with nil state_variables" do data = { - "id" => "wf_tracing_false", - "tracing" => { "enabled" => false }, + "id" => "wf_123", + "state_variables" => nil, + "version" => "1.0.0", } - workflow = described_class.deserialize(data) - - expect(workflow.tracing.enabled).to be(false) + instance = described_class.deserialize(data) + expect(instance.state_variables).to be_nil end - it "handles tracing with enabled nil" do + it "deserializes with empty state_variables" do data = { - "id" => "wf_tracing_nil", - "tracing" => { "enabled" => nil }, + "id" => "wf_123", + "state_variables" => {}, } - workflow = described_class.deserialize(data) - - expect(workflow.tracing.enabled).to be_nil + instance = described_class.deserialize(data) + expect(instance.state_variables).to eq({}) end - it "handles empty tracing data" do + it "deserializes with complex state_variables" do data = { - "id" => "wf_empty_tracing", - "tracing" => {}, + "id" => "wf_123", + "state_variables" => { + "nested" => { "data" => "value" }, + "array" => [1, 2, 3], + }, } - workflow = described_class.deserialize(data) - - expect(workflow.tracing.enabled).to be_nil + instance = described_class.deserialize(data) + expect(instance.state_variables).to eq(data["state_variables"]) end - end - context "when state_variables contains complex data" do - it "preserves nested hash structures" do - complex_state = { - "config" => { "timeout" => 30, "retries" => 3 }, - "user_preferences" => { "theme" => "dark", "language" => "en" }, - "feature_flags" => { "new_ui" => true, "beta_features" => false }, - "metadata" => { "created_at" => "2023-01-01", "tags" => %w[important urgent] }, - } + it "deserializes tracing as Tracing object" do data = { - "id" => "wf_complex_state", - "state_variables" => complex_state, + "id" => "wf_123", + "tracing" => { "enabled" => false }, } - workflow = described_class.deserialize(data) - - expect(workflow.state_variables).to eq(complex_state) - expect(workflow.state_variables["config"]["timeout"]).to eq(30) - expect(workflow.state_variables["metadata"]["tags"]).to contain_exactly("important", "urgent") + instance = described_class.deserialize(data) + expect(instance.tracing).to be_a(ChatKit::Session::Workflow::Tracing) + expect(instance.tracing.enabled).to eq(false) end + end - it "handles state_variables as empty hash" do + context "when data contains extra keys" do + it "extracts only known keys using dig" do data = { - "id" => "wf_empty_state", - "state_variables" => {}, + "id" => "wf_extra", + "state_variables" => { "var" => "val" }, + "version" => "5.0.0", + "extra_key" => "ignored", + "another_extra" => "also_ignored", } - workflow = described_class.deserialize(data) + instance = described_class.deserialize(data) - expect(workflow.state_variables).to eq({}) + expect(instance.id).to eq("wf_extra") + expect(instance.state_variables).to eq({ "var" => "val" }) + expect(instance.version).to eq("5.0.0") end end - context "with edge cases" do - it "ignores extra fields in data" do - data = { - "id" => "wf_extra_fields", - "state_variables" => { "key" => "value" }, - "tracing" => { "enabled" => true }, - "version" => "1.0.0", - "extra_field" => "should_be_ignored", - "another_field" => 123, - } - workflow = described_class.deserialize(data) - - expect(workflow.id).to eq("wf_extra_fields") - expect(workflow.state_variables).to eq({ "key" => "value" }) - expect(workflow.tracing.enabled).to be(true) - expect(workflow.version).to eq("1.0.0") - end + it "returns an instance of Workflow" do + instance = described_class.deserialize({ "id" => "wf_test" }) + expect(instance).to be_a(described_class) + end + end - it "returns a new instance each time" do - data = { "id" => "wf_new_instance", "version" => "1.0.0" } - workflow1 = described_class.deserialize(data) - workflow2 = described_class.deserialize(data) + describe "#serialize" do + context "when all attributes have values" do + it "serializes to complete hash" do + tracing = ChatKit::Session::Workflow::Tracing.new(enabled: true) + instance = described_class.new( + id: "wf_serialize_123", + state_variables: { "key" => "value" }, + tracing:, + version: "6.0.0" + ) + result = instance.serialize - expect(workflow1).not_to be(workflow2) - expect(workflow1.id).to eq(workflow2.id) - expect(workflow1.version).to eq(workflow2.version) + expect(result[:id]).to eq("wf_serialize_123") + expect(result[:state_variables]).to eq({ "key" => "value" }) + expect(result[:tracing]).to be_a(Hash) + expect(result[:version]).to eq("6.0.0") end - it "handles string values properly" do - data = { - "id" => "wf_string_handling", - "version" => "2.0.0-alpha.1+build.456", - } - workflow = described_class.deserialize(data) + it "calls serialize on tracing object" do + tracing = ChatKit::Session::Workflow::Tracing.new(enabled: false) + instance = described_class.new(id: "wf_123", tracing:) + result = instance.serialize - expect(workflow.id).to eq("wf_string_handling") - expect(workflow.version).to eq("2.0.0-alpha.1+build.456") + expect(result[:tracing]).to eq(tracing.serialize) end end - context "round-trip serialization" do - it "can deserialize what was serialized" do - original = described_class.new( - id: "wf_roundtrip", - state_variables: { "test" => "value", "number" => 42 }, - tracing: { enabled: true }, - version: "1.2.3" - ) - serialized = original.serialize - # Convert keys to strings to simulate JSON parsing - string_keyed_data = serialized.transform_keys(&:to_s) - # Also convert the nested tracing keys - string_keyed_data["tracing"] = string_keyed_data["tracing"].transform_keys(&:to_s) - deserialized = described_class.deserialize(string_keyed_data) - - expect(deserialized.id).to eq(original.id) - expect(deserialized.state_variables).to eq(original.state_variables) - expect(deserialized.tracing.enabled).to eq(original.tracing.enabled) - expect(deserialized.version).to eq(original.version) - end - - it "handles nil values in round-trip" do - original = described_class.new( - id: "wf_nil_roundtrip", + context "when optional attributes are nil" do + it "compacts nil values from serialized hash" do + instance = described_class.new( + id: "wf_compact", state_variables: nil, - tracing: { enabled: nil }, version: nil ) - serialized = original.serialize - # Since serialize uses compact, nil values are removed - string_keyed_data = serialized.transform_keys(&:to_s) - deserialized = described_class.deserialize(string_keyed_data) + result = instance.serialize - expect(deserialized.id).to eq(original.id) - expect(deserialized.state_variables).to be_nil - expect(deserialized.tracing.enabled).to be_nil - expect(deserialized.version).to be_nil + expect(result).to have_key(:id) + expect(result).to have_key(:tracing) + expect(result).not_to have_key(:state_variables) + expect(result).not_to have_key(:version) end + end - it "maintains data integrity through multiple round-trips" do - original_data = { - "id" => "wf_multi_roundtrip", - "state_variables" => { "counter" => 5, "active" => true }, - "tracing" => { "enabled" => false }, - "version" => "0.1.0", - } - - # First round-trip - workflow1 = described_class.deserialize(original_data) - serialized1 = workflow1.serialize.transform_keys(&:to_s) - serialized1["tracing"] = serialized1["tracing"].transform_keys(&:to_s) - - # Second round-trip - workflow2 = described_class.deserialize(serialized1) - serialized2 = workflow2.serialize.transform_keys(&:to_s) - serialized2["tracing"] = serialized2["tracing"].transform_keys(&:to_s) + context "when state_variables is empty hash" do + it "includes empty hash in serialization" do + instance = described_class.new(id: "wf_123", state_variables: {}) + result = instance.serialize + expect(result[:state_variables]).to eq({}) + end + end - expect(serialized1).to eq(serialized2) - expect(workflow2.id).to eq(original_data["id"]) - expect(workflow2.state_variables).to eq(original_data["state_variables"]) - expect(workflow2.version).to eq(original_data["version"]) + context "when state_variables has complex structure" do + it "serializes complex nested structure" do + state = { + "config" => { "timeout" => 30, "retries" => 3 }, + "flags" => %w[debug verbose], + } + instance = described_class.new(id: "wf_123", state_variables: state) + result = instance.serialize + expect(result[:state_variables]).to eq(state) end end + + it "returns a hash" do + instance = described_class.new(id: "wf_test") + result = instance.serialize + expect(result).to be_a(Hash) + end end describe "attribute accessors" do - let(:workflow) { described_class.new(id: "wf_accessor_test") } + let(:instance) { described_class.new(id: "wf_accessor_test") } describe "#id" do - it "is readable and writable" do - expect(workflow.id).to eq("wf_accessor_test") - workflow.id = "wf_new_id" - expect(workflow.id).to eq("wf_new_id") + it "allows reading the id value" do + expect(instance.id).to eq("wf_accessor_test") + end + + it "allows writing new id value" do + instance.id = "wf_new_id" + expect(instance.id).to eq("wf_new_id") + end + + it "allows setting to nil" do + instance.id = nil + expect(instance.id).to be_nil end end describe "#state_variables" do - it "is readable and writable" do - expect(workflow.state_variables).to be_nil - new_state = { "test" => "value" } - workflow.state_variables = new_state - expect(workflow.state_variables).to eq(new_state) + it "allows reading the state_variables value" do + expect(instance.state_variables).to be_nil + end + + it "allows writing hash value" do + instance.state_variables = { "new_key" => "new_value" } + expect(instance.state_variables).to eq({ "new_key" => "new_value" }) end - it "accepts nil value" do - workflow.state_variables = nil - expect(workflow.state_variables).to be_nil + it "allows writing nil value" do + instance.state_variables = { "key" => "value" } + instance.state_variables = nil + expect(instance.state_variables).to be_nil + end + + it "allows writing empty hash" do + instance.state_variables = {} + expect(instance.state_variables).to eq({}) end end describe "#tracing" do - it "is readable and writable" do - expect(workflow.tracing).to be_a(ChatKit::Session::Workflow::Tracing) + it "allows reading the tracing value" do + expect(instance.tracing).to be_a(ChatKit::Session::Workflow::Tracing) + end + + it "allows writing new Tracing instance" do new_tracing = ChatKit::Session::Workflow::Tracing.new(enabled: false) - workflow.tracing = new_tracing - expect(workflow.tracing).to eq(new_tracing) - expect(workflow.tracing.enabled).to be(false) + instance.tracing = new_tracing + expect(instance.tracing).to eq(new_tracing) end end describe "#version" do - it "is readable and writable" do - expect(workflow.version).to be_nil - workflow.version = "3.0.0" - expect(workflow.version).to eq("3.0.0") + it "allows reading the version value" do + expect(instance.version).to be_nil end - it "accepts nil value" do - workflow.version = nil - expect(workflow.version).to be_nil + it "allows writing string value" do + instance.version = "7.0.0" + expect(instance.version).to eq("7.0.0") + end + + it "allows writing nil value" do + instance.version = "1.0.0" + instance.version = nil + expect(instance.version).to be_nil end end end - describe "#serialize" do - context "when all attributes have values" do - let(:state_vars) { { "serialize_key" => "serialize_value" } } - let(:tracing_params) { { enabled: true } } - let(:workflow) do - described_class.new( - id: "wf_serialize_full", - state_variables: state_vars, - tracing: tracing_params, - version: "2.1.0" - ) + describe "integration with FactoryBot" do + context "using default factory" do + it "creates valid instance" do + instance = build(:workflow) + expect(instance).to be_a(described_class) + expect(instance.id).to eq("wf_abc123") + expect(instance.state_variables).to eq({ "variable1" => "value1", "variable2" => "value2" }) + expect(instance.tracing).to be_a(ChatKit::Session::Workflow::Tracing) + expect(instance.version).to eq("1.0.0") end + end - it "returns hash with all attributes" do - result = workflow.serialize + context "using :minimal trait" do + it "creates instance with minimal attributes" do + instance = build(:workflow, :minimal) + expect(instance.id).to eq("wf_abc123") + expect(instance.state_variables).to be_nil + expect(instance.version).to be_nil + end + end - expect(result).to eq({ - id: "wf_serialize_full", - state_variables: state_vars, - tracing: { enabled: true }, - version: "2.1.0", - }) + context "using :with_nil_state trait" do + it "creates instance with nil state_variables" do + instance = build(:workflow, :with_nil_state) + expect(instance.state_variables).to be_nil end end - context "when optional attributes are nil" do - let(:workflow) { described_class.new(id: "wf_serialize_minimal") } + context "using :with_empty_state trait" do + it "creates instance with empty state_variables" do + instance = build(:workflow, :with_empty_state) + expect(instance.state_variables).to eq({}) + end + end - it "excludes nil values due to compact" do - result = workflow.serialize + context "using :with_nil_version trait" do + it "creates instance with nil version" do + instance = build(:workflow, :with_nil_version) + expect(instance.version).to be_nil + end + end - expect(result).to eq({ - id: "wf_serialize_minimal", - tracing: {}, - }) - expect(result).not_to have_key(:state_variables) - expect(result).not_to have_key(:version) + context "using :with_complex_state trait" do + it "creates instance with complex state_variables" do + instance = build(:workflow, :with_complex_state) + expect(instance.state_variables).to include("config", "user_input", "flags") + expect(instance.state_variables["config"]).to eq({ "timeout" => 30, "retries" => 3 }) + expect(instance.state_variables["flags"]).to eq(%w[debug verbose]) end end - context "when state_variables is empty hash" do - let(:workflow) do - described_class.new( - id: "wf_empty_state", - state_variables: {}, - version: "1.0.0" - ) + context "overriding attributes" do + it "allows custom id" do + instance = build(:workflow, id: "wf_custom") + expect(instance.id).to eq("wf_custom") end - it "includes empty hash in serialization" do - result = workflow.serialize + it "allows custom state_variables" do + instance = build(:workflow, state_variables: { "custom" => "state" }) + expect(instance.state_variables).to eq({ "custom" => "state" }) + end - expect(result[:state_variables]).to eq({}) - expect(result).to have_key(:state_variables) + it "allows custom version" do + instance = build(:workflow, version: "10.0.0") + expect(instance.version).to eq("10.0.0") end end + end - context "when tracing is disabled" do - let(:workflow) do - described_class.new( - id: "wf_disabled_tracing", - tracing: { enabled: false } - ) + describe "round-trip serialization" do + it "maintains data integrity with all attributes" do + original = described_class.new( + id: "wf_roundtrip", + state_variables: { "key" => "value" }, + version: "8.0.0" + ) + serialized = original.serialize + deserialized = described_class.deserialize(JSON.parse(serialized.to_json)) + + expect(deserialized.id).to eq(original.id) + expect(deserialized.state_variables).to eq(original.state_variables) + expect(deserialized.version).to eq(original.version) + end + + it "maintains data integrity with minimal attributes" do + original = described_class.new(id: "wf_minimal") + serialized = original.serialize + deserialized = described_class.deserialize(JSON.parse(serialized.to_json)) + + expect(deserialized.id).to eq(original.id) + expect(deserialized.state_variables).to eq(original.state_variables) + expect(deserialized.version).to eq(original.version) + end + + it "maintains data integrity with complex state_variables" do + original = described_class.new( + id: "wf_complex", + state_variables: { + "nested" => { "deep" => { "value" => 123 } }, + "array" => [1, 2, 3], + } + ) + serialized = original.serialize + deserialized = described_class.deserialize(JSON.parse(serialized.to_json)) + + expect(deserialized.state_variables).to eq(original.state_variables) + end + + it "maintains tracing data integrity" do + original = described_class.new( + id: "wf_tracing", + tracing: { enabled: true } + ) + serialized = original.serialize + deserialized = described_class.deserialize(JSON.parse(serialized.to_json)) + + expect(deserialized.tracing.enabled).to eq(original.tracing.enabled) + end + end + + describe "edge cases" do + context "when modifying attributes after initialization" do + it "allows changing id" do + instance = described_class.new(id: "wf_original") + expect(instance.id).to eq("wf_original") + + instance.id = "wf_modified" + expect(instance.id).to eq("wf_modified") + end + + it "allows changing state_variables" do + instance = described_class.new(id: "wf_123", state_variables: { "old" => "value" }) + instance.state_variables = { "new" => "value" } + expect(instance.state_variables).to eq({ "new" => "value" }) end - it "includes tracing with enabled: false" do - result = workflow.serialize + it "allows changing version" do + instance = described_class.new(id: "wf_123", version: "1.0.0") + instance.version = "2.0.0" + expect(instance.version).to eq("2.0.0") + end - expect(result[:tracing]).to eq({ enabled: false }) + it "allows changing tracing" do + instance = described_class.new(id: "wf_123") + new_tracing = ChatKit::Session::Workflow::Tracing.new(enabled: false) + instance.tracing = new_tracing + expect(instance.tracing.enabled).to eq(false) end end - context "when tracing enabled is nil" do - let(:workflow) do - described_class.new( - id: "wf_nil_tracing_enabled", - tracing: { enabled: nil } + context "when serializing multiple times" do + it "produces consistent results" do + instance = described_class.new( + id: "wf_consistent", + state_variables: { "key" => "value" }, + version: "9.0.0" ) + first_serialization = instance.serialize + second_serialization = instance.serialize + + expect(first_serialization).to eq(second_serialization) + end + end + + context "when modifying after serialization" do + it "subsequent serializations reflect modifications" do + instance = described_class.new(id: "wf_123", version: "1.0.0") + first_result = instance.serialize + expect(first_result[:version]).to eq("1.0.0") + + instance.version = "2.0.0" + second_result = instance.serialize + expect(second_result[:version]).to eq("2.0.0") end - it "excludes enabled from tracing due to compact" do - result = workflow.serialize + it "handles transition to nil" do + instance = described_class.new(id: "wf_123", version: "1.0.0") + first_result = instance.serialize + expect(first_result).to have_key(:version) - expect(result[:tracing]).to eq({}) + instance.version = nil + second_result = instance.serialize + expect(second_result).not_to have_key(:version) end end - end - describe "integration with Tracing" do - context "when tracing parameter is provided as hash" do - it "converts hash to Tracing object" do - workflow = described_class.new( - id: "wf_tracing_integration", - tracing: { enabled: true } - ) + context "when deserializing with unexpected data types" do + it "handles string values for state_variables" do + data = { + "id" => "wf_123", + "state_variables" => "not_a_hash", + } + instance = described_class.deserialize(data) + expect(instance.state_variables).to eq("not_a_hash") + end - expect(workflow.tracing).to be_a(ChatKit::Session::Workflow::Tracing) - expect(workflow.tracing.enabled).to be(true) + it "handles numeric id" do + data = { "id" => 123 } + instance = described_class.deserialize(data) + expect(instance.id).to eq(123) end end - context "when tracing parameter responds to to_h" do - it "converts to hash and creates tracing object" do - custom_tracing = Struct.new(:enabled) do - def to_h - { enabled: } - end - end.new(false) + context "when working with tracing parameter" do + it "converts hash to Tracing instance on initialization" do + instance = described_class.new(id: "wf_123", tracing: { enabled: true }) + expect(instance.tracing).to be_a(ChatKit::Session::Workflow::Tracing) + expect(instance.tracing.enabled).to eq(true) + end - workflow = described_class.new( - id: "wf_custom_tracing", - tracing: custom_tracing - ) + it "converts empty hash to Tracing instance" do + instance = described_class.new(id: "wf_123", tracing: {}) + expect(instance.tracing).to be_a(ChatKit::Session::Workflow::Tracing) + end + + it "preserves Tracing instance when passed directly" do + tracing = ChatKit::Session::Workflow::Tracing.new(enabled: false) + instance = described_class.new(id: "wf_123", tracing:) + expect(instance.tracing).to equal(tracing) + end + + it "handles nil tracing parameter" do + instance = described_class.new(id: "wf_123", tracing: nil) + expect(instance.tracing).to be_a(ChatKit::Session::Workflow::Tracing) + end + end - expect(workflow.tracing).to be_a(ChatKit::Session::Workflow::Tracing) - expect(workflow.tracing.enabled).to be(false) + context "when working with state_variables structure" do + it "preserves array values" do + state = { "list" => [1, 2, 3, 4, 5] } + instance = described_class.new(id: "wf_123", state_variables: state) + expect(instance.state_variables["list"]).to eq([1, 2, 3, 4, 5]) + end + + it "preserves deeply nested structures" do + state = { + "level1" => { + "level2" => { + "level3" => { + "value" => "deep", + }, + }, + }, + } + instance = described_class.new(id: "wf_123", state_variables: state) + expect(instance.state_variables.dig("level1", "level2", "level3", "value")).to eq("deep") + end + + it "preserves mixed types" do + state = { + "string" => "text", + "number" => 42, + "boolean" => true, + "null" => nil, + "array" => [1, 2, 3], + "object" => { "nested" => "value" }, + } + instance = described_class.new(id: "wf_123", state_variables: state) + expect(instance.state_variables).to eq(state) end end end - describe "edge cases and validation" do - context "with boundary values" do - it "handles empty string id" do - workflow = described_class.new(id: "") - expect(workflow.id).to eq("") + describe "private methods" do + describe "#setup_tracing" do + it "returns Tracing instance when given Tracing object" do + tracing = ChatKit::Session::Workflow::Tracing.new(enabled: true) + instance = described_class.new(id: "wf_123", tracing:) + expect(instance.tracing).to equal(tracing) end - it "handles very long id" do - long_id = "wf_#{'x' * 1000}" - workflow = described_class.new(id: long_id) - expect(workflow.id).to eq(long_id) + it "converts hash to Tracing instance" do + instance = described_class.new(id: "wf_123", tracing: { enabled: false }) + expect(instance.tracing).to be_a(ChatKit::Session::Workflow::Tracing) + expect(instance.tracing.enabled).to eq(false) end - it "handles version with special characters" do - workflow = described_class.new(id: "wf_test", version: "1.0.0-beta.1+build.123") - expect(workflow.version).to eq("1.0.0-beta.1+build.123") + it "handles nil by creating Tracing with no arguments" do + instance = described_class.new(id: "wf_123", tracing: nil) + expect(instance.tracing).to be_a(ChatKit::Session::Workflow::Tracing) end end + end - context "when comparing new vs build methods" do - it "produces identical results when same parameters provided" do - params = { - id: "wf_comparison", - state_variables: { "key" => "value" }, - tracing: { enabled: true }, - version: "1.0.0", - } + describe "API documentation compliance" do + context "according to OpenAI API reference" do + it "requires id parameter" do + expect { described_class.new }.to raise_error(ArgumentError) + end + + it "accepts optional state_variables" do + instance = described_class.new(id: "wf_123") + expect(instance.state_variables).to be_nil + end - workflow_new = described_class.new(**params) - workflow_build = described_class.build(**params) + it "accepts optional tracing" do + instance = described_class.new(id: "wf_123") + expect(instance.tracing).to be_a(ChatKit::Session::Workflow::Tracing) + end - expect(workflow_new.serialize).to eq(workflow_build.serialize) + it "accepts optional version" do + instance = described_class.new(id: "wf_123") + expect(instance.version).to be_nil end end + end - context "when checking serialization consistency" do - it "maintains consistent serialization across multiple calls" do - workflow = described_class.new( - id: "wf_consistency", - state_variables: { "test" => "value" }, - version: "1.0.0" - ) - - first_serialize = workflow.serialize - second_serialize = workflow.serialize + describe "common use cases" do + context "workflow creation scenarios" do + it "creates workflow with just id" do + workflow = described_class.new(id: "wf_simple") + expect(workflow.id).to eq("wf_simple") + end - expect(first_serialize).to eq(second_serialize) + it "creates workflow with id and version" do + workflow = described_class.new(id: "wf_versioned", version: "1.2.3") + expect(workflow.id).to eq("wf_versioned") + expect(workflow.version).to eq("1.2.3") end - it "reflects changes in subsequent serializations" do - workflow = described_class.new(id: "wf_changes") + it "creates workflow with state" do + workflow = described_class.new( + id: "wf_stateful", + state_variables: { "user_id" => "123", "session_id" => "abc" } + ) + expect(workflow.state_variables).to include("user_id", "session_id") + end - original_serialize = workflow.serialize - workflow.version = "2.0.0" - updated_serialize = workflow.serialize + it "creates workflow with tracing enabled" do + workflow = described_class.new( + id: "wf_traced", + tracing: { enabled: true } + ) + expect(workflow.tracing.enabled).to eq(true) + end - expect(original_serialize).not_to have_key(:version) - expect(updated_serialize[:version]).to eq("2.0.0") + it "creates fully configured workflow" do + workflow = described_class.new( + id: "wf_full", + state_variables: { "config" => "production" }, + tracing: { enabled: true }, + version: "2.1.0" + ) + expect(workflow.id).to eq("wf_full") + expect(workflow.state_variables).to eq({ "config" => "production" }) + expect(workflow.tracing.enabled).to eq(true) + expect(workflow.version).to eq("2.1.0") end end end diff --git a/spec/chatkit/session_spec.rb b/spec/chatkit/session_spec.rb deleted file mode 100644 index dc80eca..0000000 --- a/spec/chatkit/session_spec.rb +++ /dev/null @@ -1,644 +0,0 @@ -# frozen_string_literal: true - -require "spec_helper" - -RSpec.describe ChatKit::Session do - let(:user_id) { "user_123" } - let(:workflow_params) { attributes_for(:workflow) } - let(:client) { build(:client, api_key: "test_api_key_123", host: "https://api.openai.com") } - let(:test_api_key) { "sk-test123456789" } - let(:test_workflow_id) { "wf_test123" } - - before do - # Set test environment variables for VCR filtering - allow(ENV).to receive(:[]).and_call_original - allow(ENV).to receive(:[]).with("OPENAI_API_KEY").and_return(test_api_key) - allow(ENV).to receive(:[]).with("WORKFLOW_ID").and_return(test_workflow_id) - end - - describe ".create!" do - context "with minimal required parameters" do - let(:workflow_params) { attributes_for(:workflow, :minimal) } - - it "creates a session with user_id and workflow only", :vcr do - VCR.use_cassette("ChatKit_Session/_create_/with_minimal_required_parameters/creates_session_successfully") do - # This test will record real API interaction on first run, then replay from cassette - expect do - described_class.create!( - user_id:, - workflow: workflow_params, - client: - ) - end.to raise_error(ChatKit::Error, /401/) - # NOTE: This currently fails with 401 due to invalid API key in cassette - # In a real scenario with valid API keys, this would succeed and create a session - end - end - - it "uses default client when not provided", :vcr do - VCR.use_cassette("ChatKit_Session/_create_/with_minimal_required_parameters/uses_default_client") do - # Set up configuration so default client can be created - allow(ChatKit.configuration).to receive(:api_key).and_return("test_api_key_123") - allow(ChatKit.configuration).to receive(:host).and_return("https://api.openai.com") - - # This test records real API interaction with default client - expect do - described_class.create!( - user_id:, - workflow: workflow_params - ) - end.to raise_error(ChatKit::Error, /401/) - # NOTE: Real API responds with 401 due to invalid test API key - end - end - end - - context "with all optional parameters" do - let(:chatkit_configuration_params) { attributes_for(:chatkit_configuration, :all_enabled) } - let(:expires_after_params) { attributes_for(:expires_after, :one_hour) } - let(:rate_limits_params) { attributes_for(:rate_limits, :high_limit) } - - it "creates a session with all parameters", :vcr do - VCR.use_cassette("ChatKit_Session/_create_/with_all_optional_parameters/creates_session_with_all_params") do - # This test records real API interaction with all optional parameters - expect do - described_class.create!( - user_id:, - workflow: workflow_params, - chatkit_configuration: chatkit_configuration_params, - expires_after: expires_after_params, - rate_limits: rate_limits_params, - client: - ) - end.to raise_error(ChatKit::Error, /401/) - # NOTE: Currently fails with 401 due to test API key in cassette - end - end - end - - context "with API error responses" do - it "handles 401 unauthorized error", :vcr do - VCR.use_cassette("ChatKit_Session/_create_/with_API_error_responses/handles_401_unauthorized") do - client_with_invalid_key = build(:client, api_key: "invalid_key", host: "https://api.openai.com") - - # This test uses real API response - cassette shows 401 error for invalid API key - expect do - described_class.create!( - user_id:, - workflow: workflow_params, - client: client_with_invalid_key - ) - end.to raise_error(ChatKit::Error, /401/) - # NOTE: Real API returned 401 Unauthorized for invalid API key - end - end - - it "handles 400 bad request error", :vcr do - VCR.use_cassette("ChatKit_Session/_create_/with_API_error_responses/handles_400_bad_request") do - invalid_workflow = { id: nil } - - # This test uses real API response - cassette shows 401 due to invalid API key - expect do - described_class.create!( - user_id:, - workflow: invalid_workflow, - client: - ) - end.to raise_error(ChatKit::Error, /401/) - # NOTE: Real API returned 401 Unauthorized instead of 400 - end - end - - it "handles 429 rate limit error", :vcr do - VCR.use_cassette("ChatKit_Session/_create_/with_API_error_responses/handles_429_rate_limit") do - # This test uses real API response - cassette shows 401 due to invalid API key - expect do - described_class.create!( - user_id:, - workflow: workflow_params, - client: - ) - end.to raise_error(ChatKit::Error, /401/) - # NOTE: Real API returned 401 Unauthorized instead of 429 - end - end - - it "handles 500 internal server error", :vcr do - VCR.use_cassette("ChatKit_Session/_create_/with_API_error_responses/handles_500_server_error") do - # This test uses real API response - cassette shows 401 due to invalid API key - expect do - described_class.create!( - user_id:, - workflow: workflow_params, - client: - ) - end.to raise_error(ChatKit::Error, /401/) - # NOTE: Real API returned 401 Unauthorized instead of 500 - end - end - end - end - - describe "#initialize" do - it "initializes with required parameters" do - session = described_class.new( - user_id:, - workflow: workflow_params, - client: - ) - - expect(session.user_id).to eq(user_id) - expect(session.workflow).to be_a(ChatKit::Session::Workflow) - expect(session.client).to eq(client) - expect(session.chatkit_configuration).to be_a(ChatKit::Session::ChatKitConfiguration) - expect(session.rate_limits).to be_a(ChatKit::Session::RateLimits) - end - - it "handles nil optional parameters" do - session = described_class.new( - user_id:, - workflow: workflow_params, - chatkit_configuration: nil, - expires_after: nil, - rate_limits: nil, - client: - ) - - expect(session.expires_after).to be_nil - expect(session.chatkit_configuration).to be_a(ChatKit::Session::ChatKitConfiguration) - expect(session.rate_limits).to be_a(ChatKit::Session::RateLimits) - end - - it "builds expires_after when hash is provided" do - expires_after_hash = { anchor: "creation", seconds: 1800 } - - session = described_class.new( - user_id:, - workflow: workflow_params, - expires_after: expires_after_hash, - client: - ) - - expect(session.expires_after).to be_a(ChatKit::Session::ExpiresAfter) - expect(session.expires_after.anchor).to eq("creation") - expect(session.expires_after.seconds).to eq(1800) - end - - context "when default client is not provided" do - it "creates default client" do - allow(ChatKit::Client).to receive(:new).and_return(client) - - session = described_class.new( - user_id:, - workflow: workflow_params - ) - - expect(session.client).to eq(client) - expect(ChatKit::Client).to have_received(:new) - end - end - end - - describe "#create!" do - let(:session) do - described_class.new( - user_id:, - workflow: workflow_params, - client: - ) - end - - context "with successful API response" do - it "creates session and updates current session data", :vcr do - VCR.use_cassette("ChatKit_Session/_create_/with_successful_API_response/creates_and_updates_current_session") do - # This test records real API interaction for session creation - expect do - session.create! - end.to raise_error(ChatKit::Error, /401/) - # NOTE: Currently fails with 401, but with valid API key would succeed - # and update current session data - end - end - - it "parses response correctly", :vcr do - VCR.use_cassette("ChatKit_Session/_create_/with_successful_API_response/parses_response_correctly") do - # This test records real API response parsing behavior - expect do - session.create! - end.to raise_error(ChatKit::Error, /401/) - # NOTE: With valid API key, this would test actual JSON response parsing - end - end - end - - context "with different parameter combinations" do - describe "chatkit_configuration parameter variations" do - it "handles all_enabled configuration", :vcr do - VCR.use_cassette("ChatKit_Session/parameter_combinations/chatkit_configuration_parameter_variations/all_enabled") do - session_with_config = described_class.new( - user_id:, - workflow: workflow_params, - chatkit_configuration: attributes_for(:chatkit_configuration, :all_enabled), - client: - ) - - expect do - session_with_config.create! - end.to raise_error(ChatKit::Error, /401/) - - expect(session_with_config.chatkit_configuration).to be_a(ChatKit::Session::ChatKitConfiguration) - end - end - - it "handles all_disabled configuration", :vcr do - VCR.use_cassette("ChatKit_Session/parameter_combinations/chatkit_configuration_parameter_variations/all_disabled") do - session_with_config = described_class.new( - user_id:, - workflow: workflow_params, - chatkit_configuration: attributes_for(:chatkit_configuration, :all_disabled), - client: - ) - - expect do - session_with_config.create! - end.to raise_error(ChatKit::Error, /401/) - - expect(session_with_config.chatkit_configuration).to be_a(ChatKit::Session::ChatKitConfiguration) - end - end - - it "handles mixed_settings configuration", :vcr do - VCR.use_cassette("ChatKit_Session/parameter_combinations/chatkit_configuration_parameter_variations/mixed_settings") do - session_with_config = described_class.new( - user_id:, - workflow: workflow_params, - chatkit_configuration: attributes_for(:chatkit_configuration, :mixed_settings), - client: - ) - - expect do - session_with_config.create! - end.to raise_error(ChatKit::Error, /401/) - - expect(session_with_config.chatkit_configuration).to be_a(ChatKit::Session::ChatKitConfiguration) - end - end - - it "handles minimal_config configuration", :vcr do - VCR.use_cassette("ChatKit_Session/parameter_combinations/chatkit_configuration_parameter_variations/minimal_config") do - session_with_config = described_class.new( - user_id:, - workflow: workflow_params, - chatkit_configuration: attributes_for(:chatkit_configuration, :minimal_config), - client: - ) - - expect do - session_with_config.create! - end.to raise_error(ChatKit::Error, /401/) - - expect(session_with_config.chatkit_configuration).to be_a(ChatKit::Session::ChatKitConfiguration) - end - end - end - - describe "workflow parameter variations" do - it "handles workflow with complex state", :vcr do - VCR.use_cassette("ChatKit_Session/parameter_combinations/workflow_parameter_variations/complex_state") do - session_with_workflow = described_class.new( - user_id:, - workflow: attributes_for(:workflow, :with_complex_state), - client: - ) - - expect do - session_with_workflow.create! - end.to raise_error(ChatKit::Error, /401/) - - expect(session_with_workflow.workflow.state_variables).to be_a(Hash) - expect(session_with_workflow.workflow.state_variables).to include("config", "user_input", "flags") - end - end - - it "handles workflow with nil state", :vcr do - VCR.use_cassette("ChatKit_Session/parameter_combinations/workflow_parameter_variations/nil_state") do - session_with_workflow = described_class.new( - user_id:, - workflow: attributes_for(:workflow, :with_nil_state), - client: - ) - - expect do - session_with_workflow.create! - end.to raise_error(ChatKit::Error, /401/) - - expect(session_with_workflow.workflow.state_variables).to be_nil - end - end - - it "handles workflow with empty state", :vcr do - VCR.use_cassette("ChatKit_Session/parameter_combinations/workflow_parameter_variations/empty_state") do - session_with_workflow = described_class.new( - user_id:, - workflow: attributes_for(:workflow, :with_empty_state), - client: - ) - - expect do - session_with_workflow.create! - end.to raise_error(ChatKit::Error, /401/) - - expect(session_with_workflow.workflow.state_variables).to eq({}) - end - end - - it "handles workflow with nil version", :vcr do - VCR.use_cassette("ChatKit_Session/parameter_combinations/workflow_parameter_variations/nil_version") do - session_with_workflow = described_class.new( - user_id:, - workflow: attributes_for(:workflow, :with_nil_version), - client: - ) - - expect do - session_with_workflow.create! - end.to raise_error(ChatKit::Error, /401/) - - expect(session_with_workflow.workflow.version).to be_nil - end - end - end - - describe "expires_after parameter variations" do - it "handles short expiry", :vcr do - VCR.use_cassette("ChatKit_Session/parameter_combinations/expires_after_parameter_variations/short_expiry") do - session_with_expires = described_class.new( - user_id:, - workflow: workflow_params, - expires_after: attributes_for(:expires_after, :short_expiry), - client: - ) - - expect do - session_with_expires.create! - end.to raise_error(ChatKit::Error, /401/) - - expect(session_with_expires.expires_after.seconds).to eq(60) - end - end - - it "handles long expiry", :vcr do - VCR.use_cassette("ChatKit_Session/parameter_combinations/expires_after_parameter_variations/long_expiry") do - session_with_expires = described_class.new( - user_id:, - workflow: workflow_params, - expires_after: attributes_for(:expires_after, :long_expiry), - client: - ) - - expect do - session_with_expires.create! - end.to raise_error(ChatKit::Error, /401/) - - expect(session_with_expires.expires_after.seconds).to eq(3600) - end - end - - it "handles last_activity_anchor", :vcr do - VCR.use_cassette("ChatKit_Session/parameter_combinations/expires_after_parameter_variations/last_activity_anchor") do - session_with_expires = described_class.new( - user_id:, - workflow: workflow_params, - expires_after: attributes_for(:expires_after, :last_activity_anchor), - client: - ) - - expect do - session_with_expires.create! - end.to raise_error(ChatKit::Error, /401/) - - expect(session_with_expires.expires_after.anchor).to eq("last_activity") - end - end - end - - describe "rate_limits parameter variations" do - it "handles high limit", :vcr do - VCR.use_cassette("ChatKit_Session/parameter_combinations/rate_limits_parameter_variations/high_limit") do - session_with_limits = described_class.new( - user_id:, - workflow: workflow_params, - rate_limits: attributes_for(:rate_limits, :high_limit), - client: - ) - - expect do - session_with_limits.create! - end.to raise_error(ChatKit::Error, /401/) - - expect(session_with_limits.rate_limits.max_requests_per_1_minute).to eq(100) - end - end - - it "handles low limit", :vcr do - VCR.use_cassette("ChatKit_Session/parameter_combinations/rate_limits_parameter_variations/low_limit") do - session_with_limits = described_class.new( - user_id:, - workflow: workflow_params, - rate_limits: attributes_for(:rate_limits, :low_limit), - client: - ) - - expect do - session_with_limits.create! - end.to raise_error(ChatKit::Error, /401/) - - expect(session_with_limits.rate_limits.max_requests_per_1_minute).to eq(5) - end - end - - it "handles no limit", :vcr do - VCR.use_cassette("ChatKit_Session/parameter_combinations/rate_limits_parameter_variations/no_limit") do - session_with_limits = described_class.new( - user_id:, - workflow: workflow_params, - rate_limits: attributes_for(:rate_limits, :no_limit), - client: - ) - - expect do - session_with_limits.create! - end.to raise_error(ChatKit::Error, /401/) - - expect(session_with_limits.rate_limits.max_requests_per_1_minute).to be_nil - end - end - end - end - end - - describe "private methods" do - let(:session) do - described_class.new( - user_id:, - workflow: workflow_params, - client: - ) - end - - describe "#build_payload" do - it "builds correct payload structure" do - payload = session.send(:build_payload) - - expect(payload).to have_key(:user) - expect(payload).to have_key(:workflow) - expect(payload).to have_key(:chatkit_configuration) - expect(payload).to have_key(:rate_limits) - expect(payload[:user]).to eq(user_id) - end - - it "excludes nil values using compact" do - session_with_nils = described_class.new( - user_id:, - workflow: workflow_params, - expires_after: nil, - client: - ) - - payload = session_with_nils.send(:build_payload) - - expect(payload).not_to have_key(:expires_after) - end - - it "includes expires_after when provided" do - session_with_expires = described_class.new( - user_id:, - workflow: workflow_params, - expires_after: { anchor: "creation", seconds: 600 }, - client: - ) - - payload = session_with_expires.send(:build_payload) - - expect(payload).to have_key(:expires_after) - expect(payload[:expires_after]).to be_a(Hash) - end - end - - describe "#sessions_endpoint" do - it "returns correct endpoint" do - endpoint = session.send(:sessions_endpoint) - expect(endpoint).to eq("/v1/chatkit/sessions") - end - end - - describe "#sessions_header" do - it "returns correct headers" do - headers = session.send(:sessions_header) - - expected_headers = { - "Accept" => "application/json", - "Content-Type" => "application/json", - "OpenAI-Beta" => "chatkit_beta=v1", - } - - expect(headers).to eq(expected_headers) - end - end - - describe "#handle_response_errors" do - it "does not raise error for successful response" do - response_double = instance_double( - HTTP::Response, - code: 200 - ) - - expect do - session.send(:handle_response_errors, response_double) - end.not_to raise_error - end - - it "raises SessionError for error responses" do - response_double = instance_double( - HTTP::Response, - code: 400, - body: "Bad Request" - ) - - expect do - session.send(:handle_response_errors, response_double) - end.to raise_error(ChatKit::SessionError, /400: Bad Request/) - end - end - end - - describe "integration with related classes" do - it "properly integrates with ChatKit::Client" do - session = described_class.new( - user_id:, - workflow: workflow_params, - client: - ) - - expect(session.client).to be_a(ChatKit::Client) - expect(session.client.api_key).not_to be_nil - expect(session.client.host).not_to be_nil - end - - it "properly integrates with Workflow" do - workflow_attrs = attributes_for(:workflow, :with_complex_state) - session = described_class.new( - user_id:, - workflow: workflow_attrs, - client: - ) - - expect(session.workflow).to be_a(ChatKit::Session::Workflow) - expect(session.workflow.id).to eq(workflow_attrs[:id]) - expect(session.workflow.state_variables).to be_a(Hash) - expect(session.workflow.tracing).to be_a(ChatKit::Session::Workflow::Tracing) - end - - it "properly integrates with ChatKitConfiguration" do - config_attrs = attributes_for(:chatkit_configuration, :all_enabled) - session = described_class.new( - user_id:, - workflow: workflow_params, - chatkit_configuration: config_attrs, - client: - ) - - expect(session.chatkit_configuration).to be_a(ChatKit::Session::ChatKitConfiguration) - expect(session.chatkit_configuration.automatic_thread_titling).not_to be_nil - expect(session.chatkit_configuration.file_upload).not_to be_nil - expect(session.chatkit_configuration.history).not_to be_nil - end - - it "properly integrates with ExpiresAfter" do - expires_attrs = attributes_for(:expires_after, :one_hour) - session = described_class.new( - user_id:, - workflow: workflow_params, - expires_after: expires_attrs, - client: - ) - - expect(session.expires_after).to be_a(ChatKit::Session::ExpiresAfter) - expect(session.expires_after.anchor).to eq(expires_attrs[:anchor]) - expect(session.expires_after.seconds).to eq(expires_attrs[:seconds]) - end - - it "properly integrates with RateLimits" do - limits_attrs = attributes_for(:rate_limits, :high_limit) - session = described_class.new( - user_id:, - workflow: workflow_params, - rate_limits: limits_attrs, - client: - ) - - expect(session.rate_limits).to be_a(ChatKit::Session::RateLimits) - expect(session.rate_limits.max_requests_per_1_minute).to eq(limits_attrs[:max_requests_per_1_minute]) - end - end -end diff --git a/spec/factories/chatkit_configuration.rb b/spec/factories/chatkit_configuration.rb index 800b5fd..2b39e98 100644 --- a/spec/factories/chatkit_configuration.rb +++ b/spec/factories/chatkit_configuration.rb @@ -4,6 +4,10 @@ factory :automatic_thread_titling, class: "ChatKit::Session::ChatKitConfiguration::AutomaticThreadTitling" do enabled { true } + trait :enabled do + enabled { true } + end + trait :disabled do enabled { false } end @@ -12,6 +16,10 @@ enabled { nil } end + trait :default_enabled do + enabled { ChatKit::Session::Defaults::ENABLED } + end + initialize_with { new(enabled:) } end @@ -20,6 +28,10 @@ max_file_size { 256 } max_files { 5 } + trait :enabled do + enabled { true } + end + trait :disabled do enabled { false } end @@ -28,6 +40,10 @@ enabled { nil } end + trait :default_enabled do + enabled { ChatKit::Session::Defaults::ENABLED } + end + trait :large_files do max_file_size { 1024 } max_files { 20 } @@ -43,6 +59,11 @@ max_files { ChatKit::Session::ChatKitConfiguration::FileUpload::Defaults::MAX_FILES } end + trait :nil_limits do + max_file_size { nil } + max_files { nil } + end + initialize_with { new(enabled:, max_file_size:, max_files:) } end @@ -50,6 +71,10 @@ enabled { true } recent_threads { 50 } + trait :enabled do + enabled { true } + end + trait :disabled do enabled { false } end @@ -58,6 +83,10 @@ enabled { nil } end + trait :default_enabled do + enabled { ChatKit::Session::Defaults::ENABLED } + end + trait :no_thread_limit do recent_threads { nil } end @@ -70,6 +99,10 @@ recent_threads { 1000 } end + trait :default_recent_threads do + recent_threads { nil } + end + initialize_with { new(enabled:, recent_threads:) } end @@ -104,6 +137,12 @@ history_params { { enabled: nil, recent_threads: nil } } end + trait :with_objects do + automatic_thread_titling_params { build(:automatic_thread_titling) } + file_upload_params { build(:file_upload) } + history_params { build(:history) } + end + initialize_with do new( file_upload: file_upload_params, diff --git a/spec/factories/response.rb b/spec/factories/response.rb new file mode 100644 index 0000000..fc2cf21 --- /dev/null +++ b/spec/factories/response.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :base_response, class: "ChatKit::Session::BaseResponse" do + id { "sess_abc123" } + object { "chatkit.session" } + status { "active" } + association :chatkit_configuration + client_secret { "secret_xyz789" } + expires_at { (Time.now + 3600).to_i.to_s } + max_requests_per_1_minute { 10 } + association :rate_limits + user { { "id" => "user_123", "name" => "John Doe" } } + association :workflow + + trait :expired do + status { "expired" } + expires_at { (Time.now - 3600).to_i.to_s } + end + + trait :with_nil_user do + user { nil } + end + + trait :with_empty_user do + user { {} } + end + + trait :high_rate_limit do + max_requests_per_1_minute { 100 } + end + + trait :low_rate_limit do + max_requests_per_1_minute { 1 } + end + + initialize_with do + new( + id:, + object:, + status:, + chatkit_configuration:, + client_secret:, + expires_at:, + max_requests_per_1_minute:, + rate_limits:, + user:, + workflow: + ) + end + end +end diff --git a/spec/fixtures/session/create/missing_header.json b/spec/fixtures/session/create/missing_header.json new file mode 100644 index 0000000..362f302 --- /dev/null +++ b/spec/fixtures/session/create/missing_header.json @@ -0,0 +1,8 @@ +{ + "error": { + "message": "You must provide the 'OpenAI-Beta' header to access the Chatkit API. Please try again by setting the header 'OpenAI-Beta: chatkit_beta=v1'.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_beta" + } +} diff --git a/spec/fixtures/session/create/missing_user.json b/spec/fixtures/session/create/missing_user.json new file mode 100644 index 0000000..ec092b7 --- /dev/null +++ b/spec/fixtures/session/create/missing_user.json @@ -0,0 +1,8 @@ +{ + "error": { + "message": "Missing required parameter: 'user'.", + "type": "invalid_request_error", + "param": "user", + "code": "missing_required_parameter" + } +} diff --git a/spec/fixtures/session/create/missing_workflow.json b/spec/fixtures/session/create/missing_workflow.json new file mode 100644 index 0000000..a9f43e3 --- /dev/null +++ b/spec/fixtures/session/create/missing_workflow.json @@ -0,0 +1,8 @@ +{ + "error": { + "message": "Missing required parameter: 'workflow'.", + "type": "invalid_request_error", + "param": "workflow", + "code": "missing_required_parameter" + } +} diff --git a/spec/fixtures/session/create/success.json b/spec/fixtures/session/create/success.json new file mode 100644 index 0000000..eac6b1e --- /dev/null +++ b/spec/fixtures/session/create/success.json @@ -0,0 +1,35 @@ +{ + "id": "sess_abc123", + "object": "chatkit.session", + "status": "active", + "client_secret": "chatkit_token_123", + "expires_at": "1234567890", + "max_requests_per_1_minute": 60, + "chatkit_configuration": { + "history": { + "enabled": true + }, + "file_upload": { + "enabled": true, + "max_file_size_mb": 10, + "max_files": 5 + }, + "automatic_thread_titling": { + "enabled": false + } + }, + "rate_limits": { + "max_requests_per_1_minute": 60 + }, + "user": { + "id": "user_123" + }, + "workflow": { + "id": "workflow_alpha", + "version": "2024-10-01", + "state_variables": null, + "tracing": { + "enabled": false + } + } +} diff --git a/spec/fixtures/session/create/unauthorized.json b/spec/fixtures/session/create/unauthorized.json new file mode 100644 index 0000000..cb2fdd0 --- /dev/null +++ b/spec/fixtures/session/create/unauthorized.json @@ -0,0 +1,8 @@ +{ + "error": { + "message": "Missing bearer or basic authentication in header", + "type": "invalid_request_error", + "param": null, + "code": null + } +} diff --git a/spec/fixtures/session/create/workflow_not_found.json b/spec/fixtures/session/create/workflow_not_found.json new file mode 100644 index 0000000..e466fff --- /dev/null +++ b/spec/fixtures/session/create/workflow_not_found.json @@ -0,0 +1,8 @@ +{ + "error": { + "message": "Workflow with id 'wf_123...' not found.", + "type": "invalid_request_error", + "param": null, + "code": null + } +} diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 46899bd..973e0ff 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -10,6 +10,9 @@ # Configure WebMock WebMock.disable_net_connect!(allow_localhost: true) +# Load support files (helpers, shared contexts) +Dir[File.join(__dir__, "support/**/*.rb")].sort.each { |f| require f } + RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status" diff --git a/spec/support/fixture_helper.rb b/spec/support/fixture_helper.rb new file mode 100644 index 0000000..151509e --- /dev/null +++ b/spec/support/fixture_helper.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module FixtureHelper + # Load fixture file from spec/fixtures. + # Usage: load_fixture("session/create/success.json") or + # load_fixture("success.json", subdir: "session/create") + def load_fixture(filename, subdir: nil) + subdir_path = subdir ? File.join("spec", "fixtures", subdir, filename) : File.join("spec", "fixtures", filename) + + path = if defined?(Rails) && Rails.respond_to?(:root) + Rails.root.join(subdir_path) + else + File.expand_path(File.join(__dir__, "..", + subdir ? File.join("fixtures", subdir, filename) : File.join("fixtures", filename))) + end + + File.read(path) + end +end + +RSpec.configure do |config| + config.include FixtureHelper +end From 9cde6b312f2a06d83cc7b42f86423e2a0103cfdd Mon Sep 17 00:00:00 2001 From: Raniery Date: Thu, 11 Dec 2025 09:37:43 -0300 Subject: [PATCH 03/10] feat: add workflow improvements --- lib/chatkit/conversation/response/thread/item.rb | 16 +++------------- .../response/thread/item/workflow.rb | 2 ++ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/lib/chatkit/conversation/response/thread/item.rb b/lib/chatkit/conversation/response/thread/item.rb index a71cc26..9628cc8 100644 --- a/lib/chatkit/conversation/response/thread/item.rb +++ b/lib/chatkit/conversation/response/thread/item.rb @@ -84,7 +84,7 @@ def from_event(data) inference_options: data["inference_options"] || {}, content: data["content"] || [], quoted_text: data["quoted_text"] || "", - workflow: parse_workflow_data(data) + workflow: Workflow.from_event(data["workflow"]) ) end end @@ -118,7 +118,7 @@ def update_from_event!(data) if @workflow @workflow.update!(data["workflow"]) else - @workflow = parse_workflow_data(data) + @workflow = Workflow.from_event(data["workflow"]) end end @@ -138,17 +138,6 @@ def process_update!(update_data) end end - protected - - # Parse workflow data from event - # @param data [Hash] The event data - # @return [Workflow, nil] - def parse_workflow_data(data) - return nil unless data["workflow"] - - Workflow.from_event(data["workflow"]) - end - private # Parse content array into Content objects @@ -190,6 +179,7 @@ def handle_content_part_added!(update_data) # @return [void] def handle_text_delta!(update_data) delta_text = update_data["delta"] + return unless delta_text @delta << delta_text diff --git a/lib/chatkit/conversation/response/thread/item/workflow.rb b/lib/chatkit/conversation/response/thread/item/workflow.rb index 1713270..74ae69a 100644 --- a/lib/chatkit/conversation/response/thread/item/workflow.rb +++ b/lib/chatkit/conversation/response/thread/item/workflow.rb @@ -43,6 +43,8 @@ def initialize(type: nil, tasks: nil, summary: nil, expanded: nil, response_item # @param data [Hash] The workflow data from the event # @return [Workflow] def self.from_event(data) + return nil if data.nil? + new( type: data["type"], tasks: data["tasks"], From fdd09387f14a4f7d60a34e146a3d952279d6b4e3 Mon Sep 17 00:00:00 2001 From: Raniery Date: Thu, 11 Dec 2025 09:38:19 -0300 Subject: [PATCH 04/10] feat: add scope class --- lib/chatkit/session/cancel/scope.rb | 27 +++++++++++++ spec/chatkit/session/cancel/scope_spec.rb | 49 +++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 lib/chatkit/session/cancel/scope.rb create mode 100644 spec/chatkit/session/cancel/scope_spec.rb diff --git a/lib/chatkit/session/cancel/scope.rb b/lib/chatkit/session/cancel/scope.rb new file mode 100644 index 0000000..0b6de38 --- /dev/null +++ b/lib/chatkit/session/cancel/scope.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module ChatKit + class Session + class Cancel + # Represents scope from cancel session response. + class Scope + # @!attribute [rw] customer_id + # @return [String] + attr_accessor :customer_id + + # param customer_id [String] The ID of the scope. + def initialize(customer_id:) + @customer_id = customer_id + end + + class << self + def deserialize(data) + new( + customer_id: data&.dig("customer_id") + ) + end + end + end + end + end +end diff --git a/spec/chatkit/session/cancel/scope_spec.rb b/spec/chatkit/session/cancel/scope_spec.rb new file mode 100644 index 0000000..57a67b2 --- /dev/null +++ b/spec/chatkit/session/cancel/scope_spec.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +RSpec.describe ChatKit::Session::Cancel::Scope do + describe ".new" do + it "initializes with customer_id" do + instance = described_class.new(customer_id: "cust_123") + expect(instance.customer_id).to eq("cust_123") + end + + it "allows reading and writing customer_id" do + instance = described_class.new(customer_id: "initial") + instance.customer_id = "updated" + expect(instance.customer_id).to eq("updated") + end + end + + describe ".deserialize" do + context "when data is nil" do + it "returns an instance with nil customer_id" do + instance = described_class.deserialize(nil) + expect(instance).to be_a(described_class) + expect(instance.customer_id).to be_nil + end + end + + context "when data is an empty hash" do + it "returns an instance with nil customer_id" do + instance = described_class.deserialize({}) + expect(instance.customer_id).to be_nil + end + end + + context "when data contains customer_id" do + it "sets the customer_id value" do + data = { "customer_id" => "cust_999" } + instance = described_class.deserialize(data) + expect(instance.customer_id).to eq("cust_999") + end + end + + context "when data contains extra keys" do + it "extracts only known keys" do + data = { "customer_id" => "cust_x", "extra" => "ignored" } + instance = described_class.deserialize(data) + expect(instance.customer_id).to eq("cust_x") + end + end + end +end From 94c19508317ec830e5c54a7f491a892b7f2104fa Mon Sep 17 00:00:00 2001 From: Raniery Date: Thu, 11 Dec 2025 09:38:31 -0300 Subject: [PATCH 05/10] feat: add cancel response class --- lib/chatkit/session/cancel/response.rb | 56 +++++++++++++++ spec/chatkit/session/cancel/response_spec.rb | 72 ++++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 lib/chatkit/session/cancel/response.rb create mode 100644 spec/chatkit/session/cancel/response_spec.rb diff --git a/lib/chatkit/session/cancel/response.rb b/lib/chatkit/session/cancel/response.rb new file mode 100644 index 0000000..a71d098 --- /dev/null +++ b/lib/chatkit/session/cancel/response.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +module ChatKit + class Session + class Cancel + # Represents the response from cancel session. + class Response < Session::BaseResponse + # @!attribute [rw] cancelled_at + # @return [String] + attr_accessor :cancelled_at + + # @!attribute [rw] scope + # @return [Scope, nil] + attr_accessor :scope + + # @!attribute [rw] ttl_seconds + # @return [Integer, nil] + attr_accessor :ttl_seconds + + # @param cancelled_at [String] The cancellation time. + def initialize(cancelled_at:, scope:, ttl_seconds:, **kwargs) + super(**kwargs) + + @cancelled_at = cancelled_at + @scope = scope + @ttl_seconds = ttl_seconds + end + + class << self + def deserialize(data) + chatkit_configuration = Session::ChatKitConfiguration.deserialize(data&.dig("chatkit_configuration")) + rate_limits = Session::RateLimits.deserialize(data&.dig("rate_limits")) + scope = Scope.deserialize(data&.dig("scope")) + workflow = Session::Workflow.deserialize(data&.dig("workflow")) + + new( + id: data&.dig("id"), + object: data&.dig("object"), + status: data&.dig("status"), + client_secret: data&.dig("client_secret"), + expires_at: data&.dig("expires_at"), + max_requests_per_1_minute: data&.dig("max_requests_per_1_minute"), + user: data&.dig("user"), + ttl_seconds: data&.dig("ttl_seconds"), + cancelled_at: data&.dig("cancelled_at"), + chatkit_configuration:, + rate_limits:, + scope:, + workflow: + ) + end + end + end + end + end +end diff --git a/spec/chatkit/session/cancel/response_spec.rb b/spec/chatkit/session/cancel/response_spec.rb new file mode 100644 index 0000000..b7830b9 --- /dev/null +++ b/spec/chatkit/session/cancel/response_spec.rb @@ -0,0 +1,72 @@ +# frozen_string_literal: true + +require "spec_helper" + +RSpec.describe ChatKit::Session::Cancel::Response do + describe ".deserialize" do + subject(:response) { described_class.deserialize(data) } + + let(:data) do + { + "id" => "sess_123", + "object" => "session", + "status" => "cancelled", + "client_secret" => "secret", + "expires_at" => "2025-12-11T00:00:00Z", + "max_requests_per_1_minute" => 10, + "user" => "user_1", + "ttl_seconds" => 3600, + "cancelled_at" => "2025-12-10T00:00:00Z", + "chatkit_configuration" => { "some_key" => "value" }, + "rate_limits" => { "max_requests_per_1_minute" => 10 }, + "scope" => { "customer_id" => "cust_1" }, + "workflow" => { "id" => "wf_1", "version" => "v1" }, + } + end + + it "returns a Response instance" do + expect(response).to be_a(described_class) + end + + it "sets scalar attributes from the input hash" do + expect(response.id).to eq("sess_123") + expect(response.object).to eq("session") + expect(response.status).to eq("cancelled") + expect(response.client_secret).to eq("secret") + expect(response.expires_at).to eq("2025-12-11T00:00:00Z") + expect(response.max_requests_per_1_minute).to eq(10) + expect(response.user).to eq("user_1") + expect(response.ttl_seconds).to eq(3600) + expect(response.cancelled_at).to eq("2025-12-10T00:00:00Z") + end + + it "deserializes nested objects" do + expect(response.chatkit_configuration).to be_a(ChatKit::Session::ChatKitConfiguration) + expect(response.rate_limits).to be_a(ChatKit::Session::RateLimits) + expect(response.scope).to be_a(ChatKit::Session::Cancel::Scope) + expect(response.workflow).to be_a(ChatKit::Session::Workflow) + end + + context "when data is nil" do + subject(:response_nil) { described_class.deserialize(nil) } + + it "returns a Response instance with nil scalars and default nested objects" do + expect(response_nil).to be_a(described_class) + expect(response_nil.id).to be_nil + expect(response_nil.object).to be_nil + expect(response_nil.status).to be_nil + expect(response_nil.client_secret).to be_nil + expect(response_nil.expires_at).to be_nil + expect(response_nil.max_requests_per_1_minute).to be_nil + expect(response_nil.user).to be_nil + expect(response_nil.ttl_seconds).to be_nil + expect(response_nil.cancelled_at).to be_nil + + expect(response_nil.chatkit_configuration).to be_a(ChatKit::Session::ChatKitConfiguration) + expect(response_nil.rate_limits).to be_a(ChatKit::Session::RateLimits) + expect(response_nil.scope).to be_a(ChatKit::Session::Cancel::Scope) + expect(response_nil.workflow).to be_a(ChatKit::Session::Workflow) + end + end + end +end From 729f09c806277ddc643242d4b2813ebe7ad34116 Mon Sep 17 00:00:00 2001 From: Raniery Date: Thu, 11 Dec 2025 09:39:28 -0300 Subject: [PATCH 06/10] feat: add a class to handle session cancellation --- lib/chatkit/session/cancel.rb | 55 ++++ spec/chatkit/session/cancel_spec.rb | 282 ++++++++++++++++++ .../session/cancel/invalid_session_id.json | 8 + .../session/cancel/missing_header.json | 8 + spec/fixtures/session/cancel/success.json | 34 +++ .../fixtures/session/cancel/unauthorized.json | 8 + 6 files changed, 395 insertions(+) create mode 100644 lib/chatkit/session/cancel.rb create mode 100644 spec/chatkit/session/cancel_spec.rb create mode 100644 spec/fixtures/session/cancel/invalid_session_id.json create mode 100644 spec/fixtures/session/cancel/missing_header.json create mode 100644 spec/fixtures/session/cancel/success.json create mode 100644 spec/fixtures/session/cancel/unauthorized.json diff --git a/lib/chatkit/session/cancel.rb b/lib/chatkit/session/cancel.rb new file mode 100644 index 0000000..1e012f0 --- /dev/null +++ b/lib/chatkit/session/cancel.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +module ChatKit + class Session + # Represents the Cancel Session operation. + # source: https://platform.openai.com/docs/api-reference/chatkit/sessions/cancel + class Cancel + class CancelError < StandardError; end + + # @param session_id [String] The ID of the session to cancel. + # @param client [Ruby::ChatKit::Client, nil] - optional - The ChatKit client instance. + def initialize(session_id:, client: Client.new) + @session_id = session_id + @client = client + end + + class << self + # @param session_id [String] The ID of the session to cancel. + def call(session_id:, client: Client.new) + new(session_id:, client:).call + end + end + + # Executes the Cancel Session operation. + # @return [Cancel::Response] The response object. + def call + perform_request + end + + private + + # Performs the HTTP request to create a session. + # + # @param payload [Hash] The request payload. + # @return [Net::HTTPResponse] The HTTP response. + def perform_request + response = @client.connection.headers(sessions_header).post(cancel_session_endpoint) + + raise CancelError, "Failed to cancel session: #{response.status}" unless response.status.success? + + Response.deserialize(response.parse) + end + + # @return [String] The endpoint URL for sessions. + def cancel_session_endpoint + Request::Endpoints.cancel_session_endpoint({ id: @session_id }) + end + + # @return [Hash] The headers for session requests. + def sessions_header + Request::Headers.sessions_header + end + end + end +end diff --git a/spec/chatkit/session/cancel_spec.rb b/spec/chatkit/session/cancel_spec.rb new file mode 100644 index 0000000..522461f --- /dev/null +++ b/spec/chatkit/session/cancel_spec.rb @@ -0,0 +1,282 @@ +# frozen_string_literal: true + +RSpec.describe ChatKit::Session::Cancel do + let(:api_key) { "test_api_key_123" } + let(:host) { "https://api.openai.com" } + let(:session_id) { "cksess_123" } + let(:client) { ChatKit::Client.new(api_key:, host:) } + + before do + # Configure ChatKit with API key + ChatKit.configure do |config| + config.api_key = api_key + config.host = host + end + end + + describe ".new" do + context "when all required arguments are provided" do + it "initializes with session_id" do + instance = described_class.new(session_id:, client:) + + expect(instance.instance_variable_get(:@session_id)).to eq(session_id) + expect(instance.instance_variable_get(:@client)).to eq(client) + end + end + + context "when client is not provided" do + it "initializes with default client" do + instance = described_class.new(session_id:) + + expect(instance.instance_variable_get(:@session_id)).to eq(session_id) + expect(instance.instance_variable_get(:@client)).to be_a(ChatKit::Client) + end + end + end + + describe ".call" do + it "creates a new instance and calls #call" do + success_response = load_fixture("success.json", subdir: "session/cancel") + + stub_request(:post, "#{host}/v1/chatkit/sessions/#{session_id}/cancel") + .to_return(status: 200, body: success_response, headers: { "Content-Type" => "application/json" }) + + expect(described_class).to receive(:new).with(session_id:, client:).and_call_original + + result = described_class.call(session_id:, client:) + expect(result).to be_a(ChatKit::Session::Cancel::Response) + end + end + + describe "#call" do + context "when API returns success response (200)" do + let(:success_response) { load_fixture("success.json", subdir: "session/cancel") } + + before do + stub_request(:post, "#{host}/v1/chatkit/sessions/#{session_id}/cancel") + .to_return(status: 200, body: success_response, headers: { "Content-Type" => "application/json" }) + end + + it "returns a Response object" do + instance = described_class.new(session_id:, client:) + result = instance.call + + expect(result).to be_a(ChatKit::Session::Cancel::Response) + end + + it "correctly deserializes the response" do + instance = described_class.new(session_id:, client:) + result = instance.call + + expect(result.id).to eq("cksess_123") + expect(result.object).to eq("chatkit.session") + expect(result.status).to eq("cancelled") + expect(result.user).to eq("123") + expect(result.expires_at).to eq(1_765_453_320) + expect(result.max_requests_per_1_minute).to eq(10) + end + + it "includes chatkit_configuration" do + instance = described_class.new(session_id:, client:) + result = instance.call + + expect(result.chatkit_configuration).to be_a(ChatKit::Session::ChatKitConfiguration) + expect(result.chatkit_configuration.automatic_thread_titling.enabled).to be true + expect(result.chatkit_configuration.file_upload.enabled).to be false + expect(result.chatkit_configuration.file_upload.max_file_size).to eq(512) + expect(result.chatkit_configuration.file_upload.max_files).to eq(10) + expect(result.chatkit_configuration.history.enabled).to be true + end + + it "includes rate_limits" do + instance = described_class.new(session_id:, client:) + result = instance.call + + expect(result.rate_limits).to be_a(ChatKit::Session::RateLimits) + expect(result.rate_limits.max_requests_per_1_minute).to eq(10) + end + + it "includes workflow information" do + instance = described_class.new(session_id:, client:) + result = instance.call + + expect(result.workflow).to be_a(ChatKit::Session::Workflow) + expect(result.workflow.id).to eq("wf_123") + expect(result.workflow.tracing.enabled).to be true + end + + it "sends correct headers" do + request_stub = stub_request(:post, "#{host}/v1/chatkit/sessions/#{session_id}/cancel") + .with( + headers: { + "Authorization" => "Bearer #{api_key}", + "Accept" => "application/json", + "Content-Type" => "application/json", + "OpenAI-Beta" => "chatkit_beta=v1", + } + ) + .to_return(status: 200, body: success_response, headers: { "Content-Type" => "application/json" }) + + instance = described_class.new(session_id:, client:) + instance.call + + expect(request_stub).to have_been_requested + end + + it "makes POST request to correct endpoint" do + request_stub = stub_request(:post, "#{host}/v1/chatkit/sessions/#{session_id}/cancel") + .to_return(status: 200, body: success_response, headers: { "Content-Type" => "application/json" }) + + instance = described_class.new(session_id:, client:) + instance.call + + expect(request_stub).to have_been_requested.once + end + end + + context "when API returns 401 unauthorized error" do + let(:unauthorized_response) { load_fixture("unauthorized.json", subdir: "session/cancel") } + + before do + stub_request(:post, "#{host}/v1/chatkit/sessions/#{session_id}/cancel") + .to_return(status: 401, body: unauthorized_response, headers: { "Content-Type" => "application/json" }) + end + + it "raises CancelError" do + instance = described_class.new(session_id:, client:) + + expect { instance.call }.to raise_error( + ChatKit::Session::Cancel::CancelError, + "Failed to cancel session: 401 Unauthorized" + ) + end + end + + context "when API returns 400 with invalid session_id" do + let(:invalid_session_id_response) { load_fixture("invalid_session_id.json", subdir: "session/cancel") } + let(:invalid_session_id) { "id" } + + before do + stub_request(:post, "#{host}/v1/chatkit/sessions/#{invalid_session_id}/cancel") + .to_return(status: 400, body: invalid_session_id_response, headers: { "Content-Type" => "application/json" }) + end + + it "raises CancelError" do + instance = described_class.new(session_id: invalid_session_id, client:) + + expect { instance.call }.to raise_error( + ChatKit::Session::Cancel::CancelError, + "Failed to cancel session: 400 Bad Request" + ) + end + + it "includes the invalid session_id in the request" do + request_stub = stub_request(:post, "#{host}/v1/chatkit/sessions/#{invalid_session_id}/cancel") + .to_return(status: 400, body: invalid_session_id_response, headers: { "Content-Type" => "application/json" }) + + instance = described_class.new(session_id: invalid_session_id, client:) + + expect { instance.call }.to raise_error(ChatKit::Session::Cancel::CancelError) + expect(request_stub).to have_been_requested + end + end + + context "when API returns 400 with missing header" do + let(:missing_header_response) { load_fixture("missing_header.json", subdir: "session/cancel") } + + before do + stub_request(:post, "#{host}/v1/chatkit/sessions/#{session_id}/cancel") + .to_return(status: 400, body: missing_header_response, headers: { "Content-Type" => "application/json" }) + end + + it "raises CancelError" do + instance = described_class.new(session_id:, client:) + + expect { instance.call }.to raise_error( + ChatKit::Session::Cancel::CancelError, + "Failed to cancel session: 400 Bad Request" + ) + end + end + + context "when API returns 404 not found" do + before do + stub_request(:post, "#{host}/v1/chatkit/sessions/#{session_id}/cancel") + .to_return(status: 404, body: '{"error": {"message": "Session not found"}}', headers: { "Content-Type" => "application/json" }) + end + + it "raises CancelError" do + instance = described_class.new(session_id:, client:) + + expect { instance.call }.to raise_error( + ChatKit::Session::Cancel::CancelError, + "Failed to cancel session: 404 Not Found" + ) + end + end + + context "when API returns 500 server error" do + before do + stub_request(:post, "#{host}/v1/chatkit/sessions/#{session_id}/cancel") + .to_return(status: 500, body: '{"error": {"message": "Internal server error"}}', headers: { "Content-Type" => "application/json" }) + end + + it "raises CancelError" do + instance = described_class.new(session_id:, client:) + + expect { instance.call }.to raise_error( + ChatKit::Session::Cancel::CancelError, + "Failed to cancel session: 500 Internal Server Error" + ) + end + end + + context "when network error occurs" do + before do + stub_request(:post, "#{host}/v1/chatkit/sessions/#{session_id}/cancel") + .to_raise(StandardError.new("Connection refused")) + end + + it "raises the network error" do + instance = described_class.new(session_id:, client:) + + expect { instance.call }.to raise_error(StandardError, "Connection refused") + end + end + + context "when timeout occurs" do + before do + stub_request(:post, "#{host}/v1/chatkit/sessions/#{session_id}/cancel") + .to_timeout + end + + it "raises timeout error" do + instance = described_class.new(session_id:, client:) + + expect { instance.call }.to raise_error(StandardError) + end + end + end + + describe "private methods" do + let(:instance) { described_class.new(session_id:, client:) } + + describe "#cancel_session_endpoint" do + it "returns correct endpoint URL" do + endpoint = instance.send(:cancel_session_endpoint) + + expect(endpoint).to eq("/v1/chatkit/sessions/#{session_id}/cancel") + end + end + + describe "#sessions_header" do + it "returns correct headers" do + headers = instance.send(:sessions_header) + + expect(headers).to include( + "OpenAI-Beta" => "chatkit_beta=v1" + ) + end + end + end +end diff --git a/spec/fixtures/session/cancel/invalid_session_id.json b/spec/fixtures/session/cancel/invalid_session_id.json new file mode 100644 index 0000000..e69f3f7 --- /dev/null +++ b/spec/fixtures/session/cancel/invalid_session_id.json @@ -0,0 +1,8 @@ +{ + "error": { + "message": "Invalid 'session_id': 'id'. Expected an ID that begins with 'cksess'.", + "type": "invalid_request_error", + "param": "session_id", + "code": "invalid_value" + } +} diff --git a/spec/fixtures/session/cancel/missing_header.json b/spec/fixtures/session/cancel/missing_header.json new file mode 100644 index 0000000..a37eccb --- /dev/null +++ b/spec/fixtures/session/cancel/missing_header.json @@ -0,0 +1,8 @@ +{ + "error": { + "message": "You must provide the 'OpenAI-Beta' header to access the Chatkit API. Please try again by setting the header 'OpenAI-Beta: chatkit_beta=v1'.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_beta" + } +} diff --git a/spec/fixtures/session/cancel/success.json b/spec/fixtures/session/cancel/success.json new file mode 100644 index 0000000..8a58c22 --- /dev/null +++ b/spec/fixtures/session/cancel/success.json @@ -0,0 +1,34 @@ +{ + "id": "cksess_123", + "object": "chatkit.session", + "status": "cancelled", + "chatkit_configuration": { + "automatic_thread_titling": { + "enabled": true + }, + "file_upload": { + "enabled": false, + "max_file_size": 512, + "max_files": 10 + }, + "history": { + "enabled": true, + "recent_threads": null + } + }, + "client_secret": "", + "expires_at": 1765453320, + "max_requests_per_1_minute": 10, + "rate_limits": { + "max_requests_per_1_minute": 10 + }, + "user": "123", + "workflow": { + "id": "wf_123", + "state_variables": null, + "tracing": { + "enabled": true + }, + "version": null + } +} diff --git a/spec/fixtures/session/cancel/unauthorized.json b/spec/fixtures/session/cancel/unauthorized.json new file mode 100644 index 0000000..089d835 --- /dev/null +++ b/spec/fixtures/session/cancel/unauthorized.json @@ -0,0 +1,8 @@ +{ + "error": { + "message": "Missing bearer or basic authentication in header", + "type": "invalid_request_error", + "param": null, + "code": null + } +} From b34072c53d3db444a032be7fcae91e6d213afaec Mon Sep 17 00:00:00 2001 From: Raniery Date: Thu, 11 Dec 2025 09:39:47 -0300 Subject: [PATCH 07/10] feat: add cancel session method to client --- lib/chatkit/client.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/chatkit/client.rb b/lib/chatkit/client.rb index 25ffe37..a925481 100644 --- a/lib/chatkit/client.rb +++ b/lib/chatkit/client.rb @@ -58,6 +58,17 @@ def create_session!(user_id:, workflow_id:, chatkit_configuration: nil, expires_ ) end + # Cancels the current session or a specified session by ID. + # @param session_id [String] - The ID of the session to cancel. + # + # @raise [RuntimeError] If no session ID is provided and there is no current session. + # @return [Session::Cancel::Response] The response from the cancel operation. + def cancel_session!(session_id:) + raise "No session ID provided" if session_id.nil? + + Session.cancel!(session_id:, client: self) + end + # Sends a message in a conversation, optionally uploading files. # @param text [String] The text message to send. # @param files [Array] - optional - The files to upload and attach to the message. From 49d2c4a15df3b98859b2eec2adf8462b3018a0b7 Mon Sep 17 00:00:00 2001 From: Raniery Date: Mon, 5 Jan 2026 11:30:09 -0300 Subject: [PATCH 08/10] fix: rubocop style warnings --- lib/chatkit/client.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/chatkit/client.rb b/lib/chatkit/client.rb index 4fb46c3..dc7e831 100644 --- a/lib/chatkit/client.rb +++ b/lib/chatkit/client.rb @@ -28,11 +28,11 @@ module OpenAI # @param timeout [Integer, nil] - optional - The timeout for requests. # @param logger [Logger, nil] - optional - The logger instance. def initialize( - api_key: ChatKit.configuration.api_key, + api_key: ChatKit.configuration.api_key, host: ChatKit.configuration.host, timeout: ChatKit.configuration.timeout, logger: nil - ) + ) @api_key = api_key @host = host @timeout = timeout From 63953cd0b7755e279cf478fc9c87bf6da202c9d5 Mon Sep 17 00:00:00 2001 From: Raniery Date: Mon, 5 Jan 2026 11:30:42 -0300 Subject: [PATCH 09/10] spec: fix some broken specs --- spec/chatkit/client_spec.rb | 118 ++++-------------------------------- spec/factories/config.rb | 16 +---- 2 files changed, 15 insertions(+), 119 deletions(-) diff --git a/spec/chatkit/client_spec.rb b/spec/chatkit/client_spec.rb index 971b8ab..ed57342 100644 --- a/spec/chatkit/client_spec.rb +++ b/spec/chatkit/client_spec.rb @@ -16,48 +16,17 @@ describe ".new" do context "when no parameters are provided" do it "uses configuration defaults" do - config = build(:config, api_key: "factory_api_key", host: "https://factory-host.com") - allow(ChatKit).to receive(:configuration).and_return(config) - + ChatKit.configuration = build(:config, api_key: "factory_config_api_key", host: ChatKit::Client::OpenAI::HOST) client = described_class.new - expect(client.api_key).to eq("factory_api_key") - expect(client.host).to eq("https://factory-host.com") - end - - it "works with production configuration" do - config = build(:config, :production_config) - allow(ChatKit).to receive(:configuration).and_return(config) - - client = described_class.new - - expect(client.api_key).to eq("sk-prod123456789") + expect(client.api_key).to eq("factory_config_api_key") expect(client.host).to eq(ChatKit::Client::OpenAI::HOST) end - - it "works with development configuration" do - config = build(:config, :development_config) - allow(ChatKit).to receive(:configuration).and_return(config) - - client = described_class.new - - expect(client.api_key).to eq("dev_key_123") - expect(client.host).to eq("http://localhost:8000") - end end context "when both parameters are provided" do - it "initializes with provided api_key and host" do - client = described_class.new(api_key: test_api_key, host: test_host) - - expect(client.api_key).to eq(test_api_key) - expect(client.host).to eq(test_host) - end - it "overrides configuration values" do - config = build(:config, api_key: "config_key", host: "https://config.com") - allow(ChatKit).to receive(:configuration).and_return(config) - + ChatKit.configuration = build(:config, api_key: "config_key", host: "https://config.com") client = described_class.new(api_key: test_api_key, host: test_host) expect(client.api_key).to eq(test_api_key) @@ -67,19 +36,7 @@ context "when only api_key is provided" do it "uses provided api_key and default host from configuration" do - config = build(:config, host: "https://factory-config-host.com") - allow(ChatKit).to receive(:configuration).and_return(config) - - client = described_class.new(api_key: test_api_key) - - expect(client.api_key).to eq(test_api_key) - expect(client.host).to eq("https://factory-config-host.com") - end - - it "works with production host from config" do - config = build(:config, :with_production_host) - allow(ChatKit).to receive(:configuration).and_return(config) - + ChatKit.configuration = build(:config, host: ChatKit::Client::OpenAI::HOST) client = described_class.new(api_key: test_api_key) expect(client.api_key).to eq(test_api_key) @@ -89,19 +46,15 @@ context "when only host is provided" do it "uses provided host and default api_key from configuration" do - config = build(:config, api_key: "factory_config_api_key") - allow(ChatKit).to receive(:configuration).and_return(config) - + ChatKit.configuration = build(:config, api_key: "default_config_api_key") client = described_class.new(host: test_host) - expect(client.api_key).to eq("factory_config_api_key") + expect(client.api_key).to eq("default_config_api_key") expect(client.host).to eq(test_host) end it "works with nil api_key from config" do - config = build(:config, :with_nil_api_key) - allow(ChatKit).to receive(:configuration).and_return(config) - + ChatKit.configuration = build(:config, :with_nil_api_key) client = described_class.new(host: test_host) expect(client.api_key).to be_nil @@ -165,6 +118,8 @@ end describe "attribute accessors" do + before { ChatKit.configuration = build(:config, api_key: test_api_key, host: test_host) } + let(:client) { described_class.new(api_key: test_api_key, host: test_host) } describe "#api_key" do @@ -224,6 +179,8 @@ let(:mock_http_connection) { instance_double(HTTP::Client) } before do + ChatKit.configuration = build(:config, api_key: test_api_key, host: test_host) + allow(HTTP).to receive(:persistent).with(test_host).and_return(mock_http_base) allow(mock_http_base).to receive(:auth).with("Bearer #{test_api_key}").and_return(mock_http_connection) end @@ -293,27 +250,16 @@ end describe "integration with configuration" do - let(:mock_config) { instance_double(ChatKit::Config, api_key: "config_key", host: "https://config.com") } - - before do - allow(ChatKit).to receive(:configuration).and_return(mock_config) - end - it "uses configuration values as defaults" do + ChatKit.configuration = build(:config, api_key: "config_key", host: "https://config.com") client = described_class.new expect(client.api_key).to eq("config_key") expect(client.host).to eq("https://config.com") end - it "overrides configuration with explicit parameters" do - client = described_class.new(api_key: "explicit_key", host: "https://explicit.com") - - expect(client.api_key).to eq("explicit_key") - expect(client.host).to eq("https://explicit.com") - end - it "partially overrides configuration" do + ChatKit.configuration = build(:config, api_key: "config_key", host: "https://config.com") client = described_class.new(api_key: "explicit_key") expect(client.api_key).to eq("explicit_key") @@ -367,42 +313,4 @@ end end end - - describe "real-world scenarios" do - context "with OpenAI production setup" do - it "can be configured for OpenAI API" do - client = described_class.new( - api_key: "sk-real_openai_key_here", - host: ChatKit::Client::OpenAI::HOST - ) - - expect(client.api_key).to eq("sk-real_openai_key_here") - expect(client.host).to eq("https://api.openai.com") - end - end - - context "with development setup" do - it "can be configured for local development" do - client = described_class.new( - api_key: "dev_key", - host: "http://localhost:8000" - ) - - expect(client.api_key).to eq("dev_key") - expect(client.host).to eq("http://localhost:8000") - end - end - - context "with environment-based configuration" do - it "respects environment variables through configuration" do - mock_config = instance_double(ChatKit::Config, api_key: "env_api_key", host: "https://env-host.com") - allow(ChatKit).to receive(:configuration).and_return(mock_config) - - client = described_class.new - - expect(client.api_key).to eq("env_api_key") - expect(client.host).to eq("https://env-host.com") - end - end - end end diff --git a/spec/factories/config.rb b/spec/factories/config.rb index 39fa069..12cbb9f 100644 --- a/spec/factories/config.rb +++ b/spec/factories/config.rb @@ -4,6 +4,7 @@ factory :config, class: "ChatKit::Config" do api_key { "test_api_key_456" } host { "https://test-config.openai.com" } + timeout { nil } trait :with_nil_api_key do api_key { nil } @@ -25,19 +26,6 @@ host { "http://localhost:3000" } end - trait :with_environment_defaults do - transient do - env_api_key { "env_test_key_789" } - end - - before(:build) do |_config, evaluator| - allow(ENV).to receive(:fetch).with("OPENAI_API_KEY", nil).and_return(evaluator.env_api_key) - end - - api_key { nil } - host { ChatKit::Client::OpenAI::HOST } - end - trait :production_config do api_key { "sk-prod123456789" } host { ChatKit::Client::OpenAI::HOST } @@ -48,6 +36,6 @@ host { "http://localhost:8000" } end - initialize_with { new(api_key:, host:) } + initialize_with { new(api_key:, host:, timeout:) } end end From 89c8c3058b8c6b386a21474996abcd4732f1c564 Mon Sep 17 00:00:00 2001 From: Raniery Date: Mon, 5 Jan 2026 11:31:18 -0300 Subject: [PATCH 10/10] chore: change gem version --- Gemfile.lock | 2 +- lib/chatkit/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 88a2576..035c973 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - ruby-chatkit (0.1.9) + ruby-chatkit (0.2.0) base64 event_stream_parser http diff --git a/lib/chatkit/version.rb b/lib/chatkit/version.rb index b8ca8ad..a866bd6 100644 --- a/lib/chatkit/version.rb +++ b/lib/chatkit/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module ChatKit - VERSION = "0.1.9" + VERSION = "0.2.0" end