diff --git a/CHANGELOG.md b/CHANGELOG.md index 2aaa3823..9037fb95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [7.0.1] - 2024-04-30 + +### Fixed + +- Update to v2 of Assistants in Messages, Runs, RunSteps and Threads - thanks to [@willywg](https://github.com/willywg) and others for pointing this out. + ## [7.0.0] - 2024-04-27 ### Added diff --git a/Gemfile.lock b/Gemfile.lock index 2efb508e..477982ad 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - ruby-openai (7.0.0) + ruby-openai (7.0.1) event_stream_parser (>= 0.3.0, < 2.0.0) faraday (>= 1) faraday-multipart (>= 1) diff --git a/lib/openai/assistants.rb b/lib/openai/assistants.rb index 17e7b348..c7fbc2d0 100644 --- a/lib/openai/assistants.rb +++ b/lib/openai/assistants.rb @@ -1,7 +1,9 @@ module OpenAI class Assistants + BETA_VERSION = "v2".freeze + def initialize(client:) - @client = client.beta(assistants: "v2") + @client = client.beta(assistants: OpenAI::Assistants::BETA_VERSION) end def list diff --git a/lib/openai/batches.rb b/lib/openai/batches.rb index 621348db..fcc65a76 100644 --- a/lib/openai/batches.rb +++ b/lib/openai/batches.rb @@ -1,7 +1,7 @@ module OpenAI class Batches def initialize(client:) - @client = client.beta(assistants: "v1") + @client = client.beta(assistants: OpenAI::Assistants::BETA_VERSION) end def list diff --git a/lib/openai/messages.rb b/lib/openai/messages.rb index 079f1af3..1e335fd7 100644 --- a/lib/openai/messages.rb +++ b/lib/openai/messages.rb @@ -1,7 +1,7 @@ module OpenAI class Messages def initialize(client:) - @client = client.beta(assistants: "v1") + @client = client.beta(assistants: OpenAI::Assistants::BETA_VERSION) end def list(thread_id:, parameters: {}) diff --git a/lib/openai/run_steps.rb b/lib/openai/run_steps.rb index 9051f887..0a436dfe 100644 --- a/lib/openai/run_steps.rb +++ b/lib/openai/run_steps.rb @@ -1,7 +1,7 @@ module OpenAI class RunSteps def initialize(client:) - @client = client.beta(assistants: "v1") + @client = client.beta(assistants: OpenAI::Assistants::BETA_VERSION) end def list(thread_id:, run_id:, parameters: {}) diff --git a/lib/openai/runs.rb b/lib/openai/runs.rb index 6eb86a07..e1af4601 100644 --- a/lib/openai/runs.rb +++ b/lib/openai/runs.rb @@ -1,7 +1,7 @@ module OpenAI class Runs def initialize(client:) - @client = client.beta(assistants: "v1") + @client = client.beta(assistants: OpenAI::Assistants::BETA_VERSION) end def list(thread_id:, parameters: {}) diff --git a/lib/openai/threads.rb b/lib/openai/threads.rb index 19e4a4d8..ed494aac 100644 --- a/lib/openai/threads.rb +++ b/lib/openai/threads.rb @@ -1,7 +1,7 @@ module OpenAI class Threads def initialize(client:) - @client = client.beta(assistants: "v1") + @client = client.beta(assistants: OpenAI::Assistants::BETA_VERSION) end def retrieve(id:) diff --git a/lib/openai/version.rb b/lib/openai/version.rb index 66b3a2c1..766e8043 100644 --- a/lib/openai/version.rb +++ b/lib/openai/version.rb @@ -1,3 +1,3 @@ module OpenAI - VERSION = "7.0.0".freeze + VERSION = "7.0.1".freeze end diff --git a/spec/fixtures/cassettes/batches_cancel.yml b/spec/fixtures/cassettes/batches_cancel.yml index 613ab548..e7591b70 100644 --- a/spec/fixtures/cassettes/batches_cancel.yml +++ b/spec/fixtures/cassettes/batches_cancel.yml @@ -124,4 +124,66 @@ http_interactions: encoding: ASCII-8BIT string: '{"id":"batch_PUHjvg0ufFNNqFUop8cDU5RR","object":"batch","endpoint":"/v1/chat/completions","errors":null,"input_file_id":"file-BwiY5C5hJwpUrCiCxwc1OOjH","completion_window":"24h","status":"cancelling","output_file_id":null,"error_file_id":null,"created_at":1714223018,"in_progress_at":null,"expires_at":1714309418,"finalizing_at":null,"completed_at":null,"failed_at":null,"expired_at":null,"cancelling_at":1714223019,"cancelled_at":null,"request_counts":{"total":0,"completed":0,"failed":0},"metadata":null}' recorded_at: Sat, 27 Apr 2024 13:03:39 GMT +- request: + method: post + uri: https://api.openai.com/v1/batches/batch_vMMPgZwommDlITEXwEN2PmDb/cancel + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Content-Length: + - '0' + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:28:04 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_1b9b0babb2208a321a1f7eb63129e6dc + Openai-Processing-Ms: + - '561' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=ATci08rzrFM.dLl99saogIc4.DM8fPgG3cGJQgAoVfI-1714433284-1.0.1.1-4nZrjlGBuLUeYyDi793C17fBXOaPBmqd.n6JKDBgu.oHQzMjf5QH0YUh.EEsFoHl6yoF6w.Uo5BsdCrCG3ypFQ; + path=/; expires=Mon, 29-Apr-24 23:58:04 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=Oov5hun7cUlpR00qbg98Z6KBxqwqXmtOMH6UanVrt.g-1714433284725-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c310f93f8752cf-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: '{"id":"batch_vMMPgZwommDlITEXwEN2PmDb","object":"batch","endpoint":"/v1/chat/completions","errors":null,"input_file_id":"file-ra9iGYj6YGXlcGlliaz8TEmm","completion_window":"24h","status":"cancelling","output_file_id":null,"error_file_id":null,"created_at":1714433283,"in_progress_at":null,"expires_at":1714519683,"finalizing_at":null,"completed_at":null,"failed_at":null,"expired_at":null,"cancelling_at":1714433284,"cancelled_at":null,"request_counts":{"total":0,"completed":0,"failed":0},"metadata":null}' + recorded_at: Mon, 29 Apr 2024 23:28:04 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/batches_cancel_input.yml b/spec/fixtures/cassettes/batches_cancel_input.yml index e7ba0d3e..3e8b349f 100644 --- a/spec/fixtures/cassettes/batches_cancel_input.yml +++ b/spec/fixtures/cassettes/batches_cancel_input.yml @@ -5,7 +5,7 @@ http_interactions: uri: https://api.openai.com/v1/files body: encoding: UTF-8 - string: "-------------RubyMultipartPost-765fd1934aeb0cc3a3eafe93bbb41aa6\r\nContent-Disposition: + string: "-------------RubyMultipartPost-cab9ea29ec0bfa2ba09003a4d0dd7e36\r\nContent-Disposition: form-data; name=\"file\"; filename=\"batch.jsonl\"\r\nContent-Length: 468\r\nContent-Type: \r\nContent-Transfer-Encoding: binary\r\n\r\n{\"custom_id\": \"request-1\", \"method\": \"POST\", \"url\": \"/v1/chat/completions\", \"body\": {\"model\": @@ -14,11 +14,11 @@ http_interactions: \"request-2\", \"method\": \"POST\", \"url\": \"/v1/chat/completions\", \"body\": {\"model\": \"gpt-3.5-turbo\", \"messages\": [{\"role\": \"system\", \"content\": \"You are a helpful assistant.\"}, {\"role\": \"user\", \"content\": \"What - is 3+2?\"}]}}\n\r\n-------------RubyMultipartPost-765fd1934aeb0cc3a3eafe93bbb41aa6\r\nContent-Disposition: - form-data; name=\"purpose\"\r\n\r\nbatch\r\n-------------RubyMultipartPost-765fd1934aeb0cc3a3eafe93bbb41aa6--\r\n" + is 3+2?\"}]}}\n\r\n-------------RubyMultipartPost-cab9ea29ec0bfa2ba09003a4d0dd7e36\r\nContent-Disposition: + form-data; name=\"purpose\"\r\n\r\nbatch\r\n-------------RubyMultipartPost-cab9ea29ec0bfa2ba09003a4d0dd7e36--\r\n" headers: Content-Type: - - multipart/form-data; boundary=-----------RubyMultipartPost-765fd1934aeb0cc3a3eafe93bbb41aa6 + - multipart/form-data; boundary=-----------RubyMultipartPost-cab9ea29ec0bfa2ba09003a4d0dd7e36 Authorization: - Bearer Content-Length: @@ -35,7 +35,7 @@ http_interactions: message: OK headers: Date: - - Sat, 27 Apr 2024 13:03:38 GMT + - Mon, 29 Apr 2024 23:28:03 GMT Content-Type: - application/json Transfer-Encoding: @@ -47,9 +47,9 @@ http_interactions: Openai-Organization: - user-jxm65ijkzc1qrfhc0ij8moic X-Request-Id: - - req_a32d86389c70694afe29f23043010e34 + - req_0db3b45429c2b3d4b45022203dba5e98 Openai-Processing-Ms: - - '409' + - '347' Access-Control-Allow-Origin: - "*" Strict-Transport-Security: @@ -57,15 +57,15 @@ http_interactions: Cf-Cache-Status: - DYNAMIC Set-Cookie: - - __cf_bm=bd03lUR_PooG3XdLh2rokwsxKlSpmTjre9EgrdkV._g-1714223018-1.0.1.1-r5T6UYbBpTB174PYiKgLvo.cnfIJ.HwB3q2Bf4mvSgTjFioDCngqaugLpp6.M8o4fZPnYsaL_RoY54SmFKCJ.w; - path=/; expires=Sat, 27-Apr-24 13:33:38 GMT; domain=.api.openai.com; HttpOnly; + - __cf_bm=Ojn9rw60du95Du61GHqnoYthF676Xsr1Guz.5KMy2RM-1714433283-1.0.1.1-K0XVWOLoYmevJkhOOZyHuDLl0A6kWt5NcCeBXeteKHKsVqLnn5fngTK6jOny.D4_FlfvzaI2VmSeKqs4LIANsw; + path=/; expires=Mon, 29-Apr-24 23:58:03 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None - - _cfuvid=h3ULHcAqxBWgB99EX8bsoRkmtDChV9h0WpFvEbdATvc-1714223018331-0.0.1.1-604800000; + - _cfuvid=DtpP2gel8VEmopU7LxkbzxL3IPygpW96bkvNepQ.szs-1714433283292-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None Server: - cloudflare Cf-Ray: - - 87af0384e8d01ca0-SOF + - 87c310f19a11dd54-LHR Alt-Svc: - h3=":443"; ma=86400 body: @@ -73,13 +73,13 @@ http_interactions: string: | { "object": "file", - "id": "file-BwiY5C5hJwpUrCiCxwc1OOjH", + "id": "file-ra9iGYj6YGXlcGlliaz8TEmm", "purpose": "batch", "filename": "batch.jsonl", "bytes": 468, - "created_at": 1714223017, + "created_at": 1714433282, "status": "processed", "status_details": null } - recorded_at: Sat, 27 Apr 2024 13:03:38 GMT + recorded_at: Mon, 29 Apr 2024 23:28:03 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/batches_cancel_setup.yml b/spec/fixtures/cassettes/batches_cancel_setup.yml index bf1e2813..6bd59467 100644 --- a/spec/fixtures/cassettes/batches_cancel_setup.yml +++ b/spec/fixtures/cassettes/batches_cancel_setup.yml @@ -86,4 +86,90 @@ http_interactions: "metadata": null } recorded_at: Sat, 27 Apr 2024 13:03:39 GMT +- request: + method: post + uri: https://api.openai.com/v1/batches + body: + encoding: UTF-8 + string: '{"input_file_id":"file-ra9iGYj6YGXlcGlliaz8TEmm","endpoint":"/v1/chat/completions","completion_window":"24h"}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:28:03 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_c0dd6021769e4c354a96fb0c30e1d6d7 + Openai-Processing-Ms: + - '374' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=EzCLc22pCCtMX0vyWwwNR5KkjPNCwhu8VQ839WIu2lc-1714433283-1.0.1.1-OF_aGcG55nqn6V0Kn3ISia_an3ziJu0fVHjX4hAOtpZqWDFagCMw.QiKkV1gvhdr8NldL9He429TsFNiFI49jw; + path=/; expires=Mon, 29-Apr-24 23:58:03 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=jACnNHXg6cfHCC2TnVBltAdbv6iPZ31hpkCwWhCAnU0-1714433283924-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c310f56a0277b8-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "batch_vMMPgZwommDlITEXwEN2PmDb", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-ra9iGYj6YGXlcGlliaz8TEmm", + "completion_window": "24h", + "status": "validating", + "output_file_id": null, + "error_file_id": null, + "created_at": 1714433283, + "in_progress_at": null, + "expires_at": 1714519683, + "finalizing_at": null, + "completed_at": null, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 0, + "completed": 0, + "failed": 0 + }, + "metadata": null + } + recorded_at: Mon, 29 Apr 2024 23:28:03 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/batches_create.yml b/spec/fixtures/cassettes/batches_create.yml index dc5b2f87..298a09aa 100644 --- a/spec/fixtures/cassettes/batches_create.yml +++ b/spec/fixtures/cassettes/batches_create.yml @@ -86,4 +86,90 @@ http_interactions: "metadata": null } recorded_at: Sat, 27 Apr 2024 13:03:31 GMT +- request: + method: post + uri: https://api.openai.com/v1/batches + body: + encoding: UTF-8 + string: '{"input_file_id":"file-N7nsmzhfE6V1ssV48uSeHTbE","endpoint":"/v1/chat/completions","completion_window":"24h"}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:28:02 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_f7ab3bf2ce956ffba92074a3f4b562c8 + Openai-Processing-Ms: + - '412' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=XG5YMVvGUyU9gU9zygEmssgbGN3mB0dLCl5HsSGwir4-1714433282-1.0.1.1-G0NXO9r8HS46kTTBRLOkqJbECmKdr9r05MJDTeNxrsd58ssSF481ue51MyX6Sg4O3uSfIqgUvISsolOiJWey4A; + path=/; expires=Mon, 29-Apr-24 23:58:02 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=Ld7fH.4BlER_ZkTk24YZK_ZZOtHSDf9XLd.cDBpRoTg-1714433282727-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c310ed8d336409-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "batch_DCSlpj7ogdBSa838BZx5UvUd", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-N7nsmzhfE6V1ssV48uSeHTbE", + "completion_window": "24h", + "status": "validating", + "output_file_id": null, + "error_file_id": null, + "created_at": 1714433282, + "in_progress_at": null, + "expires_at": 1714519682, + "finalizing_at": null, + "completed_at": null, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 0, + "completed": 0, + "failed": 0 + }, + "metadata": null + } + recorded_at: Mon, 29 Apr 2024 23:28:02 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/batches_create_input.yml b/spec/fixtures/cassettes/batches_create_input.yml index 7b7e9520..005e6f8b 100644 --- a/spec/fixtures/cassettes/batches_create_input.yml +++ b/spec/fixtures/cassettes/batches_create_input.yml @@ -5,7 +5,7 @@ http_interactions: uri: https://api.openai.com/v1/files body: encoding: UTF-8 - string: "-------------RubyMultipartPost-4cbb6b074048f4ee01bf8553d6378821\r\nContent-Disposition: + string: "-------------RubyMultipartPost-8608c2dab4ddaadbcf628b86e1155370\r\nContent-Disposition: form-data; name=\"file\"; filename=\"batch.jsonl\"\r\nContent-Length: 468\r\nContent-Type: \r\nContent-Transfer-Encoding: binary\r\n\r\n{\"custom_id\": \"request-1\", \"method\": \"POST\", \"url\": \"/v1/chat/completions\", \"body\": {\"model\": @@ -14,11 +14,11 @@ http_interactions: \"request-2\", \"method\": \"POST\", \"url\": \"/v1/chat/completions\", \"body\": {\"model\": \"gpt-3.5-turbo\", \"messages\": [{\"role\": \"system\", \"content\": \"You are a helpful assistant.\"}, {\"role\": \"user\", \"content\": \"What - is 3+2?\"}]}}\n\r\n-------------RubyMultipartPost-4cbb6b074048f4ee01bf8553d6378821\r\nContent-Disposition: - form-data; name=\"purpose\"\r\n\r\nbatch\r\n-------------RubyMultipartPost-4cbb6b074048f4ee01bf8553d6378821--\r\n" + is 3+2?\"}]}}\n\r\n-------------RubyMultipartPost-8608c2dab4ddaadbcf628b86e1155370\r\nContent-Disposition: + form-data; name=\"purpose\"\r\n\r\nbatch\r\n-------------RubyMultipartPost-8608c2dab4ddaadbcf628b86e1155370--\r\n" headers: Content-Type: - - multipart/form-data; boundary=-----------RubyMultipartPost-4cbb6b074048f4ee01bf8553d6378821 + - multipart/form-data; boundary=-----------RubyMultipartPost-8608c2dab4ddaadbcf628b86e1155370 Authorization: - Bearer Content-Length: @@ -35,7 +35,7 @@ http_interactions: message: OK headers: Date: - - Sat, 27 Apr 2024 13:03:31 GMT + - Mon, 29 Apr 2024 23:28:02 GMT Content-Type: - application/json Transfer-Encoding: @@ -47,9 +47,9 @@ http_interactions: Openai-Organization: - user-jxm65ijkzc1qrfhc0ij8moic X-Request-Id: - - req_4cd750317073defd9664ee772c4f46ff + - req_30cafa9d0d7380bde8d3c6d99867dadd Openai-Processing-Ms: - - '466' + - '494' Access-Control-Allow-Origin: - "*" Strict-Transport-Security: @@ -57,15 +57,15 @@ http_interactions: Cf-Cache-Status: - DYNAMIC Set-Cookie: - - __cf_bm=DvhHA84spFPWFBff757jyXzVbBzNZTmWcGeK6TLR0c8-1714223011-1.0.1.1-45.LDBypJDczhCIfqgGDyA0D_tUI5Lr.pUUidL85Jmn2oxPUo8xL1b5CsHdvtrqIYfLdVatDwos2zPrBkINv_g; - path=/; expires=Sat, 27-Apr-24 13:33:31 GMT; domain=.api.openai.com; HttpOnly; + - __cf_bm=SzM0QJIuAJD9aWo0bWnshBpq.MsKqoeqvQBbCbbRxqg-1714433282-1.0.1.1-HjppHgXq6M9HNZG5XJxo9GsYfNtsWQmuzZtLcuT96A8g6_.2DysBgYh0CRVvFfqb_ouCo_S3.eXX95kX8TIYBA; + path=/; expires=Mon, 29-Apr-24 23:58:02 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None - - _cfuvid=h6_kMSrChhyxUu9RvMbU5eUfadBaaLySFkl.9vugo2E-1714223011163-0.0.1.1-604800000; + - _cfuvid=EFgM3nseuMRL5WEkkK0Cn.I1T41I5xPruTRjJ1kEk5M-1714433282102-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None Server: - cloudflare Cf-Ray: - - 87af0357ba336ea1-SOF + - 87c310e92f5593e3-LHR Alt-Svc: - h3=":443"; ma=86400 body: @@ -73,13 +73,13 @@ http_interactions: string: | { "object": "file", - "id": "file-uFk9X2lZO7ug5rr95SjODqax", + "id": "file-N7nsmzhfE6V1ssV48uSeHTbE", "purpose": "batch", "filename": "batch.jsonl", "bytes": 468, - "created_at": 1714223010, + "created_at": 1714433281, "status": "processed", "status_details": null } - recorded_at: Sat, 27 Apr 2024 13:03:31 GMT + recorded_at: Mon, 29 Apr 2024 23:28:02 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/batches_list.yml b/spec/fixtures/cassettes/batches_list.yml index 2006bbb5..a7e5f3b3 100644 --- a/spec/fixtures/cassettes/batches_list.yml +++ b/spec/fixtures/cassettes/batches_list.yml @@ -120,4 +120,280 @@ http_interactions: "has_more": false } recorded_at: Sat, 27 Apr 2024 13:02:57 GMT +- request: + method: get + uri: https://api.openai.com/v1/batches + body: + encoding: US-ASCII + string: '' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:27:59 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_37c4738096df06b1cdd3574ab0aa9262 + Openai-Processing-Ms: + - '275' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=8fQJ_Cw85pkn8vUraRZLO.pVOZ1avRnYR4E7UKd5TLc-1714433279-1.0.1.1-d6vgDMK1kbIxAFpWto0vxrOTh50hDr7Q0BfKZSc1Md7Y_K8fwQa4k0YoCgKSeGcu4ZwYymIgJo9KGsbPlVnm3g; + path=/; expires=Mon, 29-Apr-24 23:57:59 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=siKX63nxUeSg5ippWFnKQtqRB1_Ojlz5e4W9.5fz3Nw-1714433279734-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c310dbdbac6409-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "object": "list", + "data": [ + { + "id": "batch_gidid1h27isU29Yg0xFVrEw4", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-M7kN0Xj6JljJnpiV7zUUAIlW", + "completion_window": "24h", + "status": "validating", + "output_file_id": null, + "error_file_id": null, + "created_at": 1714433279, + "in_progress_at": null, + "expires_at": 1714519679, + "finalizing_at": null, + "completed_at": null, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 0, + "completed": 0, + "failed": 0 + }, + "metadata": null + }, + { + "id": "batch_nxlrM7H9HBi2aEr6lDB75hBv", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-olNUMBePFrhJyuMEAvJSC1W8", + "completion_window": "24h", + "status": "completed", + "output_file_id": "file-XBfCbFfnc5DQwtqYYLjxeZHV", + "error_file_id": null, + "created_at": 1714223320, + "in_progress_at": 1714223321, + "expires_at": 1714309720, + "finalizing_at": 1714223382, + "completed_at": 1714223382, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 2, + "completed": 2, + "failed": 0 + }, + "metadata": null + }, + { + "id": "batch_PUHjvg0ufFNNqFUop8cDU5RR", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-BwiY5C5hJwpUrCiCxwc1OOjH", + "completion_window": "24h", + "status": "cancelled", + "output_file_id": null, + "error_file_id": "file-c3u20eRJWsrgT0KCcaHWwvQJ", + "created_at": 1714223018, + "in_progress_at": null, + "expires_at": 1714309418, + "finalizing_at": null, + "completed_at": null, + "failed_at": null, + "expired_at": null, + "cancelling_at": 1714223019, + "cancelled_at": 1714252234, + "request_counts": { + "total": 0, + "completed": 0, + "failed": 0 + }, + "metadata": null + }, + { + "id": "batch_34QbcyhH4WIPPGl4H5LsQZBr", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-uFk9X2lZO7ug5rr95SjODqax", + "completion_window": "24h", + "status": "completed", + "output_file_id": "file-wm2T1A4YmTnFWwc9pf8yAu8j", + "error_file_id": null, + "created_at": 1714223011, + "in_progress_at": 1714223012, + "expires_at": 1714309411, + "finalizing_at": 1714223073, + "completed_at": 1714223073, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 2, + "completed": 2, + "failed": 0 + }, + "metadata": null + }, + { + "id": "batch_nKe4BBzmYfJqFPbKe743NLRA", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-6hOLqRYsS9Btw7Ag2e4ashUB", + "completion_window": "24h", + "status": "cancelled", + "output_file_id": "file-EDziB1kp2BYluDwB7T0c1ufu", + "error_file_id": "file-g1GtaPmgyIUXNnr1CIXSo1Cc", + "created_at": 1714222982, + "in_progress_at": 1714222982, + "expires_at": 1714309382, + "finalizing_at": null, + "completed_at": null, + "failed_at": null, + "expired_at": null, + "cancelling_at": 1714222982, + "cancelled_at": 1714252267, + "request_counts": { + "total": 2, + "completed": 1, + "failed": 0 + }, + "metadata": null + }, + { + "id": "batch_0ii4rIpvpb1XwC7isnnPo7UN", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-FXV6zUECcn3Zfizm7J273QXx", + "completion_window": "24h", + "status": "completed", + "output_file_id": "file-2rZ2KGOEMt6UZGaOt6x5Zy7u", + "error_file_id": null, + "created_at": 1714222978, + "in_progress_at": 1714222979, + "expires_at": 1714309378, + "finalizing_at": 1714223040, + "completed_at": 1714223040, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 2, + "completed": 2, + "failed": 0 + }, + "metadata": null + }, + { + "id": "batch_AfuCFw8jZ14rbXkIQWDeYnMU", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-FBhzJKh5hRnQKCgiGk0ipMHa", + "completion_window": "24h", + "status": "completed", + "output_file_id": "file-LEirJzpk0rzmkZztSIVeE3tP", + "error_file_id": null, + "created_at": 1714222977, + "in_progress_at": 1714222977, + "expires_at": 1714309377, + "finalizing_at": 1714223038, + "completed_at": 1714223038, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 2, + "completed": 2, + "failed": 0 + }, + "metadata": null + }, + { + "id": "batch_LZZPpO4LijHQyOIjQmJ0pQgm", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-zQaBd9PBocsMDmMPxZqLpiyV", + "completion_window": "24h", + "status": "completed", + "output_file_id": "file-KmHShqD31LedY0hDoaunJrIi", + "error_file_id": null, + "created_at": 1714222948, + "in_progress_at": 1714222948, + "expires_at": 1714309348, + "finalizing_at": 1714223010, + "completed_at": 1714223011, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 2, + "completed": 2, + "failed": 0 + }, + "metadata": null + } + ], + "first_id": "batch_gidid1h27isU29Yg0xFVrEw4", + "last_id": "batch_LZZPpO4LijHQyOIjQmJ0pQgm", + "has_more": false + } + recorded_at: Mon, 29 Apr 2024 23:27:59 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/batches_list_input.yml b/spec/fixtures/cassettes/batches_list_input.yml index 974b350d..398a0874 100644 --- a/spec/fixtures/cassettes/batches_list_input.yml +++ b/spec/fixtures/cassettes/batches_list_input.yml @@ -5,7 +5,7 @@ http_interactions: uri: https://api.openai.com/v1/files body: encoding: UTF-8 - string: "-------------RubyMultipartPost-27a5fa65b4ebe6ef77f44000a4660b94\r\nContent-Disposition: + string: "-------------RubyMultipartPost-79e7ea6a5442064647ea4949c914b6ac\r\nContent-Disposition: form-data; name=\"file\"; filename=\"batch.jsonl\"\r\nContent-Length: 468\r\nContent-Type: \r\nContent-Transfer-Encoding: binary\r\n\r\n{\"custom_id\": \"request-1\", \"method\": \"POST\", \"url\": \"/v1/chat/completions\", \"body\": {\"model\": @@ -14,11 +14,11 @@ http_interactions: \"request-2\", \"method\": \"POST\", \"url\": \"/v1/chat/completions\", \"body\": {\"model\": \"gpt-3.5-turbo\", \"messages\": [{\"role\": \"system\", \"content\": \"You are a helpful assistant.\"}, {\"role\": \"user\", \"content\": \"What - is 3+2?\"}]}}\n\r\n-------------RubyMultipartPost-27a5fa65b4ebe6ef77f44000a4660b94\r\nContent-Disposition: - form-data; name=\"purpose\"\r\n\r\nbatch\r\n-------------RubyMultipartPost-27a5fa65b4ebe6ef77f44000a4660b94--\r\n" + is 3+2?\"}]}}\n\r\n-------------RubyMultipartPost-79e7ea6a5442064647ea4949c914b6ac\r\nContent-Disposition: + form-data; name=\"purpose\"\r\n\r\nbatch\r\n-------------RubyMultipartPost-79e7ea6a5442064647ea4949c914b6ac--\r\n" headers: Content-Type: - - multipart/form-data; boundary=-----------RubyMultipartPost-27a5fa65b4ebe6ef77f44000a4660b94 + - multipart/form-data; boundary=-----------RubyMultipartPost-79e7ea6a5442064647ea4949c914b6ac Authorization: - Bearer Content-Length: @@ -35,7 +35,7 @@ http_interactions: message: OK headers: Date: - - Sat, 27 Apr 2024 13:02:56 GMT + - Mon, 29 Apr 2024 23:27:58 GMT Content-Type: - application/json Transfer-Encoding: @@ -47,9 +47,9 @@ http_interactions: Openai-Organization: - user-jxm65ijkzc1qrfhc0ij8moic X-Request-Id: - - req_846f073907f5b655e2a3014d69cba022 + - req_ee2cf54e766e54041c80758bbadfe5b0 Openai-Processing-Ms: - - '382' + - '553' Access-Control-Allow-Origin: - "*" Strict-Transport-Security: @@ -57,15 +57,15 @@ http_interactions: Cf-Cache-Status: - DYNAMIC Set-Cookie: - - __cf_bm=bffYSFDzD6GxtLwKUSLEzqpB4bCA2N14HlfLFjYaK4I-1714222976-1.0.1.1-x0_rYmYjvK9GXw7qlqrBqduotuegPov3dIXkDwRSoZq.4eMQ0jgc0VAx7LXugGzy3SacseZyW195mP8v5tUgpQ; - path=/; expires=Sat, 27-Apr-24 13:32:56 GMT; domain=.api.openai.com; HttpOnly; + - __cf_bm=IH3wYB2DqQFjv0GocEFhFP5YQQbKp9hfUSN6zNqQLEk-1714433278-1.0.1.1-3MANN4k2uKRnt7280pH_YGVfVLYORpzyCtlHj.8.oHtZX96O3bF3tvDbq3oe.TGAi8AWt9vJnzZxZVkiVcWN2g; + path=/; expires=Mon, 29-Apr-24 23:57:58 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None - - _cfuvid=qSNCgcp7RUsbnkTPgfiHPDZ..GAKDpK8Eli.utuzc6Y-1714222976756-0.0.1.1-604800000; + - _cfuvid=WqB.UxI8MP7eiaV9QWNruWe4z90oN_LKC1WvdrEb.fk-1714433278558-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None Server: - cloudflare Cf-Ray: - - 87af02812a058ee6-SOF + - 87c310d2be2f06b6-LHR Alt-Svc: - h3=":443"; ma=86400 body: @@ -73,13 +73,13 @@ http_interactions: string: | { "object": "file", - "id": "file-FBhzJKh5hRnQKCgiGk0ipMHa", + "id": "file-M7kN0Xj6JljJnpiV7zUUAIlW", "purpose": "batch", "filename": "batch.jsonl", "bytes": 468, - "created_at": 1714222976, + "created_at": 1714433278, "status": "processed", "status_details": null } - recorded_at: Sat, 27 Apr 2024 13:02:56 GMT + recorded_at: Mon, 29 Apr 2024 23:27:58 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/batches_list_setup.yml b/spec/fixtures/cassettes/batches_list_setup.yml index 87738f88..951ce85a 100644 --- a/spec/fixtures/cassettes/batches_list_setup.yml +++ b/spec/fixtures/cassettes/batches_list_setup.yml @@ -86,4 +86,90 @@ http_interactions: "metadata": null } recorded_at: Sat, 27 Apr 2024 13:02:57 GMT +- request: + method: post + uri: https://api.openai.com/v1/batches + body: + encoding: UTF-8 + string: '{"input_file_id":"file-M7kN0Xj6JljJnpiV7zUUAIlW","endpoint":"/v1/chat/completions","completion_window":"24h"}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:27:59 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_26aacec6ff52cc1c11239f70aef7676c + Openai-Processing-Ms: + - '495' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=zCPCpZfMDhzKbveOCP1soenC4KOFNzZLNXEdoaGZeFU-1714433279-1.0.1.1-.EZrSFLhIigfwBNJ0SuCE4zfWeZoOD_zM.Jq3qbp5nu6jaVmkPHEhejkjbq2h.7B0vzgyBjHiUVURQV9IvkA1A; + path=/; expires=Mon, 29-Apr-24 23:57:59 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=cZpeO7gE0cZHVsRnVT8sIUq3wFjz3MtviOdLfk97Si0-1714433279251-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c310d779089502-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "batch_gidid1h27isU29Yg0xFVrEw4", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-M7kN0Xj6JljJnpiV7zUUAIlW", + "completion_window": "24h", + "status": "validating", + "output_file_id": null, + "error_file_id": null, + "created_at": 1714433279, + "in_progress_at": null, + "expires_at": 1714519679, + "finalizing_at": null, + "completed_at": null, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 0, + "completed": 0, + "failed": 0 + }, + "metadata": null + } + recorded_at: Mon, 29 Apr 2024 23:27:59 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/batches_retrieve.yml b/spec/fixtures/cassettes/batches_retrieve.yml index 4b073adf..86af9b4d 100644 --- a/spec/fixtures/cassettes/batches_retrieve.yml +++ b/spec/fixtures/cassettes/batches_retrieve.yml @@ -86,4 +86,90 @@ http_interactions: "metadata": null } recorded_at: Sat, 27 Apr 2024 13:02:59 GMT +- request: + method: get + uri: https://api.openai.com/v1/batches/batch_j7y6Qs6fqQgpELL59uMr1dmp + body: + encoding: US-ASCII + string: '' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:28:01 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_bf3676a88400cd432d3346749b59ecff + Openai-Processing-Ms: + - '99' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=vtHrhB6pbVOjkkHUfBLybK6egk4p.p6rfIOPAuDT5.E-1714433281-1.0.1.1-MrfgKeXiRexgDyAUE0qX0XPeD1erIB.zgo5be167c59Hi7nVeAStW5pKZXaJeCBGYNEb78q5gTnSM.CgrJA73Q; + path=/; expires=Mon, 29-Apr-24 23:58:01 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=_a6YUePpFIhRoC08kdjaWl2._HFgWic5jRS1G1qSp04-1714433281398-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c310e75f6e71f0-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "batch_j7y6Qs6fqQgpELL59uMr1dmp", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-cjc9pVMqKYchbLw9lUskuTVW", + "completion_window": "24h", + "status": "validating", + "output_file_id": null, + "error_file_id": null, + "created_at": 1714433280, + "in_progress_at": null, + "expires_at": 1714519680, + "finalizing_at": null, + "completed_at": null, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 0, + "completed": 0, + "failed": 0 + }, + "metadata": null + } + recorded_at: Mon, 29 Apr 2024 23:28:01 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/batches_retrieve_input.yml b/spec/fixtures/cassettes/batches_retrieve_input.yml index 37feaa8d..b0ffc17a 100644 --- a/spec/fixtures/cassettes/batches_retrieve_input.yml +++ b/spec/fixtures/cassettes/batches_retrieve_input.yml @@ -5,7 +5,7 @@ http_interactions: uri: https://api.openai.com/v1/files body: encoding: UTF-8 - string: "-------------RubyMultipartPost-0ca14b2e95a8a07c39a5ed98ff137cc5\r\nContent-Disposition: + string: "-------------RubyMultipartPost-bb805dd0fd4794c9165d4bb2d19b2464\r\nContent-Disposition: form-data; name=\"file\"; filename=\"batch.jsonl\"\r\nContent-Length: 468\r\nContent-Type: \r\nContent-Transfer-Encoding: binary\r\n\r\n{\"custom_id\": \"request-1\", \"method\": \"POST\", \"url\": \"/v1/chat/completions\", \"body\": {\"model\": @@ -14,11 +14,11 @@ http_interactions: \"request-2\", \"method\": \"POST\", \"url\": \"/v1/chat/completions\", \"body\": {\"model\": \"gpt-3.5-turbo\", \"messages\": [{\"role\": \"system\", \"content\": \"You are a helpful assistant.\"}, {\"role\": \"user\", \"content\": \"What - is 3+2?\"}]}}\n\r\n-------------RubyMultipartPost-0ca14b2e95a8a07c39a5ed98ff137cc5\r\nContent-Disposition: - form-data; name=\"purpose\"\r\n\r\nbatch\r\n-------------RubyMultipartPost-0ca14b2e95a8a07c39a5ed98ff137cc5--\r\n" + is 3+2?\"}]}}\n\r\n-------------RubyMultipartPost-bb805dd0fd4794c9165d4bb2d19b2464\r\nContent-Disposition: + form-data; name=\"purpose\"\r\n\r\nbatch\r\n-------------RubyMultipartPost-bb805dd0fd4794c9165d4bb2d19b2464--\r\n" headers: Content-Type: - - multipart/form-data; boundary=-----------RubyMultipartPost-0ca14b2e95a8a07c39a5ed98ff137cc5 + - multipart/form-data; boundary=-----------RubyMultipartPost-bb805dd0fd4794c9165d4bb2d19b2464 Authorization: - Bearer Content-Length: @@ -35,7 +35,7 @@ http_interactions: message: OK headers: Date: - - Sat, 27 Apr 2024 13:02:58 GMT + - Mon, 29 Apr 2024 23:28:00 GMT Content-Type: - application/json Transfer-Encoding: @@ -47,9 +47,9 @@ http_interactions: Openai-Organization: - user-jxm65ijkzc1qrfhc0ij8moic X-Request-Id: - - req_56e6f2609456100c91e3efa143ac457e + - req_1959a69eca3a684c38e6124095162b89 Openai-Processing-Ms: - - '290' + - '328' Access-Control-Allow-Origin: - "*" Strict-Transport-Security: @@ -57,15 +57,15 @@ http_interactions: Cf-Cache-Status: - DYNAMIC Set-Cookie: - - __cf_bm=UJ2M6dOePz0w8oh7DJ7Hz2z1oCive7p_V9eqjWGhclM-1714222978-1.0.1.1-gfeXCPNAjeXhOSd3ammWlCQGFFE2qFNdp7a_XvxC1jFk1N68Goju0uSnMVEIZFfXk06Uq87irkhI.RCz6gByEA; - path=/; expires=Sat, 27-Apr-24 13:32:58 GMT; domain=.api.openai.com; HttpOnly; + - __cf_bm=lhON.6jnXM7HbbM0pqDw2gSpS_QvGVIuMFrXieZkHsc-1714433280-1.0.1.1-ExG92mfXRDiUn5JqgDr7S4UPTmXeMS3Jm9VpyLPsHotelxWP4CFl8FE1JvYOMWt8zL9LHxg8rt6K1Fy92RA9vA; + path=/; expires=Mon, 29-Apr-24 23:58:00 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None - - _cfuvid=ZuNqOwz1MH0USqLxh9JKEnCU19PP8dABqyp3UIDBZQ8-1714222978265-0.0.1.1-604800000; + - _cfuvid=X_o3ZVlYPc1oGeZfZmHuptW8s0m4nqYQx3ZNIM2aoEM-1714433280300-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None Server: - cloudflare Cf-Ray: - - 87af028b2dbb3db8-SOF + - 87c310defa9a654c-LHR Alt-Svc: - h3=":443"; ma=86400 body: @@ -73,13 +73,13 @@ http_interactions: string: | { "object": "file", - "id": "file-FXV6zUECcn3Zfizm7J273QXx", + "id": "file-cjc9pVMqKYchbLw9lUskuTVW", "purpose": "batch", "filename": "batch.jsonl", "bytes": 468, - "created_at": 1714222977, + "created_at": 1714433280, "status": "processed", "status_details": null } - recorded_at: Sat, 27 Apr 2024 13:02:58 GMT + recorded_at: Mon, 29 Apr 2024 23:28:00 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/batches_retrieve_setup.yml b/spec/fixtures/cassettes/batches_retrieve_setup.yml index 7dfb6ebe..f747f5cc 100644 --- a/spec/fixtures/cassettes/batches_retrieve_setup.yml +++ b/spec/fixtures/cassettes/batches_retrieve_setup.yml @@ -86,4 +86,90 @@ http_interactions: "metadata": null } recorded_at: Sat, 27 Apr 2024 13:02:58 GMT +- request: + method: post + uri: https://api.openai.com/v1/batches + body: + encoding: UTF-8 + string: '{"input_file_id":"file-cjc9pVMqKYchbLw9lUskuTVW","endpoint":"/v1/chat/completions","completion_window":"24h"}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:28:01 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_9220b1e56a29c122564f93462415a77c + Openai-Processing-Ms: + - '451' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=bbs5z3B_wHsDjLRi.qgmFYSOKhpn36qn8_IEYwmX6yU-1714433281-1.0.1.1-np9AQBhaiHYzj_h4ns2C3Eh8cvulKjJipPGBycx.Y9fEYV7XbRuq78vTF0A._oPqKNuR8UHpCbXpBe2_fK9oRA; + path=/; expires=Mon, 29-Apr-24 23:58:01 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=gLzCVB3PLWoE5VePwLYaPfQ346hawpE5YMafI1XlltM-1714433281031-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c310e2ddbc776a-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "batch_j7y6Qs6fqQgpELL59uMr1dmp", + "object": "batch", + "endpoint": "/v1/chat/completions", + "errors": null, + "input_file_id": "file-cjc9pVMqKYchbLw9lUskuTVW", + "completion_window": "24h", + "status": "validating", + "output_file_id": null, + "error_file_id": null, + "created_at": 1714433280, + "in_progress_at": null, + "expires_at": 1714519680, + "finalizing_at": null, + "completed_at": null, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 0, + "completed": 0, + "failed": 0 + }, + "metadata": null + } + recorded_at: Mon, 29 Apr 2024 23:28:01 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/messages_create.yml b/spec/fixtures/cassettes/messages_create.yml index 12fcdeba..d811f820 100644 --- a/spec/fixtures/cassettes/messages_create.yml +++ b/spec/fixtures/cassettes/messages_create.yml @@ -162,4 +162,85 @@ http_interactions: "metadata": {} } recorded_at: Sat, 27 Apr 2024 20:48:41 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_NaBzWPHbUOrHuL7zvatab4gX/messages + body: + encoding: UTF-8 + string: '{"role":"user","content":"Can you help me write an API library to interact + with the OpenAI API please?"}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:28:23 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_2b0f6831e5de3eb32c0bfb9a348943aa + Openai-Processing-Ms: + - '121' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=KdEP.WpW4jKkWd_OSClH5lE7ze4oWAnRJK.s5M6Cc4w-1714433303-1.0.1.1-ulvjqVs_vN4c4auJZUVzwbbmcTzrXII5878Cld9wN9.H725b049BtoI2Vkypd6_323wufZZT1S8EOyKJihJtGw; + path=/; expires=Mon, 29-Apr-24 23:58:23 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=vMqRoVG_7C00AKNL6lTRxujEfYzdZjAjAf5CjVdhSLs-1714433303766-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31172fb49953e-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "msg_36ksihVtkG7irJenzTmBEXEr", + "object": "thread.message", + "created_at": 1714433303, + "assistant_id": null, + "thread_id": "thread_NaBzWPHbUOrHuL7zvatab4gX", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "Can you help me write an API library to interact with the OpenAI API please?", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + } + recorded_at: Mon, 29 Apr 2024 23:28:23 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/messages_create_thread_setup.yml b/spec/fixtures/cassettes/messages_create_thread_setup.yml index 7afdd7f7..23405152 100644 --- a/spec/fixtures/cassettes/messages_create_thread_setup.yml +++ b/spec/fixtures/cassettes/messages_create_thread_setup.yml @@ -66,4 +66,71 @@ http_interactions: "metadata": {} } recorded_at: Sat, 27 Apr 2024 20:48:40 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads + body: + encoding: UTF-8 + string: "{}" + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:28:23 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_970af0af179fca8e51bc46c99ad43615 + Openai-Processing-Ms: + - '34' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=dFyDlMATu6xYckDYittwavpRKhatFbg6xyuJFrN54.8-1714433303-1.0.1.1-hcjSCGOcPk_IJKHop1ccSNbx9iEOsB1cjbdaRQ3BboQHsqpQpzcHikD1OgIMqS01ADFSy0jXLw.b.TqmJX2Z4g; + path=/; expires=Mon, 29-Apr-24 23:58:23 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=9mjjVmphhKFM..XJJXNkij_bzghTf371mmDT3.NZUzg-1714433303460-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c311719a828891-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "thread_NaBzWPHbUOrHuL7zvatab4gX", + "object": "thread", + "created_at": 1714433303, + "metadata": {}, + "tool_resources": {} + } + recorded_at: Mon, 29 Apr 2024 23:28:23 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/messages_list.yml b/spec/fixtures/cassettes/messages_list.yml index ed00a482..af71bfe3 100644 --- a/spec/fixtures/cassettes/messages_list.yml +++ b/spec/fixtures/cassettes/messages_list.yml @@ -134,4 +134,71 @@ http_interactions: "has_more": false } recorded_at: Sat, 27 Apr 2024 20:48:40 GMT +- request: + method: get + uri: https://api.openai.com/v1/threads/thread_5jqgwFrC5ZmNkl5iqYEZiKYQ/messages?order=asc + body: + encoding: US-ASCII + string: '' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:28:23 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_04074eb6f079e5271046b59e666b6542 + Openai-Processing-Ms: + - '94' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=vP_POqLRa2T4PhZVrly9sAUZB5ox.EAsHoa0PhH92Qk-1714433303-1.0.1.1-Oa8aCwMhgL0whWjrgu6gVqXgeUBjbbFaKcVypk7aR.BCdYMzaisNsB4QHFTPvpiH.ree15pHmrj_Xm..rCJpUA; + path=/; expires=Mon, 29-Apr-24 23:58:23 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=idaeAD58BDXFS.cEqBzwsCiCPHr5GtXXPK0DXwNXFrk-1714433303222-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c3116fc99ddd86-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "object": "list", + "data": [], + "first_id": null, + "last_id": null, + "has_more": false + } + recorded_at: Mon, 29 Apr 2024 23:28:23 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/messages_list_thread_setup.yml b/spec/fixtures/cassettes/messages_list_thread_setup.yml index e04ea1c3..22d5b0dd 100644 --- a/spec/fixtures/cassettes/messages_list_thread_setup.yml +++ b/spec/fixtures/cassettes/messages_list_thread_setup.yml @@ -66,4 +66,71 @@ http_interactions: "metadata": {} } recorded_at: Sat, 27 Apr 2024 20:48:39 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads + body: + encoding: UTF-8 + string: "{}" + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:28:22 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_3fa98df9b57daa85a58cbe1ec2d8dac7 + Openai-Processing-Ms: + - '39' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=Qwq1rMbLmxLPuVYJiVlQyjf8edSL6GVtYgGvycu09PY-1714433302-1.0.1.1-ezZbEuHwUwVLVK.LVyojiDYWzCPjOyY4_g8ZUNx7hvGY9ts7gXma5NiAJbHGbZbmnklxR5RbonJA_U3ldIGGtg; + path=/; expires=Mon, 29-Apr-24 23:58:22 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=FDMB9lE0XmM.QOQxBFgbi_cynXwlkvSPMPS9UFNRvAA-1714433302951-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c3116e5c5a60ef-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "thread_5jqgwFrC5ZmNkl5iqYEZiKYQ", + "object": "thread", + "created_at": 1714433302, + "metadata": {}, + "tool_resources": {} + } + recorded_at: Mon, 29 Apr 2024 23:28:22 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/messages_modify.yml b/spec/fixtures/cassettes/messages_modify.yml index a4659bd4..40848225 100644 --- a/spec/fixtures/cassettes/messages_modify.yml +++ b/spec/fixtures/cassettes/messages_modify.yml @@ -164,4 +164,290 @@ http_interactions: } } recorded_at: Sat, 27 Apr 2024 20:48:42 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_XfGoeHgrhrRtmi7jtBqRPXkg/messages/msg_OtZ1InUvH5HsQNlwVSXenAuH + body: + encoding: UTF-8 + string: '{"metadata":{"modified":true}}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:28:24 GMT + Content-Type: + - application/json + Content-Length: + - '220' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_bcd3fd0f7fefc5498933575a6e595673 + Openai-Processing-Ms: + - '92' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=nppG83QjvU41ug3VuPlXOepxU4iG_iQLdt2JByL9GEo-1714433304-1.0.1.1-fQquzj_z3BSUg8ZCkki1VxH62JCS4h7mE2zTFmenQlxpJ4y7EJusdOSYBr5MhMGnbmc3vZwDm2jAC.o_8prffA; + path=/; expires=Mon, 29-Apr-24 23:58:24 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=q3PvEs4.l3iiCXdyhS.2jZMBrBpotQH0qJ.0jNXE8yE-1714433304622-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c311788bf963d6-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Invalid type for 'metadata.modified': expected a string, but got a boolean instead.", + "type": "invalid_request_error", + "param": "metadata.modified", + "code": "invalid_type" + } + } + recorded_at: Mon, 29 Apr 2024 23:28:24 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_EVTO6t46okTBOpzZGH04xmRw/messages/msg_Afo6ZFADquz3UOp0qQVa4mpg + body: + encoding: UTF-8 + string: '{"metadata":{"modified":true}}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:31:44 GMT + Content-Type: + - application/json + Content-Length: + - '220' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_ffb1658441efe5b2a279de3ac051c652 + Openai-Processing-Ms: + - '83' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=oItoXwgrr7_DPzcf3TaeA.NUImAOry6T13C_Jy7ANL8-1714433504-1.0.1.1-4Xi1oEP8Mngh3M8HDvsrf5UlaN8gmy87sR2ZvpyIlVijVkkjRFgggUEs8nV8TR0CV6GoU8IoClXYnavmQ_qoNA; + path=/; expires=Tue, 30-Apr-24 00:01:44 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=qd33PStHltVywIO9aPku81p475zrFSXMCn1HX33rf2c-1714433504952-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c3165c7fed52ab-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Invalid type for 'metadata.modified': expected a string, but got a boolean instead.", + "type": "invalid_request_error", + "param": "metadata.modified", + "code": "invalid_type" + } + } + recorded_at: Mon, 29 Apr 2024 23:31:44 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_1OzNYsu1GGKtiiWp0YPWPLvG/messages/msg_DZMthtuQh4aEUozjsf2WAGZV + body: + encoding: UTF-8 + string: '{"metadata":{"modified":true}}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:32:12 GMT + Content-Type: + - application/json + Content-Length: + - '220' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_6d34c037c7c0878f076b70068fa50833 + Openai-Processing-Ms: + - '92' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=DwabOoxTF2CFlY9ZOsdZRRLqh8zMS_BmbJWDweaLVD8-1714433532-1.0.1.1-vGZfJIQ2eq.79V8hOJ_TldNt0NahSOD6sQLncdIiYDsXK5.TzO2NJipaWQfusK.RvTwb33fSqzYZbQB1xSn6BQ; + path=/; expires=Tue, 30-Apr-24 00:02:12 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=Ul26tjhr2fC38IT5dWGLYlS6X_n.eYvtHl.t5n4Sbfo-1714433532458-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c317088a8f76c3-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Invalid type for 'metadata.modified': expected a string, but got a boolean instead.", + "type": "invalid_request_error", + "param": "metadata.modified", + "code": "invalid_type" + } + } + recorded_at: Mon, 29 Apr 2024 23:32:12 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_9aksFceTGOrlNUXhYQyn1tAk/messages/msg_1fScUhjuzcaxWCwr7Z33PN0k + body: + encoding: UTF-8 + string: '{"metadata":{"modified":"true"}}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:32:25 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_b04de3ac3d59461f9e76fd2444b7c2bc + Openai-Processing-Ms: + - '110' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=W.61Iwyb7JBPhnycsuRU4Q3FSOcgarbtZYY52b2d7sc-1714433545-1.0.1.1-5x2JweHvFwBI7P_Spk6ND8vbaWdIiKZ5IXc13O5QgxbONBGNvrM0X63ufHEHdBtmRg8S8JcKVRiTkWnaATN1rA; + path=/; expires=Tue, 30-Apr-24 00:02:25 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=BFrZFbdOZMpGAlhXFWPaXe5zuOXTCSRNMLR39.3eGNc-1714433545989-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c3175cfed66430-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "msg_1fScUhjuzcaxWCwr7Z33PN0k", + "object": "thread.message", + "created_at": 1714433545, + "assistant_id": null, + "thread_id": "thread_9aksFceTGOrlNUXhYQyn1tAk", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "Can you help me write an API library to interact with the OpenAI API please?", + "annotations": [] + } + } + ], + "file_ids": [], + "metadata": { + "modified": "true" + } + } + recorded_at: Mon, 29 Apr 2024 23:32:25 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/messages_modify_message_setup.yml b/spec/fixtures/cassettes/messages_modify_message_setup.yml index 2cb8e6dc..0687c132 100644 --- a/spec/fixtures/cassettes/messages_modify_message_setup.yml +++ b/spec/fixtures/cassettes/messages_modify_message_setup.yml @@ -162,4 +162,409 @@ http_interactions: "metadata": {} } recorded_at: Sat, 27 Apr 2024 20:48:42 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_XfGoeHgrhrRtmi7jtBqRPXkg/messages + body: + encoding: UTF-8 + string: '{"role":"user","content":"Can you help me write an API library to interact + with the OpenAI API please?"}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:28:24 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_dbd7a847dad6c99577a9ec53be014310 + Openai-Processing-Ms: + - '124' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=auETJrsW97nCAj1U94Yc.B5QPVf4SGcykVXV0KXAGA0-1714433304-1.0.1.1-a0Gr1LYQ.CvJux6TWu261qDlZpiSxJAy77Kmaibw4y25u_xGDb6ZoR2lzuJGq2lAF0lZ9_.Xft4vlsNhjjILUw; + path=/; expires=Mon, 29-Apr-24 23:58:24 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=TyhrQ6miLWNHMsHPqJWwB2KzooG7nX_oyqEsjcE1z_8-1714433304317-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c311767f5f6329-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "msg_OtZ1InUvH5HsQNlwVSXenAuH", + "object": "thread.message", + "created_at": 1714433304, + "assistant_id": null, + "thread_id": "thread_XfGoeHgrhrRtmi7jtBqRPXkg", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "Can you help me write an API library to interact with the OpenAI API please?", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + } + recorded_at: Mon, 29 Apr 2024 23:28:24 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_EVTO6t46okTBOpzZGH04xmRw/messages + body: + encoding: UTF-8 + string: '{"role":"user","content":"Can you help me write an API library to interact + with the OpenAI API please?"}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:31:44 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_dfd5632418039f2c24f512a1569371a1 + Openai-Processing-Ms: + - '133' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=zQgqvELY3PfNg6lRyvGBWmggCw0iKXY66aTVI8fCJ1E-1714433504-1.0.1.1-M1qdntCIu6djCVdDe3zNMDKjkaxc0GDZMtipLC5M1RbGqrnTQSxuxpUzszh4OD4pf9hWzktNquvj19WZ8tQvEg; + path=/; expires=Tue, 30-Apr-24 00:01:44 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=bz0t56jMOwbsZrGnn0YfzdFI5XwjdtdY11HVp6RWP8E-1714433504550-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31659dc5794fd-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "msg_Afo6ZFADquz3UOp0qQVa4mpg", + "object": "thread.message", + "created_at": 1714433504, + "assistant_id": null, + "thread_id": "thread_EVTO6t46okTBOpzZGH04xmRw", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "Can you help me write an API library to interact with the OpenAI API please?", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + } + recorded_at: Mon, 29 Apr 2024 23:31:44 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_TSqSarEQuDAuY3IUhzUaDsTh/messages + body: + encoding: UTF-8 + string: '{"role":"user","content":"Can you help me write an API library to interact + with the OpenAI API please?"}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:31:54 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_01a1f7daf6e48a76274af3ebe4ed2b55 + Openai-Processing-Ms: + - '120' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=aKbCPjzahb4mEkgciikeKSOU.6Luxntej5vwX5I0i.w-1714433514-1.0.1.1-zrAvDiyuniFMUQ8sBkLDu5GUs6GlINAIkF_CS5zjWS7d5SAq61qUCmudmtfalSVe2x.R74XscBG5DvQEJmYB5Q; + path=/; expires=Tue, 30-Apr-24 00:01:54 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=U5alZbG3CTMj1fzlEDuLS.qbZAUhvKmXlcUg1rk4uZI-1714433514328-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c316970d313699-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "msg_JKgblCf5sKRp4efzpJaALBIR", + "object": "thread.message", + "created_at": 1714433514, + "assistant_id": null, + "thread_id": "thread_TSqSarEQuDAuY3IUhzUaDsTh", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "Can you help me write an API library to interact with the OpenAI API please?", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + } + recorded_at: Mon, 29 Apr 2024 23:31:54 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_1OzNYsu1GGKtiiWp0YPWPLvG/messages + body: + encoding: UTF-8 + string: '{"role":"user","content":"Can you help me write an API library to interact + with the OpenAI API please?"}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:32:12 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_974eb9abdd95288ed273832dfb4cc9a0 + Openai-Processing-Ms: + - '208' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=iGkkNm9nUfn_.mRPVXGW6PecARdCc7EF4_RzXwnGJ74-1714433532-1.0.1.1-sBXlPTqFblb0TcdrrEbNODSzyL2a1zkybyEc7wmy_xgx9JQYF1tEy1IMywm8uTq3O9tsATUgtcx9lIjS3n.JsQ; + path=/; expires=Tue, 30-Apr-24 00:02:12 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=YP21v8CdREicalHPTaOU_siz5.5lfCEMLarqXRgnjw4-1714433532130-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c317059e7f3697-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "msg_DZMthtuQh4aEUozjsf2WAGZV", + "object": "thread.message", + "created_at": 1714433531, + "assistant_id": null, + "thread_id": "thread_1OzNYsu1GGKtiiWp0YPWPLvG", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "Can you help me write an API library to interact with the OpenAI API please?", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + } + recorded_at: Mon, 29 Apr 2024 23:32:12 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_9aksFceTGOrlNUXhYQyn1tAk/messages + body: + encoding: UTF-8 + string: '{"role":"user","content":"Can you help me write an API library to interact + with the OpenAI API please?"}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:32:25 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_311a93865f61b8e54977919097fcc2aa + Openai-Processing-Ms: + - '104' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=j804F2GjyhMH8.lqlN_pofMoe0cYymb8MJxKP6xrzlQ-1714433545-1.0.1.1-8ck53lsk20wDRJJzelVN0nBCxnQaGnaFDTrwlk7f68R0P4bkfbgPAUjg_tLt2uHqmoi_o7_8fdYb5e.kqGkl4g; + path=/; expires=Tue, 30-Apr-24 00:02:25 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=OamA1wRWxCUaDJhLJxClxj2TrHP6f1pM1NUN_uD5JdA-1714433545687-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c3175b2f5ddd7c-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "msg_1fScUhjuzcaxWCwr7Z33PN0k", + "object": "thread.message", + "created_at": 1714433545, + "assistant_id": null, + "thread_id": "thread_9aksFceTGOrlNUXhYQyn1tAk", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "Can you help me write an API library to interact with the OpenAI API please?", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + } + recorded_at: Mon, 29 Apr 2024 23:32:25 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/messages_modify_thread_setup.yml b/spec/fixtures/cassettes/messages_modify_thread_setup.yml index 6a3ceaaf..d4b94908 100644 --- a/spec/fixtures/cassettes/messages_modify_thread_setup.yml +++ b/spec/fixtures/cassettes/messages_modify_thread_setup.yml @@ -66,4 +66,71 @@ http_interactions: "metadata": {} } recorded_at: Sat, 27 Apr 2024 20:48:41 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads + body: + encoding: UTF-8 + string: "{}" + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:32:25 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_df617d6163ee9d862564f1d73332e551 + Openai-Processing-Ms: + - '55' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=JbravAFz.PAZAyuGEuOxuV7.fz0Djioo9IHCeLxdVQE-1714433545-1.0.1.1-N28Ltq2Lv7D6kQY74yRuUaKZh2Zuh42_htnIG0A0oerOLS4s21RQQFjL5b_MEF5sApxBVaDYj1VBvalld5SZfw; + path=/; expires=Tue, 30-Apr-24 00:02:25 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=l_ORSpF2eYKkJyonvkYBZdUQm3Z7cq.HedTAXtxS6rE-1714433545396-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c317599b389451-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "thread_9aksFceTGOrlNUXhYQyn1tAk", + "object": "thread", + "created_at": 1714433545, + "metadata": {}, + "tool_resources": {} + } + recorded_at: Mon, 29 Apr 2024 23:32:25 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/messages_retrieve.yml b/spec/fixtures/cassettes/messages_retrieve.yml index 0751e358..b5e16f12 100644 --- a/spec/fixtures/cassettes/messages_retrieve.yml +++ b/spec/fixtures/cassettes/messages_retrieve.yml @@ -160,4 +160,84 @@ http_interactions: "metadata": {} } recorded_at: Sat, 27 Apr 2024 20:48:39 GMT +- request: + method: get + uri: https://api.openai.com/v1/threads/thread_cQkVK3NnPhIoyf6ZIp7Ohb0r/messages/msg_M4cwypUl0keUl9Z3iAYc17hD + body: + encoding: US-ASCII + string: '' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:28:22 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_1dfd06b0e5c0a43f518e1f01763c1c38 + Openai-Processing-Ms: + - '99' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=q5iQitWWYFeTtO1kN.dwBj1DeQBQJ2TQt3Q5e3Jwwbg-1714433302-1.0.1.1-9A5j86CJ1.tusbLBzmp.vhE1gURTgzntcaoaVxbRnA.tvIn9641z9aCSRR7qNbhBrx1MiNtFfwCu_NrZYt2Edg; + path=/; expires=Mon, 29-Apr-24 23:58:22 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=8LHoBCfsE2yle2BkaNrO4QDBswKoVzsxMNyGeoBpJCw-1714433302667-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c3116c49080706-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "msg_M4cwypUl0keUl9Z3iAYc17hD", + "object": "thread.message", + "created_at": 1714433302, + "assistant_id": null, + "thread_id": "thread_cQkVK3NnPhIoyf6ZIp7Ohb0r", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "Can you help me write an API library to interact with the OpenAI API please?", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + } + recorded_at: Mon, 29 Apr 2024 23:28:22 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/messages_retrieve_message_setup.yml b/spec/fixtures/cassettes/messages_retrieve_message_setup.yml index 5acd3929..0b7d4037 100644 --- a/spec/fixtures/cassettes/messages_retrieve_message_setup.yml +++ b/spec/fixtures/cassettes/messages_retrieve_message_setup.yml @@ -162,4 +162,85 @@ http_interactions: "metadata": {} } recorded_at: Sat, 27 Apr 2024 20:48:39 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_cQkVK3NnPhIoyf6ZIp7Ohb0r/messages + body: + encoding: UTF-8 + string: '{"role":"user","content":"Can you help me write an API library to interact + with the OpenAI API please?"}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:28:22 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_ae70a6334963d4968b7f1dd4c5fcd0c4 + Openai-Processing-Ms: + - '116' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=AX.No__rfOKUslUL_K9ClAnYdhL.Lbhq2d__LTbHxqQ-1714433302-1.0.1.1-3dzJw_5VzUW7zES66849lLNeQxUlJelXxirR_YghMVDv6UhSCwSBVZ7uWab_uxtG7ZZl17KvM5HSLAPEQLLJbA; + path=/; expires=Mon, 29-Apr-24 23:58:22 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=yJE1awSLrAbk0_kMIe.yTkX_RWK8psh0nRpaAsMAyIY-1714433302397-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c3116a7e4063d8-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "msg_M4cwypUl0keUl9Z3iAYc17hD", + "object": "thread.message", + "created_at": 1714433302, + "assistant_id": null, + "thread_id": "thread_cQkVK3NnPhIoyf6ZIp7Ohb0r", + "run_id": null, + "role": "user", + "content": [ + { + "type": "text", + "text": { + "value": "Can you help me write an API library to interact with the OpenAI API please?", + "annotations": [] + } + } + ], + "attachments": [], + "metadata": {} + } + recorded_at: Mon, 29 Apr 2024 23:28:22 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/messages_retrieve_thread_setup.yml b/spec/fixtures/cassettes/messages_retrieve_thread_setup.yml index ff716c04..1f71e3dc 100644 --- a/spec/fixtures/cassettes/messages_retrieve_thread_setup.yml +++ b/spec/fixtures/cassettes/messages_retrieve_thread_setup.yml @@ -66,4 +66,71 @@ http_interactions: "metadata": {} } recorded_at: Sat, 27 Apr 2024 20:48:38 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads + body: + encoding: UTF-8 + string: "{}" + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:28:22 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_608813ff20dce5a5c8c61d4f30636b04 + Openai-Processing-Ms: + - '107' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=NDf7sSZ0juYn9hgf6Go9GyxLJ.BqavBIHCIQPSakOQM-1714433302-1.0.1.1-YB0eiuopXoKnHSgDMXOBgvnFlmwWWbY7CpzB77YB0g7Ad_iXV6e0mMHLJaD3cgCPLz.ArX5mAi.Bf7kv8Aq1wQ; + path=/; expires=Mon, 29-Apr-24 23:58:22 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=2zRFFTBfOqCWawc2IVWTqryAbunRel0oHttyPHaLbj0-1714433302010-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c311669e9735bc-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "thread_cQkVK3NnPhIoyf6ZIp7Ohb0r", + "object": "thread", + "created_at": 1714433301, + "metadata": {}, + "tool_resources": {} + } + recorded_at: Mon, 29 Apr 2024 23:28:22 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/run_steps_list.yml b/spec/fixtures/cassettes/run_steps_list.yml index e9399dd9..8fdc542e 100644 --- a/spec/fixtures/cassettes/run_steps_list.yml +++ b/spec/fixtures/cassettes/run_steps_list.yml @@ -157,4 +157,71 @@ http_interactions: "has_more": false } recorded_at: Sat, 27 Apr 2024 20:48:16 GMT +- request: + method: get + uri: https://api.openai.com/v1/threads/thread_G8OSmr36Xv5rCr2ZXYsR94z3/runs/run_Y3rMslbLzvsod64HHI1TeGlp/steps?order=asc + body: + encoding: US-ASCII + string: '' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:37:26 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_43373a3a413d3e2a4dc973c63f06185b + Openai-Processing-Ms: + - '98' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=oa9j81JJ616_wFo6jtIK6QYexoJAoF0XQrWVThzX6sE-1714433846-1.0.1.1-wSvEx0dAVbPxwoauvALwHoBe5NRk_ovfD0bNob9gnKDkKTXgu8ZU0xmtqLLFd9hl0_TtM32e48D5DFckqSnHzQ; + path=/; expires=Tue, 30-Apr-24 00:07:26 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=U0NZkTe7ilYXFdCreHPGgjGEkDB9jQLbJvdWUmK5JTE-1714433846557-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31eb37f649535-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "object": "list", + "data": [], + "first_id": null, + "last_id": null, + "has_more": false + } + recorded_at: Mon, 29 Apr 2024 23:37:26 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/run_steps_list_assistant_setup.yml b/spec/fixtures/cassettes/run_steps_list_assistant_setup.yml index 4f2b0497..b21e93c5 100644 --- a/spec/fixtures/cassettes/run_steps_list_assistant_setup.yml +++ b/spec/fixtures/cassettes/run_steps_list_assistant_setup.yml @@ -80,7 +80,9 @@ http_interactions: uri: https://api.openai.com/v1/assistants body: encoding: UTF-8 - string: '{"model":"gpt-4","name":"OpenAI-Ruby test assistant"}' + string: '{"model":"gpt-4","name":"OpenAI-Ruby test assistant","instructions":"You + are a Ruby dev bot. When asked a question, write and run Ruby code to answer + the question"}' headers: Content-Type: - application/json @@ -100,7 +102,7 @@ http_interactions: message: OK headers: Date: - - Sat, 27 Apr 2024 20:48:14 GMT + - Mon, 29 Apr 2024 23:37:25 GMT Content-Type: - application/json Transfer-Encoding: @@ -112,36 +114,36 @@ http_interactions: Openai-Organization: - user-jxm65ijkzc1qrfhc0ij8moic X-Request-Id: - - req_e8c6d7c10b0adfb9594388f8f25ff0ea + - req_450f2fc56a1883b88fa145880c9b6560 Openai-Processing-Ms: - - '79' + - '86' Strict-Transport-Security: - max-age=15724800; includeSubDomains Cf-Cache-Status: - DYNAMIC Set-Cookie: - - __cf_bm=TRQtmMUTA8VnF2nAgZTl9GCon4Bv6okUdGY4Lf_aDP4-1714250894-1.0.1.1-vQsso16GdhF8m.Tjv1GWeCb4rzME8ezCvPPMG6wU5Ly5y80T4r_rMMONqihpxDQhhhYJS1db1K_LTNlbggMTQA; - path=/; expires=Sat, 27-Apr-24 21:18:14 GMT; domain=.api.openai.com; HttpOnly; + - __cf_bm=JaI3p5VzdOLFnkcL.LgmpRaTxN6vLiAfUKA3s.KA3UE-1714433845-1.0.1.1-t9tkGzcAEwYkBJfsKnDjNdOQRvTVFZODObxvbta.NvWE0B61yDENardOmYp2M1MzWmJH6FEoxP9ZgJbD9_dnNg; + path=/; expires=Tue, 30-Apr-24 00:07:25 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None - - _cfuvid=xYKjzi5.poGYTfNsV45ATe3B0ZuU5yHfXIGMvOBbfOg-1714250894446-0.0.1.1-604800000; + - _cfuvid=SDbzaKPsKEQyP5UUJDowPz0MIqFEShSwHT5HbyWB2.8-1714433845538-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None Server: - cloudflare Cf-Ray: - - 87b1ac188d510c6b-SOF + - 87c31ead481c24ae-LHR Alt-Svc: - h3=":443"; ma=86400 body: encoding: ASCII-8BIT string: |- { - "id": "asst_0BWclWx3dwDhj27ciEm5LF1N", + "id": "asst_DBRFUiRHOmIhkb5ny9ck3et9", "object": "assistant", - "created_at": 1714250894, + "created_at": 1714433845, "name": "OpenAI-Ruby test assistant", "description": null, "model": "gpt-4", - "instructions": null, + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", "tools": [], "top_p": 1.0, "temperature": 1.0, @@ -149,5 +151,5 @@ http_interactions: "metadata": {}, "response_format": "auto" } - recorded_at: Sat, 27 Apr 2024 20:48:14 GMT + recorded_at: Mon, 29 Apr 2024 23:37:25 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/run_steps_list_run_setup.yml b/spec/fixtures/cassettes/run_steps_list_run_setup.yml index d952ccd7..38579a11 100644 --- a/spec/fixtures/cassettes/run_steps_list_run_setup.yml +++ b/spec/fixtures/cassettes/run_steps_list_run_setup.yml @@ -184,4 +184,96 @@ http_interactions: "tool_choice": "auto" } recorded_at: Sat, 27 Apr 2024 20:48:15 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_G8OSmr36Xv5rCr2ZXYsR94z3/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_DBRFUiRHOmIhkb5ny9ck3et9"}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:37:26 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_e5375e8f338736a7c29d3ee108ad459c + Openai-Processing-Ms: + - '320' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=Pghh9fch9iE2Mc7GH5LlsWxUv9kItsWaDAmmWx_cSwQ-1714433846-1.0.1.1-zphU3It8h.YMjeDbGmVGZLo5rjGH5LEyoBQyOZOsAhJ.MJ54u4wPd0rEb5D44t9NgW5RBORC3zf4DKzTo9BWdA; + path=/; expires=Tue, 30-Apr-24 00:07:26 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=vKch2HpowcQZvRzn5cVCfLfdkugqzt.0bOCB_AOcvXA-1714433846151-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31eafb9877732-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "run_Y3rMslbLzvsod64HHI1TeGlp", + "object": "thread.run", + "created_at": 1714433845, + "assistant_id": "asst_DBRFUiRHOmIhkb5ny9ck3et9", + "thread_id": "thread_G8OSmr36Xv5rCr2ZXYsR94z3", + "status": "queued", + "started_at": null, + "expires_at": 1714434445, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "required_action": null, + "last_error": null, + "model": "gpt-4", + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "temperature": 1.0, + "top_p": 1.0, + "max_completion_tokens": null, + "max_prompt_tokens": null, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "incomplete_details": null, + "usage": null, + "response_format": "auto", + "tool_choice": "auto" + } + recorded_at: Mon, 29 Apr 2024 23:37:26 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/run_steps_list_thread_setup.yml b/spec/fixtures/cassettes/run_steps_list_thread_setup.yml index 7d433f7e..b02df605 100644 --- a/spec/fixtures/cassettes/run_steps_list_thread_setup.yml +++ b/spec/fixtures/cassettes/run_steps_list_thread_setup.yml @@ -66,4 +66,71 @@ http_interactions: "metadata": {} } recorded_at: Sat, 27 Apr 2024 20:48:14 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads + body: + encoding: UTF-8 + string: "{}" + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:37:25 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_9db815b22d9b243b27b2a3b7a35cbdc9 + Openai-Processing-Ms: + - '22' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=K5Ur6CzHyg8plW1fQr3EXiHBkfc3Mbd_l.vQVJ_1lx4-1714433845-1.0.1.1-RBweRWntmP0vnMm21XadXvrsx6J0CAI80q8A8k.4k33_AaxjnOjYt8RcUp8rC66LYEzfVCWMJLh9aePUCsPEQQ; + path=/; expires=Tue, 30-Apr-24 00:07:25 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=K7IFKLlG_xIBxVP2wxdrsFS7kQUFb8efD9vvJ063WCM-1714433845252-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31eabebcf23be-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "thread_G8OSmr36Xv5rCr2ZXYsR94z3", + "object": "thread", + "created_at": 1714433845, + "metadata": {}, + "tool_resources": {} + } + recorded_at: Mon, 29 Apr 2024 23:37:25 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/run_steps_retrieve.yml b/spec/fixtures/cassettes/run_steps_retrieve.yml index f24119ea..91a1d659 100644 --- a/spec/fixtures/cassettes/run_steps_retrieve.yml +++ b/spec/fixtures/cassettes/run_steps_retrieve.yml @@ -408,4 +408,72 @@ http_interactions: } } recorded_at: Sat, 27 Apr 2024 20:48:18 GMT +- request: + method: get + uri: https://api.openai.com/v1/threads/thread_JpRlqMom9C0pOoJToHcIUJCy/runs/run_g7AijG0Y0TsIvjmHorv3zB46/steps/123 + body: + encoding: US-ASCII + string: '' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 404 + message: Not Found + headers: + Date: + - Mon, 29 Apr 2024 23:37:27 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_1011f23cd2cf306b22a53adf52811550 + Openai-Processing-Ms: + - '101' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=0yyyfs2dnbz_6s8teqUbYYgMBed_Uru5pOKRcBf_ZN0-1714433847-1.0.1.1-PgNGKf5g.QkNivPV0NSfbko8rM1qmhOkOTRgElriAbizYNK6VjJGVRUEr1GOQstvtyIElFVWXXMMwaJ4auOkMg; + path=/; expires=Tue, 30-Apr-24 00:07:27 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=O0QFcnBetchOSPzDm.GaNkC4XCvj134zDYL7FGeRnHI-1714433847881-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31ebbdf2f770d-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "error": { + "message": "No run step found with id '123'.", + "type": "invalid_request_error", + "param": null, + "code": null + } + } + recorded_at: Mon, 29 Apr 2024 23:37:27 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/run_steps_retrieve_assistant_setup.yml b/spec/fixtures/cassettes/run_steps_retrieve_assistant_setup.yml index f767f84b..993849c4 100644 --- a/spec/fixtures/cassettes/run_steps_retrieve_assistant_setup.yml +++ b/spec/fixtures/cassettes/run_steps_retrieve_assistant_setup.yml @@ -77,7 +77,9 @@ http_interactions: uri: https://api.openai.com/v1/assistants body: encoding: UTF-8 - string: '{"model":"gpt-4","name":"OpenAI-Ruby test assistant"}' + string: '{"model":"gpt-4","name":"OpenAI-Ruby test assistant","instructions":"You + are a Ruby dev bot. When asked a question, write and run Ruby code to answer + the question"}' headers: Content-Type: - application/json @@ -97,7 +99,7 @@ http_interactions: message: OK headers: Date: - - Sat, 27 Apr 2024 20:48:17 GMT + - Mon, 29 Apr 2024 23:37:27 GMT Content-Type: - application/json Transfer-Encoding: @@ -109,36 +111,36 @@ http_interactions: Openai-Organization: - user-jxm65ijkzc1qrfhc0ij8moic X-Request-Id: - - req_dba07a82484093ee3509a60f737e03f7 + - req_1fdb2c72cecac775ba4dc459dd1810ad Openai-Processing-Ms: - - '92' + - '84' Strict-Transport-Security: - max-age=15724800; includeSubDomains Cf-Cache-Status: - DYNAMIC Set-Cookie: - - __cf_bm=pWNKLS8g08_KrSw8DpgxVqdi3xOl4S0E4zLX2Wb4II0-1714250897-1.0.1.1-BOhEZ3LP8a2CAxKasqAJyXzJw0xUXjvGa0G1.A9qvA04SrF2d7RGSG2JVvB2pWe9F_bfJrn7j_WW3NZw8qPf1w; - path=/; expires=Sat, 27-Apr-24 21:18:17 GMT; domain=.api.openai.com; HttpOnly; + - __cf_bm=oRRSHWcfyqCJ6k0gDi8.N3zsZCCmD.zGHQSii7NFM3E-1714433847-1.0.1.1-HgnbrWc0pGgzuFeRSuHfHblRUOt89wFPMBIpGMjixyk0eXRdw4HakLrSngUlG2JPTpVTFYJpmhPnkdD0_KZfGw; + path=/; expires=Tue, 30-Apr-24 00:07:27 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None - - _cfuvid=Omt_bvhaWLgrSzm9eeJEr72gJjtiDN.ArdyoC6NK.Jw-1714250897242-0.0.1.1-604800000; + - _cfuvid=Pe2ELtfVc0kV.XMlNOFTdW4m1mBA_BMygIwBMqXppLY-1714433847082-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None Server: - cloudflare Cf-Ray: - - 87b1ac2a0a016e9e-SOF + - 87c31eb6f86248c5-LHR Alt-Svc: - h3=":443"; ma=86400 body: encoding: ASCII-8BIT string: |- { - "id": "asst_HMzirL8Xv4hzIUwx2D2QDu8G", + "id": "asst_qS6Y4iuu3JviULGS8LrhIPA1", "object": "assistant", - "created_at": 1714250897, + "created_at": 1714433847, "name": "OpenAI-Ruby test assistant", "description": null, "model": "gpt-4", - "instructions": null, + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", "tools": [], "top_p": 1.0, "temperature": 1.0, @@ -146,5 +148,5 @@ http_interactions: "metadata": {}, "response_format": "auto" } - recorded_at: Sat, 27 Apr 2024 20:48:17 GMT + recorded_at: Mon, 29 Apr 2024 23:37:27 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/run_steps_retrieve_run_setup.yml b/spec/fixtures/cassettes/run_steps_retrieve_run_setup.yml index 72fd45e5..670072fe 100644 --- a/spec/fixtures/cassettes/run_steps_retrieve_run_setup.yml +++ b/spec/fixtures/cassettes/run_steps_retrieve_run_setup.yml @@ -487,4 +487,164 @@ http_interactions: "tool_choice": "auto" } recorded_at: Sat, 27 Apr 2024 20:48:17 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_kUaXGmNM6K7ppaqDprPgPMVL/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_TduimAX9TeOjD3jFV2Xcn7hm"}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:28:55 GMT + Content-Type: + - application/json + Content-Length: + - '209' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_b06408cc54b0c50574cf214464fe5a84 + Openai-Processing-Ms: + - '160' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=DspES5QE9XvyD6RwUlTCcDBAQTHidM8IPCDOJVJEwv4-1714433335-1.0.1.1-ky8BRPzkbpK1gtXOPmps45ay4159iZBSeh1GPjze2ZDHuPunhur1tz9Y3YfyQodBHPol0NWagb0eN0SAP0XVZw; + path=/; expires=Mon, 29-Apr-24 23:58:55 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=fXNd9AS83KU9DpH3fg46.Fjgaav0UD4oZRa_ULkwytk-1714433335675-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c3123a2ec83855-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Run creation requires a Thread with a user message or an assistant with instructions.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_thread" + } + } + recorded_at: Mon, 29 Apr 2024 23:28:55 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_JpRlqMom9C0pOoJToHcIUJCy/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_qS6Y4iuu3JviULGS8LrhIPA1"}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:37:27 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_fd0da51f7bcb684ac933c6fc77937e71 + Openai-Processing-Ms: + - '296' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=OzVTHFESMpWLbI_pbQdMIf.8Tlc1_0f2xR3sFAHwuO0-1714433847-1.0.1.1-diLybauoxwNSC.V12r.t.XsVykK.g_DZFUIJcsx.W2AL19jSgVbwxuxuZ1zh6Yv3.lyT4PgGmILVvcF5M7xNxg; + path=/; expires=Tue, 30-Apr-24 00:07:27 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=vwMCXIvE2QG76elhoKGPPWgLiFFInLZ.D2NWNamAzDw-1714433847577-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31eb8a8753690-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "run_g7AijG0Y0TsIvjmHorv3zB46", + "object": "thread.run", + "created_at": 1714433847, + "assistant_id": "asst_qS6Y4iuu3JviULGS8LrhIPA1", + "thread_id": "thread_JpRlqMom9C0pOoJToHcIUJCy", + "status": "queued", + "started_at": null, + "expires_at": 1714434447, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "required_action": null, + "last_error": null, + "model": "gpt-4", + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "temperature": 1.0, + "top_p": 1.0, + "max_completion_tokens": null, + "max_prompt_tokens": null, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "incomplete_details": null, + "usage": null, + "response_format": "auto", + "tool_choice": "auto" + } + recorded_at: Mon, 29 Apr 2024 23:37:27 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/run_steps_retrieve_thread_setup.yml b/spec/fixtures/cassettes/run_steps_retrieve_thread_setup.yml index 627b6542..c02203fa 100644 --- a/spec/fixtures/cassettes/run_steps_retrieve_thread_setup.yml +++ b/spec/fixtures/cassettes/run_steps_retrieve_thread_setup.yml @@ -66,4 +66,71 @@ http_interactions: "metadata": {} } recorded_at: Sat, 27 Apr 2024 20:48:16 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads + body: + encoding: UTF-8 + string: "{}" + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:37:26 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_3260c9e237ef9c9534ba425b7be6cf46 + Openai-Processing-Ms: + - '57' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=uP2uJEeWza2UjWX_vBODtXR81UUg..tQNOZDf_vkv7s-1714433846-1.0.1.1-Dnlj2TWRsW_6qWmzJ.2R.DAYHeKax0tjk0CGNM2g6WhfWQiJirFTjIB_lsE1lVcAmA2o0LDVplk5P2xcCaS0Tw; + path=/; expires=Tue, 30-Apr-24 00:07:26 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=.3X35USyZoouR89aGq.SCF5O0.ANUBYvm.DC0v0gaRo-1714433846808-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31eb56ff2940f-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "thread_JpRlqMom9C0pOoJToHcIUJCy", + "object": "thread", + "created_at": 1714433846, + "metadata": {}, + "tool_resources": {} + } + recorded_at: Mon, 29 Apr 2024 23:37:26 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_cancel.yml b/spec/fixtures/cassettes/runs_cancel.yml index 6fea8043..0758e799 100644 --- a/spec/fixtures/cassettes/runs_cancel.yml +++ b/spec/fixtures/cassettes/runs_cancel.yml @@ -269,4 +269,98 @@ http_interactions: "tool_choice": "auto" } recorded_at: Sat, 27 Apr 2024 22:07:50 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_svAq19uVG43TD78Xy0Con7I6/runs/run_e7bGDaCl3StbnlUIIitEejpy/cancel + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Content-Length: + - '0' + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:35:35 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_512ad4cd90464001e19cb243b82b0410 + Openai-Processing-Ms: + - '185' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=gEfMr.4Zii8xg6bnaAQ40M_MxwgmYfz5StFV8RuWuFM-1714433735-1.0.1.1-rfpXL2rsMmdgRzEa.YuvB7Wx6OZOVqtBvnaY4SM8my5x2sMllhGgLL09US6zvdcWQ6OfnBDirJcdSiR83vfgGQ; + path=/; expires=Tue, 30-Apr-24 00:05:35 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=S.deLADOhPWNTLFWZ9CMKtFccLVdQJ2Pso2VgLeYxLo-1714433735412-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31bfc6fce640a-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "run_e7bGDaCl3StbnlUIIitEejpy", + "object": "thread.run", + "created_at": 1714433734, + "assistant_id": "asst_HNPgL0I3E8pKzCSi6x6U7vlY", + "thread_id": "thread_svAq19uVG43TD78Xy0Con7I6", + "status": "cancelling", + "started_at": 1714433735, + "expires_at": 1714434334, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "required_action": null, + "last_error": null, + "model": "gpt-4", + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "temperature": 1.0, + "top_p": 1.0, + "max_completion_tokens": 16, + "max_prompt_tokens": 256, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "incomplete_details": null, + "usage": null, + "response_format": "auto", + "tool_choice": "auto" + } + recorded_at: Mon, 29 Apr 2024 23:35:35 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_cancel_assistant_setup.yml b/spec/fixtures/cassettes/runs_cancel_assistant_setup.yml index f94a67f9..a44da5f7 100644 --- a/spec/fixtures/cassettes/runs_cancel_assistant_setup.yml +++ b/spec/fixtures/cassettes/runs_cancel_assistant_setup.yml @@ -77,7 +77,9 @@ http_interactions: uri: https://api.openai.com/v1/assistants body: encoding: UTF-8 - string: '{"model":"gpt-4","name":"OpenAI-Ruby test assistant"}' + string: '{"model":"gpt-4","name":"OpenAI-Ruby test assistant","instructions":"You + are a Ruby dev bot. When asked a question, write and run Ruby code to answer + the question"}' headers: Content-Type: - application/json @@ -97,7 +99,7 @@ http_interactions: message: OK headers: Date: - - Sat, 27 Apr 2024 22:07:48 GMT + - Mon, 29 Apr 2024 23:35:34 GMT Content-Type: - application/json Transfer-Encoding: @@ -109,36 +111,36 @@ http_interactions: Openai-Organization: - user-jxm65ijkzc1qrfhc0ij8moic X-Request-Id: - - req_04a6698b91ca9a28696c4880f0fdd934 + - req_a2464387e17b5178dc0f10a4426b5264 Openai-Processing-Ms: - - '86' + - '65' Strict-Transport-Security: - max-age=15724800; includeSubDomains Cf-Cache-Status: - DYNAMIC Set-Cookie: - - __cf_bm=geog7XawseGwfclTGWmd5gfnItRq_AviEK5VgCzD64g-1714255668-1.0.1.1-QCYj3p_IU1Hq2HOIa0B1JLDtAo9MRzpKZoM3a5Rt9eGhle1pr.EQEwQXup9AuZ993TEZXCoSbhLJPvHK62Z9KA; - path=/; expires=Sat, 27-Apr-24 22:37:48 GMT; domain=.api.openai.com; HttpOnly; + - __cf_bm=bK48H3DRKOUyUX4DEXJfvNXx5.FSn.0lT9xLznYJno4-1714433734-1.0.1.1-EBCpv0uw7Zt_BXCxbs4QcjsCtr8lBJ3.vW5kv7jnMtpeJg3RGTL_9WfJHZduvQ0B_bp3AWfSFh0DSq0G5O9T0g; + path=/; expires=Tue, 30-Apr-24 00:05:34 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None - - _cfuvid=CeH319PqcD940hIWJE.Ov3SHBJEpYcegCCuW8PdFXPw-1714255668981-0.0.1.1-604800000; + - _cfuvid=.iHaNHUbGv_6b.UaTs5PVrKzScbAJrXR4EIlyCHN4iE-1714433734485-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None Server: - cloudflare Cf-Ray: - - 87b220a99bd63dbb-SOF + - 87c31bf75b8b777a-LHR Alt-Svc: - h3=":443"; ma=86400 body: encoding: ASCII-8BIT string: |- { - "id": "asst_3jVqFUi9zsnhWmmEkgajTWNM", + "id": "asst_HNPgL0I3E8pKzCSi6x6U7vlY", "object": "assistant", - "created_at": 1714255668, + "created_at": 1714433734, "name": "OpenAI-Ruby test assistant", "description": null, "model": "gpt-4", - "instructions": null, + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", "tools": [], "top_p": 1.0, "temperature": 1.0, @@ -146,5 +148,5 @@ http_interactions: "metadata": {}, "response_format": "auto" } - recorded_at: Sat, 27 Apr 2024 22:07:49 GMT + recorded_at: Mon, 29 Apr 2024 23:35:34 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_cancel_run_setup.yml b/spec/fixtures/cassettes/runs_cancel_run_setup.yml index 7b4a4261..b49515e6 100644 --- a/spec/fixtures/cassettes/runs_cancel_run_setup.yml +++ b/spec/fixtures/cassettes/runs_cancel_run_setup.yml @@ -263,4 +263,232 @@ http_interactions: "tool_choice": "auto" } recorded_at: Sat, 27 Apr 2024 22:07:49 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_UNN4I8mJYusmiD2gc5eh74Ls/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_rLfOZDSrRUxiBUOz06ePWLmR","max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:28:46 GMT + Content-Type: + - application/json + Content-Length: + - '209' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_572bf383256732d19ea8499d3adc1707 + Openai-Processing-Ms: + - '172' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=LppuEZnqLeQR8ZgoMM7S02blBW8X6HPL2fffYDp98JE-1714433326-1.0.1.1-i6wwIv3X2Y2G7_BpxMuDqlETjOG5qnyBLTefTOtY2Cpc_S.yU8M1dPeW.uccXBaaVyPrTZdBrpMPrmcjP0GRkQ; + path=/; expires=Mon, 29-Apr-24 23:58:46 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=_JZgifLypWabWlSVY3jXpPo1ldwFyE9SAKhw2k2q.pc-1714433326934-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c312037e83414d-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Run creation requires a Thread with a user message or an assistant with instructions.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_thread" + } + } + recorded_at: Mon, 29 Apr 2024 23:28:46 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_QMdTqrUBg9DNCJ3vzLSuMPFZ/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_0TJTQTW64xCj0XF57VNBaQON","max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:30:32 GMT + Content-Type: + - application/json + Content-Length: + - '209' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_4d120209b451f7d6ed664113af42baa5 + Openai-Processing-Ms: + - '157' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=OszOMuYFUVA0PEebjgqYf4h2meyndeKtnNmCAKUo804-1714433432-1.0.1.1-DSqKxdBxdRU4qeCsMJ0qPHIMYE.plaleDYZbMo7QHShu1tFcdGsHZYrkI3PYaukwBwiDtQwhd_x.j8DCRA0fPA; + path=/; expires=Tue, 30-Apr-24 00:00:32 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=rnuYWxUAQOGW_Pb7.g4n_bExPst9YV45i4iV.rGImWw-1714433432087-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31494c982886e-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Run creation requires a Thread with a user message or an assistant with instructions.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_thread" + } + } + recorded_at: Mon, 29 Apr 2024 23:30:32 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_svAq19uVG43TD78Xy0Con7I6/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_HNPgL0I3E8pKzCSi6x6U7vlY","max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:35:34 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_17ce663cbcb24e34b1960eaa029e28a5 + Openai-Processing-Ms: + - '319' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=cf2D2mbH1fepgj8B001hyFQ1in1I6OCK3J0kQOZjwdQ-1714433734-1.0.1.1-Z_cI8eDJa1U4KU1p7SNQ4s7l2saDCnTX76YDe4xBRZ1s61RJG.YuETiH8mBUUmVj1_x_4IoVF4FfaVgBNkJUWw; + path=/; expires=Tue, 30-Apr-24 00:05:34 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=OqfHbAe.UpVEbutDrPsOOEny.6qZ42SeMQTFcS63zaA-1714433734999-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31bf8f83c9502-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "run_e7bGDaCl3StbnlUIIitEejpy", + "object": "thread.run", + "created_at": 1714433734, + "assistant_id": "asst_HNPgL0I3E8pKzCSi6x6U7vlY", + "thread_id": "thread_svAq19uVG43TD78Xy0Con7I6", + "status": "queued", + "started_at": null, + "expires_at": 1714434334, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "required_action": null, + "last_error": null, + "model": "gpt-4", + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "temperature": 1.0, + "top_p": 1.0, + "max_completion_tokens": 16, + "max_prompt_tokens": 256, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "incomplete_details": null, + "usage": null, + "response_format": "auto", + "tool_choice": "auto" + } + recorded_at: Mon, 29 Apr 2024 23:35:35 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_cancel_thread_setup.yml b/spec/fixtures/cassettes/runs_cancel_thread_setup.yml index 86567888..da27ae48 100644 --- a/spec/fixtures/cassettes/runs_cancel_thread_setup.yml +++ b/spec/fixtures/cassettes/runs_cancel_thread_setup.yml @@ -66,4 +66,71 @@ http_interactions: "metadata": {} } recorded_at: Sat, 27 Apr 2024 22:07:48 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads + body: + encoding: UTF-8 + string: "{}" + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:35:34 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_3a353689c059dd8b5039a0a620da5830 + Openai-Processing-Ms: + - '21' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=9pZWnbPgvr3d6PAeRVFDZPQLR6KgkYxO6LOa7bTVHiI-1714433734-1.0.1.1-ay14Va.0SpPoydMBn9dndw2wAbCWcSdZtvLDdeAiryt4t9F3fhMyRKUPrtsjxTca37pL_oNkZB8nYf0lQRrHGQ; + path=/; expires=Tue, 30-Apr-24 00:05:34 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=..D7PFw.hvMrX8XV.Q_gtMFHRkyJhIEha8uCG5b6QDQ-1714433734234-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31bf60c966385-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "thread_svAq19uVG43TD78Xy0Con7I6", + "object": "thread", + "created_at": 1714433734, + "metadata": {}, + "tool_resources": {} + } + recorded_at: Mon, 29 Apr 2024 23:35:34 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_create.yml b/spec/fixtures/cassettes/runs_create.yml index 29ac054f..92216441 100644 --- a/spec/fixtures/cassettes/runs_create.yml +++ b/spec/fixtures/cassettes/runs_create.yml @@ -263,4 +263,232 @@ http_interactions: "tool_choice": "auto" } recorded_at: Sat, 27 Apr 2024 22:07:43 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_qS2JdglckQ3HMfpGnPwknHYh/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_4rFWslgJUm9jeDw3Vps58QKM","stream":false,"max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:28:43 GMT + Content-Type: + - application/json + Content-Length: + - '209' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_973b869259e06ad5c98fede320875d05 + Openai-Processing-Ms: + - '173' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=3pnyTZernWiZiVXpY.0ty_f0C14Yd1RhOWV.TFE8VNc-1714433323-1.0.1.1-50QN4UtYCyUq3rKxJduxZ5aGRY27aA0Tnk0U_5I8cbfCN7YFW6lxkMQHPbmRWWT_SYCqMK8o33vUPAM5ttmrvA; + path=/; expires=Mon, 29-Apr-24 23:58:43 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=0LXbZs0Mxr8MC0BZHe5JscbPmVRdPdjlUveW9WEh7Mk-1714433323956-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c311f0dca5946b-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Run creation requires a Thread with a user message or an assistant with instructions.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_thread" + } + } + recorded_at: Mon, 29 Apr 2024 23:28:43 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_ltegEX5R47Rf8Tdm8daTBic3/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_odlpM4TyItBSZdCRcj0C5RhW","stream":false,"max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:30:28 GMT + Content-Type: + - application/json + Content-Length: + - '209' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_3cb9fe52602cc533f5f42b3436a78bfc + Openai-Processing-Ms: + - '170' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=QFk1yVNZFmVHVcoT2TvVrCj.XwybYwEV.8HpMWBTCkg-1714433428-1.0.1.1-.uGkqEeZqNKZHiAtI2w4f89meQMgWgG09I1QZ2jmsNIn8aJlruOdltYQodg3iuPXpK2jtLoyXk6Mf8OH4PGtkA; + path=/; expires=Tue, 30-Apr-24 00:00:28 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=awvqwzbLJYMtWamblOUSg43kMoKY78jwQ3CeKlMgLUo-1714433428826-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31480497f9517-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Run creation requires a Thread with a user message or an assistant with instructions.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_thread" + } + } + recorded_at: Mon, 29 Apr 2024 23:30:28 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_6hbha2BlJI0a71EnJgou7kk3/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_N1oWljftjFCZz5VGszSvMEa6","stream":false,"max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:35:28 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_731ca32291e98e3df8490cfc2d6bcb09 + Openai-Processing-Ms: + - '319' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=HDQzxDZb3j0LPZLO_PE9nPgm0vDFeMVm1.4Q8aLKyNk-1714433728-1.0.1.1-X2Kx73HothfyewYxLljDN8Wk70gz1b4tnsiFSSaVGx5epnYOXqvc__ito9zjEGhDP0m_3hG4BqCWW4qZ2dDAaQ; + path=/; expires=Tue, 30-Apr-24 00:05:28 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=plfwx3nYsCnQgIWPC7WGlRY6J08um75DGVARmYknA1M-1714433728081-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31bcdcf814145-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "run_hy0Lp0vCM5aP6reMMlWJ5W8y", + "object": "thread.run", + "created_at": 1714433727, + "assistant_id": "asst_N1oWljftjFCZz5VGszSvMEa6", + "thread_id": "thread_6hbha2BlJI0a71EnJgou7kk3", + "status": "queued", + "started_at": null, + "expires_at": 1714434327, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "required_action": null, + "last_error": null, + "model": "gpt-4", + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "temperature": 1.0, + "top_p": 1.0, + "max_completion_tokens": 16, + "max_prompt_tokens": 256, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "incomplete_details": null, + "usage": null, + "response_format": "auto", + "tool_choice": "auto" + } + recorded_at: Mon, 29 Apr 2024 23:35:28 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_create_assistant_setup.yml b/spec/fixtures/cassettes/runs_create_assistant_setup.yml index 734f89de..c1e9916a 100644 --- a/spec/fixtures/cassettes/runs_create_assistant_setup.yml +++ b/spec/fixtures/cassettes/runs_create_assistant_setup.yml @@ -77,7 +77,9 @@ http_interactions: uri: https://api.openai.com/v1/assistants body: encoding: UTF-8 - string: '{"model":"gpt-4","name":"OpenAI-Ruby test assistant"}' + string: '{"model":"gpt-4","name":"OpenAI-Ruby test assistant","instructions":"You + are a Ruby dev bot. When asked a question, write and run Ruby code to answer + the question"}' headers: Content-Type: - application/json @@ -97,7 +99,7 @@ http_interactions: message: OK headers: Date: - - Sat, 27 Apr 2024 22:07:43 GMT + - Mon, 29 Apr 2024 23:35:27 GMT Content-Type: - application/json Transfer-Encoding: @@ -109,36 +111,36 @@ http_interactions: Openai-Organization: - user-jxm65ijkzc1qrfhc0ij8moic X-Request-Id: - - req_035b135abd98bf5899ab495f47b93af1 + - req_30c746427d6d68bd7a63cab483a4e784 Openai-Processing-Ms: - - '77' + - '92' Strict-Transport-Security: - max-age=15724800; includeSubDomains Cf-Cache-Status: - DYNAMIC Set-Cookie: - - __cf_bm=2tIfov0wBwt2gEbdaoV4LYAD9PaOeYFfPVXNBnwvkao-1714255663-1.0.1.1-.zf0vBLLBaZyV3XRoP06OQBe11yWzTF8izy8XB33XYniWejjIWFiPjhZZ3BW_xGOHj9AlmAybQY7bXQQ2NmADQ; - path=/; expires=Sat, 27-Apr-24 22:37:43 GMT; domain=.api.openai.com; HttpOnly; + - __cf_bm=tM6gLi4LOIP44ciDBNRfeWsWOBtZypF4cObwsMubgEw-1714433727-1.0.1.1-ey8jvQM420skgvffm3HMIgL0dOPtrUuORput5ohwMwcr2u.OXmFN_Y_1ToygEbXgjrW_Clpmj9rqB4Cq6yYltA; + path=/; expires=Tue, 30-Apr-24 00:05:27 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None - - _cfuvid=Y2ShUk8sZzNpx47uQofa1nk7qQ_m8wAl_DjA818rTNI-1714255663423-0.0.1.1-604800000; + - _cfuvid=6jhSn2QLo4SJl348u0yA0aa1asJBKzAC77QHmgj8e8Y-1714433727577-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None Server: - cloudflare Cf-Ray: - - 87b22086d9783db8-SOF + - 87c31bcbfb460672-LHR Alt-Svc: - h3=":443"; ma=86400 body: encoding: ASCII-8BIT string: |- { - "id": "asst_sjD1do8PvDsrM4rr7IlRR8Wi", + "id": "asst_N1oWljftjFCZz5VGszSvMEa6", "object": "assistant", - "created_at": 1714255663, + "created_at": 1714433727, "name": "OpenAI-Ruby test assistant", "description": null, "model": "gpt-4", - "instructions": null, + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", "tools": [], "top_p": 1.0, "temperature": 1.0, @@ -146,5 +148,5 @@ http_interactions: "metadata": {}, "response_format": "auto" } - recorded_at: Sat, 27 Apr 2024 22:07:43 GMT + recorded_at: Mon, 29 Apr 2024 23:35:27 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_create_thread_and_run.yml b/spec/fixtures/cassettes/runs_create_thread_and_run.yml index 01203b43..55d14d81 100644 --- a/spec/fixtures/cassettes/runs_create_thread_and_run.yml +++ b/spec/fixtures/cassettes/runs_create_thread_and_run.yml @@ -92,4 +92,96 @@ http_interactions: "tool_choice": "auto" } recorded_at: Sat, 27 Apr 2024 22:28:09 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_VcuNVLAXPQLIZhuKZwFsYN8n"}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:35:36 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_32941e3c7a367374ae3414c07b3dddd6 + Openai-Processing-Ms: + - '267' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=HWIvrwCxf48J5kE52ugZdaTmQkq1cv8YZgrEkrLArag-1714433736-1.0.1.1-UEMVH02QoShaYaE.bOPj0zCHMjn8ZJDVgFE3on4FSjCHX00HUVWwhvTmuH_if4oHCxYDDkW5XwlPpNUO9FKWYQ; + path=/; expires=Tue, 30-Apr-24 00:05:36 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=JgxbB8kKC5bNyYVzhItIM3j.BNZOwKEcdfbDsmlxhy8-1714433736191-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31c00b99e9490-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "run_FKkoUOnsuuCQZRFBCp5TazRv", + "object": "thread.run", + "created_at": 1714433736, + "assistant_id": "asst_VcuNVLAXPQLIZhuKZwFsYN8n", + "thread_id": "thread_jnsBJBYNua8w7kpue97pzxtu", + "status": "queued", + "started_at": null, + "expires_at": 1714434336, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "required_action": null, + "last_error": null, + "model": "gpt-4", + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "temperature": 1.0, + "top_p": 1.0, + "max_completion_tokens": null, + "max_prompt_tokens": null, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "incomplete_details": null, + "usage": null, + "response_format": "auto", + "tool_choice": "auto" + } + recorded_at: Mon, 29 Apr 2024 23:35:36 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_create_thread_and_run_assistant_setup.yml b/spec/fixtures/cassettes/runs_create_thread_and_run_assistant_setup.yml index 11dca336..50983b83 100644 --- a/spec/fixtures/cassettes/runs_create_thread_and_run_assistant_setup.yml +++ b/spec/fixtures/cassettes/runs_create_thread_and_run_assistant_setup.yml @@ -5,7 +5,9 @@ http_interactions: uri: https://api.openai.com/v1/assistants body: encoding: UTF-8 - string: '{"model":"gpt-4","name":"OpenAI-Ruby test assistant"}' + string: '{"model":"gpt-4","name":"OpenAI-Ruby test assistant","instructions":"You + are a Ruby dev bot. When asked a question, write and run Ruby code to answer + the question"}' headers: Content-Type: - application/json @@ -25,7 +27,7 @@ http_interactions: message: OK headers: Date: - - Sat, 27 Apr 2024 22:28:09 GMT + - Mon, 29 Apr 2024 23:35:35 GMT Content-Type: - application/json Transfer-Encoding: @@ -37,36 +39,36 @@ http_interactions: Openai-Organization: - user-jxm65ijkzc1qrfhc0ij8moic X-Request-Id: - - req_01139a321a4f3965a2f1df4c1d531071 + - req_65303f4ab0dc9ca53a54209978450a38 Openai-Processing-Ms: - - '151' + - '82' Strict-Transport-Security: - max-age=15724800; includeSubDomains Cf-Cache-Status: - DYNAMIC Set-Cookie: - - __cf_bm=vR1sYErFjpww23gEMsdPxw7nbW7hB084xk.Zrr9.lsc-1714256889-1.0.1.1-zRDn5HDihQaIodU4KLRT.2zHK2q7GyhQbqAsA7LdPYXtUWfIEo5YdjbvN9SbdiON96WDvK1eqJTlP90hBVdCKA; - path=/; expires=Sat, 27-Apr-24 22:58:09 GMT; domain=.api.openai.com; HttpOnly; + - __cf_bm=hclv1xs61T2Au_wvXBWBBG8_cQ_KfaUSkhtrD7Il504-1714433735-1.0.1.1-2J3bLZqtXGvvBFZcNclT6xbxDIwenxw4aJ2scVfRwN3T0ETPKBj1wi0MX63M2_cOJnGeeZp9xH66AJNiek20iA; + path=/; expires=Tue, 30-Apr-24 00:05:35 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None - - _cfuvid=82QBxyo1_Q3lFKtv40M65tlAAYPHaekurShQ0exmUtI-1714256889256-0.0.1.1-604800000; + - _cfuvid=IfX9jEvrhi8qxEhEvHWSd58dFaxpIHQ7x0GWpM7IwuY-1714433735724-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None Server: - cloudflare Cf-Ray: - - 87b23e73ded23dc1-SOF + - 87c31bfefd6135dd-LHR Alt-Svc: - h3=":443"; ma=86400 body: encoding: ASCII-8BIT string: |- { - "id": "asst_lOE8Fdv5X9oMlEkcJauLDA16", + "id": "asst_VcuNVLAXPQLIZhuKZwFsYN8n", "object": "assistant", - "created_at": 1714256889, + "created_at": 1714433735, "name": "OpenAI-Ruby test assistant", "description": null, "model": "gpt-4", - "instructions": null, + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", "tools": [], "top_p": 1.0, "temperature": 1.0, @@ -74,5 +76,5 @@ http_interactions: "metadata": {}, "response_format": "auto" } - recorded_at: Sat, 27 Apr 2024 22:28:09 GMT + recorded_at: Mon, 29 Apr 2024 23:35:35 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_create_thread_setup.yml b/spec/fixtures/cassettes/runs_create_thread_setup.yml index 49d64a6c..8394d51c 100644 --- a/spec/fixtures/cassettes/runs_create_thread_setup.yml +++ b/spec/fixtures/cassettes/runs_create_thread_setup.yml @@ -66,4 +66,71 @@ http_interactions: "metadata": {} } recorded_at: Sat, 27 Apr 2024 22:07:43 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads + body: + encoding: UTF-8 + string: "{}" + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:35:27 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_f804ec35bc5484109fe374c8fdf695bf + Openai-Processing-Ms: + - '40' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=3ArWA45JNmW7agxwULqU5UutgZnEexMlIo8X_odzMic-1714433727-1.0.1.1-5VJtEyQa2Roi7N2v3njGEIRxY8A2tTulXObvPTprkArVZph04Quz4m2.SLUOHzvWYwbq6MPP8.hhoqlynjsoHQ; + path=/; expires=Tue, 30-Apr-24 00:05:27 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=WgEpL0qKKTPw8i385e62eDzo4BtDtNOwBQ1NzkOXK5w-1714433727294-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31bca894fdd4c-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "thread_6hbha2BlJI0a71EnJgou7kk3", + "object": "thread", + "created_at": 1714433727, + "metadata": {}, + "tool_resources": {} + } + recorded_at: Mon, 29 Apr 2024 23:35:27 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_list.yml b/spec/fixtures/cassettes/runs_list.yml index 0caed198..2df17fc0 100644 --- a/spec/fixtures/cassettes/runs_list.yml +++ b/spec/fixtures/cassettes/runs_list.yml @@ -300,4 +300,204 @@ http_interactions: "has_more": false } recorded_at: Sat, 27 Apr 2024 22:07:41 GMT +- request: + method: get + uri: https://api.openai.com/v1/threads/thread_2TmoNHweDuvw4c0tRA8yXXZt/runs?order=asc + body: + encoding: US-ASCII + string: '' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:35:10 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_e72c3904d0833119a6a18b7f4201b22f + Openai-Processing-Ms: + - '142' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=sEauejxy3sRqwgXb8rsP4ZWuEPjntsQuOgGCdVAFCTI-1714433710-1.0.1.1-MDAQwFjS15pwFQFNC5tz6x1Z7u7RAXq_3danN.st_9MSvsrtMlc9_11Wr52OOfPfTg1y21uFvl6GrdMTESZtuA; + path=/; expires=Tue, 30-Apr-24 00:05:10 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=x64ewX0hCoeT3PKxJa9v._vxmb_.dG.g9.Ye1NFiS90-1714433710907-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31b637ea963fa-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "object": "list", + "data": [ + { + "id": "run_QpXf5BGVtXVTcSenYcgnJh3K", + "object": "thread.run", + "created_at": 1714433710, + "assistant_id": "asst_lMFvIrGdJxzRoY8bKM1KSlIL", + "thread_id": "thread_2TmoNHweDuvw4c0tRA8yXXZt", + "status": "in_progress", + "started_at": 1714433710, + "expires_at": 1714434310, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "required_action": null, + "last_error": null, + "model": "gpt-4", + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "temperature": 1.0, + "top_p": 1.0, + "max_completion_tokens": 16, + "max_prompt_tokens": 256, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "incomplete_details": null, + "usage": null, + "response_format": "auto", + "tool_choice": "auto" + } + ], + "first_id": "run_QpXf5BGVtXVTcSenYcgnJh3K", + "last_id": "run_QpXf5BGVtXVTcSenYcgnJh3K", + "has_more": false + } + recorded_at: Mon, 29 Apr 2024 23:35:10 GMT +- request: + method: get + uri: https://api.openai.com/v1/threads/thread_LlkcwBXgqA8UNe2W84J7tDpM/runs?order=asc + body: + encoding: US-ASCII + string: '' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:35:25 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_49a2116db90a6e887f16d4a4be1b1c92 + Openai-Processing-Ms: + - '128' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=euj7HQTKZhK0P2dAxfP0r4C7FRNW2W1GnVAFY3HXYM8-1714433725-1.0.1.1-vVHcG7qjcRW5DeVFKBKcfe7jo6MmvvYIVD1.BtlfQ__g9XpAMwpRdbDc07rtDsuUhUagAx7iQM5.4CrkbuwRWQ; + path=/; expires=Tue, 30-Apr-24 00:05:25 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=4zkAl5rKrBs4Umk0fUkWwM2nwBUTxDT2dkScTNokF60-1714433725530-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31bbef96a94a4-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "object": "list", + "data": [ + { + "id": "run_cFlB86OJGLnSBM5sSiDS7aIg", + "object": "thread.run", + "created_at": 1714433724, + "assistant_id": "asst_UPL9MZQUmTZyWpQGgnfDVbwq", + "thread_id": "thread_LlkcwBXgqA8UNe2W84J7tDpM", + "status": "in_progress", + "started_at": 1714433725, + "expires_at": 1714434324, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "required_action": null, + "last_error": null, + "model": "gpt-4", + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "temperature": 1.0, + "top_p": 1.0, + "max_completion_tokens": 16, + "max_prompt_tokens": 256, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "incomplete_details": null, + "usage": null, + "response_format": "auto", + "tool_choice": "auto" + } + ], + "first_id": "run_cFlB86OJGLnSBM5sSiDS7aIg", + "last_id": "run_cFlB86OJGLnSBM5sSiDS7aIg", + "has_more": false + } + recorded_at: Mon, 29 Apr 2024 23:35:25 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_list_assistant_setup.yml b/spec/fixtures/cassettes/runs_list_assistant_setup.yml index 582f5f33..bb4f01ac 100644 --- a/spec/fixtures/cassettes/runs_list_assistant_setup.yml +++ b/spec/fixtures/cassettes/runs_list_assistant_setup.yml @@ -80,7 +80,9 @@ http_interactions: uri: https://api.openai.com/v1/assistants body: encoding: UTF-8 - string: '{"model":"gpt-4","name":"OpenAI-Ruby test assistant"}' + string: '{"model":"gpt-4","name":"OpenAI-Ruby test assistant","instructions":"You + are a Ruby dev bot. When asked a question, write and run Ruby code to answer + the question"}' headers: Content-Type: - application/json @@ -100,7 +102,7 @@ http_interactions: message: OK headers: Date: - - Sat, 27 Apr 2024 22:07:40 GMT + - Mon, 29 Apr 2024 23:35:24 GMT Content-Type: - application/json Transfer-Encoding: @@ -112,36 +114,36 @@ http_interactions: Openai-Organization: - user-jxm65ijkzc1qrfhc0ij8moic X-Request-Id: - - req_ca6c94dfaa72b32014985a4944377b3a + - req_a7765f761551b47ec62b1774b4d56b3a Openai-Processing-Ms: - - '69' + - '75' Strict-Transport-Security: - max-age=15724800; includeSubDomains Cf-Cache-Status: - DYNAMIC Set-Cookie: - - __cf_bm=f.AQZXm_TcSdOshRDAR9qJit1NFor.zHxklSFCewHUs-1714255660-1.0.1.1-evbhq7WtHHpEowyLe5Xuaws_6H70qGjuAEB05ywpmVeGhSXI6tUdyGKwXmsct2TdBgMUObP9m0trEAwowPQDQA; - path=/; expires=Sat, 27-Apr-24 22:37:40 GMT; domain=.api.openai.com; HttpOnly; + - __cf_bm=c8bMQ7pSQPCyagYHdXccJ23yv1dVA5Q0GPWMn5r.DNI-1714433724-1.0.1.1-IXXWXq9v6ngFgOzWahjDM8PaDDY0f0d_7lB6ZXTF82g6bAS1DrpRW8hiECLXn2NagsbPGNsj6P_gX_Io7kCpWw; + path=/; expires=Tue, 30-Apr-24 00:05:24 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None - - _cfuvid=sCpxOQGwahExLFLSsd1nBcnHwDs.EWD6TrT4s1Yuaaw-1714255660455-0.0.1.1-604800000; + - _cfuvid=ZUBMHLFUL4jtXTQFJZFolTWKrQBZ23J_5rdw5J56ofU-1714433724667-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None Server: - cloudflare Cf-Ray: - - 87b220745db38ee4-SOF + - 87c31bb9ef826533-LHR Alt-Svc: - h3=":443"; ma=86400 body: encoding: ASCII-8BIT string: |- { - "id": "asst_pXnsv2D5D75SUSnriQZ1nSse", + "id": "asst_UPL9MZQUmTZyWpQGgnfDVbwq", "object": "assistant", - "created_at": 1714255660, + "created_at": 1714433724, "name": "OpenAI-Ruby test assistant", "description": null, "model": "gpt-4", - "instructions": null, + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", "tools": [], "top_p": 1.0, "temperature": 1.0, @@ -149,5 +151,5 @@ http_interactions: "metadata": {}, "response_format": "auto" } - recorded_at: Sat, 27 Apr 2024 22:07:40 GMT + recorded_at: Mon, 29 Apr 2024 23:35:24 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_list_run_setup.yml b/spec/fixtures/cassettes/runs_list_run_setup.yml index 94b247fd..c65f6dfe 100644 --- a/spec/fixtures/cassettes/runs_list_run_setup.yml +++ b/spec/fixtures/cassettes/runs_list_run_setup.yml @@ -276,4 +276,528 @@ http_interactions: "tool_choice": "auto" } recorded_at: Sat, 27 Apr 2024 22:07:41 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_dxrWSKL6654mHrAzRD4o1czF/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_uWap6gSOzYgGTK6x7BXVb3iI","max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:28:42 GMT + Content-Type: + - application/json + Content-Length: + - '209' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_f831b2bdb8cdb34d31d5f475ae8c44fd + Openai-Processing-Ms: + - '166' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=k78VSwA3MLayMcbmc5KQvqcNFRX5gXOPsCKrm7NW8Zo-1714433322-1.0.1.1-BE7i7XVkytBSbzs1F6wce.83oeXvmELXLTKcLXqmui7KO6ZMyzoRq5tj1WSpM4nXNalC1JLy78MMRE_XorKYCg; + path=/; expires=Mon, 29-Apr-24 23:58:42 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=mRnpxDj_m6v__CbCcWCym7Bs_dyB7FcVmKAtlV5s498-1714433322131-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c311e58a9e9553-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Run creation requires a Thread with a user message or an assistant with instructions.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_thread" + } + } + recorded_at: Mon, 29 Apr 2024 23:28:42 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_Xo7uxlA2FpHVRUN8TKVcPcDV/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_f2IIJE6t3Hk4HIIwh7hcqCYF","max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:30:26 GMT + Content-Type: + - application/json + Content-Length: + - '209' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_7e36479cc1a94b9704f336241a4f7fe6 + Openai-Processing-Ms: + - '162' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=bNoog.elqQ.0kpZ33ERgw4rybqvHOfWVJ.C_wExAYjc-1714433426-1.0.1.1-ST2KfJJskCVVT.SA4uGI2BKgBGRcXovdCTypuJqQzP2sreGsp5jfkHmYUptLNDd_Pdvp2pPrYJcsH.3NtdJMjQ; + path=/; expires=Tue, 30-Apr-24 00:00:26 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=.0tbQqB.f3PZNM.xxEFIJualZI6NHwLUHu2NyBpMoeg-1714433426779-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c314737e1523cc-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Run creation requires a Thread with a user message or an assistant with instructions.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_thread" + } + } + recorded_at: Mon, 29 Apr 2024 23:30:26 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_Y9LpJfErlQyTPSQCl75Uk3IF/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_2XOK1euGVH6FzbjtDxrIZzsm","max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:33:39 GMT + Content-Type: + - application/json + Content-Length: + - '209' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_b9f25402fb889a16758cb1d446f3e393 + Openai-Processing-Ms: + - '276' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=KBIcbKAyrUXDz7yY65eg6lkb3y9aQhZ7ueIcAMO80jM-1714433619-1.0.1.1-rmjevrwf2_h45Z9tlxcgSGbfcuVFvsPOPXhAGTqdPBtTEi2kg6kNMPzIkmyJGy.BEikbdugOkWR9eYtSZOvrhg; + path=/; expires=Tue, 30-Apr-24 00:03:39 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=xiJg6RQsjDaeLZxyIZj0J7_LfVNNOmQeMxEbS3N3o.o-1714433619553-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31927afba9553-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Run creation requires a Thread with a user message or an assistant with instructions.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_thread" + } + } + recorded_at: Mon, 29 Apr 2024 23:33:39 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_vuJhPfxLiXAZbC5pLRacLeev/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_vwDCY6skDIj2I0QmmkdKIJrr","max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:33:57 GMT + Content-Type: + - application/json + Content-Length: + - '209' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_1ec2764796e7b8ad515c8a3052b00039 + Openai-Processing-Ms: + - '168' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=AKs9o5sy_bpbV5LQahaDHg7gV_SxwPa3na5J2J8jOss-1714433637-1.0.1.1-VCGqrAa4OsIkLe5RKjLEEjB3uSom3FU5bVKohN.9spuWJJ1pUuRIYmUYnYEf3VqMySq9DP6rIlDXHpDQ.G6RMQ; + path=/; expires=Tue, 30-Apr-24 00:03:57 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=PnXwdSqb2BHnvMCD4x5B9dmIcU4BNzCJmtDDyC.O.GI-1714433637268-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c319971d5806dd-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Run creation requires a Thread with a user message or an assistant with instructions.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_thread" + } + } + recorded_at: Mon, 29 Apr 2024 23:33:57 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_DXksKVVGSdVrdk0horI6emCT/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_I14JD87FVk6uvgCjTOA07xU1","max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:34:27 GMT + Content-Type: + - application/json + Content-Length: + - '209' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_cdb70dd485ee89fc198728a8979ea41e + Openai-Processing-Ms: + - '168' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=NdH6TuueTSEHuCyFFH5D.gnY4Ix7mp0CDqL0G17nw.k-1714433667-1.0.1.1-r.6CFzBmvRJBAGaCFyK.waP0coDDQFjsqVjnSxyOnabLz4JPtpc7fBpe02Ok38Ws3FKTwIbL1kfMiIyi2JeLZg; + path=/; expires=Tue, 30-Apr-24 00:04:27 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=XF9RFDrV06qOYolT3uc3V0nkJST9iUr3cTELtD_8yi8-1714433667535-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31a543c0877a8-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Run creation requires a Thread with a user message or an assistant with instructions.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_thread" + } + } + recorded_at: Mon, 29 Apr 2024 23:34:27 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_2TmoNHweDuvw4c0tRA8yXXZt/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_lMFvIrGdJxzRoY8bKM1KSlIL","max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:35:10 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_2d1a880c13d637de4bc481dd2aa3ec81 + Openai-Processing-Ms: + - '304' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=VxImxto38V3oZOYFcwDw4DrWcoZ_s0xX9o7QnpuKYIs-1714433710-1.0.1.1-YQ79JD3kpxWlV.TcWbYs.5tAwOh5WFkvtRlbZWar37G8pp_nFMVVel6.BJ6r_Hjq0fkNTidf_N.N52b9iDmJTg; + path=/; expires=Tue, 30-Apr-24 00:05:10 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=.X3w2SZdUgU8fRDffgUJ4xLdxvxoI0NGkHxr34PHX_g-1714433710478-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31b5fcf6c63c5-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "run_QpXf5BGVtXVTcSenYcgnJh3K", + "object": "thread.run", + "created_at": 1714433710, + "assistant_id": "asst_lMFvIrGdJxzRoY8bKM1KSlIL", + "thread_id": "thread_2TmoNHweDuvw4c0tRA8yXXZt", + "status": "queued", + "started_at": null, + "expires_at": 1714434310, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "required_action": null, + "last_error": null, + "model": "gpt-4", + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "temperature": 1.0, + "top_p": 1.0, + "max_completion_tokens": 16, + "max_prompt_tokens": 256, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "incomplete_details": null, + "usage": null, + "response_format": "auto", + "tool_choice": "auto" + } + recorded_at: Mon, 29 Apr 2024 23:35:10 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_LlkcwBXgqA8UNe2W84J7tDpM/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_UPL9MZQUmTZyWpQGgnfDVbwq","max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:35:25 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_7ca1c762ca3bb0d34b1cb891d0383d06 + Openai-Processing-Ms: + - '350' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=6M7h0LN1UhMzrCY.4ANeVKI3O.eGMyslXCMAIaBjPNk-1714433725-1.0.1.1-24GYwz1HNLv43RVVOQ_jCWQYPoOKfPdZBkk9E6qzKtRADxtv.OVtPMBQJEs5m7Fprf0epS9lYZSpnG1q2Ex_Hg; + path=/; expires=Tue, 30-Apr-24 00:05:25 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=invU0tZ7L81FH53ghZWhNYckHkUn1Xy4Fz1HF2xWOWo-1714433725203-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31bbb8ee871f0-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "run_cFlB86OJGLnSBM5sSiDS7aIg", + "object": "thread.run", + "created_at": 1714433724, + "assistant_id": "asst_UPL9MZQUmTZyWpQGgnfDVbwq", + "thread_id": "thread_LlkcwBXgqA8UNe2W84J7tDpM", + "status": "queued", + "started_at": null, + "expires_at": 1714434324, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "required_action": null, + "last_error": null, + "model": "gpt-4", + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "temperature": 1.0, + "top_p": 1.0, + "max_completion_tokens": 16, + "max_prompt_tokens": 256, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "incomplete_details": null, + "usage": null, + "response_format": "auto", + "tool_choice": "auto" + } + recorded_at: Mon, 29 Apr 2024 23:35:25 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_list_thread_setup.yml b/spec/fixtures/cassettes/runs_list_thread_setup.yml index 0be1bd01..8a9889fe 100644 --- a/spec/fixtures/cassettes/runs_list_thread_setup.yml +++ b/spec/fixtures/cassettes/runs_list_thread_setup.yml @@ -66,4 +66,71 @@ http_interactions: "metadata": {} } recorded_at: Sat, 27 Apr 2024 22:07:40 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads + body: + encoding: UTF-8 + string: "{}" + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:35:24 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_d921ad08f2c39001ddd492f834309db5 + Openai-Processing-Ms: + - '21' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=0YxdFNG67czTf.rgGaAajXqvdshk9ZDtZFmbU95YJRA-1714433724-1.0.1.1-utpKK1dmDLSCujSplFdHzoWHTEL9QWNec1sDGDs95O9rA6LXJTDvYtrMljWW7fbtB9pWhdbXzTK8cMNP6eXDCQ; + path=/; expires=Tue, 30-Apr-24 00:05:24 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=dChX__Qe.p5WbXgf0sau3C3YY3Pp4XTZ1oTdG8x_tWU-1714433724405-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31bb8acf86316-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "thread_LlkcwBXgqA8UNe2W84J7tDpM", + "object": "thread", + "created_at": 1714433724, + "metadata": {}, + "tool_resources": {} + } + recorded_at: Mon, 29 Apr 2024 23:35:24 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_modify.yml b/spec/fixtures/cassettes/runs_modify.yml index e752a9eb..e0cbd572 100644 --- a/spec/fixtures/cassettes/runs_modify.yml +++ b/spec/fixtures/cassettes/runs_modify.yml @@ -204,4 +204,72 @@ http_interactions: } } recorded_at: Sat, 27 Apr 2024 22:07:48 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_gdGHwrXQ8YPgNx7qPfWR7rIE/runs/run_wJ1j1H1b9Muubjscq4kNmG4Y + body: + encoding: UTF-8 + string: '{"metadata":{"modified":true}}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:35:33 GMT + Content-Type: + - application/json + Content-Length: + - '220' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_e5b35be52e776f0c37f64e78601e4849 + Openai-Processing-Ms: + - '96' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=jYiuz91vMYSEgSnu.CY6cPJnFpB9SWwmGxldff8Gv9U-1714433733-1.0.1.1-aEQjG4CsOn7zp52tsG2x09LthjNsfV3sZBuHCTKRHKVI72YStBb16YQkhQZ2pwLheopv60ivGikBZPftyfSlSA; + path=/; expires=Tue, 30-Apr-24 00:05:33 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=t2xuqgI9BnAThfggJoRnsvjYnuw_8_myR0EJ30KbocQ-1714433733967-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31bf3edd4d170-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Invalid type for 'metadata.modified': expected a string, but got a boolean instead.", + "type": "invalid_request_error", + "param": "metadata.modified", + "code": "invalid_type" + } + } + recorded_at: Mon, 29 Apr 2024 23:35:34 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_modify_assistant_setup.yml b/spec/fixtures/cassettes/runs_modify_assistant_setup.yml index a94830e4..9693b70b 100644 --- a/spec/fixtures/cassettes/runs_modify_assistant_setup.yml +++ b/spec/fixtures/cassettes/runs_modify_assistant_setup.yml @@ -77,7 +77,9 @@ http_interactions: uri: https://api.openai.com/v1/assistants body: encoding: UTF-8 - string: '{"model":"gpt-4","name":"OpenAI-Ruby test assistant"}' + string: '{"model":"gpt-4","name":"OpenAI-Ruby test assistant","instructions":"You + are a Ruby dev bot. When asked a question, write and run Ruby code to answer + the question"}' headers: Content-Type: - application/json @@ -97,7 +99,7 @@ http_interactions: message: OK headers: Date: - - Sat, 27 Apr 2024 22:07:47 GMT + - Mon, 29 Apr 2024 23:35:33 GMT Content-Type: - application/json Transfer-Encoding: @@ -109,36 +111,36 @@ http_interactions: Openai-Organization: - user-jxm65ijkzc1qrfhc0ij8moic X-Request-Id: - - req_e33fe33feeeedd09839101ecd9d6e1df + - req_dc37dd59ec71f970b10ec90fd7b5f41e Openai-Processing-Ms: - - '84' + - '69' Strict-Transport-Security: - max-age=15724800; includeSubDomains Cf-Cache-Status: - DYNAMIC Set-Cookie: - - __cf_bm=FHVdcXefHIjazpzoaKYlSxBh9xj5kXfSVrvfvqFycN8-1714255667-1.0.1.1-gFrCEmD223RVmppUbW_Pep3vQPCbvXOicFczqj28l_L5pTzxsMw4nGzO0xQK5kRcpS4J0.Iu4vLmHMNiwNGq_A; - path=/; expires=Sat, 27-Apr-24 22:37:47 GMT; domain=.api.openai.com; HttpOnly; + - __cf_bm=D3QfH4qo72pKCMc6UPda3BB_tnhrjXRSrkiD7OILBvM-1714433733-1.0.1.1-Fkj2wWB_fSgl0zsFL6oyew6VXnj47BTCyd_09OzXWeVzF3O4JjYkdjcIMaNnKSnEYfmlC2PrPKKP9kZ.K6vv0w; + path=/; expires=Tue, 30-Apr-24 00:05:33 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None - - _cfuvid=QasnJ4OZCo6UZVV2FU7BGNay4PdJlIAvS_ZDRkPzfd4-1714255667421-0.0.1.1-604800000; + - _cfuvid=wm_XE.wIUooc6g5rt6w1QBhBn.N6iQGKx63.pSwHsWI-1714433733003-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None Server: - cloudflare Cf-Ray: - - 87b2209fdc8a0c5f-SOF + - 87c31bee1c5e069a-LHR Alt-Svc: - h3=":443"; ma=86400 body: encoding: ASCII-8BIT string: |- { - "id": "asst_6wByOGuJwYIcU1luop9B4hhU", + "id": "asst_WTxL2hAljPdBcrSTR6r3l9Ea", "object": "assistant", - "created_at": 1714255667, + "created_at": 1714433732, "name": "OpenAI-Ruby test assistant", "description": null, "model": "gpt-4", - "instructions": null, + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", "tools": [], "top_p": 1.0, "temperature": 1.0, @@ -146,5 +148,5 @@ http_interactions: "metadata": {}, "response_format": "auto" } - recorded_at: Sat, 27 Apr 2024 22:07:47 GMT + recorded_at: Mon, 29 Apr 2024 23:35:33 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_modify_run_setup.yml b/spec/fixtures/cassettes/runs_modify_run_setup.yml index b22228f0..a251c05b 100644 --- a/spec/fixtures/cassettes/runs_modify_run_setup.yml +++ b/spec/fixtures/cassettes/runs_modify_run_setup.yml @@ -263,4 +263,232 @@ http_interactions: "tool_choice": "auto" } recorded_at: Sat, 27 Apr 2024 22:07:48 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_kBfZih6KHxEnONEBq0XfIf06/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_pMxaOZkZBwvQEY04pLLidpBc","max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:28:45 GMT + Content-Type: + - application/json + Content-Length: + - '209' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_00dc1223eae78828447af1c70ad46cd9 + Openai-Processing-Ms: + - '170' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=VLFB2lTtc5jWAk.lI1Y6yurlpP.ILatgNnNi6SqwNBs-1714433325-1.0.1.1-XU5KjjQrutW5wOzpvsLEZMhgt3C9IBIy4hVG1gpfsJr3VCq5XiORXBBUbW8jJElQVZojqrN8QVnztsLocQ_tcw; + path=/; expires=Mon, 29-Apr-24 23:58:45 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=Vi2_DErdXqJ6TC9ktNbResChIS_UlPasbYNiY31bS1g-1714433325999-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c311fda8f471e1-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Run creation requires a Thread with a user message or an assistant with instructions.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_thread" + } + } + recorded_at: Mon, 29 Apr 2024 23:28:46 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_51EJvM0qOlnbVTn19VeHdMQn/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_1E2YQgzns5xsFTtAGX2xAtYe","max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:30:31 GMT + Content-Type: + - application/json + Content-Length: + - '209' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_571100deb208b2f955140aaab15a87fc + Openai-Processing-Ms: + - '184' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=LMrOAixGmuL_57xefI7_0l20q1WtgFmjOXHLy60OhxU-1714433431-1.0.1.1-oQUGVp0picLCw83tbvVbx7Te2kLjgvFYwhZFYBJeft7X5yOgCFDIWfKLqkrr8Z7pqo7zCGu.NpZblVqkOQxvgw; + path=/; expires=Tue, 30-Apr-24 00:00:31 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=6tkhUBfYQdNrDSEB1vD39CG5bOlpv5nb81JaNxFJwxU-1714433431207-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c3148f1f8806d1-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Run creation requires a Thread with a user message or an assistant with instructions.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_thread" + } + } + recorded_at: Mon, 29 Apr 2024 23:30:31 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_gdGHwrXQ8YPgNx7qPfWR7rIE/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_WTxL2hAljPdBcrSTR6r3l9Ea","max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:35:33 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_2077ab8859bfa09daa5189540ea914fa + Openai-Processing-Ms: + - '273' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=VvweNKZ715LDoF8nZKNcZyOHHkktPeBHyA34GPLbIrM-1714433733-1.0.1.1-YyonyAYtrpj7Wzl1oDHbxQoxtmaSc4fdgrm53EOKjBgByIGlU3wp80.IMW55yRHEhTZuTnlsTGdBriJ6EdwuaA; + path=/; expires=Tue, 30-Apr-24 00:05:33 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=StKBMzdlshkLFnEBQgv_nIoK06_g42p7X_JSsDJnyTo-1714433733670-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31befaa2c718c-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "run_wJ1j1H1b9Muubjscq4kNmG4Y", + "object": "thread.run", + "created_at": 1714433733, + "assistant_id": "asst_WTxL2hAljPdBcrSTR6r3l9Ea", + "thread_id": "thread_gdGHwrXQ8YPgNx7qPfWR7rIE", + "status": "queued", + "started_at": null, + "expires_at": 1714434333, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "required_action": null, + "last_error": null, + "model": "gpt-4", + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "temperature": 1.0, + "top_p": 1.0, + "max_completion_tokens": 16, + "max_prompt_tokens": 256, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "incomplete_details": null, + "usage": null, + "response_format": "auto", + "tool_choice": "auto" + } + recorded_at: Mon, 29 Apr 2024 23:35:33 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_modify_thread_setup.yml b/spec/fixtures/cassettes/runs_modify_thread_setup.yml index 4ab99b40..8ea2fc5f 100644 --- a/spec/fixtures/cassettes/runs_modify_thread_setup.yml +++ b/spec/fixtures/cassettes/runs_modify_thread_setup.yml @@ -66,4 +66,71 @@ http_interactions: "metadata": {} } recorded_at: Sat, 27 Apr 2024 22:07:47 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads + body: + encoding: UTF-8 + string: "{}" + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:35:32 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_73bfa67feb15f11e0c7eebbb4304829e + Openai-Processing-Ms: + - '24' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=Fvjeyc2lCAtBvNxVmLqLIyamI40fceD9iDQXnMbO.6s-1714433732-1.0.1.1-CV1uPYe0RCPOLRCV1cOgNkdw4ZkERVFmjZp4osexI0YKntgreIJBnw7nAhtD57Alv9rq80ny7jIUevtV94LTNQ; + path=/; expires=Tue, 30-Apr-24 00:05:32 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=99xYbpX_UFwNTzmB2GI8mSVeT8GXHJ629V74WJbWcyE-1714433732742-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31becbf5c4922-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "thread_gdGHwrXQ8YPgNx7qPfWR7rIE", + "object": "thread", + "created_at": 1714433732, + "metadata": {}, + "tool_resources": {} + } + recorded_at: Mon, 29 Apr 2024 23:35:32 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_retrieve.yml b/spec/fixtures/cassettes/runs_retrieve.yml index 93d7ba4a..5a0c1899 100644 --- a/spec/fixtures/cassettes/runs_retrieve.yml +++ b/spec/fixtures/cassettes/runs_retrieve.yml @@ -263,4 +263,96 @@ http_interactions: "tool_choice": "auto" } recorded_at: Sat, 27 Apr 2024 22:07:42 GMT +- request: + method: get + uri: https://api.openai.com/v1/threads/thread_zLTcdCfBOWhdA16mh490ukiZ/runs/run_OHJXOmN3ujL9negG5WStzEVq + body: + encoding: US-ASCII + string: '' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:35:26 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_1e697127f1cadb6dc060f6ca02fcadb9 + Openai-Processing-Ms: + - '119' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=iuVl52O.Vy3tq_vzNujfj83GAFd6DT7b7YvIfZcb5q8-1714433726-1.0.1.1-3C2KTBrLSOikYc92mSVTfskN7E1vm99zz.2B.pKv4lhurgbN5_fDsNKL4Wna8sev1diGEsj7.E4YANOwdL.iBg; + path=/; expires=Tue, 30-Apr-24 00:05:26 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=fC3pghViePzsIHY2Ii3654WMT9WsWDn266Kc9xJ9FOY-1714433726990-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31bc819826401-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "run_OHJXOmN3ujL9negG5WStzEVq", + "object": "thread.run", + "created_at": 1714433726, + "assistant_id": "asst_fqxhpajzq5zgGCF42bx98WkL", + "thread_id": "thread_zLTcdCfBOWhdA16mh490ukiZ", + "status": "in_progress", + "started_at": 1714433726, + "expires_at": 1714434326, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "required_action": null, + "last_error": null, + "model": "gpt-4", + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "temperature": 1.0, + "top_p": 1.0, + "max_completion_tokens": 16, + "max_prompt_tokens": 256, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "incomplete_details": null, + "usage": null, + "response_format": "auto", + "tool_choice": "auto" + } + recorded_at: Mon, 29 Apr 2024 23:35:27 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_retrieve_assistant_setup.yml b/spec/fixtures/cassettes/runs_retrieve_assistant_setup.yml index 43e4e485..1b4bd911 100644 --- a/spec/fixtures/cassettes/runs_retrieve_assistant_setup.yml +++ b/spec/fixtures/cassettes/runs_retrieve_assistant_setup.yml @@ -77,7 +77,9 @@ http_interactions: uri: https://api.openai.com/v1/assistants body: encoding: UTF-8 - string: '{"model":"gpt-4","name":"OpenAI-Ruby test assistant"}' + string: '{"model":"gpt-4","name":"OpenAI-Ruby test assistant","instructions":"You + are a Ruby dev bot. When asked a question, write and run Ruby code to answer + the question"}' headers: Content-Type: - application/json @@ -97,7 +99,7 @@ http_interactions: message: OK headers: Date: - - Sat, 27 Apr 2024 22:07:41 GMT + - Mon, 29 Apr 2024 23:35:26 GMT Content-Type: - application/json Transfer-Encoding: @@ -109,36 +111,36 @@ http_interactions: Openai-Organization: - user-jxm65ijkzc1qrfhc0ij8moic X-Request-Id: - - req_2faceedb426e0334963c952582e9b243 + - req_ce2a33a15caabb77d06bdcb9813a016b Openai-Processing-Ms: - - '104' + - '70' Strict-Transport-Security: - max-age=15724800; includeSubDomains Cf-Cache-Status: - DYNAMIC Set-Cookie: - - __cf_bm=OrlS8AHiWN5jA8FKMUEjg7AE9bvGzbagk9nhxXOb69U-1714255661-1.0.1.1-TL5YEyJ6GqEPlL6zqg5wiKudku.bWvp4Tdol9Twiukh.yTRlune9hPRfdaPVrqoBaK4DeJXnyq4FRaWx8ZTdfw; - path=/; expires=Sat, 27-Apr-24 22:37:41 GMT; domain=.api.openai.com; HttpOnly; + - __cf_bm=km1ZYvhcUa1lJCjY6zY4NDWbvgP1pz0A.DKQmoB1Ctw-1714433726-1.0.1.1-TzIjwHyUFAIBTJSfukYj45nX7vH6QLUSo0j7_MtB2AADjJ4Eqezr2qxQZSRWIjSE_WPCRolBjwf9__rPHOfTKg; + path=/; expires=Tue, 30-Apr-24 00:05:26 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None - - _cfuvid=KiX5Jh7.xYvW6qPb_.dOPGoOD7EQr5YmLOdrLLmKb3U-1714255661987-0.0.1.1-604800000; + - _cfuvid=d5I_rSP4h_RCAA5hf5lcJFAS.IpUC6EYYqnF9ckpm60-1714433726145-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None Server: - cloudflare Cf-Ray: - - 87b2207dcbde0c7f-SOF + - 87c31bc32cca63c2-LHR Alt-Svc: - h3=":443"; ma=86400 body: encoding: ASCII-8BIT string: |- { - "id": "asst_QZA2NmIaHMFoYs7AfWNjJFoK", + "id": "asst_fqxhpajzq5zgGCF42bx98WkL", "object": "assistant", - "created_at": 1714255661, + "created_at": 1714433726, "name": "OpenAI-Ruby test assistant", "description": null, "model": "gpt-4", - "instructions": null, + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", "tools": [], "top_p": 1.0, "temperature": 1.0, @@ -146,5 +148,5 @@ http_interactions: "metadata": {}, "response_format": "auto" } - recorded_at: Sat, 27 Apr 2024 22:07:41 GMT + recorded_at: Mon, 29 Apr 2024 23:35:26 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_retrieve_run_setup.yml b/spec/fixtures/cassettes/runs_retrieve_run_setup.yml index 0fea24d6..631edddf 100644 --- a/spec/fixtures/cassettes/runs_retrieve_run_setup.yml +++ b/spec/fixtures/cassettes/runs_retrieve_run_setup.yml @@ -263,4 +263,232 @@ http_interactions: "tool_choice": "auto" } recorded_at: Sat, 27 Apr 2024 22:07:42 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_KlnvHahvNJuLPZRV3z252l0K/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_a1wlOh7EwkoJy66PvjiMMlFS","max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:28:43 GMT + Content-Type: + - application/json + Content-Length: + - '209' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_74d6a44c440e1632d9ff2065ee79c39b + Openai-Processing-Ms: + - '177' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=2zRLNfL9WezloFdZhHnYtl2kXUvx3XDG6aH_yn2I88M-1714433323-1.0.1.1-uG_MeZRAAaDXru4MMylzx6wVV0ERji1mZt7kAHH8SBD.VI5tvzUd2Gh1YLajlmRht6XHdJ91Y_L7AMW6fYCxRA; + path=/; expires=Mon, 29-Apr-24 23:58:43 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=va6f..aWdTqXp90dqjidKC0KKLQ1Yc4tp8E4eh1yde0-1714433323036-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c311eb18e15326-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Run creation requires a Thread with a user message or an assistant with instructions.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_thread" + } + } + recorded_at: Mon, 29 Apr 2024 23:28:43 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_JVi7FdEEZEag8ixtdpC4ty16/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_eDGTLDVvxWnFzvJi1Wa8wv2a","max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:30:27 GMT + Content-Type: + - application/json + Content-Length: + - '209' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_df834a41869028b9f69bfe9d48995528 + Openai-Processing-Ms: + - '195' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=8mbTOtUZjKluLEns1Pf.zdp0wk_WtUuagi.BuvJMAvY-1714433427-1.0.1.1-9HhyFkkkqkKaNMRS3pIYWHgu1zeRtRqjzKvAfRAY2LKo2n.kP67fQ5KiNIuqAwg0ovnj_lL_mP4y1OUqk7BgcQ; + path=/; expires=Tue, 30-Apr-24 00:00:27 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=WqoCyoLNYcOGhQtNRjqmvTL4ggJ4jlyxdJqdpINL2xk-1714433427825-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31479ed0a76c0-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Run creation requires a Thread with a user message or an assistant with instructions.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_thread" + } + } + recorded_at: Mon, 29 Apr 2024 23:30:27 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_zLTcdCfBOWhdA16mh490ukiZ/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_fqxhpajzq5zgGCF42bx98WkL","max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:35:26 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_cbd262ac56428579643341682d0b150b + Openai-Processing-Ms: + - '319' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=4fkvfEriAYQ04YzReTqNbXDpkKsuVM_cjwrTPgUrCUU-1714433726-1.0.1.1-qozNeltDbNfhKx3R8ELHb1gZZcgmcX.slJyH_2NXpbtTZ.Ihoza9piFFyK0iprITXxqCFekFSPQnTk7UkgsvxQ; + path=/; expires=Tue, 30-Apr-24 00:05:26 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=zb5AKzz_TtlbY0AkkRlKM7F1ua.PGZvqUcuE6K1Ysek-1714433726668-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31bc4db7a63d7-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "run_OHJXOmN3ujL9negG5WStzEVq", + "object": "thread.run", + "created_at": 1714433726, + "assistant_id": "asst_fqxhpajzq5zgGCF42bx98WkL", + "thread_id": "thread_zLTcdCfBOWhdA16mh490ukiZ", + "status": "queued", + "started_at": null, + "expires_at": 1714434326, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "required_action": null, + "last_error": null, + "model": "gpt-4", + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "temperature": 1.0, + "top_p": 1.0, + "max_completion_tokens": 16, + "max_prompt_tokens": 256, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "incomplete_details": null, + "usage": null, + "response_format": "auto", + "tool_choice": "auto" + } + recorded_at: Mon, 29 Apr 2024 23:35:26 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_retrieve_thread_setup.yml b/spec/fixtures/cassettes/runs_retrieve_thread_setup.yml index 7892adcd..f87208fc 100644 --- a/spec/fixtures/cassettes/runs_retrieve_thread_setup.yml +++ b/spec/fixtures/cassettes/runs_retrieve_thread_setup.yml @@ -66,4 +66,71 @@ http_interactions: "metadata": {} } recorded_at: Sat, 27 Apr 2024 22:07:41 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads + body: + encoding: UTF-8 + string: "{}" + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:35:25 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_d8f191ee0075d97f0884b12717e9423b + Openai-Processing-Ms: + - '34' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=Geic34euPmSXtHbXdyrzN6ckJZZAU41DKAV4SpqOgTQ-1714433725-1.0.1.1-a3l2Z0asbf2lEvrnmcx9WLhHrHyXCUawmopxp.nNzTAXqcKcEdl9QCDv2J74aGRmYFDA2NAwTjttQtkq9AJhyw; + path=/; expires=Tue, 30-Apr-24 00:05:25 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=FSH6rT1coo_9ykRUi1Gqs_2f40PSzeWqT.QnGRdCohU-1714433725852-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31bc1989a35b9-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "thread_zLTcdCfBOWhdA16mh490ukiZ", + "object": "thread", + "created_at": 1714433725, + "metadata": {}, + "tool_resources": {} + } + recorded_at: Mon, 29 Apr 2024 23:35:25 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_streamed_create.yml b/spec/fixtures/cassettes/runs_streamed_create.yml index c15b9d36..8abdddbb 100644 --- a/spec/fixtures/cassettes/runs_streamed_create.yml +++ b/spec/fixtures/cassettes/runs_streamed_create.yml @@ -138,5 +138,279 @@ http_interactions: data: [DONE] recorded_at: Sat, 27 Apr 2024 22:07:46 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_IC1QoEI1XpbsSeg6AF15v2mP/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_H2PoKkKFjw0n4FvvPS7f2M8f","stream":true,"max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:28:44 GMT + Content-Type: + - application/json + Content-Length: + - '209' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_067fc4b3dfcb0d9881a62971c166a244 + Openai-Processing-Ms: + - '154' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=yWmOyMRDLUpfukaSjhGaYH7GEMFNJyMn0l.NcyNcXXg-1714433324-1.0.1.1-LWuU8lygvRuRhrJTHeVk693Se5yHcMCguquHVB.Hd3Gj_JEK1_yMGFPrB78H244oasGiK2T8XHZj4ZodoSkl3w; + path=/; expires=Mon, 29-Apr-24 23:58:44 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=0OYHCqaWUWbbvdKlqVb2nEki9qUffc8Q5EAYBEOnAps-1714433324874-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c311f6b994369a-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Run creation requires a Thread with a user message or an assistant with instructions.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_thread" + } + } + recorded_at: Mon, 29 Apr 2024 23:28:44 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_0pyflvoCWSmI4wqJdQST7QKX/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_gjgvE5qgbF8nsVXF6y01C6fU","stream":true,"max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:30:30 GMT + Content-Type: + - application/json + Content-Length: + - '209' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_d78c80fb6032ff5e76e5d70766ddb7c7 + Openai-Processing-Ms: + - '168' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=RSKO1AbJFWQrwdjR9VvnK93IRW5K2ved1whoTCof7q0-1714433430-1.0.1.1-8GemJUde46NhSz5G7PsuAuX0PEIr9AIawOsKKXb8WJ7OF5jNso8KLvpV_VJdbR2xyVWduGADRyXuqKAhcjiWfQ; + path=/; expires=Tue, 30-Apr-24 00:00:30 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=0kkKEVB8.vWNMU7khQcRYPYKIP_Jb0LIwBBZQ4FUU6A-1714433430263-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c314894f778865-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Run creation requires a Thread with a user message or an assistant with instructions.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_thread" + } + } + recorded_at: Mon, 29 Apr 2024 23:30:30 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_SGytyoGQFzrGUyBp3OSSlKcy/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_bZxEGReqm63trZ2h4pEDxSGU","stream":true,"max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:35:29 GMT + Content-Type: + - text/event-stream; charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_9ce60545532482f3b4a2f4d3e1dc02b2 + Openai-Processing-Ms: + - '319' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=GxT06nuKglRdwnfHAHIiNVp4OuwXRU2xtY9D90yRRqI-1714433729-1.0.1.1-Gyw6iepqbWbX3P.BTXzlb5zF4Tdblup4PlzjEwAUeBc3HN2dPw.8yEUZsjCZoExkA6JjHkpvG2.YCwWu8L7jAA; + path=/; expires=Tue, 30-Apr-24 00:05:29 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=tG2TZxTgxch2jWZT1Lzt8.cEAnWlX2pjbEkNKgAcqrQ-1714433729189-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31bd4a941654a-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |+ + event: thread.run.created + data: {"id":"run_B5f5IVSEP7Sa7tif3hCrtSbo","object":"thread.run","created_at":1714433728,"assistant_id":"asst_bZxEGReqm63trZ2h4pEDxSGU","thread_id":"thread_SGytyoGQFzrGUyBp3OSSlKcy","status":"queued","started_at":null,"expires_at":1714434328,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4","instructions":"You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question","tools":[],"tool_resources":{"code_interpreter":{"file_ids":[]}},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":16,"max_prompt_tokens":256,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto"} + + event: thread.run.queued + data: {"id":"run_B5f5IVSEP7Sa7tif3hCrtSbo","object":"thread.run","created_at":1714433728,"assistant_id":"asst_bZxEGReqm63trZ2h4pEDxSGU","thread_id":"thread_SGytyoGQFzrGUyBp3OSSlKcy","status":"queued","started_at":null,"expires_at":1714434328,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4","instructions":"You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question","tools":[],"tool_resources":{"code_interpreter":{"file_ids":[]}},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":16,"max_prompt_tokens":256,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto"} + + event: thread.run.in_progress + data: {"id":"run_B5f5IVSEP7Sa7tif3hCrtSbo","object":"thread.run","created_at":1714433728,"assistant_id":"asst_bZxEGReqm63trZ2h4pEDxSGU","thread_id":"thread_SGytyoGQFzrGUyBp3OSSlKcy","status":"in_progress","started_at":1714433729,"expires_at":1714434328,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4","instructions":"You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question","tools":[],"tool_resources":{"code_interpreter":{"file_ids":[]}},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":16,"max_prompt_tokens":256,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto"} + + event: thread.run.step.created + data: {"id":"step_csJRFWmiJNLv3ElBrh4wnWlo","object":"thread.run.step","created_at":1714433730,"run_id":"run_B5f5IVSEP7Sa7tif3hCrtSbo","assistant_id":"asst_bZxEGReqm63trZ2h4pEDxSGU","thread_id":"thread_SGytyoGQFzrGUyBp3OSSlKcy","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1714434328,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_X9MPWjYNmdhcJd8fdiPFxhRR"}},"usage":null} + + event: thread.run.step.in_progress + data: {"id":"step_csJRFWmiJNLv3ElBrh4wnWlo","object":"thread.run.step","created_at":1714433730,"run_id":"run_B5f5IVSEP7Sa7tif3hCrtSbo","assistant_id":"asst_bZxEGReqm63trZ2h4pEDxSGU","thread_id":"thread_SGytyoGQFzrGUyBp3OSSlKcy","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1714434328,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_X9MPWjYNmdhcJd8fdiPFxhRR"}},"usage":null} + + event: thread.message.created + data: {"id":"msg_X9MPWjYNmdhcJd8fdiPFxhRR","object":"thread.message","created_at":1714433730,"assistant_id":"asst_bZxEGReqm63trZ2h4pEDxSGU","thread_id":"thread_SGytyoGQFzrGUyBp3OSSlKcy","run_id":"run_B5f5IVSEP7Sa7tif3hCrtSbo","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"attachments":[],"metadata":{}} + + event: thread.message.in_progress + data: {"id":"msg_X9MPWjYNmdhcJd8fdiPFxhRR","object":"thread.message","created_at":1714433730,"assistant_id":"asst_bZxEGReqm63trZ2h4pEDxSGU","thread_id":"thread_SGytyoGQFzrGUyBp3OSSlKcy","run_id":"run_B5f5IVSEP7Sa7tif3hCrtSbo","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"attachments":[],"metadata":{}} + + event: thread.message.delta + data: {"id":"msg_X9MPWjYNmdhcJd8fdiPFxhRR","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Sure","annotations":[]}}]}} + + event: thread.message.delta + data: {"id":"msg_X9MPWjYNmdhcJd8fdiPFxhRR","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":","}}]}} + + event: thread.message.delta + data: {"id":"msg_X9MPWjYNmdhcJd8fdiPFxhRR","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" I"}}]}} + + event: thread.message.delta + data: {"id":"msg_X9MPWjYNmdhcJd8fdiPFxhRR","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" can"}}]}} + + event: thread.message.delta + data: {"id":"msg_X9MPWjYNmdhcJd8fdiPFxhRR","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" help"}}]}} + + event: thread.message.delta + data: {"id":"msg_X9MPWjYNmdhcJd8fdiPFxhRR","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" with"}}]}} + + event: thread.message.delta + data: {"id":"msg_X9MPWjYNmdhcJd8fdiPFxhRR","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" writing"}}]}} + + event: thread.message.delta + data: {"id":"msg_X9MPWjYNmdhcJd8fdiPFxhRR","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" Ruby"}}]}} + + event: thread.message.delta + data: {"id":"msg_X9MPWjYNmdhcJd8fdiPFxhRR","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" code"}}]}} + + event: thread.message.delta + data: {"id":"msg_X9MPWjYNmdhcJd8fdiPFxhRR","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"."}}]}} + + event: thread.message.delta + data: {"id":"msg_X9MPWjYNmdhcJd8fdiPFxhRR","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" However"}}]}} + + event: thread.message.delta + data: {"id":"msg_X9MPWjYNmdhcJd8fdiPFxhRR","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":","}}]}} + + event: thread.message.delta + data: {"id":"msg_X9MPWjYNmdhcJd8fdiPFxhRR","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" as"}}]}} + + event: thread.message.delta + data: {"id":"msg_X9MPWjYNmdhcJd8fdiPFxhRR","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" an"}}]}} + + event: thread.message.delta + data: {"id":"msg_X9MPWjYNmdhcJd8fdiPFxhRR","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" AI"}}]}} + + event: thread.message.incomplete + data: {"id":"msg_X9MPWjYNmdhcJd8fdiPFxhRR","object":"thread.message","created_at":1714433730,"assistant_id":"asst_bZxEGReqm63trZ2h4pEDxSGU","thread_id":"thread_SGytyoGQFzrGUyBp3OSSlKcy","run_id":"run_B5f5IVSEP7Sa7tif3hCrtSbo","status":"incomplete","incomplete_details":{"reason":"max_tokens"},"incomplete_at":1714433732,"completed_at":null,"role":"assistant","content":[{"type":"text","text":{"value":"Sure, I can help with writing Ruby code. However, as an AI","annotations":[]}}],"attachments":[],"metadata":{}} + + event: thread.run.step.completed + data: {"id":"step_csJRFWmiJNLv3ElBrh4wnWlo","object":"thread.run.step","created_at":1714433730,"run_id":"run_B5f5IVSEP7Sa7tif3hCrtSbo","assistant_id":"asst_bZxEGReqm63trZ2h4pEDxSGU","thread_id":"thread_SGytyoGQFzrGUyBp3OSSlKcy","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1714433732,"expires_at":1714434328,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_X9MPWjYNmdhcJd8fdiPFxhRR"}},"usage":{"prompt_tokens":27,"completion_tokens":16,"total_tokens":43}} + + event: thread.run.completed + data: {"id":"run_B5f5IVSEP7Sa7tif3hCrtSbo","object":"thread.run","created_at":1714433728,"assistant_id":"asst_bZxEGReqm63trZ2h4pEDxSGU","thread_id":"thread_SGytyoGQFzrGUyBp3OSSlKcy","status":"incomplete","started_at":1714433729,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1714433732,"required_action":null,"last_error":null,"model":"gpt-4","instructions":"You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question","tools":[],"tool_resources":{"code_interpreter":{"file_ids":[]}},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":16,"max_prompt_tokens":256,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":{"reason":"max_prompt_tokens"},"usage":{"prompt_tokens":27,"completion_tokens":16,"total_tokens":43},"response_format":"auto","tool_choice":"auto"} + + event: done + data: [DONE] + + recorded_at: Mon, 29 Apr 2024 23:35:32 GMT recorded_with: VCR 6.1.0 ... diff --git a/spec/fixtures/cassettes/runs_streamed_create_assistant_setup.yml b/spec/fixtures/cassettes/runs_streamed_create_assistant_setup.yml index 432f449a..c580387b 100644 --- a/spec/fixtures/cassettes/runs_streamed_create_assistant_setup.yml +++ b/spec/fixtures/cassettes/runs_streamed_create_assistant_setup.yml @@ -5,7 +5,9 @@ http_interactions: uri: https://api.openai.com/v1/assistants body: encoding: UTF-8 - string: '{"model":"gpt-4","name":"OpenAI-Ruby test assistant"}' + string: '{"model":"gpt-4","name":"OpenAI-Ruby test assistant","instructions":"You + are a Ruby dev bot. When asked a question, write and run Ruby code to answer + the question"}' headers: Content-Type: - application/json @@ -25,7 +27,7 @@ http_interactions: message: OK headers: Date: - - Sat, 27 Apr 2024 22:07:44 GMT + - Mon, 29 Apr 2024 23:35:28 GMT Content-Type: - application/json Transfer-Encoding: @@ -37,36 +39,36 @@ http_interactions: Openai-Organization: - user-jxm65ijkzc1qrfhc0ij8moic X-Request-Id: - - req_e024327b8d1505187aaaef0058ba37c4 + - req_28099de6f0242c80a7d8eddadcf9e9a1 Openai-Processing-Ms: - - '89' + - '86' Strict-Transport-Security: - max-age=15724800; includeSubDomains Cf-Cache-Status: - DYNAMIC Set-Cookie: - - __cf_bm=T1HR0GtJ8_XEwvANjkG.2madZ5j.UvCH1hAPdjBQJJw-1714255664-1.0.1.1-Yp7kXx7ltlwqxU7SuUaB3HQsS8nMHyX71kgUXsVLQoh3e9taoJSPdMboN8h8hGPi9LvbTwR4JgEQOmvor.eOdQ; - path=/; expires=Sat, 27-Apr-24 22:37:44 GMT; domain=.api.openai.com; HttpOnly; + - __cf_bm=SFcsxSe8Zq3hPT4O7oghitN1wJ9mq_2_F6Do7fBcKXc-1714433728-1.0.1.1-FGOWJ2O4MO_mEf04sK0U7JQjUx3CZbqVTq3CneQBFiDqrvaEDYyFQoZHiXYb9US16giHQXYgYz1fenq7W6bvCw; + path=/; expires=Tue, 30-Apr-24 00:05:28 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None - - _cfuvid=QcdAxdXd2vdNt7us0BJBrFsNnG52lJn5ZziG2TxzyLY-1714255664484-0.0.1.1-604800000; + - _cfuvid=7EUpdgDyQiDf3aHjm43JNJWgWT9qF.wpx9Irw8iKSC0-1714433728686-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None Server: - cloudflare Cf-Ray: - - 87b2208d6c458ef6-SOF + - 87c31bd2ffb4654d-LHR Alt-Svc: - h3=":443"; ma=86400 body: encoding: ASCII-8BIT string: |- { - "id": "asst_oPWScAi5gQn5mCjQVkJT0vYQ", + "id": "asst_bZxEGReqm63trZ2h4pEDxSGU", "object": "assistant", - "created_at": 1714255664, + "created_at": 1714433728, "name": "OpenAI-Ruby test assistant", "description": null, "model": "gpt-4", - "instructions": null, + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", "tools": [], "top_p": 1.0, "temperature": 1.0, @@ -74,5 +76,5 @@ http_interactions: "metadata": {}, "response_format": "auto" } - recorded_at: Sat, 27 Apr 2024 22:07:44 GMT + recorded_at: Mon, 29 Apr 2024 23:35:28 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_streamed_create_thread_setup.yml b/spec/fixtures/cassettes/runs_streamed_create_thread_setup.yml index 1889b6b6..b12531f9 100644 --- a/spec/fixtures/cassettes/runs_streamed_create_thread_setup.yml +++ b/spec/fixtures/cassettes/runs_streamed_create_thread_setup.yml @@ -66,4 +66,71 @@ http_interactions: "metadata": {} } recorded_at: Sat, 27 Apr 2024 22:07:44 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads + body: + encoding: UTF-8 + string: "{}" + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:35:28 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_6e617dc200725eed12df175a0181e0d9 + Openai-Processing-Ms: + - '30' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=OoAEJgF0ItZcUUe5VTsAqMuDmdun4nEw_LMFvT575_w-1714433728-1.0.1.1-6y56sQd3Nfltb9BbxnmQcGBvy7Zab3l_a27xqgknVfbc6fVhiGIYJNtCATODNy.EGtlsibfqEI9khCpd6V08yw; + path=/; expires=Tue, 30-Apr-24 00:05:28 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=QtEshV3F9VSx8xZg3c2PTN7OEStBn646jWrmZVGeEBU-1714433728405-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31bd19a4edcb7-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "thread_SGytyoGQFzrGUyBp3OSSlKcy", + "object": "thread", + "created_at": 1714433728, + "metadata": {}, + "tool_resources": {} + } + recorded_at: Mon, 29 Apr 2024 23:35:28 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_submit_tool_outputs.yml b/spec/fixtures/cassettes/runs_submit_tool_outputs.yml index 7d472a85..7341b7f2 100644 --- a/spec/fixtures/cassettes/runs_submit_tool_outputs.yml +++ b/spec/fixtures/cassettes/runs_submit_tool_outputs.yml @@ -207,4 +207,73 @@ http_interactions: } } recorded_at: Sat, 27 Apr 2024 22:07:52 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_8fbbGYQXQQ8rxRkvSi4smUqN/runs/run_SizI68F960B2zPxJ1TSdtEZO/submit_tool_outputs + body: + encoding: UTF-8 + string: '{"tool_outputs":[{"tool_call_id":"call_Vfq8wpokTGewt0ubGCkeuwo1","output":"{\"success\": + true, \"output\": \"Hello, World\"}"}]}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:35:37 GMT + Content-Type: + - application/json + Content-Length: + - '170' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_7d7f724864c86abc95d4e14f939cd2c5 + Openai-Processing-Ms: + - '100' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=GXebxeeRrzQF4CeyuMsVsqL3wz2PR5BeQklXLlB7OGo-1714433737-1.0.1.1-bcH3_Klw_BuEhc2Um3UE8JRDoiqjFTW64Hl18Hi1ro12FED6YJWEio.lKjKp5MUByRoXX1lb_ELdmJvUrSfUyw; + path=/; expires=Tue, 30-Apr-24 00:05:37 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=9T3AiIPC8_8WCs50nPxv4pCRBdSuVp54ECPGolIcjZM-1714433737704-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31c0b3e0660f3-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Runs in status \"in_progress\" do not accept tool outputs.", + "type": "invalid_request_error", + "param": null, + "code": null + } + } + recorded_at: Mon, 29 Apr 2024 23:35:37 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_submit_tool_outputs_assistant_setup.yml b/spec/fixtures/cassettes/runs_submit_tool_outputs_assistant_setup.yml index 9dab9970..1d751334 100644 --- a/spec/fixtures/cassettes/runs_submit_tool_outputs_assistant_setup.yml +++ b/spec/fixtures/cassettes/runs_submit_tool_outputs_assistant_setup.yml @@ -77,7 +77,9 @@ http_interactions: uri: https://api.openai.com/v1/assistants body: encoding: UTF-8 - string: '{"model":"gpt-4","name":"OpenAI-Ruby test assistant"}' + string: '{"model":"gpt-4","name":"OpenAI-Ruby test assistant","instructions":"You + are a Ruby dev bot. When asked a question, write and run Ruby code to answer + the question"}' headers: Content-Type: - application/json @@ -97,7 +99,7 @@ http_interactions: message: OK headers: Date: - - Sat, 27 Apr 2024 22:07:51 GMT + - Mon, 29 Apr 2024 23:35:36 GMT Content-Type: - application/json Transfer-Encoding: @@ -109,36 +111,36 @@ http_interactions: Openai-Organization: - user-jxm65ijkzc1qrfhc0ij8moic X-Request-Id: - - req_6f1cd91f56f9fff85a1f0d2b239149be + - req_46fb9591f8b45cf24c578946e037030a Openai-Processing-Ms: - - '79' + - '80' Strict-Transport-Security: - max-age=15724800; includeSubDomains Cf-Cache-Status: - DYNAMIC Set-Cookie: - - __cf_bm=OP5T.YywqX1iJO4EfUBjFiXqXsVOUVv0_zMvXo4_ghw-1714255671-1.0.1.1-yyiiOExgFEl2j2gQBSWsCGdPxidVLtpaJ9TNI5uwtSi7GJ0_lNJ0J9v1PJRYtx5l_fIMkLkJca0Iv3DXmhTCKA; - path=/; expires=Sat, 27-Apr-24 22:37:51 GMT; domain=.api.openai.com; HttpOnly; + - __cf_bm=pkrAbHj63v8U26BztKtKAwT1PzcJXsfPOCQk0m018rA-1714433736-1.0.1.1-2UvjDSAeEPWzTZ5qpzS4LZDxKd7UqCQ_qs7UJuYFUZdAB6jibYIF5UWuXesekk9tg6dgJf2KzO2ka9dxcSfgmg; + path=/; expires=Tue, 30-Apr-24 00:05:36 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None - - _cfuvid=IQmpwx_XfNDlZlbzYELQ3jIxNomUFjmdqcA2RTcXwE8-1714255671419-0.0.1.1-604800000; + - _cfuvid=nKmBTXC9AeA_2SOJLfPuCjSrrstp2qUjzZrpaZxtM78-1714433736770-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None Server: - cloudflare Cf-Ray: - - 87b220b8d8221c3f-SOF + - 87c31c058f4a945a-LHR Alt-Svc: - h3=":443"; ma=86400 body: encoding: ASCII-8BIT string: |- { - "id": "asst_DVA8muNuqUlSdqCDx8daq30u", + "id": "asst_RGcZp3Fwh023bHMnE2wL0ckX", "object": "assistant", - "created_at": 1714255671, + "created_at": 1714433736, "name": "OpenAI-Ruby test assistant", "description": null, "model": "gpt-4", - "instructions": null, + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", "tools": [], "top_p": 1.0, "temperature": 1.0, @@ -146,5 +148,5 @@ http_interactions: "metadata": {}, "response_format": "auto" } - recorded_at: Sat, 27 Apr 2024 22:07:51 GMT + recorded_at: Mon, 29 Apr 2024 23:35:36 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_submit_tool_outputs_run_setup.yml b/spec/fixtures/cassettes/runs_submit_tool_outputs_run_setup.yml index 503a3f47..bec658f6 100644 --- a/spec/fixtures/cassettes/runs_submit_tool_outputs_run_setup.yml +++ b/spec/fixtures/cassettes/runs_submit_tool_outputs_run_setup.yml @@ -263,4 +263,232 @@ http_interactions: "tool_choice": "auto" } recorded_at: Sat, 27 Apr 2024 22:07:52 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_fb9OknoSdNbAtJLlKtzMkvjA/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_XJZl8phT2eFR8yjkULX0Pp5O","max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:28:48 GMT + Content-Type: + - application/json + Content-Length: + - '209' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_a027b5c4b014fec94cc6710846c53dc8 + Openai-Processing-Ms: + - '169' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=i0guibcWHOfpLTbHdrYdwKQccejyROp_xiExs_zMQjc-1714433328-1.0.1.1-2pJOtrZs4Sw5jhPc1wlvjUcWvz6yXPKm0d7ILkw8RBlyfRC.X.soU2p7CGdaDpT2CIcjQ.kQpmS2mkJ1ycTlhw; + path=/; expires=Mon, 29-Apr-24 23:58:48 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=3fGS.B0ItlZtW0gX6OcGmauCeo79sExDlod8TxaCPvU-1714433328326-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c3120c3baddc83-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Run creation requires a Thread with a user message or an assistant with instructions.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_thread" + } + } + recorded_at: Mon, 29 Apr 2024 23:28:48 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_3yhkRpVHl8bFZwdVcLZfkqXy/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_mC6W3KxaastGZZ52MetyIj3D","max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:30:33 GMT + Content-Type: + - application/json + Content-Length: + - '209' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_e483f45eabfd62019068074bb00d12ca + Openai-Processing-Ms: + - '190' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=eyZdjdp5ucJQrEnB1sq9ulRN4Dwud2LlJeDXQeFdaJw-1714433433-1.0.1.1-8dZk9kaTWUfHnHPwwlW53Ut78cJ8veAwUfMOhQG7yXIhRw8FwxGj023DTPf0z2enwj1q_HK9TA8bhyzk6KGDcQ; + path=/; expires=Tue, 30-Apr-24 00:00:33 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=TE4A4F1UT_u04uaezuKecYKk4dRnZ3kI82Qns4anKm4-1714433433655-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c3149e6f7d63f4-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Run creation requires a Thread with a user message or an assistant with instructions.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_thread" + } + } + recorded_at: Mon, 29 Apr 2024 23:30:33 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_8fbbGYQXQQ8rxRkvSi4smUqN/runs + body: + encoding: UTF-8 + string: '{"assistant_id":"asst_RGcZp3Fwh023bHMnE2wL0ckX","max_prompt_tokens":256,"max_completion_tokens":16}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:35:37 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_50a277e37463b1b7d8cdf408eaa67f16 + Openai-Processing-Ms: + - '378' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=yd6ABxRS83TiLmv.3dkN6zlPPoESXVgNjfVXAExJYmQ-1714433737-1.0.1.1-Dc2piboaZuHRoiLjQdMRWK4zG51MUWhufVFYTFdyFT0lEf86N7mpLaxA5OUz1V1J6BOfJKge0819F.vW0fzKCw; + path=/; expires=Tue, 30-Apr-24 00:05:37 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=NZ9ZAfaiKYOqa0Xk9Vr..uA_2Ti17XmLudWs0rxBlqs-1714433737348-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31c073e4b60f8-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "run_SizI68F960B2zPxJ1TSdtEZO", + "object": "thread.run", + "created_at": 1714433737, + "assistant_id": "asst_RGcZp3Fwh023bHMnE2wL0ckX", + "thread_id": "thread_8fbbGYQXQQ8rxRkvSi4smUqN", + "status": "queued", + "started_at": null, + "expires_at": 1714434337, + "cancelled_at": null, + "failed_at": null, + "completed_at": null, + "required_action": null, + "last_error": null, + "model": "gpt-4", + "instructions": "You are a Ruby dev bot. When asked a question, write and run Ruby code to answer the question", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "temperature": 1.0, + "top_p": 1.0, + "max_completion_tokens": 16, + "max_prompt_tokens": 256, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "incomplete_details": null, + "usage": null, + "response_format": "auto", + "tool_choice": "auto" + } + recorded_at: Mon, 29 Apr 2024 23:35:37 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/runs_submit_tool_outputs_thread_setup.yml b/spec/fixtures/cassettes/runs_submit_tool_outputs_thread_setup.yml index 7456fe0b..dfa80d13 100644 --- a/spec/fixtures/cassettes/runs_submit_tool_outputs_thread_setup.yml +++ b/spec/fixtures/cassettes/runs_submit_tool_outputs_thread_setup.yml @@ -66,4 +66,71 @@ http_interactions: "metadata": {} } recorded_at: Sat, 27 Apr 2024 22:07:51 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads + body: + encoding: UTF-8 + string: "{}" + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:35:36 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_9482b18e4f5569cc861b15236e1a1c2d + Openai-Processing-Ms: + - '21' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=Xz8f5Ea75F26q4IyMwW1entxclR93L9TyCH9v.iACFA-1714433736-1.0.1.1-uPS8Zue9OCTvbA8Y9TmtS5U99j27EXh4juEMZCtQUvyTSggWqnjqhBYVFv72Bpism7wBvwxBZw6ULVDFu6DYHw; + path=/; expires=Tue, 30-Apr-24 00:05:36 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=hCjwOCFQBBehyHCzV0YTz9y_baR7PohY0LIc618.TO0-1714433736491-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31c042f42dc39-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "thread_8fbbGYQXQQ8rxRkvSi4smUqN", + "object": "thread", + "created_at": 1714433736, + "metadata": {}, + "tool_resources": {} + } + recorded_at: Mon, 29 Apr 2024 23:35:36 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/threads_create.yml b/spec/fixtures/cassettes/threads_create.yml index 8db04a01..ddbbe70a 100644 --- a/spec/fixtures/cassettes/threads_create.yml +++ b/spec/fixtures/cassettes/threads_create.yml @@ -66,4 +66,71 @@ http_interactions: "metadata": {} } recorded_at: Sat, 27 Apr 2024 20:48:27 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads + body: + encoding: UTF-8 + string: "{}" + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:29:58 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_1461e81e31541d3d032f9cb4779b90f6 + Openai-Processing-Ms: + - '38' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=vF19XzPAqslS2.ep.kxYS_eAa4ndzG6LXPBCpRQE5GY-1714433398-1.0.1.1-W1CaF3_ZLGTHBuD_Evz_E3eeyDm_8g15swZ2QnVqmv7Kzf260BlJ1I3qEQoL03fSV4kCjBYFok5k8i0IdJhHOg; + path=/; expires=Mon, 29-Apr-24 23:59:58 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=_elxTz70.eDmMrzzF5hsf0sAw6deVX51vbgiVdJXCVg-1714433398199-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c313c1b8d348c4-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "thread_yzrpkZBj4yzm6ljmalTNTiKl", + "object": "thread", + "created_at": 1714433398, + "metadata": {}, + "tool_resources": {} + } + recorded_at: Mon, 29 Apr 2024 23:29:58 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/threads_delete.yml b/spec/fixtures/cassettes/threads_delete.yml index eb0997b7..7fd2cf59 100644 --- a/spec/fixtures/cassettes/threads_delete.yml +++ b/spec/fixtures/cassettes/threads_delete.yml @@ -130,4 +130,69 @@ http_interactions: "deleted": true } recorded_at: Sat, 27 Apr 2024 20:48:29 GMT +- request: + method: delete + uri: https://api.openai.com/v1/threads/thread_sc5ZaG4SVT62mMf5PggP5w4V + body: + encoding: US-ASCII + string: '' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:29:59 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_0a78681972e4842a6adad3fafda92333 + Openai-Processing-Ms: + - '126' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=ItfR_t_z5BhITsJ7qXu100okUuzsufsMLaWYUxNdca8-1714433399-1.0.1.1-hD76JFYiMlDfkgvFLGXzELun_vIry.uFpv_J_bwf3kqnHuOrt.szePj2MUm7dIe5aMypjnSd.qYGTJGYr9DadA; + path=/; expires=Mon, 29-Apr-24 23:59:59 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=japVK5L0N8XwWEjQ69u1EuThGZWe3_5lDTCnYHA7AGM-1714433399249-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c313c7bf046322-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "thread_sc5ZaG4SVT62mMf5PggP5w4V", + "object": "thread.deleted", + "deleted": true + } + recorded_at: Mon, 29 Apr 2024 23:29:59 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/threads_delete_setup.yml b/spec/fixtures/cassettes/threads_delete_setup.yml index 62dbea36..974bdcb6 100644 --- a/spec/fixtures/cassettes/threads_delete_setup.yml +++ b/spec/fixtures/cassettes/threads_delete_setup.yml @@ -66,4 +66,71 @@ http_interactions: "metadata": {} } recorded_at: Sat, 27 Apr 2024 20:48:28 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads + body: + encoding: UTF-8 + string: "{}" + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:29:58 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_316e2f198e40ecf860617eb64b3a282a + Openai-Processing-Ms: + - '26' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=XQmVP18yjF0WCcemEgePo.LbETd35UG8utZ2uCScEb4-1714433398-1.0.1.1-QTWwQmnlv7ZRI0gIYRaySfzJh4BRjHoC7Otk2Tl38TQHiQtCo04GUJtKCJB9zdhRWqd2MNg_atLSjaZtJdvuOw; + path=/; expires=Mon, 29-Apr-24 23:59:58 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=3AfCE9f4raCI9W9ce0apLwhXdwjV6MuTjE897Nj9NDA-1714433398923-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c313c65fa46395-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "thread_sc5ZaG4SVT62mMf5PggP5w4V", + "object": "thread", + "created_at": 1714433398, + "metadata": {}, + "tool_resources": {} + } + recorded_at: Mon, 29 Apr 2024 23:29:58 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/threads_modify.yml b/spec/fixtures/cassettes/threads_modify.yml index 50405b98..e7e7c740 100644 --- a/spec/fixtures/cassettes/threads_modify.yml +++ b/spec/fixtures/cassettes/threads_modify.yml @@ -136,4 +136,209 @@ http_interactions: } } recorded_at: Sat, 27 Apr 2024 20:48:28 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_uJfx6VB7s6v33G7Mq9374bqN + body: + encoding: UTF-8 + string: '{"metadata":{"modified":true}}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:29:58 GMT + Content-Type: + - application/json + Content-Length: + - '220' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_f23f10eb5e112399baab221e05f53d17 + Openai-Processing-Ms: + - '84' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=QZB5TUm9.FP.PEUTHxz95iRO5nZlhj5reP_9zIMBGUA-1714433398-1.0.1.1-Fj5VpSX7KGVztjmt7jQl.ZeOjuPFTu2fXMXsSa4XcIacaoIsCQW_i.xzfg2LoXnK4QZzuRX2.BS409f972zHvA; + path=/; expires=Mon, 29-Apr-24 23:59:58 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=vqbfXVxsqGX9kON9bz_FVAZbojJIEkMIl6O_so.Vg4Y-1714433398710-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c313c49e4a88a4-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Invalid type for 'metadata.modified': expected a string, but got a boolean instead.", + "type": "invalid_request_error", + "param": "metadata.modified", + "code": "invalid_type" + } + } + recorded_at: Mon, 29 Apr 2024 23:29:58 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_lSBjLdfYQgOwNp592snT4V2y + body: + encoding: UTF-8 + string: '{"metadata":{"modified":true}}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Mon, 29 Apr 2024 23:38:09 GMT + Content-Type: + - application/json + Content-Length: + - '220' + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_672eff0b029ee2972e7df085bc997dab + Openai-Processing-Ms: + - '89' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=TwrInHjtUV5rtBdxQ3TDnhuGrq_tYRzwS4Q_eAeyb4Q-1714433889-1.0.1.1-WpP5usFNd.33e_AFtKD7LwVZjF9LvbnmFuOocE0u_geRFRgCrWZ11MdFGK7dffJ0cxmC36ImUHLTMSgNhUGUbw; + path=/; expires=Tue, 30-Apr-24 00:08:09 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=UJFoBxWxEPHN6ci2HIHUi2jo5srC.3BJxtWkAy6Erh0-1714433889653-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c31fc0edd324da-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: UTF-8 + string: |- + { + "error": { + "message": "Invalid type for 'metadata.modified': expected a string, but got a boolean instead.", + "type": "invalid_request_error", + "param": "metadata.modified", + "code": "invalid_type" + } + } + recorded_at: Mon, 29 Apr 2024 23:38:09 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads/thread_i3Hs96sQAsLBfOTU1Rl6137V + body: + encoding: UTF-8 + string: '{"metadata":{"modified":"true"}}' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:38:20 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_670da65ae8e1e780dbe57211a377e991 + Openai-Processing-Ms: + - '129' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=GO83Kw2JX76CSlnvwKC5LnHUbDIdGQ73afZWTvkL6A8-1714433900-1.0.1.1-H9xNP3x.4kOVNrJ.R4bhn3k1F5njk7cOcrHykfz7CTPPhvLe8SlC2SHeS6iD_fBnVTFGrk1Y.e6Wfx60x8w3Aw; + path=/; expires=Tue, 30-Apr-24 00:08:20 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=.dmwG.cMze2DCI.zWGm8Lt7_6IazZDGejbnXb.LnyDs-1714433900526-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c32004ae1c7196-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "thread_i3Hs96sQAsLBfOTU1Rl6137V", + "object": "thread", + "created_at": 1714433900, + "metadata": { + "modified": "true" + }, + "tool_resources": {} + } + recorded_at: Mon, 29 Apr 2024 23:38:20 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/threads_modify_setup.yml b/spec/fixtures/cassettes/threads_modify_setup.yml index 980f42ed..74db448b 100644 --- a/spec/fixtures/cassettes/threads_modify_setup.yml +++ b/spec/fixtures/cassettes/threads_modify_setup.yml @@ -66,4 +66,71 @@ http_interactions: "metadata": {} } recorded_at: Sat, 27 Apr 2024 20:48:27 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads + body: + encoding: UTF-8 + string: "{}" + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:38:20 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_ddfb8f444118cbcf23f46a6f3e6057e1 + Openai-Processing-Ms: + - '31' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=jaEFS8Dq5vG9WOuToGG5Ffm15L46U6kl12apjdgrQVc-1714433900-1.0.1.1-D_UgpQiXZo8t8a1MK3yS9a_GSZnzjPCwO_I0qPUkzYdHvTmEyy8B8QuGfXJuy5adm04ayEHgGtiO3D9Hitvogg; + path=/; expires=Tue, 30-Apr-24 00:08:20 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=uhFugBDKYBk6SltALcESHG_mEkrP5dInMLV5sgeE6Yo-1714433900210-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c320034e4023ee-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "thread_i3Hs96sQAsLBfOTU1Rl6137V", + "object": "thread", + "created_at": 1714433900, + "metadata": {}, + "tool_resources": {} + } + recorded_at: Mon, 29 Apr 2024 23:38:20 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/threads_retrieve.yml b/spec/fixtures/cassettes/threads_retrieve.yml index 20a72f70..fcb47f57 100644 --- a/spec/fixtures/cassettes/threads_retrieve.yml +++ b/spec/fixtures/cassettes/threads_retrieve.yml @@ -132,4 +132,75 @@ http_interactions: "metadata": {} } recorded_at: Sat, 27 Apr 2024 20:48:27 GMT +- request: + method: get + uri: https://api.openai.com/v1/threads/thread_1a8fCeNxEKD298ryktrswbvb + body: + encoding: US-ASCII + string: '' + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:29:57 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_383cbbeaee8595b28994ce90158328f6 + Openai-Processing-Ms: + - '106' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=fhl0KKLp2QRU4UAQfWRC2e7FUCwVK5ztEqm__2gBg8c-1714433397-1.0.1.1-TFz_PtN.Dic8lsWztIDJL6v90lfo6TcwDZ_WPiTB7DRLXYPl8hAoiqSg4dNLiHYBpWNjkblbfLN_mlVLznCrlA; + path=/; expires=Mon, 29-Apr-24 23:59:57 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=QiCyowqEJbsJh3HKgr3zHnPAilEGHIhAx7s.2Xys.Uo-1714433397983-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c313bfef696544-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "thread_1a8fCeNxEKD298ryktrswbvb", + "object": "thread", + "created_at": 1714433397, + "metadata": {}, + "tool_resources": { + "code_interpreter": { + "file_ids": [] + } + } + } + recorded_at: Mon, 29 Apr 2024 23:29:57 GMT recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/cassettes/threads_retrieve_setup.yml b/spec/fixtures/cassettes/threads_retrieve_setup.yml index cc6469e1..00626244 100644 --- a/spec/fixtures/cassettes/threads_retrieve_setup.yml +++ b/spec/fixtures/cassettes/threads_retrieve_setup.yml @@ -66,4 +66,71 @@ http_interactions: "metadata": {} } recorded_at: Sat, 27 Apr 2024 20:48:26 GMT +- request: + method: post + uri: https://api.openai.com/v1/threads + body: + encoding: UTF-8 + string: "{}" + headers: + Content-Type: + - application/json + Authorization: + - Bearer + Openai-Beta: + - assistants=v2 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 29 Apr 2024 23:29:57 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Openai-Version: + - '2020-10-01' + Openai-Organization: + - user-jxm65ijkzc1qrfhc0ij8moic + X-Request-Id: + - req_48aab85245d565782a4807ec00338ee9 + Openai-Processing-Ms: + - '44' + Strict-Transport-Security: + - max-age=15724800; includeSubDomains + Cf-Cache-Status: + - DYNAMIC + Set-Cookie: + - __cf_bm=4yHvMDSdnzmhCcygBmA1CJwuKVnYnwTMD9lpJTudw_o-1714433397-1.0.1.1-b91B4jAtgvoszWtuFkzA88M8nu7J23HiWURb5AstyuSTCu7C8EpzYS4WqWVVEfKv5eOnQ56n4xgDH.ZrZdZsUg; + path=/; expires=Mon, 29-Apr-24 23:59:57 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=_mNtT_eIhTek1iwW3mcujcub7Ogwobao9Tz2c4M_C6o-1714433397674-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Server: + - cloudflare + Cf-Ray: + - 87c313be6dfa947c-LHR + Alt-Svc: + - h3=":443"; ma=86400 + body: + encoding: ASCII-8BIT + string: |- + { + "id": "thread_1a8fCeNxEKD298ryktrswbvb", + "object": "thread", + "created_at": 1714433397, + "metadata": {}, + "tool_resources": {} + } + recorded_at: Mon, 29 Apr 2024 23:29:57 GMT recorded_with: VCR 6.1.0 diff --git a/spec/openai/client/client_spec.rb b/spec/openai/client/client_spec.rb index 4160cb9c..daa1652a 100644 --- a/spec/openai/client/client_spec.rb +++ b/spec/openai/client/client_spec.rb @@ -113,10 +113,10 @@ end context "when using beta APIs" do - let(:client) { OpenAI::Client.new.beta(assistants: "v1") } + let(:client) { OpenAI::Client.new.beta(assistants: "v2") } it "sends the appropriate header value" do - expect(client.send(:headers)["OpenAI-Beta"]).to eq "assistants=v1" + expect(client.send(:headers)["OpenAI-Beta"]).to eq "assistants=v2" end end diff --git a/spec/openai/client/messages_spec.rb b/spec/openai/client/messages_spec.rb index de8ee8e6..eff8d4f7 100644 --- a/spec/openai/client/messages_spec.rb +++ b/spec/openai/client/messages_spec.rb @@ -69,7 +69,7 @@ id: message_id, thread_id: thread_id, parameters: { - metadata: { modified: true } + metadata: { modified: "true" } } ) end diff --git a/spec/openai/client/run_steps_spec.rb b/spec/openai/client/run_steps_spec.rb index 739e994c..05c30f36 100644 --- a/spec/openai/client/run_steps_spec.rb +++ b/spec/openai/client/run_steps_spec.rb @@ -10,7 +10,8 @@ OpenAI::Client.new.assistants.create( parameters: { model: "gpt-4", - name: "OpenAI-Ruby test assistant" + name: "OpenAI-Ruby test assistant", + instructions: "When asked a question, write and run Ruby code to answer the question" } )["id"] end diff --git a/spec/openai/client/runs_spec.rb b/spec/openai/client/runs_spec.rb index f88b6d50..1d5f7e0d 100644 --- a/spec/openai/client/runs_spec.rb +++ b/spec/openai/client/runs_spec.rb @@ -13,7 +13,8 @@ OpenAI::Client.new.assistants.create( parameters: { model: "gpt-4", - name: "OpenAI-Ruby test assistant" + name: "OpenAI-Ruby test assistant", + instructions: "When asked a question, write and run Ruby code to answer the question" } )["id"] end diff --git a/spec/openai/client/threads_spec.rb b/spec/openai/client/threads_spec.rb index 0bb50861..d79c3665 100644 --- a/spec/openai/client/threads_spec.rb +++ b/spec/openai/client/threads_spec.rb @@ -35,7 +35,7 @@ let(:response) do OpenAI::Client.new.threads.modify( id: thread_id, - parameters: { metadata: { modified: true } } + parameters: { metadata: { modified: "true" } } ) end