From 0114416ef8666471961a1a2b485f5e3744b0ee20 Mon Sep 17 00:00:00 2001 From: Geoff-Robin Date: Fri, 22 Aug 2025 01:52:58 +0530 Subject: [PATCH 1/7] Plugin created --- plugins/groq/LICENSE | 202 +++++ plugins/groq/README.md | 63 ++ .../cassettes/test_chat_predict.yaml | 445 +++++++++++ .../cassettes/test_chat_predict_batches.yaml | 738 ++++++++++++++++++ .../test_chat_predict_with_context.yaml | 100 +++ plugins/groq/plugin_test/test_model_groq.py | 63 ++ plugins/groq/pyproject.toml | 36 + plugins/groq/superduper_groq/__init__.py | 3 + plugins/groq/superduper_groq/model.py | 87 +++ 9 files changed, 1737 insertions(+) create mode 100644 plugins/groq/LICENSE create mode 100644 plugins/groq/README.md create mode 100644 plugins/groq/plugin_test/cassettes/test_chat_predict.yaml create mode 100644 plugins/groq/plugin_test/cassettes/test_chat_predict_batches.yaml create mode 100644 plugins/groq/plugin_test/cassettes/test_chat_predict_with_context.yaml create mode 100644 plugins/groq/plugin_test/test_model_groq.py create mode 100644 plugins/groq/pyproject.toml create mode 100644 plugins/groq/superduper_groq/__init__.py create mode 100644 plugins/groq/superduper_groq/model.py diff --git a/plugins/groq/LICENSE b/plugins/groq/LICENSE new file mode 100644 index 0000000000..a48ac85f90 --- /dev/null +++ b/plugins/groq/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [2023] [SuperDuperDB, Inc.] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/plugins/groq/README.md b/plugins/groq/README.md new file mode 100644 index 0000000000..f4af421564 --- /dev/null +++ b/plugins/groq/README.md @@ -0,0 +1,63 @@ + +# superduper-groq + +SuperDuperDB integration with Groq API + +## Installation + +```bash +pip install superduper-groq +``` + +## API + + +- [Code](https://github.com/superduper-io/superduper/tree/main/plugins/groq) +- [API-docs](/docs/api/plugins/superduper-groq) + +| Class | Description | +|---|---| +| `superduper_groq.model.GroqAPIModel` | Base Class for Groq API Models | +| `superduper_groq.model.GroqChatCompletions` | Chat Completions Model for Groq API | + + + + + + + +Create a Chat Model with All Attributes + +```python +model = GroqChatCompletions( + identifier="llama3-8b-8192", + GROQ_API_KEY=os.getenv("GROQ_API_KEY"), + temperature=0.7, + system_message="You are a helpful assistant.", + tool_choice="auto", + tools=[], + include_reasoning=True, + browser_search=False +) +``` + +Single Prediction + +```python +response = model.predict("Tell me about AI") +print(response) +``` + +Prediction with Context +```python +response = model.predict("Tell me about ", context=["Artificial Intelligence"]) +print(response) +``` + +Batch Predictions +```python +prompts = ["Hello world", "Explain machine learning"] +responses = model.predict_batches(prompts) +for i, resp in enumerate(responses, 1): + print(f"Response {i}: {resp}") +``` \ No newline at end of file diff --git a/plugins/groq/plugin_test/cassettes/test_chat_predict.yaml b/plugins/groq/plugin_test/cassettes/test_chat_predict.yaml new file mode 100644 index 0000000000..d620027f18 --- /dev/null +++ b/plugins/groq/plugin_test/cassettes/test_chat_predict.yaml @@ -0,0 +1,445 @@ +interactions: +- request: + body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello + world"}],"model":"llama3-8b-8192","temperature":0.2,"tool_choice":"auto","tools":null}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '190' + content-type: + - application/json + host: + - api.groq.com + user-agent: + - Groq/Python 0.31.0 + x-stainless-arch: + - other:amd64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Windows + x-stainless-package-version: + - 0.31.0 + x-stainless-read-timeout: + - '60' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.3 + method: POST + uri: https://api.groq.com/openai/v1/chat/completions + response: + body: + string: !!binary | + H4sIAAAAAAAAA1SSzW7bMBCE730Kdi+5SIZ+TZmXXOtnKAKBIlcWY5Irk1Ts1PC7F3LtBL0Ovtnd + GewVjAYBapJJudnmEpuq4YXOddt1eVNzlXd1s82VkgorLLkeRsiAhndU6WHcKHKzxWTIQwYqoEyo + QZS8bbuirdsyA0caLQiwVjpZ592Qd+WuWumJjMII4vcVjNd4AVFk4DBGeUAQVwhkEQTIGE1M0qfV + Qz6hX7f/QmuJpQkD/mT79BKZNwpZIuYQE/ukZcP28R/AIjlMk/EHtmdKejahnVeEnU2aMkaBnWmx + +i5Zc7yPWeO9wi0DS4c50BBB+MXaDEbjTZz6gDKSBwEx0Qy3twyW5+GnBRfsk3EIothUddPybssz + mAO5OfWJjugjiKr+lh5sUVS7rtnyco36bPbbwP+Xn6aya8sdr6oMEiVpv/i2+FKeaFW2RVPv6tvj + 3H4IKI+azv4ZL37GhK4fjT9gmIO5tz3OPW9H3JWD6hrI4NIfAp3WrPcfCnjqi/JY8wr/SDcmFdv3 + Sz1O9azOH3otMWL4MGotBQMIIN9rdNJruP34CwAA//8DACbqtqiIAgAA + headers: + CF-RAY: + - 972c9d351f027f44-MAA + Cache-Control: + - private, max-age=0, no-store, no-cache, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Thu, 21 Aug 2025 19:42:31 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=A7pxXrx39679Ilgl5_7H3CFLRAc_e.DNGeBS5EXY3Ew-1755805351-1.0.1.1-ixNncwEtwpndV2XUt6Hz03jFT0LzgQtOwes5FTqPza51Yedtnw031GnJIXmu4ZQIeQLpayi17BFDbdzg9N.wr0JAy1.46oSD3pgeySr.xMY; + path=/; expires=Thu, 21-Aug-25 20:12:31 GMT; domain=.groq.com; HttpOnly; Secure; + SameSite=None + Transfer-Encoding: + - chunked + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + vary: + - Origin + via: + - 1.1 google + x-groq-region: + - bom + x-ratelimit-limit-requests: + - '14400' + x-ratelimit-limit-tokens: + - '6000' + x-ratelimit-remaining-requests: + - '14399' + x-ratelimit-remaining-tokens: + - '5980' + x-ratelimit-reset-requests: + - 6s + x-ratelimit-reset-tokens: + - 200ms + x-request-id: + - req_01k372ezamftcs5jx3fh3pcwvd + status: + code: 200 + message: OK +- request: + body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello + world"}],"model":"llama3-8b-8192","temperature":null,"tool_choice":"auto","tools":null}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '191' + content-type: + - application/json + host: + - api.groq.com + user-agent: + - Groq/Python 0.31.0 + x-stainless-arch: + - other:amd64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Windows + x-stainless-package-version: + - 0.31.0 + x-stainless-read-timeout: + - '60' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.3 + method: POST + uri: https://api.groq.com/openai/v1/chat/completions + response: + body: + string: '{"error":{"message":"Invalid API Key","type":"invalid_request_error","code":"invalid_api_key"}} + + ' + headers: + CF-RAY: + - 972ca3d43f367f65-MAA + Cache-Control: + - private, max-age=0, no-store, no-cache, must-revalidate + Connection: + - keep-alive + Content-Length: + - '96' + Content-Type: + - application/json + Date: + - Thu, 21 Aug 2025 19:47:02 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=hXwftCtBirv40AIgQlZw7Pmw8QBpOMieuufJckSMMKk-1755805622-1.0.1.1-Iotz19P5h0Xy6UGGpiY4BkZxIhHFupIivhGJjM.NY6mTfDweiU.HNkuiBtpFwBPnK.Vw7LCi8ee4Hj_g625A0fmr2zD.cu7BsxtRK8OBghY; + path=/; expires=Thu, 21-Aug-25 20:17:02 GMT; domain=.groq.com; HttpOnly; Secure; + SameSite=None + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + vary: + - Origin + via: + - 1.1 google + x-groq-region: + - bom + x-request-id: + - req_01k372q86dfzm8a2cg842drysr + status: + code: 401 + message: Unauthorized +- request: + body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello + world"}],"model":"llama3-8b-8192","temperature":null,"tool_choice":"auto","tools":null}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '191' + content-type: + - application/json + cookie: + - __cf_bm=hXwftCtBirv40AIgQlZw7Pmw8QBpOMieuufJckSMMKk-1755805622-1.0.1.1-Iotz19P5h0Xy6UGGpiY4BkZxIhHFupIivhGJjM.NY6mTfDweiU.HNkuiBtpFwBPnK.Vw7LCi8ee4Hj_g625A0fmr2zD.cu7BsxtRK8OBghY + host: + - api.groq.com + user-agent: + - Groq/Python 0.31.0 + x-stainless-arch: + - other:amd64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Windows + x-stainless-package-version: + - 0.31.0 + x-stainless-read-timeout: + - '60' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.3 + method: POST + uri: https://api.groq.com/openai/v1/chat/completions + response: + body: + string: '{"error":{"message":"Invalid API Key","type":"invalid_request_error","code":"invalid_api_key"}} + + ' + headers: + CF-RAY: + - 972ca3ee095f7f65-MAA + Cache-Control: + - private, max-age=0, no-store, no-cache, must-revalidate + Connection: + - keep-alive + Content-Length: + - '96' + Content-Type: + - application/json + Date: + - Thu, 21 Aug 2025 19:47:06 GMT + Server: + - cloudflare + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + vary: + - Origin + via: + - 1.1 google + x-groq-region: + - bom + x-request-id: + - req_01k372qc75fzrbeehpzj5vzbfe + status: + code: 401 + message: Unauthorized +- request: + body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello + world"}],"model":"llama3-8b-8192","temperature":null,"tool_choice":"auto","tools":null}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '191' + content-type: + - application/json + host: + - api.groq.com + user-agent: + - Groq/Python 0.31.0 + x-stainless-arch: + - other:amd64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Windows + x-stainless-package-version: + - 0.31.0 + x-stainless-read-timeout: + - '60' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.3 + method: POST + uri: https://api.groq.com/openai/v1/chat/completions + response: + body: + string: !!binary | + H4sIAAAAAAAAA1SSzY7bMAyE730KlZde7ED+t3XptXmGojBkmba1kURHkptsg7x74TTZttfBNyRn + wBvoEQSoRUZlV5Oqth2kGopUllOWlmrAtFNNkY55jrLheduNIyRAwxuq+DQeFNnVYNTkIAHlUUYc + QWRNVbW8qpsuAUsjGhBgjLSySNshbbMu3+mFtMIA4vsNtBvxCoInYDEEOSOIG3gyCAJkCDpE6eLu + IRfR7du/oTHE4oIeP7Nj/BKY0wpZJGYRI3un7cCO4Q/AAlmMi3YzOzIlHVvQrDvCLjoujDy70GbG + h2L06TFlT/cV7gkYmldPQwDhNmMSmLTTYek9ykAOBIRIK9x/JLC97j5vuGEftUUQ/JAXZV1y3hUJ + rJ7sGvtIJ3QBRP6P9IQ5Lzgvsrbdo76a/Wuo/5dfpqypu4pXdQKRojQffNl9KC8053XX5mV5f97b + Dx7laaSLe+UL7yGi7SftZvSr14+2p7Vvqgm7bFBtCQlc+9nTeQ/7+CGP555np6LJ/a+pQR5ic7nW + 16LMeYlubzGg/6nV3gp6EECuH9FKN8L9028AAAD//wMATCz2dIgCAAA= + headers: + CF-RAY: + - 972ca535f855179c-MAA + Cache-Control: + - private, max-age=0, no-store, no-cache, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Thu, 21 Aug 2025 19:47:59 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=g6mqNsOSygoeFx.9l__cOnheFl1NBZpOZnzqg9x0DvM-1755805679-1.0.1.1-oCwlN_96GVIapxDLMMDgcqCb1GrMBmOoINmTsDSgpdIW5WE_XnMFi9l81EKZ.hK51gTBbjkM4i9leW3iupdPlVB9i2hHaI.DpPTm8ImVDxI; + path=/; expires=Thu, 21-Aug-25 20:17:59 GMT; domain=.groq.com; HttpOnly; Secure; + SameSite=None + Transfer-Encoding: + - chunked + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + vary: + - Origin + via: + - 1.1 google + x-groq-region: + - bom + x-ratelimit-limit-requests: + - '14400' + x-ratelimit-limit-tokens: + - '6000' + x-ratelimit-remaining-requests: + - '14399' + x-ratelimit-remaining-tokens: + - '5980' + x-ratelimit-reset-requests: + - 6s + x-ratelimit-reset-tokens: + - 200ms + x-request-id: + - req_01k372rzf7e0st7wx6x34204en + status: + code: 200 + message: OK +- request: + body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello + world"}],"model":"llama3-8b-8192","temperature":null,"tool_choice":"auto","tools":null}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '191' + content-type: + - application/json + host: + - api.groq.com + user-agent: + - Groq/Python 0.31.0 + x-stainless-arch: + - other:amd64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Windows + x-stainless-package-version: + - 0.31.0 + x-stainless-read-timeout: + - '60' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.3 + method: POST + uri: https://api.groq.com/openai/v1/chat/completions + response: + body: + string: !!binary | + H4sIAAAAAAAAA1SSvY7bMBCE+zwFb5s00kGiKItkkzZ+hiAQKHJtMeaPTNI+G4bfPdDF9iHt4Bvs + zGBvYA1I0LMq2i+unlrTTS2auhcTq9lONzU3XNQNF8yoTpuJTlBBnP6gLg/ju45+cVhsDFCBTqgK + GpDt0Pe86TltKvDRoAMJzimvuppPNW8FXek5Wo0Z5K8b2GDwAnLFMWe1R5A3SNEhSFA521xUKKsn + hoJhvf4TnYukzJjwjWzL90yC1UhKJB6xkGs8vZFt/geQHD2W2YY92RKtApnRLStCPmyZSYlGXX/A + vQIX90uKUwYZTs5VsLPB5nlMqHIMICGXuMD9dwWnZ8bjCU84FusRZPNOOyGGTcs3FSwp+qWMJR4w + ZJC0+5IecNNQwTkb2FrrueKXof1ffppaRjdNzzYVlFiUe/GMvZQXOlAmGnp/xB2nhOpg4kd41svX + XNCPOxv2mJZkP4fdLePQ71C0k+YMKriM+xSPa9fPd0l4HJv20A30ws8Cmc84L+fr0CsvFF1HzJjO + Vq+jYAIJMYwGvQoG7t/+AgAA//8DAFS5DWlzAgAA + headers: + CF-RAY: + - 972ca8a50fa70bbe-MAA + Cache-Control: + - private, max-age=0, no-store, no-cache, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Thu, 21 Aug 2025 19:50:20 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=GZHidvEVV2yRyW4J2bHqXH7O9FesahPnGnadyFLFqd0-1755805820-1.0.1.1-LwNiXDNMqp28mDs66RqRtTKQiPp6IM7urJ0WrTY72CJXhuYjgqJUz3W10c1O_4Lzvo_h7Ux2p2V43mC0cZAJMmq1DiR9U7LsRTn.9S0SvTU; + path=/; expires=Thu, 21-Aug-25 20:20:20 GMT; domain=.groq.com; HttpOnly; Secure; + SameSite=None + Transfer-Encoding: + - chunked + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + vary: + - Origin + via: + - 1.1 google + x-groq-region: + - bom + x-ratelimit-limit-requests: + - '14400' + x-ratelimit-limit-tokens: + - '6000' + x-ratelimit-remaining-requests: + - '14399' + x-ratelimit-remaining-tokens: + - '5980' + x-ratelimit-reset-requests: + - 6s + x-ratelimit-reset-tokens: + - 200ms + x-request-id: + - req_01k372x8v9e4msehpvy75am9a2 + status: + code: 200 + message: OK +version: 1 diff --git a/plugins/groq/plugin_test/cassettes/test_chat_predict_batches.yaml b/plugins/groq/plugin_test/cassettes/test_chat_predict_batches.yaml new file mode 100644 index 0000000000..a48957c953 --- /dev/null +++ b/plugins/groq/plugin_test/cassettes/test_chat_predict_batches.yaml @@ -0,0 +1,738 @@ +interactions: +- request: + body: '{"messages":[{"role":"user","content":"What''s the capital of France?"}],"model":"llama3-8b-8192","temperature":0.3,"tool_choice":"auto","tools":null}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '149' + content-type: + - application/json + host: + - api.groq.com + user-agent: + - Groq/Python 0.31.0 + x-stainless-arch: + - other:amd64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Windows + x-stainless-package-version: + - 0.31.0 + x-stainless-read-timeout: + - '60' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.3 + method: POST + uri: https://api.groq.com/openai/v1/chat/completions + response: + body: + string: !!binary | + H4sIAAAAAAAAA1SRzW6kMBCE7/sUbJ9NBAYPxg+Qcw65RREydgPO+IexPZNkR/PuK6IZVnstfaXq + qr6C0SBALTIrt9pSsQNSHOtSaU7Ltse6HFnVlL1SUh8kp2zqgUAYP1Dlu/FJBbdazCZ4IKAiyowa + RN0xxivWsIaACxotCLBWOtmUfCx53dONXoJRmEC8XcF4jV8gKgIOU5IzgrhCDBZBgEzJpCx93jzB + Z/Rb+uuChZKrydIWYSqeo/QKC5OKFxlN+g03AjbMawxjAuHP1hKYjDdpGSLKFDwISDmscHsncH4k + ns54xiEbhyCqJ9q0vD00HSewxuDWPORwRJ+2fv+kO1xVtK1539HtyMcmu4H/r+4exmjf1pRADlna + HadsV3a061ve8PZ2P3cYI8qjDp/+US99p4xumIyfMa7R/Mw0rUPHJuzrUfEWCHwNcwynrevP8yOe + hqo+Nh2d6maZso5uPqnLn4v8UNO4jZgwXozaRsEIAoIfNDrpNdx+/QUAAP//AwDRlq7RQQIAAA== + headers: + CF-RAY: + - 972c9d407eb17eeb-MAA + Cache-Control: + - private, max-age=0, no-store, no-cache, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Thu, 21 Aug 2025 19:42:33 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=bp9d0lAYiUc8ePrlyGAhn3FmOrm2GiS_.qqEonN9FMQ-1755805353-1.0.1.1-iqtDQYOjm.Hloz4sDE1euFtiJBv3Qw4QZSr1Tt9DP0I.O4RFG1skiO_amL4Sn_VOUTxn70n5FvIeYpr9p6n2IzuFmY78v0AT2weUl9tuH.g; + path=/; expires=Thu, 21-Aug-25 20:12:33 GMT; domain=.groq.com; HttpOnly; Secure; + SameSite=None + Transfer-Encoding: + - chunked + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + vary: + - Origin + via: + - 1.1 google + x-groq-region: + - bom + x-ratelimit-limit-requests: + - '14400' + x-ratelimit-limit-tokens: + - '6000' + x-ratelimit-remaining-requests: + - '14398' + x-ratelimit-remaining-tokens: + - '5987' + x-ratelimit-reset-requests: + - 10.182s + x-ratelimit-reset-tokens: + - 130ms + x-request-id: + - req_01k372f13hftdrmgqcvzvajcfb + status: + code: 200 + message: OK +- request: + body: '{"messages":[{"role":"user","content":"Summarize the history of Python + in 1 sentence."}],"model":"llama3-8b-8192","temperature":0.3,"tool_choice":"auto","tools":null}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '166' + content-type: + - application/json + cookie: + - __cf_bm=bp9d0lAYiUc8ePrlyGAhn3FmOrm2GiS_.qqEonN9FMQ-1755805353-1.0.1.1-iqtDQYOjm.Hloz4sDE1euFtiJBv3Qw4QZSr1Tt9DP0I.O4RFG1skiO_amL4Sn_VOUTxn70n5FvIeYpr9p6n2IzuFmY78v0AT2weUl9tuH.g + host: + - api.groq.com + user-agent: + - Groq/Python 0.31.0 + x-stainless-arch: + - other:amd64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Windows + x-stainless-package-version: + - 0.31.0 + x-stainless-read-timeout: + - '60' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.3 + method: POST + uri: https://api.groq.com/openai/v1/chat/completions + response: + body: + string: !!binary | + H4sIAAAAAAAAA1RTS4+bMBC+91eM5mxWPEICnCv1WvVaVWjAA7jxg7VNsukq/70yTbbt0ePvNePx + OyqJHY4LxdGsOhtrbnniKqubRmYHKtpsGOoha445NYeiyKtDhQLd8JPH+CC+jM6smqNyFgWOnimy + xK441XWT11VdCTROssYOtSZDVdYMWVO0ZUIvTo0csPv+jspKfsMuF2g4BJoZu3f0TjN2SCGoEMnG + xHE2sk3uX29xcRauFOBhC8pCXBg0RYaibfIAww2+bEo6uJCFby6EzQgg+LzFcYEUfYvsYfVu9mQM + ewFkJSwUICg7MvDF6cuuHB0QXJVkfcu2wFLAouYl03xhLdI9+9VzSvFUU3YGTXbeaGY4W3e1MDkP + KiZxs2o1qngT4JkkDUrvh+Suyc+cwpnNqngDN4FMLm5lHwRcVVx2kUn5EMGzZgqcei/attgVnJ1d + cn/QDNu410m6Nb1UAl/IK7clFdYypA5GvcnEuvLwL1NAGBXbqCY1Pkam7CxAUiQgS/oWVPiTnPyO + UqT3gWitZrYjv+BdoHbz6t0QsLOb1gInZVVYes8UnMUOQ3Qr3n8I3J6v/7rxxn1UhrHLX8qqbg/N + 8dgKXL0za+yjO7MN2JXl39IDnOdlczieTkVamOd+fhCa8v/yk1Qfy6o5lieB0UXSH/giP3yUPrBt + 3tRV29wfgfvBM52lu9png+EWIpt+UnZOq6H2pZ3W/lRP3BbD2BxQ4Fs/e/eaut2/oufXPi/O1amc + ChnYnP3F3Crjh+l6Xn6lMQb2FzWmsbDHDp3tJRuyEu+ffgMAAP//AwC08gFezwMAAA== + headers: + CF-RAY: + - 972c9d428f887eeb-MAA + Cache-Control: + - private, max-age=0, no-store, no-cache, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Thu, 21 Aug 2025 19:42:33 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + vary: + - Origin + via: + - 1.1 google + x-groq-region: + - bom + x-ratelimit-limit-requests: + - '14400' + x-ratelimit-limit-tokens: + - '6000' + x-ratelimit-remaining-requests: + - '14397' + x-ratelimit-remaining-tokens: + - '5966' + x-ratelimit-reset-requests: + - 17.673999999s + x-ratelimit-reset-tokens: + - 336.999999ms + x-request-id: + - req_01k372f1dsemkrvmy3mrbfwkhz + status: + code: 200 + message: OK +- request: + body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello"}],"model":"llama3-8b-8192","temperature":null,"tool_choice":"auto","tools":null}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '185' + content-type: + - application/json + host: + - api.groq.com + user-agent: + - Groq/Python 0.31.0 + x-stainless-arch: + - other:amd64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Windows + x-stainless-package-version: + - 0.31.0 + x-stainless-read-timeout: + - '60' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.3 + method: POST + uri: https://api.groq.com/openai/v1/chat/completions + response: + body: + string: '{"error":{"message":"Invalid API Key","type":"invalid_request_error","code":"invalid_api_key"}} + + ' + headers: + CF-RAY: + - 972ca3f86ff0c87a-MAA + Cache-Control: + - private, max-age=0, no-store, no-cache, must-revalidate + Connection: + - keep-alive + Content-Length: + - '96' + Content-Type: + - application/json + Date: + - Thu, 21 Aug 2025 19:47:08 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=UhqO2zat1gtMrGieUXdXOpkyLRJXE_oRcFucVsQh1fU-1755805628-1.0.1.1-b0EExmKlKfKc_UL4DLkPy0pw0pK0zrbjS2qNLcu00zrM2j_ZZaQ9KUpHMJg46EZORtNZnfvlT7GfdKLttiNc6pFhd8Lp6Ox35cJk.Z_gX6U; + path=/; expires=Thu, 21-Aug-25 20:17:08 GMT; domain=.groq.com; HttpOnly; Secure; + SameSite=None + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + vary: + - Origin + via: + - 1.1 google + x-groq-region: + - bom + x-request-id: + - req_01k372qdvbevx9dvaw7d9svnh1 + status: + code: 401 + message: Unauthorized +- request: + body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello"}],"model":"llama3-8b-8192","temperature":null,"tool_choice":"auto","tools":null}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '185' + content-type: + - application/json + cookie: + - __cf_bm=UhqO2zat1gtMrGieUXdXOpkyLRJXE_oRcFucVsQh1fU-1755805628-1.0.1.1-b0EExmKlKfKc_UL4DLkPy0pw0pK0zrbjS2qNLcu00zrM2j_ZZaQ9KUpHMJg46EZORtNZnfvlT7GfdKLttiNc6pFhd8Lp6Ox35cJk.Z_gX6U + host: + - api.groq.com + user-agent: + - Groq/Python 0.31.0 + x-stainless-arch: + - other:amd64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Windows + x-stainless-package-version: + - 0.31.0 + x-stainless-read-timeout: + - '60' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.3 + method: POST + uri: https://api.groq.com/openai/v1/chat/completions + response: + body: + string: '{"error":{"message":"Invalid API Key","type":"invalid_request_error","code":"invalid_api_key"}} + + ' + headers: + CF-RAY: + - 972ca411de64c87a-MAA + Cache-Control: + - private, max-age=0, no-store, no-cache, must-revalidate + Connection: + - keep-alive + Content-Length: + - '96' + Content-Type: + - application/json + Date: + - Thu, 21 Aug 2025 19:47:12 GMT + Server: + - cloudflare + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + vary: + - Origin + via: + - 1.1 google + x-groq-region: + - bom + x-request-id: + - req_01k372qht9fzvvdk3rpe3p6v8e + status: + code: 401 + message: Unauthorized +- request: + body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello"}],"model":"llama3-8b-8192","temperature":null,"tool_choice":"auto","tools":null}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '185' + content-type: + - application/json + host: + - api.groq.com + user-agent: + - Groq/Python 0.31.0 + x-stainless-arch: + - other:amd64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Windows + x-stainless-package-version: + - 0.31.0 + x-stainless-read-timeout: + - '60' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.3 + method: POST + uri: https://api.groq.com/openai/v1/chat/completions + response: + body: + string: !!binary | + H4sIAAAAAAAAA1SSza6bMBCF930KdzbdQMQ/xptum2eoKmTMAL6xPcQ2N7mK8u4VUdKo26PveOYc + zw30CALUIqOyq0lbxVUr5ZSiKsu0QpxSXnZ1mo8FKqnGThUVJEDDB6r4NB4U2dVg1OQgAeVRRhxB + 5G1d86xueJ6ApRENCDBGWlmmfEh53hU7vZBWGED8voF2I15BZAlYDEHOCOIGngyCABmCDlG6uHvI + RXT79F9oDH1nx/gjMKcVskjMIkb2RduBHQOLC3pkgSzGRbuZHZmSji1o1h1hFx2XhJFnF9rM+JCM + Pj2e2YP9hHsChubV0xBAuM2YBCbtdFh6jzKQAwEh0gr3Pwlsr5XPG27YR20RRHYoyrJqiyxvElg9 + 2TX2kU7oAoiieEtPOMsK3lRVXu8pX6W+Dc3/8suUt01X5CVPIFKU5h9fvZUXWmR13dR1eX/u2w8e + 5Wmki3vlC18hou0n7Wb0q9ePoqe1b+sJu3xQfP//az97Ou9hH+fj8dxn+alsi5DzYRpVV/HPKXbr + tQzVvLcY0H9qtbeCHgSQ60e00o1w//YXAAD//wMAdbmqA4MCAAA= + headers: + CF-RAY: + - 972ca5414f951797-MAA + Cache-Control: + - private, max-age=0, no-store, no-cache, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Thu, 21 Aug 2025 19:48:01 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=dt3v_TL7suT9_wad2MRuzsOJIHs1Dv9InJ.ld9U3zyk-1755805681-1.0.1.1-Wrr.b2Of59oEZ.U.aWZNiW1TuLjb5xPCmeKQyAUZjTJHj80jSPxRnthIFwJk3yf6fXfwJqcvmeweEe4A3OI5Tmc_cfYRQ9oB5WONUSDftLY; + path=/; expires=Thu, 21-Aug-25 20:18:01 GMT; domain=.groq.com; HttpOnly; Secure; + SameSite=None + Transfer-Encoding: + - chunked + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + vary: + - Origin + via: + - 1.1 google + x-groq-region: + - bom + x-ratelimit-limit-requests: + - '14400' + x-ratelimit-limit-tokens: + - '6000' + x-ratelimit-remaining-requests: + - '14398' + x-ratelimit-remaining-tokens: + - '5981' + x-ratelimit-reset-requests: + - 10.172999999s + x-ratelimit-reset-tokens: + - 190ms + x-request-id: + - req_01k372s18bfdc948vft9px3s4g + status: + code: 200 + message: OK +- request: + body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Summarize + AI history in 2 sentences"}],"model":"llama3-8b-8192","temperature":null,"tool_choice":"auto","tools":null}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '215' + content-type: + - application/json + cookie: + - __cf_bm=dt3v_TL7suT9_wad2MRuzsOJIHs1Dv9InJ.ld9U3zyk-1755805681-1.0.1.1-Wrr.b2Of59oEZ.U.aWZNiW1TuLjb5xPCmeKQyAUZjTJHj80jSPxRnthIFwJk3yf6fXfwJqcvmeweEe4A3OI5Tmc_cfYRQ9oB5WONUSDftLY + host: + - api.groq.com + user-agent: + - Groq/Python 0.31.0 + x-stainless-arch: + - other:amd64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Windows + x-stainless-package-version: + - 0.31.0 + x-stainless-read-timeout: + - '60' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.3 + method: POST + uri: https://api.groq.com/openai/v1/chat/completions + response: + body: + string: !!binary | + H4sIAAAAAAAAA3xUTY/jNgy991cQPG0BZ2DH8fjjNthDOwV66t66RSBLtM2NLHkoOZtgMP+9kCeZ + 3V569BMf3+MT5Vdkgx3qSUU9L3ZXV9Whqst2V9Sadgc9mF1bmX7X76vDvqSq0QNhhr7/RjreiA/a + z4ulyN5hhlpIRTLYFXVVNXn12BQZzt6QxQ6tVbMqd02/a4p2n6onz5oCdn+/IjtDF+zyDGcKQY2E + 3SuKt4QdqhA4ROVi4ngXySX130kIOICC/S5QQjVBWOdZyRX8AE/PMHGIXq7dV/fVfZkItHealrid + SuSBNSsLzy6StTxuDT49Pf8KRkUK0Ct9guhBOc3kIvwmRJoy6NcIcSJIc4m7i9wkexqVA3ZbRdFW + eYDvHKft09CZrF/m1MwPGzSwhJh4i/hR1BxAOQPKjl44TnOA/gop4TWSQNh8cIgBLJ8Inqxy8GUV + duNG+8NPDv7Un5XE6foAf3EaKE7ksi0MFVIAkd1KJs1FZ2/PqUD8Ok43w03+bqFo2/+xTpeFJEK4 + hkg3z7PSEzsCS0ocuzHb0CS6FXNK14ACobDKe9bsQEinlldS8pOaMuebkCFaPlpuHdP5It7yQKLS + 2t2CV8tiWW9IAKXFhwBnJezXAOzMGqIwhQd8y9D6cRHfB+zcam2GAzsO01FIBe+wwxD9gm//ZLje + F/FlpZWOkWfCLn/Yl1VZt01+yHARPy/xGP2JXMCuzH9At+I8L+uiafePaXfvT+WDUBTlf/E7q66L + um6TRPRR2R+EQ/kB3WubvGkfm/LtZvjYC6mT8d/dfcD3ezoO7EaSRXh7P8NyrKuB2qLXzQEzvBxH + 8S9p2u2vIPRyzItTWe9D8a0ZjG7nQV3OL268nKKkGAPJmXWKhQQ79O5oaFbO4Nsv/wIAAP//AwCX + xsFfWgQAAA== + headers: + CF-RAY: + - 972ca543686e1797-MAA + Cache-Control: + - private, max-age=0, no-store, no-cache, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Thu, 21 Aug 2025 19:48:01 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + vary: + - Origin + via: + - 1.1 google + x-groq-region: + - bom + x-ratelimit-limit-requests: + - '14400' + x-ratelimit-limit-tokens: + - '6000' + x-ratelimit-remaining-requests: + - '14397' + x-ratelimit-remaining-tokens: + - '5932' + x-ratelimit-reset-requests: + - 17.683s + x-ratelimit-reset-tokens: + - 678.999999ms + x-request-id: + - req_01k372s1j8fdc9mfaxvqngxktr + status: + code: 200 + message: OK +- request: + body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello"}],"model":"llama3-8b-8192","temperature":null,"tool_choice":"auto","tools":null}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '185' + content-type: + - application/json + host: + - api.groq.com + user-agent: + - Groq/Python 0.31.0 + x-stainless-arch: + - other:amd64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Windows + x-stainless-package-version: + - 0.31.0 + x-stainless-read-timeout: + - '60' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.3 + method: POST + uri: https://api.groq.com/openai/v1/chat/completions + response: + body: + string: !!binary | + H4sIAAAAAAAAA1SSwY7iMBBEf8XbFy4JSpyEOLnsdfmG1Spy7IZ4cNzGdgYQ4t9XYQdGey29qu5y + +w5GQw9qkknN3uZa8KYuWp23He/yWnQ6F2NV56gPja5arjohIAMaP1ClL+NW0ewtJkMOMlABZUIN + fdk2jSgawcsMZtJooQdr5SyrXIy5KDu+0hMZhRH633cwTuMV+iKDGWOUR4T+DoEsQg8yRhOTdGn1 + kEvo1um/0Fr6wfZpE5kzClkiNiMmdqNly/aRpQkDskgzpsm4I9szJR2b0PoVYReTJkaBXWix+qlY + c3qmrL1+sv1mZs+EROzfBt826W7svGBca8c1JJE3Kq7ARr9ztIlqiXELjwwsHX2gMULvFmszOBhn + 4jQElJEc9BATeXj8yWB5lT8vuOCQzIzQF1tetVxUu7LKwAeafRoSndBF6Dn/lr7gouBd1fKqXd/r + dZ63oeb/yy8TF7uirNcJiZK0b35Xv5UXWpVNJXbN42vdYQwoT5ou7lUv3mLCeTgYd8Tgg3le7OCH + tjlgV45K1JDBdTgGOq9dn/8w4HkoylPV8qt0F6z9Z6N3h3L04eI+5V+BArE4tagsMxkUKKlFSlZK + +XnxKam5iXkpSrVcAAAAAP//AwCrTZh6zAIAAA== + headers: + CF-RAY: + - 972ca8b0eb05380b-MAA + Cache-Control: + - private, max-age=0, no-store, no-cache, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Thu, 21 Aug 2025 19:50:21 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=bG4dH3WwFIyJLRlIKR40Rvq1IDUDC46YvFEZk9tgEE8-1755805821-1.0.1.1-YrFvcrKET2GhwzbERNaUsb60Os97Y2WYflbIhT1YbXHiX_BfR53k3ST_kgSW0ADjpArmQhzu94Xpeu9CIchMHsDHvx5bTDi7GnS.EyX1Wq4; + path=/; expires=Thu, 21-Aug-25 20:20:21 GMT; domain=.groq.com; HttpOnly; Secure; + SameSite=None + Transfer-Encoding: + - chunked + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + vary: + - Origin + via: + - 1.1 google + x-groq-region: + - bom + x-ratelimit-limit-requests: + - '14400' + x-ratelimit-limit-tokens: + - '6000' + x-ratelimit-remaining-requests: + - '14397' + x-ratelimit-remaining-tokens: + - '5979' + x-ratelimit-reset-requests: + - 17.056s + x-ratelimit-reset-tokens: + - 206.999999ms + x-request-id: + - req_01k372xanwe4pv5d6f1bprwnva + status: + code: 200 + message: OK +- request: + body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Summarize + AI history in 2 sentences"}],"model":"llama3-8b-8192","temperature":null,"tool_choice":"auto","tools":null}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '215' + content-type: + - application/json + cookie: + - __cf_bm=bG4dH3WwFIyJLRlIKR40Rvq1IDUDC46YvFEZk9tgEE8-1755805821-1.0.1.1-YrFvcrKET2GhwzbERNaUsb60Os97Y2WYflbIhT1YbXHiX_BfR53k3ST_kgSW0ADjpArmQhzu94Xpeu9CIchMHsDHvx5bTDi7GnS.EyX1Wq4 + host: + - api.groq.com + user-agent: + - Groq/Python 0.31.0 + x-stainless-arch: + - other:amd64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Windows + x-stainless-package-version: + - 0.31.0 + x-stainless-read-timeout: + - '60' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.3 + method: POST + uri: https://api.groq.com/openai/v1/chat/completions + response: + body: + string: !!binary | + H4sIAAAAAAAAA3RUTW/kNgy991cQPLWAHXg89nz4FvTSLJDT9tYUA9qibe3IlCPRk5kG+e+FJpnN + 7mGPfnpP5Huk/IrWYIPdSNpNs8urfVFSUe5zU/ZVXlFR5LRvOe83u36zM2W9qQvM0LffuNMP4V3n + p9mxWi+YYReYlA02q21d74p6V5YZTt6wwwado4nW+a7Nd6t9mdijtx1HbP55RSuGz9gUGU4cIw2M + zSsG7xgbpBhtVBJNGi/Kkqr/xYHBRiBog+Ue4jJNFC7ge7h/gNFG9eECVqCEyEnUcWye5Enug9re + dpYcPIiyc3ZIh/D7/cMf0PJAAupB6cgQR5o53aEjw2RNXhY6QseiS7jAi9XxemL4xM7PE4um8s4P + tiMHgSl6sTIAiYE5+NbxlEfvTlfMDT5YHacI7QXuHQn8vQQrQwaPFE5W4NFKPF6yq/qLHwUeuz8p + 6JigycsAXkcOMftsRDlM8IS/cPiE0HIq3XkrbJKv1b7e3MFXm/zryJJds6MIfPLuxAZ0DH4ZRjhR + sH6JEJUGjhlY6dxi0mVhcZy3FNlAvETlKWbA55mDfn5P1I1WGBxTkKvF5Mkwzz9AVxfRDpJ6J1Eg + cyLpOMUaU7OBU/JguCPDEUywJ5YU3gfxSkr7uCgHGCmYFwqcgSElSOtAA79XfidR2lpyMPsXDnf4 + lqHzQxpTxEYW5zLsrdg4Ht4HiQ1G9TO+/ZvhclvR54UXPqidGJvirlxvdlVZFnWGc/DTrAf1R5aI + zbr4hD7IRbHe1sW6qtNW3x7Rd8FqtfkZv6m2+3K/LVdVhuqV3Keg2nyHbtzduqi2db1/++j40Aam + o/EvcnP4PqJDb2XgMAd7fVr9fNjWPe9XbberMMPzYQj+Odm9/jACPx+K1XG9Lc/034WrWYlirC/f + xrMW55Rj5HCyXcqFAzbo5WB4IjH49tv/AAAA//8DAGlMCBh1BAAA + headers: + CF-RAY: + - 972ca8b2fdef380b-MAA + Cache-Control: + - private, max-age=0, no-store, no-cache, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Thu, 21 Aug 2025 19:50:22 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + vary: + - Origin + via: + - 1.1 google + x-groq-region: + - bom + x-ratelimit-limit-requests: + - '14400' + x-ratelimit-limit-tokens: + - '6000' + x-ratelimit-remaining-requests: + - '14396' + x-ratelimit-remaining-tokens: + - '5915' + x-ratelimit-reset-requests: + - 23.677999999s + x-ratelimit-reset-tokens: + - 846.999999ms + x-request-id: + - req_01k372xazye4ptaass5yjhxt0x + status: + code: 200 + message: OK +version: 1 diff --git a/plugins/groq/plugin_test/cassettes/test_chat_predict_with_context.yaml b/plugins/groq/plugin_test/cassettes/test_chat_predict_with_context.yaml new file mode 100644 index 0000000000..522840ba6e --- /dev/null +++ b/plugins/groq/plugin_test/cassettes/test_chat_predict_with_context.yaml @@ -0,0 +1,100 @@ +interactions: +- request: + body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Tell + me about"}],"model":"llama3-8b-8192","temperature":null,"tool_choice":"auto","tools":null}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '193' + content-type: + - application/json + host: + - api.groq.com + user-agent: + - Groq/Python 0.31.0 + x-stainless-arch: + - other:amd64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Windows + x-stainless-package-version: + - 0.31.0 + x-stainless-read-timeout: + - '60' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.3 + method: POST + uri: https://api.groq.com/openai/v1/chat/completions + response: + body: + string: !!binary | + H4sIAAAAAAAAA1ySzW7bMBCEX2WzF18kQz+m9XPpIbnkEYqiEChpLbGmuDRJJTEMv3tBx3aBXgfz + LWdneUE1YovDLMOwWJ0emn7Ii7FOh0rs0t2+EGkvKUv3Td4U1SArqipMkPs/NIQ7uB14sZqCYoMJ + Do5koBHbvBKizkRdZAkuPJLGFrWWiyzTuk/rvCmie2Y1kMf21wWVGekL22gn7+VE2F7QsSZsUXqv + fJAmRIZNIBNf/8nr5oPAB+kCjRBIa2UmWAg8LxRmZaYE+jWACqCZjx60OhKceYVFTXOAWd5wtpbG + F3hjswnwyc6dE3jfLDCTIwgMM2m7hVdpbqjVJD3BQRnl56g48BQjDQTsQPojSDit5GMjP+B9M4Lm + j9ug7zUi84LXBDVP1nHvsTWr1gl+j+wcSc8GW4zJ8Po7wfVRx2mllbqgFsI22xalKJq8FCJB63ix + oQt8JOOxLXb/pLs5y4qmFnktYoOPgz2B3X/yAyozUZVVhAIHqZ/+ffNUntZSiLqprve4Xe9IHkf+ + NI/1/NkHWrqDMhM569TthgfbVeJATd4P9Q4T/Oomx6e46+1nOjp12V8ZZhubG1VYFiWlpVeVFJoa + ZmSZlidnVJongwKxOLWoLDMZFCipRUpWSvl58SmpuYl5KUq1XAAAAAD//wMA/d7bYt4CAAA= + headers: + CF-RAY: + - 972ca8aaf922a905-MAA + Cache-Control: + - private, max-age=0, no-store, no-cache, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Thu, 21 Aug 2025 19:50:20 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=sRBa71c38cTZwKBymCnl5Xdsxcx6E.YGXn9zCYD_xDE-1755805820-1.0.1.1-KhUJ0hVLP9u6_C7PvvTIq37rxZAPFxoDSe2e8fibrdhVYkDbD5U79i_WFvRW44_O0MXInOnfI.5i7BfdHigsE3riT9LTgjm0ap15p7sQAPY; + path=/; expires=Thu, 21-Aug-25 20:20:20 GMT; domain=.groq.com; HttpOnly; Secure; + SameSite=None + Transfer-Encoding: + - chunked + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + vary: + - Origin + via: + - 1.1 google + x-groq-region: + - bom + x-ratelimit-limit-requests: + - '14400' + x-ratelimit-limit-tokens: + - '6000' + x-ratelimit-remaining-requests: + - '14398' + x-ratelimit-remaining-tokens: + - '5979' + x-ratelimit-reset-requests: + - 11.070999999s + x-ratelimit-reset-tokens: + - 210ms + x-request-id: + - req_01k372x9rbfgztq51hj5wchy7c + status: + code: 200 + message: OK +version: 1 diff --git a/plugins/groq/plugin_test/test_model_groq.py b/plugins/groq/plugin_test/test_model_groq.py new file mode 100644 index 0000000000..a4a405bed8 --- /dev/null +++ b/plugins/groq/plugin_test/test_model_groq.py @@ -0,0 +1,63 @@ +import os +import pytest +import vcr +from superduper_groq import GroqChatCompletions +from dotenv import load_dotenv + +load_dotenv() +CASSETTE_DIR = os.path.join(os.path.dirname(__file__), 'cassettes') + +# Ensure API key is set for testing +if os.getenv('GROQ_API_KEY') is None: + mp = pytest.MonkeyPatch() + mp.setenv('GROQ_API_KEY', 'sk-TopSecret') + +# ----------------------- +# Single prediction test +# ----------------------- +@vcr.use_cassette( + f"{CASSETTE_DIR}/test_chat_predict.yaml", + filter_headers=["authorization"], + record_mode="all" +) +def test_chat_predict(): + model = GroqChatCompletions( + identifier="llama3-8b-8192", + system_message="You are a helpful assistant." + ) + resp = model.predict("Hello world") + assert isinstance(resp, str) + +# ----------------------- +# Prediction with context +# ----------------------- +@vcr.use_cassette( + f"{CASSETTE_DIR}/test_chat_predict_with_context.yaml", + filter_headers=["authorization"], + record_mode="all" +) +def test_chat_predict_with_context(): + model = GroqChatCompletions( + identifier="llama3-8b-8192", + system_message="You are a helpful assistant." + ) + resp = model.predict("Tell me about", context=["AI"]) + assert isinstance(resp, str) + +# ----------------------- +# Batch prediction test +# ----------------------- +@vcr.use_cassette( + f"{CASSETTE_DIR}/test_chat_predict_batches.yaml", + filter_headers=["authorization"], + record_mode="all" +) +def test_chat_predict_batches(): + model = GroqChatCompletions( + identifier="llama3-8b-8192", + system_message="You are a helpful assistant." + ) + dataset = ["Hello", "Summarize AI history in 2 sentences"] + resp = model.predict_batches(dataset) + assert isinstance(resp, list) + assert all(isinstance(r, str) for r in resp) diff --git a/plugins/groq/pyproject.toml b/plugins/groq/pyproject.toml new file mode 100644 index 0000000000..df3c952093 --- /dev/null +++ b/plugins/groq/pyproject.toml @@ -0,0 +1,36 @@ +[build-system] +requires = ["setuptools>=42"] +build-backend = "setuptools.build_meta" + +[project] +name = "superduper-groq" +version = "0.1.0" +description = "SuperDuperDB integration with Groq API" +authors = [ + {name = "Geoffrey Robinson", email = "jeffrobin132004@gmail.com"}, +] +dependencies = [ + "superduper-framework>=0.1.0", + "groq>=0.4.0", +] +requires-python = ">=3.8" + +[project.optional-dependencies] +test = [ + "pytest>=7.0.0", + "pytest-cov>=4.0.0", + "pytest-mock>=3.10.0", +] + +[tool.setuptools.packages.find] +include = ["superduper_groq*"] +exclude = ["plugin_test*"] + +[tool.pytest.ini_options] +testpaths = ["tests"] +python_files = ["test_*.py"] +python_functions = ["test_*"] +addopts = "-v --cov=superduper_groq --cov-report=term-missing" + +[project.entry-points."superduper.plugin"] +groq = "superduper_groq" \ No newline at end of file diff --git a/plugins/groq/superduper_groq/__init__.py b/plugins/groq/superduper_groq/__init__.py new file mode 100644 index 0000000000..27edf0a8a0 --- /dev/null +++ b/plugins/groq/superduper_groq/__init__.py @@ -0,0 +1,3 @@ +from .model import GroqChatCompletions +__version__ = "0.7.0" +__all__ = ['GroqChatCompletions'] diff --git a/plugins/groq/superduper_groq/model.py b/plugins/groq/superduper_groq/model.py new file mode 100644 index 0000000000..bfb9fe1285 --- /dev/null +++ b/plugins/groq/superduper_groq/model.py @@ -0,0 +1,87 @@ +import groq +from groq import APIConnectionError, APIError, APIStatusError, APITimeoutError +from superduper.components.model import APIBaseModel +from superduper.base.query_dataset import QueryDataset +import os +import dataclasses as dc +from superduper.misc.retry import Retry +from typing import Any, Optional, Union, List, Dict +from superduper.misc.utils import format_prompt + + +retry = Retry( + exception_types=(APIConnectionError, APIError, APIStatusError, APITimeoutError) +) + + +class GroqAPIModel(APIBaseModel): + """Base Class for Groq API Models + + :param groq_api_key: The API key for authenticating with the Groq API + """ + + GROQ_API_KEY: Optional[str] = os.getenv("GROQ_API_KEY") + temperature: Optional[float] = None + system_message: Optional[str] = None + tool_choice: Optional[Union[str, Dict]] = "auto" + tools: Optional[list] = dc.field(default_factory=list) + include_reasoning: Optional[bool] = None + + def postinit(self): + """Post-initialization method.""" + self.model = self.model or self.identifier + super().postinit() + + def setup(self, db=None): + """Initialize the model. + :param db: The database connection to use. + """ + self.client = groq.Groq(api_key=self.GROQ_API_KEY) + self.async_client = groq.AsyncGroq() + super().setup() + + +class GroqChatCompletions(GroqAPIModel): + """Chat Completions Model for Groq API""" + + prompt: str = '' + signature: str = '*args,**kwargs' + takes_context: bool = True + browser_search: Optional[bool] = False + browser_tool = { + "type": "browser_search", + "description": "Useful for when you need to answer questions about current events.", + } + + @retry + def predict( + self, X: Union[str, list[dict]], context: Optional[List[str]] = None + ) -> Any: + messages = [] + if isinstance(X, str): + if context is not None: + X = format_prompt(X, self.prompt, context=context) + if self.system_message: + messages.append({'role': 'system', 'content': self.system_message}) + messages.append({'role': 'user', 'content': X}) + elif isinstance(X, list) and all(isinstance(p, dict) for p in X): + if self.system_message: + messages.append({'role': 'system', 'content': self.system_message}) + messages.append({'role': 'user', 'content': X}) + if not self.browser_search and not self.tools: + tools = None + elif self.browser_search: + tools = self.tools + [self.browser_tool] + else: + tools = self.tools + response = self.client.chat.completions.create( + messages=messages, + model=self.identifier, + temperature=self.temperature, + tool_choice=self.tool_choice or "none", + tools=tools + ) + return response.choices[0].message.content + + def predict_batches(self, dataset: Union[List, QueryDataset]) -> List: + return [self.predict(dataset[i]) for i in range(len(dataset))] From 17acd1e39fe0b041e4c63b4b886b0da74cc6a1fb Mon Sep 17 00:00:00 2001 From: Geoff-Robin Date: Fri, 22 Aug 2025 02:01:10 +0530 Subject: [PATCH 2/7] Update README.md --- plugins/groq/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/groq/README.md b/plugins/groq/README.md index f4af421564..1dbc239210 100644 --- a/plugins/groq/README.md +++ b/plugins/groq/README.md @@ -26,7 +26,7 @@ pip install superduper-groq -Create a Chat Model with All Attributes +## Create a Chat Model with All Attributes ```python model = GroqChatCompletions( @@ -41,20 +41,20 @@ model = GroqChatCompletions( ) ``` -Single Prediction +## Single Prediction ```python response = model.predict("Tell me about AI") print(response) ``` -Prediction with Context +## Prediction with Context ```python response = model.predict("Tell me about ", context=["Artificial Intelligence"]) print(response) ``` -Batch Predictions +## Batch Predictions ```python prompts = ["Hello world", "Explain machine learning"] responses = model.predict_batches(prompts) From b8e46fa0810d9e74ed006e33fe21398c9298810c Mon Sep 17 00:00:00 2001 From: Geoff-Robin Date: Fri, 22 Aug 2025 16:46:36 +0530 Subject: [PATCH 3/7] Removed groq_api_key attribute --- plugins/groq/superduper_groq/model.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/groq/superduper_groq/model.py b/plugins/groq/superduper_groq/model.py index bfb9fe1285..47fd0595fe 100644 --- a/plugins/groq/superduper_groq/model.py +++ b/plugins/groq/superduper_groq/model.py @@ -19,8 +19,6 @@ class GroqAPIModel(APIBaseModel): :param groq_api_key: The API key for authenticating with the Groq API """ - - GROQ_API_KEY: Optional[str] = os.getenv("GROQ_API_KEY") temperature: Optional[float] = None system_message: Optional[str] = None tool_choice: Optional[Union[str, Dict]] = "auto" @@ -36,7 +34,7 @@ def setup(self, db=None): """Initialize the model. :param db: The database connection to use. """ - self.client = groq.Groq(api_key=self.GROQ_API_KEY) + self.client = groq.Groq(api_key=os.getenv("GROQ_API_KEY")) self.async_client = groq.AsyncGroq() super().setup() From 987cebff062c3123d40b3ca1f2cf349273493404 Mon Sep 17 00:00:00 2001 From: Geoff-Robin Date: Tue, 26 Aug 2025 01:51:38 +0530 Subject: [PATCH 4/7] auto formatter groq plugin --- plugins/groq/plugin_test/test_model_groq.py | 21 +++++++++++---------- plugins/groq/superduper_groq/__init__.py | 1 + plugins/groq/superduper_groq/model.py | 16 +++++++++------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/plugins/groq/plugin_test/test_model_groq.py b/plugins/groq/plugin_test/test_model_groq.py index a4a405bed8..25457bee60 100644 --- a/plugins/groq/plugin_test/test_model_groq.py +++ b/plugins/groq/plugin_test/test_model_groq.py @@ -1,8 +1,9 @@ import os + import pytest import vcr -from superduper_groq import GroqChatCompletions from dotenv import load_dotenv +from superduper_groq import GroqChatCompletions load_dotenv() CASSETTE_DIR = os.path.join(os.path.dirname(__file__), 'cassettes') @@ -12,50 +13,50 @@ mp = pytest.MonkeyPatch() mp.setenv('GROQ_API_KEY', 'sk-TopSecret') + # ----------------------- # Single prediction test # ----------------------- @vcr.use_cassette( f"{CASSETTE_DIR}/test_chat_predict.yaml", filter_headers=["authorization"], - record_mode="all" + record_mode="all", ) def test_chat_predict(): model = GroqChatCompletions( - identifier="llama3-8b-8192", - system_message="You are a helpful assistant." + identifier="llama3-8b-8192", system_message="You are a helpful assistant." ) resp = model.predict("Hello world") assert isinstance(resp, str) + # ----------------------- # Prediction with context # ----------------------- @vcr.use_cassette( f"{CASSETTE_DIR}/test_chat_predict_with_context.yaml", filter_headers=["authorization"], - record_mode="all" + record_mode="all", ) def test_chat_predict_with_context(): model = GroqChatCompletions( - identifier="llama3-8b-8192", - system_message="You are a helpful assistant." + identifier="llama3-8b-8192", system_message="You are a helpful assistant." ) resp = model.predict("Tell me about", context=["AI"]) assert isinstance(resp, str) + # ----------------------- # Batch prediction test # ----------------------- @vcr.use_cassette( f"{CASSETTE_DIR}/test_chat_predict_batches.yaml", filter_headers=["authorization"], - record_mode="all" + record_mode="all", ) def test_chat_predict_batches(): model = GroqChatCompletions( - identifier="llama3-8b-8192", - system_message="You are a helpful assistant." + identifier="llama3-8b-8192", system_message="You are a helpful assistant." ) dataset = ["Hello", "Summarize AI history in 2 sentences"] resp = model.predict_batches(dataset) diff --git a/plugins/groq/superduper_groq/__init__.py b/plugins/groq/superduper_groq/__init__.py index 27edf0a8a0..6badaa3269 100644 --- a/plugins/groq/superduper_groq/__init__.py +++ b/plugins/groq/superduper_groq/__init__.py @@ -1,3 +1,4 @@ from .model import GroqChatCompletions + __version__ = "0.7.0" __all__ = ['GroqChatCompletions'] diff --git a/plugins/groq/superduper_groq/model.py b/plugins/groq/superduper_groq/model.py index 47fd0595fe..a3e00da5aa 100644 --- a/plugins/groq/superduper_groq/model.py +++ b/plugins/groq/superduper_groq/model.py @@ -1,14 +1,15 @@ +import dataclasses as dc +import os +from typing import Any, Dict, List, Optional, Union + import groq from groq import APIConnectionError, APIError, APIStatusError, APITimeoutError -from superduper.components.model import APIBaseModel + from superduper.base.query_dataset import QueryDataset -import os -import dataclasses as dc +from superduper.components.model import APIBaseModel from superduper.misc.retry import Retry -from typing import Any, Optional, Union, List, Dict from superduper.misc.utils import format_prompt - retry = Retry( exception_types=(APIConnectionError, APIError, APIStatusError, APITimeoutError) ) @@ -19,12 +20,13 @@ class GroqAPIModel(APIBaseModel): :param groq_api_key: The API key for authenticating with the Groq API """ + temperature: Optional[float] = None system_message: Optional[str] = None tool_choice: Optional[Union[str, Dict]] = "auto" tools: Optional[list] = dc.field(default_factory=list) include_reasoning: Optional[bool] = None - + def postinit(self): """Post-initialization method.""" self.model = self.model or self.identifier @@ -77,7 +79,7 @@ def predict( model=self.identifier, temperature=self.temperature, tool_choice=self.tool_choice or "none", - tools=tools + tools=tools, ) return response.choices[0].message.content From 446cdc67149b3c62baa1d376460d002417a6cb1d Mon Sep 17 00:00:00 2001 From: Geoff-Robin Date: Mon, 1 Sep 2025 21:27:58 +0530 Subject: [PATCH 5/7] lint errors fixed --- plugins/groq/plugin_test/test_model_groq.py | 12 +++--------- plugins/groq/superduper_groq/model.py | 7 ++++--- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/plugins/groq/plugin_test/test_model_groq.py b/plugins/groq/plugin_test/test_model_groq.py index 25457bee60..884975a251 100644 --- a/plugins/groq/plugin_test/test_model_groq.py +++ b/plugins/groq/plugin_test/test_model_groq.py @@ -14,15 +14,13 @@ mp.setenv('GROQ_API_KEY', 'sk-TopSecret') -# ----------------------- -# Single prediction test -# ----------------------- @vcr.use_cassette( f"{CASSETTE_DIR}/test_chat_predict.yaml", filter_headers=["authorization"], record_mode="all", ) def test_chat_predict(): + """Test that GroqChatCompletions predicts a single string response.""" model = GroqChatCompletions( identifier="llama3-8b-8192", system_message="You are a helpful assistant." ) @@ -30,15 +28,13 @@ def test_chat_predict(): assert isinstance(resp, str) -# ----------------------- -# Prediction with context -# ----------------------- @vcr.use_cassette( f"{CASSETTE_DIR}/test_chat_predict_with_context.yaml", filter_headers=["authorization"], record_mode="all", ) def test_chat_predict_with_context(): + """Test that GroqChatCompletions predicts a single string response with context.""" model = GroqChatCompletions( identifier="llama3-8b-8192", system_message="You are a helpful assistant." ) @@ -46,15 +42,13 @@ def test_chat_predict_with_context(): assert isinstance(resp, str) -# ----------------------- -# Batch prediction test -# ----------------------- @vcr.use_cassette( f"{CASSETTE_DIR}/test_chat_predict_batches.yaml", filter_headers=["authorization"], record_mode="all", ) def test_chat_predict_batches(): + """Test that GroqChatCompletions predicts a batch of responses.""" model = GroqChatCompletions( identifier="llama3-8b-8192", system_message="You are a helpful assistant." ) diff --git a/plugins/groq/superduper_groq/model.py b/plugins/groq/superduper_groq/model.py index a3e00da5aa..87d757c90c 100644 --- a/plugins/groq/superduper_groq/model.py +++ b/plugins/groq/superduper_groq/model.py @@ -16,9 +16,9 @@ class GroqAPIModel(APIBaseModel): - """Base Class for Groq API Models + """Base Class for Groq API Models. - :param groq_api_key: The API key for authenticating with the Groq API + :param groq_api_key: The API key for authenticating with the Groq API. """ temperature: Optional[float] = None @@ -34,6 +34,7 @@ def postinit(self): def setup(self, db=None): """Initialize the model. + :param db: The database connection to use. """ self.client = groq.Groq(api_key=os.getenv("GROQ_API_KEY")) @@ -42,7 +43,7 @@ def setup(self, db=None): class GroqChatCompletions(GroqAPIModel): - """Chat Completions Model for Groq API""" + """Chat Completions Model for Groq API.""" prompt: str = '' signature: str = '*args,**kwargs' From 0ea8a02aba4f2d00d3cedcbe539b29a79a9d2220 Mon Sep 17 00:00:00 2001 From: Geoff-Robin Date: Tue, 2 Sep 2025 14:32:31 +0530 Subject: [PATCH 6/7] Added vcrpy to project.optional-dependencies --- plugins/groq/pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/groq/pyproject.toml b/plugins/groq/pyproject.toml index df3c952093..229e9eb650 100644 --- a/plugins/groq/pyproject.toml +++ b/plugins/groq/pyproject.toml @@ -20,6 +20,7 @@ test = [ "pytest>=7.0.0", "pytest-cov>=4.0.0", "pytest-mock>=3.10.0", + "vcrpy>=5.1.0", ] [tool.setuptools.packages.find] From 85dee0baaa9b239a57a826582b424ba0baf54ec6 Mon Sep 17 00:00:00 2001 From: Geoff-Robin Date: Sat, 6 Sep 2025 14:59:42 +0530 Subject: [PATCH 7/7] Fixed groq plugin tests by adding cassetes and a valid model_name --- .../cassettes/test_chat_predict.yaml | 393 +---------- .../cassettes/test_chat_predict_batches.yaml | 642 ++---------------- .../test_chat_predict_with_context.yaml | 50 +- plugins/groq/plugin_test/test_model_groq.py | 9 +- 4 files changed, 105 insertions(+), 989 deletions(-) diff --git a/plugins/groq/plugin_test/cassettes/test_chat_predict.yaml b/plugins/groq/plugin_test/cassettes/test_chat_predict.yaml index d620027f18..0bde1c266c 100644 --- a/plugins/groq/plugin_test/cassettes/test_chat_predict.yaml +++ b/plugins/groq/plugin_test/cassettes/test_chat_predict.yaml @@ -1,7 +1,7 @@ interactions: - request: body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello - world"}],"model":"llama3-8b-8192","temperature":0.2,"tool_choice":"auto","tools":null}' + world"}],"model":"openai/gpt-oss-20b","temperature":null,"tool_choice":"auto","tools":null}' headers: accept: - application/json @@ -10,13 +10,13 @@ interactions: connection: - keep-alive content-length: - - '190' + - '195' content-type: - application/json host: - api.groq.com user-agent: - - Groq/Python 0.31.0 + - Groq/Python 0.31.1 x-stainless-arch: - other:amd64 x-stainless-async: @@ -26,7 +26,7 @@ interactions: x-stainless-os: - Windows x-stainless-package-version: - - 0.31.0 + - 0.31.1 x-stainless-read-timeout: - '60' x-stainless-retry-count: @@ -40,17 +40,18 @@ interactions: response: body: string: !!binary | - H4sIAAAAAAAAA1SSzW7bMBCE730Kdi+5SIZ+TZmXXOtnKAKBIlcWY5Irk1Ts1PC7F3LtBL0Ovtnd - GewVjAYBapJJudnmEpuq4YXOddt1eVNzlXd1s82VkgorLLkeRsiAhndU6WHcKHKzxWTIQwYqoEyo - QZS8bbuirdsyA0caLQiwVjpZ592Qd+WuWumJjMII4vcVjNd4AVFk4DBGeUAQVwhkEQTIGE1M0qfV - Qz6hX7f/QmuJpQkD/mT79BKZNwpZIuYQE/ukZcP28R/AIjlMk/EHtmdKejahnVeEnU2aMkaBnWmx - +i5Zc7yPWeO9wi0DS4c50BBB+MXaDEbjTZz6gDKSBwEx0Qy3twyW5+GnBRfsk3EIothUddPybssz - mAO5OfWJjugjiKr+lh5sUVS7rtnyco36bPbbwP+Xn6aya8sdr6oMEiVpv/i2+FKeaFW2RVPv6tvj - 3H4IKI+azv4ZL37GhK4fjT9gmIO5tz3OPW9H3JWD6hrI4NIfAp3WrPcfCnjqi/JY8wr/SDcmFdv3 - Sz1O9azOH3otMWL4MGotBQMIIN9rdNJruP34CwAA//8DACbqtqiIAgAA + H4sIAAAAAAAAAwAAAP//VJJBj5swEIX/ijtnSA0YCL70ur1VqnrqVsjgAbwxHsd2lEVR/nuV3SRq + r0/vk96bNxcwGiSMi0rj6m3Op0F1ohrzpqq6XHRFlyvNdS6qqen0sG8GMUIGNLzhmO7gbqTVW0yG + HGQwBlQJNciirdui5m3dZbCSRgsSyKNT5uvsU04x5iUfbsRCZsQI8vcFjNP4DpJnsGKMakaQFwhk + ESSoGE1MyqUbQy6huyV4QWvpC3uhMxuVY9/ZgtazjU4skVbbN8ggoIrkjJtBwq+IgUW1Rfb6ibIz + BatfYcd+BBrUYDeWFtzYWbnEFJsDYjJuZgGjJxdxx34udLL6LmjmyZqEdtvBNQNLsw80RJDuZG0G + k3EmLv1nApAQE3m4/sng9Ch3POEJ+2RWBMl3XHRlW5f7MgMfaPWpT3RAF0H+Kz3MvK54V7b72z0e + EzyBqvlffkBVyXnXNnUGiZKyT39R7J/S09tWRcdFdb0H7oeA6qDp7B4F4xYTrv1k3IzBB/OxyeR7 + MQqlGiWUgAze+znQ8db249sCHnteHMRUL29xxFl03m8aD39lZlZRkZcLCsbi1KKyzGRQsKQWgZJN + XnxKam5iXopSLRcAAAD//wMAJtkUjbICAAA= headers: CF-RAY: - - 972c9d351f027f44-MAA + - 97acec180cce58c9-MAA Cache-Control: - private, max-age=0, no-store, no-cache, must-revalidate Connection: @@ -60,12 +61,12 @@ interactions: Content-Type: - application/json Date: - - Thu, 21 Aug 2025 19:42:31 GMT + - Sat, 06 Sep 2025 09:25:59 GMT Server: - cloudflare Set-Cookie: - - __cf_bm=A7pxXrx39679Ilgl5_7H3CFLRAc_e.DNGeBS5EXY3Ew-1755805351-1.0.1.1-ixNncwEtwpndV2XUt6Hz03jFT0LzgQtOwes5FTqPza51Yedtnw031GnJIXmu4ZQIeQLpayi17BFDbdzg9N.wr0JAy1.46oSD3pgeySr.xMY; - path=/; expires=Thu, 21-Aug-25 20:12:31 GMT; domain=.groq.com; HttpOnly; Secure; + - __cf_bm=30T388QvCy6EwN0IZNXyvRi7t0XswiQwTG9tx_vITJc-1757150759-1.0.1.1-.SD7Ew6AHyJ.aVqycWJ7KK5pHDWiK5mADPX8jFV0vGWfh6VM6n3YIIGWNpgTA_AiyLr8aeC6EzXDD_zyfugkdYprxTwShgzX_owurp176kM; + path=/; expires=Sat, 06-Sep-25 09:55:59 GMT; domain=.groq.com; HttpOnly; Secure; SameSite=None Transfer-Encoding: - chunked @@ -80,365 +81,19 @@ interactions: x-groq-region: - bom x-ratelimit-limit-requests: - - '14400' + - '1000' x-ratelimit-limit-tokens: - - '6000' + - '8000' x-ratelimit-remaining-requests: - - '14399' + - '999' x-ratelimit-remaining-tokens: - - '5980' + - '7917' x-ratelimit-reset-requests: - - 6s + - 1m26.4s x-ratelimit-reset-tokens: - - 200ms + - 622.5ms x-request-id: - - req_01k372ezamftcs5jx3fh3pcwvd - status: - code: 200 - message: OK -- request: - body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello - world"}],"model":"llama3-8b-8192","temperature":null,"tool_choice":"auto","tools":null}' - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - connection: - - keep-alive - content-length: - - '191' - content-type: - - application/json - host: - - api.groq.com - user-agent: - - Groq/Python 0.31.0 - x-stainless-arch: - - other:amd64 - x-stainless-async: - - 'false' - x-stainless-lang: - - python - x-stainless-os: - - Windows - x-stainless-package-version: - - 0.31.0 - x-stainless-read-timeout: - - '60' - x-stainless-retry-count: - - '0' - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.12.3 - method: POST - uri: https://api.groq.com/openai/v1/chat/completions - response: - body: - string: '{"error":{"message":"Invalid API Key","type":"invalid_request_error","code":"invalid_api_key"}} - - ' - headers: - CF-RAY: - - 972ca3d43f367f65-MAA - Cache-Control: - - private, max-age=0, no-store, no-cache, must-revalidate - Connection: - - keep-alive - Content-Length: - - '96' - Content-Type: - - application/json - Date: - - Thu, 21 Aug 2025 19:47:02 GMT - Server: - - cloudflare - Set-Cookie: - - __cf_bm=hXwftCtBirv40AIgQlZw7Pmw8QBpOMieuufJckSMMKk-1755805622-1.0.1.1-Iotz19P5h0Xy6UGGpiY4BkZxIhHFupIivhGJjM.NY6mTfDweiU.HNkuiBtpFwBPnK.Vw7LCi8ee4Hj_g625A0fmr2zD.cu7BsxtRK8OBghY; - path=/; expires=Thu, 21-Aug-25 20:17:02 GMT; domain=.groq.com; HttpOnly; Secure; - SameSite=None - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - vary: - - Origin - via: - - 1.1 google - x-groq-region: - - bom - x-request-id: - - req_01k372q86dfzm8a2cg842drysr - status: - code: 401 - message: Unauthorized -- request: - body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello - world"}],"model":"llama3-8b-8192","temperature":null,"tool_choice":"auto","tools":null}' - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - connection: - - keep-alive - content-length: - - '191' - content-type: - - application/json - cookie: - - __cf_bm=hXwftCtBirv40AIgQlZw7Pmw8QBpOMieuufJckSMMKk-1755805622-1.0.1.1-Iotz19P5h0Xy6UGGpiY4BkZxIhHFupIivhGJjM.NY6mTfDweiU.HNkuiBtpFwBPnK.Vw7LCi8ee4Hj_g625A0fmr2zD.cu7BsxtRK8OBghY - host: - - api.groq.com - user-agent: - - Groq/Python 0.31.0 - x-stainless-arch: - - other:amd64 - x-stainless-async: - - 'false' - x-stainless-lang: - - python - x-stainless-os: - - Windows - x-stainless-package-version: - - 0.31.0 - x-stainless-read-timeout: - - '60' - x-stainless-retry-count: - - '0' - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.12.3 - method: POST - uri: https://api.groq.com/openai/v1/chat/completions - response: - body: - string: '{"error":{"message":"Invalid API Key","type":"invalid_request_error","code":"invalid_api_key"}} - - ' - headers: - CF-RAY: - - 972ca3ee095f7f65-MAA - Cache-Control: - - private, max-age=0, no-store, no-cache, must-revalidate - Connection: - - keep-alive - Content-Length: - - '96' - Content-Type: - - application/json - Date: - - Thu, 21 Aug 2025 19:47:06 GMT - Server: - - cloudflare - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - vary: - - Origin - via: - - 1.1 google - x-groq-region: - - bom - x-request-id: - - req_01k372qc75fzrbeehpzj5vzbfe - status: - code: 401 - message: Unauthorized -- request: - body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello - world"}],"model":"llama3-8b-8192","temperature":null,"tool_choice":"auto","tools":null}' - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - connection: - - keep-alive - content-length: - - '191' - content-type: - - application/json - host: - - api.groq.com - user-agent: - - Groq/Python 0.31.0 - x-stainless-arch: - - other:amd64 - x-stainless-async: - - 'false' - x-stainless-lang: - - python - x-stainless-os: - - Windows - x-stainless-package-version: - - 0.31.0 - x-stainless-read-timeout: - - '60' - x-stainless-retry-count: - - '0' - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.12.3 - method: POST - uri: https://api.groq.com/openai/v1/chat/completions - response: - body: - string: !!binary | - H4sIAAAAAAAAA1SSzY7bMAyE730KlZde7ED+t3XptXmGojBkmba1kURHkptsg7x74TTZttfBNyRn - wBvoEQSoRUZlV5Oqth2kGopUllOWlmrAtFNNkY55jrLheduNIyRAwxuq+DQeFNnVYNTkIAHlUUYc - QWRNVbW8qpsuAUsjGhBgjLSySNshbbMu3+mFtMIA4vsNtBvxCoInYDEEOSOIG3gyCAJkCDpE6eLu - IRfR7du/oTHE4oIeP7Nj/BKY0wpZJGYRI3un7cCO4Q/AAlmMi3YzOzIlHVvQrDvCLjoujDy70GbG - h2L06TFlT/cV7gkYmldPQwDhNmMSmLTTYek9ykAOBIRIK9x/JLC97j5vuGEftUUQ/JAXZV1y3hUJ - rJ7sGvtIJ3QBRP6P9IQ5Lzgvsrbdo76a/Wuo/5dfpqypu4pXdQKRojQffNl9KC8053XX5mV5f97b - Dx7laaSLe+UL7yGi7SftZvSr14+2p7Vvqgm7bFBtCQlc+9nTeQ/7+CGP555np6LJ/a+pQR5ic7nW - 16LMeYlubzGg/6nV3gp6EECuH9FKN8L9028AAAD//wMATCz2dIgCAAA= - headers: - CF-RAY: - - 972ca535f855179c-MAA - Cache-Control: - - private, max-age=0, no-store, no-cache, must-revalidate - Connection: - - keep-alive - Content-Encoding: - - gzip - Content-Type: - - application/json - Date: - - Thu, 21 Aug 2025 19:47:59 GMT - Server: - - cloudflare - Set-Cookie: - - __cf_bm=g6mqNsOSygoeFx.9l__cOnheFl1NBZpOZnzqg9x0DvM-1755805679-1.0.1.1-oCwlN_96GVIapxDLMMDgcqCb1GrMBmOoINmTsDSgpdIW5WE_XnMFi9l81EKZ.hK51gTBbjkM4i9leW3iupdPlVB9i2hHaI.DpPTm8ImVDxI; - path=/; expires=Thu, 21-Aug-25 20:17:59 GMT; domain=.groq.com; HttpOnly; Secure; - SameSite=None - Transfer-Encoding: - - chunked - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - vary: - - Origin - via: - - 1.1 google - x-groq-region: - - bom - x-ratelimit-limit-requests: - - '14400' - x-ratelimit-limit-tokens: - - '6000' - x-ratelimit-remaining-requests: - - '14399' - x-ratelimit-remaining-tokens: - - '5980' - x-ratelimit-reset-requests: - - 6s - x-ratelimit-reset-tokens: - - 200ms - x-request-id: - - req_01k372rzf7e0st7wx6x34204en - status: - code: 200 - message: OK -- request: - body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello - world"}],"model":"llama3-8b-8192","temperature":null,"tool_choice":"auto","tools":null}' - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - connection: - - keep-alive - content-length: - - '191' - content-type: - - application/json - host: - - api.groq.com - user-agent: - - Groq/Python 0.31.0 - x-stainless-arch: - - other:amd64 - x-stainless-async: - - 'false' - x-stainless-lang: - - python - x-stainless-os: - - Windows - x-stainless-package-version: - - 0.31.0 - x-stainless-read-timeout: - - '60' - x-stainless-retry-count: - - '0' - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.12.3 - method: POST - uri: https://api.groq.com/openai/v1/chat/completions - response: - body: - string: !!binary | - H4sIAAAAAAAAA1SSvY7bMBCE+zwFb5s00kGiKItkkzZ+hiAQKHJtMeaPTNI+G4bfPdDF9iHt4Bvs - zGBvYA1I0LMq2i+unlrTTS2auhcTq9lONzU3XNQNF8yoTpuJTlBBnP6gLg/ju45+cVhsDFCBTqgK - GpDt0Pe86TltKvDRoAMJzimvuppPNW8FXek5Wo0Z5K8b2GDwAnLFMWe1R5A3SNEhSFA521xUKKsn - hoJhvf4TnYukzJjwjWzL90yC1UhKJB6xkGs8vZFt/geQHD2W2YY92RKtApnRLStCPmyZSYlGXX/A - vQIX90uKUwYZTs5VsLPB5nlMqHIMICGXuMD9dwWnZ8bjCU84FusRZPNOOyGGTcs3FSwp+qWMJR4w - ZJC0+5IecNNQwTkb2FrrueKXof1ffppaRjdNzzYVlFiUe/GMvZQXOlAmGnp/xB2nhOpg4kd41svX - XNCPOxv2mJZkP4fdLePQ71C0k+YMKriM+xSPa9fPd0l4HJv20A30ws8Cmc84L+fr0CsvFF1HzJjO - Vq+jYAIJMYwGvQoG7t/+AgAA//8DAFS5DWlzAgAA - headers: - CF-RAY: - - 972ca8a50fa70bbe-MAA - Cache-Control: - - private, max-age=0, no-store, no-cache, must-revalidate - Connection: - - keep-alive - Content-Encoding: - - gzip - Content-Type: - - application/json - Date: - - Thu, 21 Aug 2025 19:50:20 GMT - Server: - - cloudflare - Set-Cookie: - - __cf_bm=GZHidvEVV2yRyW4J2bHqXH7O9FesahPnGnadyFLFqd0-1755805820-1.0.1.1-LwNiXDNMqp28mDs66RqRtTKQiPp6IM7urJ0WrTY72CJXhuYjgqJUz3W10c1O_4Lzvo_h7Ux2p2V43mC0cZAJMmq1DiR9U7LsRTn.9S0SvTU; - path=/; expires=Thu, 21-Aug-25 20:20:20 GMT; domain=.groq.com; HttpOnly; Secure; - SameSite=None - Transfer-Encoding: - - chunked - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - vary: - - Origin - via: - - 1.1 google - x-groq-region: - - bom - x-ratelimit-limit-requests: - - '14400' - x-ratelimit-limit-tokens: - - '6000' - x-ratelimit-remaining-requests: - - '14399' - x-ratelimit-remaining-tokens: - - '5980' - x-ratelimit-reset-requests: - - 6s - x-ratelimit-reset-tokens: - - 200ms - x-request-id: - - req_01k372x8v9e4msehpvy75am9a2 + - req_01k4f5hjsceg49ppydek66xxnm status: code: 200 message: OK diff --git a/plugins/groq/plugin_test/cassettes/test_chat_predict_batches.yaml b/plugins/groq/plugin_test/cassettes/test_chat_predict_batches.yaml index a48957c953..377c9e61de 100644 --- a/plugins/groq/plugin_test/cassettes/test_chat_predict_batches.yaml +++ b/plugins/groq/plugin_test/cassettes/test_chat_predict_batches.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"messages":[{"role":"user","content":"What''s the capital of France?"}],"model":"llama3-8b-8192","temperature":0.3,"tool_choice":"auto","tools":null}' + body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello"}],"model":"openai/gpt-oss-20b","temperature":null,"tool_choice":"auto","tools":null}' headers: accept: - application/json @@ -9,13 +9,13 @@ interactions: connection: - keep-alive content-length: - - '149' + - '189' content-type: - application/json host: - api.groq.com user-agent: - - Groq/Python 0.31.0 + - Groq/Python 0.31.1 x-stainless-arch: - other:amd64 x-stainless-async: @@ -25,7 +25,7 @@ interactions: x-stainless-os: - Windows x-stainless-package-version: - - 0.31.0 + - 0.31.1 x-stainless-read-timeout: - '60' x-stainless-retry-count: @@ -39,16 +39,17 @@ interactions: response: body: string: !!binary | - H4sIAAAAAAAAA1SRzW6kMBCE7/sUbJ9NBAYPxg+Qcw65RREydgPO+IexPZNkR/PuK6IZVnstfaXq - qr6C0SBALTIrt9pSsQNSHOtSaU7Ltse6HFnVlL1SUh8kp2zqgUAYP1Dlu/FJBbdazCZ4IKAiyowa - RN0xxivWsIaACxotCLBWOtmUfCx53dONXoJRmEC8XcF4jV8gKgIOU5IzgrhCDBZBgEzJpCx93jzB - Z/Rb+uuChZKrydIWYSqeo/QKC5OKFxlN+g03AjbMawxjAuHP1hKYjDdpGSLKFDwISDmscHsncH4k - ns54xiEbhyCqJ9q0vD00HSewxuDWPORwRJ+2fv+kO1xVtK1539HtyMcmu4H/r+4exmjf1pRADlna - HadsV3a061ve8PZ2P3cYI8qjDp/+US99p4xumIyfMa7R/Mw0rUPHJuzrUfEWCHwNcwynrevP8yOe - hqo+Nh2d6maZso5uPqnLn4v8UNO4jZgwXozaRsEIAoIfNDrpNdx+/QUAAP//AwDRlq7RQQIAAA== + H4sIAAAAAAAAA1SSzW7bMBCE730Kds+SS9r65aXX9AGKHppCoMSVxJri0iTVxDD87oWSyEWvg/kW + M4O9gdEgYZhVGhZv834oK9U2x7w/jWNe8LLNm6Ye84qLutd9w0XJIQPqf+OQPsDDQIu3mAw5yGAI + qBJqkKIua1HyuhIZLKTRggTy6JT5MvmUU4z5kfcbMZMZMIL8eQPjNL6C5BksGKOaEOQNAlkECSpG + E5NyaWPIJXRbgie0lj6zJ3phg3LsG5vRenallSXS6voVMgioIjnjJpDwPWJgUV0je35Hn+HAfiCL + M61Ws4DRk9PMkzUJ7fUA9wwsTT5QH0G61doMRuNMnLv3syAhJvJw/5XBuie+rLhil8yCIPmBF1Vd + iLZoM/CBFp+6RGd0EWQj/km7mVecl7wQW8l91wdwbP+Xd+hYNnXT1GUGiZKyD78Q/CHt3pNomlMr + qvtH4K4PqM6aXtxeMF5jwqUbjZsw+GDehh59p8aiL4q6HwfI4LWbAl22tm8vFPDScXEuxnJeVMCp + SOXlfE5lFFyHaZsxYvhjhm0WDNsvuE7jopyG+6e/AAAA//8DAON8xCOHAgAA headers: CF-RAY: - - 972c9d407eb17eeb-MAA + - 97acec21e97d380b-MAA Cache-Control: - private, max-age=0, no-store, no-cache, must-revalidate Connection: @@ -58,12 +59,12 @@ interactions: Content-Type: - application/json Date: - - Thu, 21 Aug 2025 19:42:33 GMT + - Sat, 06 Sep 2025 09:26:01 GMT Server: - cloudflare Set-Cookie: - - __cf_bm=bp9d0lAYiUc8ePrlyGAhn3FmOrm2GiS_.qqEonN9FMQ-1755805353-1.0.1.1-iqtDQYOjm.Hloz4sDE1euFtiJBv3Qw4QZSr1Tt9DP0I.O4RFG1skiO_amL4Sn_VOUTxn70n5FvIeYpr9p6n2IzuFmY78v0AT2weUl9tuH.g; - path=/; expires=Thu, 21-Aug-25 20:12:33 GMT; domain=.groq.com; HttpOnly; Secure; + - __cf_bm=kQ5ckCGWP5WN31b4mSUSpqe.psOWJPVMlEsdVfhpoo0-1757150761-1.0.1.1-gEfCQ64QX3v8RxTCj2iKHtL4BANbCtO0IR4P5XpezI0dXdeLUag7oQoegwVTsfJMUf_a8vQFvGHCrLnBW5YePcuKA57NTVM_pqIYhJB0ig8; + path=/; expires=Sat, 06-Sep-25 09:56:01 GMT; domain=.groq.com; HttpOnly; Secure; SameSite=None Transfer-Encoding: - chunked @@ -78,566 +79,25 @@ interactions: x-groq-region: - bom x-ratelimit-limit-requests: - - '14400' + - '1000' x-ratelimit-limit-tokens: - - '6000' + - '8000' x-ratelimit-remaining-requests: - - '14398' + - '997' x-ratelimit-remaining-tokens: - - '5987' + - '7849' x-ratelimit-reset-requests: - - 10.182s + - 4m18.417999999s x-ratelimit-reset-tokens: - - 130ms + - 1.132499999s x-request-id: - - req_01k372f13hftdrmgqcvzvajcfb - status: - code: 200 - message: OK -- request: - body: '{"messages":[{"role":"user","content":"Summarize the history of Python - in 1 sentence."}],"model":"llama3-8b-8192","temperature":0.3,"tool_choice":"auto","tools":null}' - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - connection: - - keep-alive - content-length: - - '166' - content-type: - - application/json - cookie: - - __cf_bm=bp9d0lAYiUc8ePrlyGAhn3FmOrm2GiS_.qqEonN9FMQ-1755805353-1.0.1.1-iqtDQYOjm.Hloz4sDE1euFtiJBv3Qw4QZSr1Tt9DP0I.O4RFG1skiO_amL4Sn_VOUTxn70n5FvIeYpr9p6n2IzuFmY78v0AT2weUl9tuH.g - host: - - api.groq.com - user-agent: - - Groq/Python 0.31.0 - x-stainless-arch: - - other:amd64 - x-stainless-async: - - 'false' - x-stainless-lang: - - python - x-stainless-os: - - Windows - x-stainless-package-version: - - 0.31.0 - x-stainless-read-timeout: - - '60' - x-stainless-retry-count: - - '0' - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.12.3 - method: POST - uri: https://api.groq.com/openai/v1/chat/completions - response: - body: - string: !!binary | - H4sIAAAAAAAAA1RTS4+bMBC+91eM5mxWPEICnCv1WvVaVWjAA7jxg7VNsukq/70yTbbt0ePvNePx - OyqJHY4LxdGsOhtrbnniKqubRmYHKtpsGOoha445NYeiyKtDhQLd8JPH+CC+jM6smqNyFgWOnimy - xK441XWT11VdCTROssYOtSZDVdYMWVO0ZUIvTo0csPv+jspKfsMuF2g4BJoZu3f0TjN2SCGoEMnG - xHE2sk3uX29xcRauFOBhC8pCXBg0RYaibfIAww2+bEo6uJCFby6EzQgg+LzFcYEUfYvsYfVu9mQM - ewFkJSwUICg7MvDF6cuuHB0QXJVkfcu2wFLAouYl03xhLdI9+9VzSvFUU3YGTXbeaGY4W3e1MDkP - KiZxs2o1qngT4JkkDUrvh+Suyc+cwpnNqngDN4FMLm5lHwRcVVx2kUn5EMGzZgqcei/attgVnJ1d - cn/QDNu410m6Nb1UAl/IK7clFdYypA5GvcnEuvLwL1NAGBXbqCY1Pkam7CxAUiQgS/oWVPiTnPyO - UqT3gWitZrYjv+BdoHbz6t0QsLOb1gInZVVYes8UnMUOQ3Qr3n8I3J6v/7rxxn1UhrHLX8qqbg/N - 8dgKXL0za+yjO7MN2JXl39IDnOdlczieTkVamOd+fhCa8v/yk1Qfy6o5lieB0UXSH/giP3yUPrBt - 3tRV29wfgfvBM52lu9png+EWIpt+UnZOq6H2pZ3W/lRP3BbD2BxQ4Fs/e/eaut2/oufXPi/O1amc - ChnYnP3F3Crjh+l6Xn6lMQb2FzWmsbDHDp3tJRuyEu+ffgMAAP//AwC08gFezwMAAA== - headers: - CF-RAY: - - 972c9d428f887eeb-MAA - Cache-Control: - - private, max-age=0, no-store, no-cache, must-revalidate - Connection: - - keep-alive - Content-Encoding: - - gzip - Content-Type: - - application/json - Date: - - Thu, 21 Aug 2025 19:42:33 GMT - Server: - - cloudflare - Transfer-Encoding: - - chunked - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - vary: - - Origin - via: - - 1.1 google - x-groq-region: - - bom - x-ratelimit-limit-requests: - - '14400' - x-ratelimit-limit-tokens: - - '6000' - x-ratelimit-remaining-requests: - - '14397' - x-ratelimit-remaining-tokens: - - '5966' - x-ratelimit-reset-requests: - - 17.673999999s - x-ratelimit-reset-tokens: - - 336.999999ms - x-request-id: - - req_01k372f1dsemkrvmy3mrbfwkhz - status: - code: 200 - message: OK -- request: - body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello"}],"model":"llama3-8b-8192","temperature":null,"tool_choice":"auto","tools":null}' - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - connection: - - keep-alive - content-length: - - '185' - content-type: - - application/json - host: - - api.groq.com - user-agent: - - Groq/Python 0.31.0 - x-stainless-arch: - - other:amd64 - x-stainless-async: - - 'false' - x-stainless-lang: - - python - x-stainless-os: - - Windows - x-stainless-package-version: - - 0.31.0 - x-stainless-read-timeout: - - '60' - x-stainless-retry-count: - - '0' - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.12.3 - method: POST - uri: https://api.groq.com/openai/v1/chat/completions - response: - body: - string: '{"error":{"message":"Invalid API Key","type":"invalid_request_error","code":"invalid_api_key"}} - - ' - headers: - CF-RAY: - - 972ca3f86ff0c87a-MAA - Cache-Control: - - private, max-age=0, no-store, no-cache, must-revalidate - Connection: - - keep-alive - Content-Length: - - '96' - Content-Type: - - application/json - Date: - - Thu, 21 Aug 2025 19:47:08 GMT - Server: - - cloudflare - Set-Cookie: - - __cf_bm=UhqO2zat1gtMrGieUXdXOpkyLRJXE_oRcFucVsQh1fU-1755805628-1.0.1.1-b0EExmKlKfKc_UL4DLkPy0pw0pK0zrbjS2qNLcu00zrM2j_ZZaQ9KUpHMJg46EZORtNZnfvlT7GfdKLttiNc6pFhd8Lp6Ox35cJk.Z_gX6U; - path=/; expires=Thu, 21-Aug-25 20:17:08 GMT; domain=.groq.com; HttpOnly; Secure; - SameSite=None - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - vary: - - Origin - via: - - 1.1 google - x-groq-region: - - bom - x-request-id: - - req_01k372qdvbevx9dvaw7d9svnh1 - status: - code: 401 - message: Unauthorized -- request: - body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello"}],"model":"llama3-8b-8192","temperature":null,"tool_choice":"auto","tools":null}' - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - connection: - - keep-alive - content-length: - - '185' - content-type: - - application/json - cookie: - - __cf_bm=UhqO2zat1gtMrGieUXdXOpkyLRJXE_oRcFucVsQh1fU-1755805628-1.0.1.1-b0EExmKlKfKc_UL4DLkPy0pw0pK0zrbjS2qNLcu00zrM2j_ZZaQ9KUpHMJg46EZORtNZnfvlT7GfdKLttiNc6pFhd8Lp6Ox35cJk.Z_gX6U - host: - - api.groq.com - user-agent: - - Groq/Python 0.31.0 - x-stainless-arch: - - other:amd64 - x-stainless-async: - - 'false' - x-stainless-lang: - - python - x-stainless-os: - - Windows - x-stainless-package-version: - - 0.31.0 - x-stainless-read-timeout: - - '60' - x-stainless-retry-count: - - '0' - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.12.3 - method: POST - uri: https://api.groq.com/openai/v1/chat/completions - response: - body: - string: '{"error":{"message":"Invalid API Key","type":"invalid_request_error","code":"invalid_api_key"}} - - ' - headers: - CF-RAY: - - 972ca411de64c87a-MAA - Cache-Control: - - private, max-age=0, no-store, no-cache, must-revalidate - Connection: - - keep-alive - Content-Length: - - '96' - Content-Type: - - application/json - Date: - - Thu, 21 Aug 2025 19:47:12 GMT - Server: - - cloudflare - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - vary: - - Origin - via: - - 1.1 google - x-groq-region: - - bom - x-request-id: - - req_01k372qht9fzvvdk3rpe3p6v8e - status: - code: 401 - message: Unauthorized -- request: - body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello"}],"model":"llama3-8b-8192","temperature":null,"tool_choice":"auto","tools":null}' - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - connection: - - keep-alive - content-length: - - '185' - content-type: - - application/json - host: - - api.groq.com - user-agent: - - Groq/Python 0.31.0 - x-stainless-arch: - - other:amd64 - x-stainless-async: - - 'false' - x-stainless-lang: - - python - x-stainless-os: - - Windows - x-stainless-package-version: - - 0.31.0 - x-stainless-read-timeout: - - '60' - x-stainless-retry-count: - - '0' - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.12.3 - method: POST - uri: https://api.groq.com/openai/v1/chat/completions - response: - body: - string: !!binary | - H4sIAAAAAAAAA1SSza6bMBCF930KdzbdQMQ/xptum2eoKmTMAL6xPcQ2N7mK8u4VUdKo26PveOYc - zw30CALUIqOyq0lbxVUr5ZSiKsu0QpxSXnZ1mo8FKqnGThUVJEDDB6r4NB4U2dVg1OQgAeVRRhxB - 5G1d86xueJ6ApRENCDBGWlmmfEh53hU7vZBWGED8voF2I15BZAlYDEHOCOIGngyCABmCDlG6uHvI - RXT79F9oDH1nx/gjMKcVskjMIkb2RduBHQOLC3pkgSzGRbuZHZmSji1o1h1hFx2XhJFnF9rM+JCM - Pj2e2YP9hHsChubV0xBAuM2YBCbtdFh6jzKQAwEh0gr3Pwlsr5XPG27YR20RRHYoyrJqiyxvElg9 - 2TX2kU7oAoiieEtPOMsK3lRVXu8pX6W+Dc3/8suUt01X5CVPIFKU5h9fvZUXWmR13dR1eX/u2w8e - 5Wmki3vlC18hou0n7Wb0q9ePoqe1b+sJu3xQfP//az97Ou9hH+fj8dxn+alsi5DzYRpVV/HPKXbr - tQzVvLcY0H9qtbeCHgSQ60e00o1w//YXAAD//wMAdbmqA4MCAAA= - headers: - CF-RAY: - - 972ca5414f951797-MAA - Cache-Control: - - private, max-age=0, no-store, no-cache, must-revalidate - Connection: - - keep-alive - Content-Encoding: - - gzip - Content-Type: - - application/json - Date: - - Thu, 21 Aug 2025 19:48:01 GMT - Server: - - cloudflare - Set-Cookie: - - __cf_bm=dt3v_TL7suT9_wad2MRuzsOJIHs1Dv9InJ.ld9U3zyk-1755805681-1.0.1.1-Wrr.b2Of59oEZ.U.aWZNiW1TuLjb5xPCmeKQyAUZjTJHj80jSPxRnthIFwJk3yf6fXfwJqcvmeweEe4A3OI5Tmc_cfYRQ9oB5WONUSDftLY; - path=/; expires=Thu, 21-Aug-25 20:18:01 GMT; domain=.groq.com; HttpOnly; Secure; - SameSite=None - Transfer-Encoding: - - chunked - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - vary: - - Origin - via: - - 1.1 google - x-groq-region: - - bom - x-ratelimit-limit-requests: - - '14400' - x-ratelimit-limit-tokens: - - '6000' - x-ratelimit-remaining-requests: - - '14398' - x-ratelimit-remaining-tokens: - - '5981' - x-ratelimit-reset-requests: - - 10.172999999s - x-ratelimit-reset-tokens: - - 190ms - x-request-id: - - req_01k372s18bfdc948vft9px3s4g - status: - code: 200 - message: OK -- request: - body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Summarize - AI history in 2 sentences"}],"model":"llama3-8b-8192","temperature":null,"tool_choice":"auto","tools":null}' - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - connection: - - keep-alive - content-length: - - '215' - content-type: - - application/json - cookie: - - __cf_bm=dt3v_TL7suT9_wad2MRuzsOJIHs1Dv9InJ.ld9U3zyk-1755805681-1.0.1.1-Wrr.b2Of59oEZ.U.aWZNiW1TuLjb5xPCmeKQyAUZjTJHj80jSPxRnthIFwJk3yf6fXfwJqcvmeweEe4A3OI5Tmc_cfYRQ9oB5WONUSDftLY - host: - - api.groq.com - user-agent: - - Groq/Python 0.31.0 - x-stainless-arch: - - other:amd64 - x-stainless-async: - - 'false' - x-stainless-lang: - - python - x-stainless-os: - - Windows - x-stainless-package-version: - - 0.31.0 - x-stainless-read-timeout: - - '60' - x-stainless-retry-count: - - '0' - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.12.3 - method: POST - uri: https://api.groq.com/openai/v1/chat/completions - response: - body: - string: !!binary | - H4sIAAAAAAAAA3xUTY/jNgy991cQPG0BZ2DH8fjjNthDOwV66t66RSBLtM2NLHkoOZtgMP+9kCeZ - 3V569BMf3+MT5Vdkgx3qSUU9L3ZXV9Whqst2V9Sadgc9mF1bmX7X76vDvqSq0QNhhr7/RjreiA/a - z4ulyN5hhlpIRTLYFXVVNXn12BQZzt6QxQ6tVbMqd02/a4p2n6onz5oCdn+/IjtDF+zyDGcKQY2E - 3SuKt4QdqhA4ROVi4ngXySX130kIOICC/S5QQjVBWOdZyRX8AE/PMHGIXq7dV/fVfZkItHealrid - SuSBNSsLzy6StTxuDT49Pf8KRkUK0Ct9guhBOc3kIvwmRJoy6NcIcSJIc4m7i9wkexqVA3ZbRdFW - eYDvHKft09CZrF/m1MwPGzSwhJh4i/hR1BxAOQPKjl44TnOA/gop4TWSQNh8cIgBLJ8Inqxy8GUV - duNG+8NPDv7Un5XE6foAf3EaKE7ksi0MFVIAkd1KJs1FZ2/PqUD8Ok43w03+bqFo2/+xTpeFJEK4 - hkg3z7PSEzsCS0ocuzHb0CS6FXNK14ACobDKe9bsQEinlldS8pOaMuebkCFaPlpuHdP5It7yQKLS - 2t2CV8tiWW9IAKXFhwBnJezXAOzMGqIwhQd8y9D6cRHfB+zcam2GAzsO01FIBe+wwxD9gm//ZLje - F/FlpZWOkWfCLn/Yl1VZt01+yHARPy/xGP2JXMCuzH9At+I8L+uiafePaXfvT+WDUBTlf/E7q66L - um6TRPRR2R+EQ/kB3WubvGkfm/LtZvjYC6mT8d/dfcD3ezoO7EaSRXh7P8NyrKuB2qLXzQEzvBxH - 8S9p2u2vIPRyzItTWe9D8a0ZjG7nQV3OL268nKKkGAPJmXWKhQQ79O5oaFbO4Nsv/wIAAP//AwCX - xsFfWgQAAA== - headers: - CF-RAY: - - 972ca543686e1797-MAA - Cache-Control: - - private, max-age=0, no-store, no-cache, must-revalidate - Connection: - - keep-alive - Content-Encoding: - - gzip - Content-Type: - - application/json - Date: - - Thu, 21 Aug 2025 19:48:01 GMT - Server: - - cloudflare - Transfer-Encoding: - - chunked - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - vary: - - Origin - via: - - 1.1 google - x-groq-region: - - bom - x-ratelimit-limit-requests: - - '14400' - x-ratelimit-limit-tokens: - - '6000' - x-ratelimit-remaining-requests: - - '14397' - x-ratelimit-remaining-tokens: - - '5932' - x-ratelimit-reset-requests: - - 17.683s - x-ratelimit-reset-tokens: - - 678.999999ms - x-request-id: - - req_01k372s1j8fdc9mfaxvqngxktr - status: - code: 200 - message: OK -- request: - body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello"}],"model":"llama3-8b-8192","temperature":null,"tool_choice":"auto","tools":null}' - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - connection: - - keep-alive - content-length: - - '185' - content-type: - - application/json - host: - - api.groq.com - user-agent: - - Groq/Python 0.31.0 - x-stainless-arch: - - other:amd64 - x-stainless-async: - - 'false' - x-stainless-lang: - - python - x-stainless-os: - - Windows - x-stainless-package-version: - - 0.31.0 - x-stainless-read-timeout: - - '60' - x-stainless-retry-count: - - '0' - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.12.3 - method: POST - uri: https://api.groq.com/openai/v1/chat/completions - response: - body: - string: !!binary | - H4sIAAAAAAAAA1SSwY7iMBBEf8XbFy4JSpyEOLnsdfmG1Spy7IZ4cNzGdgYQ4t9XYQdGey29qu5y - +w5GQw9qkknN3uZa8KYuWp23He/yWnQ6F2NV56gPja5arjohIAMaP1ClL+NW0ewtJkMOMlABZUIN - fdk2jSgawcsMZtJooQdr5SyrXIy5KDu+0hMZhRH633cwTuMV+iKDGWOUR4T+DoEsQg8yRhOTdGn1 - kEvo1um/0Fr6wfZpE5kzClkiNiMmdqNly/aRpQkDskgzpsm4I9szJR2b0PoVYReTJkaBXWix+qlY - c3qmrL1+sv1mZs+EROzfBt826W7svGBca8c1JJE3Kq7ARr9ztIlqiXELjwwsHX2gMULvFmszOBhn - 4jQElJEc9BATeXj8yWB5lT8vuOCQzIzQF1tetVxUu7LKwAeafRoSndBF6Dn/lr7gouBd1fKqXd/r - dZ63oeb/yy8TF7uirNcJiZK0b35Xv5UXWpVNJXbN42vdYQwoT5ou7lUv3mLCeTgYd8Tgg3le7OCH - tjlgV45K1JDBdTgGOq9dn/8w4HkoylPV8qt0F6z9Z6N3h3L04eI+5V+BArE4tagsMxkUKKlFSlZK - +XnxKam5iXkpSrVcAAAAAP//AwCrTZh6zAIAAA== - headers: - CF-RAY: - - 972ca8b0eb05380b-MAA - Cache-Control: - - private, max-age=0, no-store, no-cache, must-revalidate - Connection: - - keep-alive - Content-Encoding: - - gzip - Content-Type: - - application/json - Date: - - Thu, 21 Aug 2025 19:50:21 GMT - Server: - - cloudflare - Set-Cookie: - - __cf_bm=bG4dH3WwFIyJLRlIKR40Rvq1IDUDC46YvFEZk9tgEE8-1755805821-1.0.1.1-YrFvcrKET2GhwzbERNaUsb60Os97Y2WYflbIhT1YbXHiX_BfR53k3ST_kgSW0ADjpArmQhzu94Xpeu9CIchMHsDHvx5bTDi7GnS.EyX1Wq4; - path=/; expires=Thu, 21-Aug-25 20:20:21 GMT; domain=.groq.com; HttpOnly; Secure; - SameSite=None - Transfer-Encoding: - - chunked - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - vary: - - Origin - via: - - 1.1 google - x-groq-region: - - bom - x-ratelimit-limit-requests: - - '14400' - x-ratelimit-limit-tokens: - - '6000' - x-ratelimit-remaining-requests: - - '14397' - x-ratelimit-remaining-tokens: - - '5979' - x-ratelimit-reset-requests: - - 17.056s - x-ratelimit-reset-tokens: - - 206.999999ms - x-request-id: - - req_01k372xanwe4pv5d6f1bprwnva + - req_01k4f5hmareg4t5qkkt5s10drg status: code: 200 message: OK - request: body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Summarize - AI history in 2 sentences"}],"model":"llama3-8b-8192","temperature":null,"tool_choice":"auto","tools":null}' + AI history in 2 sentences"}],"model":"openai/gpt-oss-20b","temperature":null,"tool_choice":"auto","tools":null}' headers: accept: - application/json @@ -646,15 +106,15 @@ interactions: connection: - keep-alive content-length: - - '215' + - '219' content-type: - application/json cookie: - - __cf_bm=bG4dH3WwFIyJLRlIKR40Rvq1IDUDC46YvFEZk9tgEE8-1755805821-1.0.1.1-YrFvcrKET2GhwzbERNaUsb60Os97Y2WYflbIhT1YbXHiX_BfR53k3ST_kgSW0ADjpArmQhzu94Xpeu9CIchMHsDHvx5bTDi7GnS.EyX1Wq4 + - __cf_bm=kQ5ckCGWP5WN31b4mSUSpqe.psOWJPVMlEsdVfhpoo0-1757150761-1.0.1.1-gEfCQ64QX3v8RxTCj2iKHtL4BANbCtO0IR4P5XpezI0dXdeLUag7oQoegwVTsfJMUf_a8vQFvGHCrLnBW5YePcuKA57NTVM_pqIYhJB0ig8 host: - api.groq.com user-agent: - - Groq/Python 0.31.0 + - Groq/Python 0.31.1 x-stainless-arch: - other:amd64 x-stainless-async: @@ -664,7 +124,7 @@ interactions: x-stainless-os: - Windows x-stainless-package-version: - - 0.31.0 + - 0.31.1 x-stainless-read-timeout: - '60' x-stainless-retry-count: @@ -678,22 +138,24 @@ interactions: response: body: string: !!binary | - H4sIAAAAAAAAA3RUTW/kNgy991cQPLWAHXg89nz4FvTSLJDT9tYUA9qibe3IlCPRk5kG+e+FJpnN - 7mGPfnpP5Huk/IrWYIPdSNpNs8urfVFSUe5zU/ZVXlFR5LRvOe83u36zM2W9qQvM0LffuNMP4V3n - p9mxWi+YYReYlA02q21d74p6V5YZTt6wwwado4nW+a7Nd6t9mdijtx1HbP55RSuGz9gUGU4cIw2M - zSsG7xgbpBhtVBJNGi/Kkqr/xYHBRiBog+Ue4jJNFC7ge7h/gNFG9eECVqCEyEnUcWye5Enug9re - dpYcPIiyc3ZIh/D7/cMf0PJAAupB6cgQR5o53aEjw2RNXhY6QseiS7jAi9XxemL4xM7PE4um8s4P - tiMHgSl6sTIAiYE5+NbxlEfvTlfMDT5YHacI7QXuHQn8vQQrQwaPFE5W4NFKPF6yq/qLHwUeuz8p - 6JigycsAXkcOMftsRDlM8IS/cPiE0HIq3XkrbJKv1b7e3MFXm/zryJJds6MIfPLuxAZ0DH4ZRjhR - sH6JEJUGjhlY6dxi0mVhcZy3FNlAvETlKWbA55mDfn5P1I1WGBxTkKvF5Mkwzz9AVxfRDpJ6J1Eg - cyLpOMUaU7OBU/JguCPDEUywJ5YU3gfxSkr7uCgHGCmYFwqcgSElSOtAA79XfidR2lpyMPsXDnf4 - lqHzQxpTxEYW5zLsrdg4Ht4HiQ1G9TO+/ZvhclvR54UXPqidGJvirlxvdlVZFnWGc/DTrAf1R5aI - zbr4hD7IRbHe1sW6qtNW3x7Rd8FqtfkZv6m2+3K/LVdVhuqV3Keg2nyHbtzduqi2db1/++j40Aam - o/EvcnP4PqJDb2XgMAd7fVr9fNjWPe9XbberMMPzYQj+Odm9/jACPx+K1XG9Lc/034WrWYlirC/f - xrMW55Rj5HCyXcqFAzbo5WB4IjH49tv/AAAA//8DAGlMCBh1BAAA + H4sIAAAAAAAAA2RUy27rNhDd9ysGs6ZdSbYsW7usLoJuAtx01VsYFDmS2FAkQ1JXcYIA/oUsC7Q/ + 5y8pKD/S2+6E0ZyZc87M8A2VxBpFz6MYnF5sebMhnreLbVZsFmvZNIum4dmCS5FzucqrQmyRoW3+ + IBEvwKWwg9MUlTXIUHjikSTWeVVWeZlVm5zhYCVprNE6Mlz93Lm4sCEsiqxJiN4qQQHr395QGUkv + WGcMBwqBd4T1G3qrCWvkIagQuYkJY00kkxjc+ahaJRTXoEwkrVVHRhA01HEDk4o9EPf6AOEwNFYr + Adw5b7noKQA3EmJP8Dh6ZTqIFCIoM4cGJU/HjyKLPQgycfQHBpq4nPMs0IsjHyEcQqThs1CcLJyO + f93dw5TY+HA6/g22nf/luyo7Z+a7bRYYTL3SBJ4CcS/61NjQ6LkGQ3Gy/umcPHDRK0OpuTepe9B2 + 0gfouDIkIXoukvVLuD8TL7I8FW888afYezt2fUi1JZG7FWHw5eFX4EKQJs8Tns3NNPcdnY4fQXBN + oLnpRt4RzPMLEEbRAw/w5eHxdPxYzYjz9xqct460Jgl392kSFiYlKThPXIKbSQquk/laibnjWZ4n + QxNJsC6qQYUBeGPHOCtpFWl5Ov4ZoB3j6GmJDD3xYJMCrPGxJxgD+Rq+4ddxGLhXr5Ta9ypE6w9J + dQGB0qoICt9wCV97O+rEx8pREAhrhAoEYUYf0qR+hKd53gos4ZfkoYpX3K3eQCYpumza3T27bBT7 + 3LoU/FwL9q9RB/b/2Twu4cHb70rSfyjgO0NtO+dtE7A2o9YMW2VU6Pdna7DGEK3D998ZjtcLeh5p + pH1UA2GdLbP1pizW2S5n6LwdXNxH+0QmYL3dfYauydmmWpVltktHd73zGyDflD/GL6i8zMpdtctz + htFGrm+AolzfQrfcarVarYv3C+H9vLrSTuYq8Hxl+1aZjrzzaj781u3LXVtVLZFskeHLvvP2Oamd + nzRPz/ssf1q3ZT+0PXXrWE7t1rUuvr5Gk2wM5L8rkWwhn94ms5c0cCPx/ad/AAAA//8DACpx+A0X + BQAA headers: CF-RAY: - - 972ca8b2fdef380b-MAA + - 97acec22eb9d380b-MAA Cache-Control: - private, max-age=0, no-store, no-cache, must-revalidate Connection: @@ -703,7 +165,7 @@ interactions: Content-Type: - application/json Date: - - Thu, 21 Aug 2025 19:50:22 GMT + - Sat, 06 Sep 2025 09:26:01 GMT Server: - cloudflare Transfer-Encoding: @@ -719,19 +181,19 @@ interactions: x-groq-region: - bom x-ratelimit-limit-requests: - - '14400' + - '1000' x-ratelimit-limit-tokens: - - '6000' + - '8000' x-ratelimit-remaining-requests: - - '14396' + - '996' x-ratelimit-remaining-tokens: - - '5915' + - '7750' x-ratelimit-reset-requests: - - 23.677999999s + - 5m45.446999999s x-ratelimit-reset-tokens: - - 846.999999ms + - 1.868499999s x-request-id: - - req_01k372xazye4ptaass5yjhxt0x + - req_01k4f5hmfheg4t5wf8pfptzztn status: code: 200 message: OK diff --git a/plugins/groq/plugin_test/cassettes/test_chat_predict_with_context.yaml b/plugins/groq/plugin_test/cassettes/test_chat_predict_with_context.yaml index 522840ba6e..1d3b3319ac 100644 --- a/plugins/groq/plugin_test/cassettes/test_chat_predict_with_context.yaml +++ b/plugins/groq/plugin_test/cassettes/test_chat_predict_with_context.yaml @@ -1,7 +1,7 @@ interactions: - request: body: '{"messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Tell - me about"}],"model":"llama3-8b-8192","temperature":null,"tool_choice":"auto","tools":null}' + me about"}],"model":"openai/gpt-oss-20b","temperature":null,"tool_choice":"auto","tools":null}' headers: accept: - application/json @@ -10,13 +10,13 @@ interactions: connection: - keep-alive content-length: - - '193' + - '197' content-type: - application/json host: - api.groq.com user-agent: - - Groq/Python 0.31.0 + - Groq/Python 0.31.1 x-stainless-arch: - other:amd64 x-stainless-async: @@ -26,7 +26,7 @@ interactions: x-stainless-os: - Windows x-stainless-package-version: - - 0.31.0 + - 0.31.1 x-stainless-read-timeout: - '60' x-stainless-retry-count: @@ -40,18 +40,20 @@ interactions: response: body: string: !!binary | - H4sIAAAAAAAAA1ySzW7bMBCEX2WzF18kQz+m9XPpIbnkEYqiEChpLbGmuDRJJTEMv3tBx3aBXgfz - LWdneUE1YovDLMOwWJ0emn7Ii7FOh0rs0t2+EGkvKUv3Td4U1SArqipMkPs/NIQ7uB14sZqCYoMJ - Do5koBHbvBKizkRdZAkuPJLGFrWWiyzTuk/rvCmie2Y1kMf21wWVGekL22gn7+VE2F7QsSZsUXqv - fJAmRIZNIBNf/8nr5oPAB+kCjRBIa2UmWAg8LxRmZaYE+jWACqCZjx60OhKceYVFTXOAWd5wtpbG - F3hjswnwyc6dE3jfLDCTIwgMM2m7hVdpbqjVJD3BQRnl56g48BQjDQTsQPojSDit5GMjP+B9M4Lm - j9ug7zUi84LXBDVP1nHvsTWr1gl+j+wcSc8GW4zJ8Po7wfVRx2mllbqgFsI22xalKJq8FCJB63ix - oQt8JOOxLXb/pLs5y4qmFnktYoOPgz2B3X/yAyozUZVVhAIHqZ/+ffNUntZSiLqprve4Xe9IHkf+ - NI/1/NkHWrqDMhM569TthgfbVeJATd4P9Q4T/Oomx6e46+1nOjp12V8ZZhubG1VYFiWlpVeVFJoa - ZmSZlidnVJongwKxOLWoLDMZFCipRUpWSvl58SmpuYl5KUq1XAAAAAD//wMA/d7bYt4CAAA= + H4sIAAAAAAAAA1STQW/bMAyF7/sVHC+9OJmd2LHjyw4DBgzYscMO62DIMh2rlkVFkpd6Rf77oDRJ + sSv1PuLxkXpF1WGNchBBTlav+rYoqGv7VZZVYpWnebpqN22+2lWbsi2olVXeY4LcPpMMV3AtebKa + gmKDCUpHIlCHdVYWZVak5S5NcOKONNbIloxQnw42rNj71SZtIzGwkuSx/vWKynT0gnVEyHtxIKxf + 0bEmrFF4r3wQJkSGTSATHXzhWXew8AyaAkwEo+ETnAYRYvGhA61GgsCgSTgDouU5fIavRBp6R5cX + b0mqfgEBga2SCVhynk0Cko0kGxJgB8IsYVDmAKQ9XVo7Ajk7xbN/6/oRE3QkPBtlDljjD08OvFg8 + POEjaR3NXYRPuIZv4cGDMtfoaA3f1Uh6gTDQAidhAkzsCJTpGdo5gOFw9amoW8NPAkPURffCjyC1 + cKpfor3jTD6uYg2PA8E9M/DDJShH3rLpIhXVPbsrrKS4YHhOUPPBOm491mbWOsFeGeWH5m04rNEH + tnj+neB8W9FxppmaoCbCOl2neZmXWbpP0DqebGgCj2Q81tX2vXTTpkW+32abuNPbGd315e7/8o3Z + lVVRlWWRYOAg9F2fFft76aYtt9siq/bF+Wq3aR2JseOTuY3nFx9oanplDuSsU5e76m0j+rzN87Lt + JSb40hwcH+Oslx/j6Nik2Zj3xTA+7/q/fp8+V9ae5Bi6l20M0ZP7o2QMhVw8fdN0NAnT4fnDPwAA + AP//AwAp8CaWdgMAAA== headers: CF-RAY: - - 972ca8aaf922a905-MAA + - 97acec1cfb85ff18-MAA Cache-Control: - private, max-age=0, no-store, no-cache, must-revalidate Connection: @@ -61,12 +63,12 @@ interactions: Content-Type: - application/json Date: - - Thu, 21 Aug 2025 19:50:20 GMT + - Sat, 06 Sep 2025 09:26:00 GMT Server: - cloudflare Set-Cookie: - - __cf_bm=sRBa71c38cTZwKBymCnl5Xdsxcx6E.YGXn9zCYD_xDE-1755805820-1.0.1.1-KhUJ0hVLP9u6_C7PvvTIq37rxZAPFxoDSe2e8fibrdhVYkDbD5U79i_WFvRW44_O0MXInOnfI.5i7BfdHigsE3riT9LTgjm0ap15p7sQAPY; - path=/; expires=Thu, 21-Aug-25 20:20:20 GMT; domain=.groq.com; HttpOnly; Secure; + - __cf_bm=n0HkzDzOAP36bAIDruAQxVFVV.oGYFmIDkwVuPia2Y4-1757150760-1.0.1.1-SIrVHe5Io5mFBAYIhGzx7YZ4SpYUkMOEt0PvXicxKRsLZDnuq.e_kmKjDCRBXy1e.HgCUKTeLOenbZ.FwGzTlsmvyBZLxctCwRtXPIx29is; + path=/; expires=Sat, 06-Sep-25 09:56:00 GMT; domain=.groq.com; HttpOnly; Secure; SameSite=None Transfer-Encoding: - chunked @@ -81,19 +83,19 @@ interactions: x-groq-region: - bom x-ratelimit-limit-requests: - - '14400' + - '1000' x-ratelimit-limit-tokens: - - '6000' + - '8000' x-ratelimit-remaining-requests: - - '14398' + - '998' x-ratelimit-remaining-tokens: - - '5979' + - '7902' x-ratelimit-reset-requests: - - 11.070999999s + - 2m52.01s x-ratelimit-reset-tokens: - - 210ms + - 730.499999ms x-request-id: - - req_01k372x9rbfgztq51hj5wchy7c + - req_01k4f5hkj6fzs90j8ppwcktdx3 status: code: 200 message: OK diff --git a/plugins/groq/plugin_test/test_model_groq.py b/plugins/groq/plugin_test/test_model_groq.py index 884975a251..e74dfd1b01 100644 --- a/plugins/groq/plugin_test/test_model_groq.py +++ b/plugins/groq/plugin_test/test_model_groq.py @@ -17,12 +17,11 @@ @vcr.use_cassette( f"{CASSETTE_DIR}/test_chat_predict.yaml", filter_headers=["authorization"], - record_mode="all", ) def test_chat_predict(): """Test that GroqChatCompletions predicts a single string response.""" model = GroqChatCompletions( - identifier="llama3-8b-8192", system_message="You are a helpful assistant." + identifier="llama-3.1-8b-instant", system_message="You are a helpful assistant." ) resp = model.predict("Hello world") assert isinstance(resp, str) @@ -31,12 +30,11 @@ def test_chat_predict(): @vcr.use_cassette( f"{CASSETTE_DIR}/test_chat_predict_with_context.yaml", filter_headers=["authorization"], - record_mode="all", ) def test_chat_predict_with_context(): """Test that GroqChatCompletions predicts a single string response with context.""" model = GroqChatCompletions( - identifier="llama3-8b-8192", system_message="You are a helpful assistant." + identifier="llama-3.1-8b-instant", system_message="You are a helpful assistant." ) resp = model.predict("Tell me about", context=["AI"]) assert isinstance(resp, str) @@ -45,12 +43,11 @@ def test_chat_predict_with_context(): @vcr.use_cassette( f"{CASSETTE_DIR}/test_chat_predict_batches.yaml", filter_headers=["authorization"], - record_mode="all", ) def test_chat_predict_batches(): """Test that GroqChatCompletions predicts a batch of responses.""" model = GroqChatCompletions( - identifier="llama3-8b-8192", system_message="You are a helpful assistant." + identifier="llama-3.1-8b-instant", system_message="You are a helpful assistant." ) dataset = ["Hello", "Summarize AI history in 2 sentences"] resp = model.predict_batches(dataset)