From c5c53973845a807818197730ef864e4bef870af4 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Mon, 4 Aug 2025 12:43:54 +0000 Subject: [PATCH 1/8] SDK regeneration --- poetry.lock | 144 +++++++++--------- pyproject.toml | 2 +- src/cohere/__init__.py | 4 + src/cohere/base_client.py | 32 ++++ src/cohere/core/client_wrapper.py | 4 +- src/cohere/finetuning/client.py | 38 +++++ src/cohere/finetuning/raw_client.py | 38 +++++ src/cohere/raw_base_client.py | 32 ++++ src/cohere/types/__init__.py | 4 + ...assistant_message_response_content_item.py | 13 +- ...ntent_start_event_delta_message_content.py | 3 +- ..._start_event_delta_message_content_type.py | 5 + .../types/chat_message_end_event_delta.py | 5 + src/cohere/types/citation.py | 5 + src/cohere/types/citation_type.py | 2 +- src/cohere/v2/client.py | 32 ++++ src/cohere/v2/raw_client.py | 32 ++++ 17 files changed, 316 insertions(+), 79 deletions(-) create mode 100644 src/cohere/types/chat_content_start_event_delta_message_content_type.py diff --git a/poetry.lock b/poetry.lock index 4a5f8c638..42e292616 100644 --- a/poetry.lock +++ b/poetry.lock @@ -13,13 +13,13 @@ files = [ [[package]] name = "anyio" -version = "4.9.0" -description = "High level compatibility layer for multiple asynchronous event loop implementations" +version = "4.10.0" +description = "High-level concurrency and networking framework on top of asyncio or Trio" optional = false python-versions = ">=3.9" files = [ - {file = "anyio-4.9.0-py3-none-any.whl", hash = "sha256:9f76d541cad6e36af7beb62e978876f3b41e3e04f2c1fbf0884604c0a9c4d93c"}, - {file = "anyio-4.9.0.tar.gz", hash = "sha256:673c0c244e15788651a4ff38710fea9675823028a6f08a5eda409e0c9840a028"}, + {file = "anyio-4.10.0-py3-none-any.whl", hash = "sha256:60e474ac86736bbfd6f210f7a61218939c318f43f9972497381f1c5e930ed3d1"}, + {file = "anyio-4.10.0.tar.gz", hash = "sha256:3f3fae35c96039744587aa5b8371e7e8e603c0702999535961dd336026973ba6"}, ] [package.dependencies] @@ -29,19 +29,17 @@ sniffio = ">=1.1" typing_extensions = {version = ">=4.5", markers = "python_version < \"3.13\""} [package.extras] -doc = ["Sphinx (>=8.2,<9.0)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx_rtd_theme"] -test = ["anyio[trio]", "blockbuster (>=1.5.23)", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "trustme", "truststore (>=0.9.1)", "uvloop (>=0.21)"] trio = ["trio (>=0.26.1)"] [[package]] name = "certifi" -version = "2025.7.9" +version = "2025.8.3" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.7" files = [ - {file = "certifi-2025.7.9-py3-none-any.whl", hash = "sha256:d842783a14f8fdd646895ac26f719a061408834473cfc10203f6a575beb15d39"}, - {file = "certifi-2025.7.9.tar.gz", hash = "sha256:c1d2ec05395148ee10cf672ffc28cd37ea0ab0d99f9cc74c43e588cbd111b079"}, + {file = "certifi-2025.8.3-py3-none-any.whl", hash = "sha256:f6c12493cfb1b06ba2ff328595af9350c65d6644968e5d3a2ffd78699af217a5"}, + {file = "certifi-2025.8.3.tar.gz", hash = "sha256:e564105f78ded564e3ae7c923924435e1daa7463faeab5bb932bc53ffae63407"}, ] [[package]] @@ -175,47 +173,47 @@ test = ["pytest (>=6)"] [[package]] name = "fastavro" -version = "1.11.1" +version = "1.12.0" description = "Fast read/write of AVRO files" optional = false python-versions = ">=3.9" files = [ - {file = "fastavro-1.11.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:603aa1c1d1be21fb4bcb63e1efb0711a9ddb337de81391c32dac95c6e0dacfcc"}, - {file = "fastavro-1.11.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:45653b312d4ce297e2bd802ea3ffd17ecbe718e5e8b6e2ae04cd72cb50bb99d5"}, - {file = "fastavro-1.11.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:998a53fc552e6bee9acda32af258f02557313c85fb5b48becba5b71ec82f421e"}, - {file = "fastavro-1.11.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:9f878c9ad819467120cb066f1c73496c42eb24ecdd7c992ec996f465ef4cedad"}, - {file = "fastavro-1.11.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:da9e4c231ac4951092c2230ca423d8a3f2966718f072ac1e2c5d2d44c70b2a50"}, - {file = "fastavro-1.11.1-cp310-cp310-win_amd64.whl", hash = "sha256:7423bfad3199567eeee7ad6816402c7c0ee1658b959e8c10540cfbc60ce96c2a"}, - {file = "fastavro-1.11.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:3573340e4564e8962e22f814ac937ffe0d4be5eabbd2250f77738dc47e3c8fe9"}, - {file = "fastavro-1.11.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7291cf47735b8bd6ff5d9b33120e6e0974f52fd5dff90cd24151b22018e7fd29"}, - {file = "fastavro-1.11.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bf3bb065d657d5bac8b2cb39945194aa086a9b3354f2da7f89c30e4dc20e08e2"}, - {file = "fastavro-1.11.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8758317c85296b848698132efb13bc44a4fbd6017431cc0f26eaeb0d6fa13d35"}, - {file = "fastavro-1.11.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:ad99d57228f83bf3e2214d183fbf6e2fda97fd649b2bdaf8e9110c36cbb02624"}, - {file = "fastavro-1.11.1-cp311-cp311-win_amd64.whl", hash = "sha256:9134090178bdbf9eefd467717ced3dc151e27a7e7bfc728260ce512697efe5a4"}, - {file = "fastavro-1.11.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:e8bc238f2637cd5d15238adbe8fb8c58d2e6f1870e0fb28d89508584670bae4b"}, - {file = "fastavro-1.11.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b403933081c83fc4d8a012ee64b86e560a024b1280e3711ee74f2abc904886e8"}, - {file = "fastavro-1.11.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3f6ecb4b5f77aa756d973b7dd1c2fb4e4c95b4832a3c98b059aa96c61870c709"}, - {file = "fastavro-1.11.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:059893df63ef823b0231b485c9d43016c7e32850cae7bf69f4e9d46dd41c28f2"}, - {file = "fastavro-1.11.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:5120ffc9a200699218e01777e695a2f08afb3547ba818184198c757dc39417bd"}, - {file = "fastavro-1.11.1-cp312-cp312-win_amd64.whl", hash = "sha256:7bb9d0d2233f33a52908b6ea9b376fe0baf1144bdfdfb3c6ad326e200a8b56b0"}, - {file = "fastavro-1.11.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:f963b8ddaf179660e814ab420850c1b4ea33e2ad2de8011549d958b21f77f20a"}, - {file = "fastavro-1.11.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0253e5b6a3c9b62fae9fc3abd8184c5b64a833322b6af7d666d3db266ad879b5"}, - {file = "fastavro-1.11.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ca637b150e1f4c0e8e564fad40a16bd922bcb7ffd1a6e4836e6084f2c4f4e8db"}, - {file = "fastavro-1.11.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:76af1709031621828ca6ce7f027f7711fa33ac23e8269e7a5733996ff8d318da"}, - {file = "fastavro-1.11.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:8224e6d8d9864d4e55dafbe88920d6a1b8c19cc3006acfac6aa4f494a6af3450"}, - {file = "fastavro-1.11.1-cp313-cp313-win_amd64.whl", hash = "sha256:cde7ed91b52ff21f0f9f157329760ba7251508ca3e9618af3ffdac986d9faaa2"}, - {file = "fastavro-1.11.1-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:e5ed1325c1c414dd954e7a2c5074daefe1eceb672b8c727aa030ba327aa00693"}, - {file = "fastavro-1.11.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8cd3c95baeec37188899824faf44a5ee94dfc4d8667b05b2f867070c7eb174c4"}, - {file = "fastavro-1.11.1-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2e0babcd81acceb4c60110af9efa25d890dbb68f7de880f806dadeb1e70fe413"}, - {file = "fastavro-1.11.1-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:b2c0cb8063c7208b53b6867983dc6ae7cc80b91116b51d435d2610a5db2fc52f"}, - {file = "fastavro-1.11.1-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:1bc2824e9969c04ab6263d269a1e0e5d40b9bd16ade6b70c29d6ffbc4f3cc102"}, - {file = "fastavro-1.11.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:8b579bab31ff87fcb5ef9f6f13baaf99f189b92ed287af60348777583628c327"}, - {file = "fastavro-1.11.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5c646f07c7827fea7425b6936a27f67f356a2a80ac19e6100ed6d3bb0610cc3d"}, - {file = "fastavro-1.11.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2915324e1edb0e06f0be0c18279c60f4cff49f6fe01626594707eb75cd9952fc"}, - {file = "fastavro-1.11.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:8fd87ee1e9101b45172fb3cff21b56ce08270d9474eec1d436393677daa95938"}, - {file = "fastavro-1.11.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:88876568ef387996fbfc6b193a5b9830de3c0497af7d07e5c839a70b86bb47e7"}, - {file = "fastavro-1.11.1-cp39-cp39-win_amd64.whl", hash = "sha256:cebb7433b860d9b13090d0e53f6db075e4e2042aeb2c577f515e73d2b9c98075"}, - {file = "fastavro-1.11.1.tar.gz", hash = "sha256:bf6acde5ee633a29fb8dfd6dfea13b164722bc3adc05a0e055df080549c1c2f8"}, + {file = "fastavro-1.12.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:e38497bd24136aad2c47376ee958be4f5b775d6f03c11893fc636eea8c1c3b40"}, + {file = "fastavro-1.12.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e8d8401b021f4b3dfc05e6f82365f14de8d170a041fbe3345f992c9c13d4f0ff"}, + {file = "fastavro-1.12.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:531b89117422db967d4e1547b34089454e942341e50331fa71920e9d5e326330"}, + {file = "fastavro-1.12.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:ae541edbc6091b890532d3e50d7bcdd324219730598cf9cb4522d1decabde37e"}, + {file = "fastavro-1.12.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:585a11f612eaadb0dcb1d3d348b90bd0d0d3ee4cf9abafd8b319663e8a0e1dcc"}, + {file = "fastavro-1.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:425fb96fbfbc06a0cc828946dd2ae9d85a5f9ff836af033d8cb963876ecb158e"}, + {file = "fastavro-1.12.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:56f78d1d527bea4833945c3a8c716969ebd133c5762e2e34f64c795bd5a10b3e"}, + {file = "fastavro-1.12.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a7ce0d117642bb4265ef6e1619ec2d93e942a98f60636e3c0fbf1eb438c49026"}, + {file = "fastavro-1.12.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:52e9d9648aad4cca5751bcbe2d3f98e85afb0ec6c6565707f4e2f647ba83ba85"}, + {file = "fastavro-1.12.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:6183875381ec1cf85a1891bf46696fd1ec2ad732980e7bccc1e52e9904e7664d"}, + {file = "fastavro-1.12.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:5ad00a2b94d3c8bf9239acf92d56e3e457e1d188687a8d80f31e858ccf91a6d6"}, + {file = "fastavro-1.12.0-cp311-cp311-win_amd64.whl", hash = "sha256:6c4d1c276ff1410f3830648bb43312894ad65709ca0cb54361e28954387a46ac"}, + {file = "fastavro-1.12.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:e849c70198e5bdf6f08df54a68db36ff72bd73e8f14b1fd664323df073c496d8"}, + {file = "fastavro-1.12.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b260e1cdc9a77853a2586b32208302c08dddfb5c20720b5179ac5330e06ce698"}, + {file = "fastavro-1.12.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:181779688d8b80957953031f0d82ec0761be667a78e03dac642511ff996c771a"}, + {file = "fastavro-1.12.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:6881caf914b36a57d1f90810f04a89bd9c837dd4a48e1b66a8b92136e85c415d"}, + {file = "fastavro-1.12.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:8bf638248499eb78c422f12fedc08f9b90b5646c3368415e388691db60e7defb"}, + {file = "fastavro-1.12.0-cp312-cp312-win_amd64.whl", hash = "sha256:ed4f18b7c2f651a5ee2233676f62aac332995086768301aa2c1741859d70b53e"}, + {file = "fastavro-1.12.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:dbe2b690d9caba7d888126cc1dd980a8fcf5ee73de41a104e3f15bb5e08c19c8"}, + {file = "fastavro-1.12.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:07ff9e6c6e8739203ccced3205646fdac6141c2efc83f4dffabf5f7d0176646d"}, + {file = "fastavro-1.12.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6a172655add31882cab4e1a96b7d49f419906b465b4c2165081db7b1db79852f"}, + {file = "fastavro-1.12.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:be20ce0331b70b35dca1a4c7808afeedf348dc517bd41602ed8fc9a1ac2247a9"}, + {file = "fastavro-1.12.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a52906681384a18b99b47e5f9eab64b4744d6e6bc91056b7e28641c7b3c59d2b"}, + {file = "fastavro-1.12.0-cp313-cp313-win_amd64.whl", hash = "sha256:cf153531191bcfc445c21e05dd97232a634463aa717cf99fb2214a51b9886bff"}, + {file = "fastavro-1.12.0-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:1928e88a760688e490118e1bedf0643b1f3727e5ba59c07ac64638dab81ae2a1"}, + {file = "fastavro-1.12.0-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:cd51b706a3ab3fe4af84a0b37f60d1bcd79295df18932494fc9f49db4ba2bab2"}, + {file = "fastavro-1.12.0-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1148263931f6965e1942cf670f146148ca95b021ae7b7e1f98bf179f1c26cc58"}, + {file = "fastavro-1.12.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:4099e0f6fb8a55f59891c0aed6bfa90c4d20a774737e5282c74181b4703ea0cb"}, + {file = "fastavro-1.12.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:10c586e9e3bab34307f8e3227a2988b6e8ac49bff8f7b56635cf4928a153f464"}, + {file = "fastavro-1.12.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:638bb234821d7377d27a23bfee5bd89dadbb956c483a27acabea813c5b3e4b58"}, + {file = "fastavro-1.12.0-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f47a4777b6ebfeef60c5d3c7e850a32e3ec5c8727ccf90436ecdfd887815ac16"}, + {file = "fastavro-1.12.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:58f743697aa63a359538b7258f5956f4f1a83d3cd4eb3c8b3c3a99b3385e4cfb"}, + {file = "fastavro-1.12.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:ab6744c62dd65c3507375a489680c97c93504ec37892c51c592d9f2c441a93a7"}, + {file = "fastavro-1.12.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:bf6bbfcef12942b45220cb7dcd222daed21223d4a02e8361570da0bedabcbc95"}, + {file = "fastavro-1.12.0-cp39-cp39-win_amd64.whl", hash = "sha256:c7f025c69f13e34fc7281c688fedd8d4e7633eb15891ea630891ee34911bdfc2"}, + {file = "fastavro-1.12.0.tar.gz", hash = "sha256:a67a87be149825d74006b57e52be068dfa24f3bfc6382543ec92cd72327fe152"}, ] [package.extras] @@ -242,13 +240,13 @@ typing = ["typing-extensions (>=4.12.2)"] [[package]] name = "fsspec" -version = "2025.5.1" +version = "2025.7.0" description = "File-system specification" optional = false python-versions = ">=3.9" files = [ - {file = "fsspec-2025.5.1-py3-none-any.whl", hash = "sha256:24d3a2e663d5fc735ab256263c4075f374a174c3410c0b25e5bd1970bceaa462"}, - {file = "fsspec-2025.5.1.tar.gz", hash = "sha256:2e55e47a540b91843b755e83ded97c6e897fa0942b11490113f09e9c443c2475"}, + {file = "fsspec-2025.7.0-py3-none-any.whl", hash = "sha256:8b012e39f63c7d5f10474de957f3ab793b47b45ae7d39f2fb735f8bbe25c0e21"}, + {file = "fsspec-2025.7.0.tar.gz", hash = "sha256:786120687ffa54b8283d942929540d8bc5ccfa820deb555a2b5d0ed2b737bf58"}, ] [package.extras] @@ -256,7 +254,7 @@ abfs = ["adlfs"] adl = ["adlfs"] arrow = ["pyarrow (>=1)"] dask = ["dask", "distributed"] -dev = ["pre-commit", "ruff"] +dev = ["pre-commit", "ruff (>=0.5)"] doc = ["numpydoc", "sphinx", "sphinx-design", "sphinx-rtd-theme", "yarl"] dropbox = ["dropbox", "dropboxdrivefs", "requests"] full = ["adlfs", "aiohttp (!=4.0.0a0,!=4.0.0a1)", "dask", "distributed", "dropbox", "dropboxdrivefs", "fusepy", "gcsfs", "libarchive-c", "ocifs", "panel", "paramiko", "pyarrow (>=1)", "pygit2", "requests", "s3fs", "smbprotocol", "tqdm"] @@ -368,19 +366,19 @@ files = [ [[package]] name = "huggingface-hub" -version = "0.33.2" +version = "0.34.3" description = "Client library to download and publish models, datasets and other repos on the huggingface.co hub" optional = false python-versions = ">=3.8.0" files = [ - {file = "huggingface_hub-0.33.2-py3-none-any.whl", hash = "sha256:3749498bfa91e8cde2ddc2c1db92c79981f40e66434c20133b39e5928ac9bcc5"}, - {file = "huggingface_hub-0.33.2.tar.gz", hash = "sha256:84221defaec8fa09c090390cd68c78b88e3c4c2b7befba68d3dc5aacbc3c2c5f"}, + {file = "huggingface_hub-0.34.3-py3-none-any.whl", hash = "sha256:5444550099e2d86e68b2898b09e85878fbd788fc2957b506c6a79ce060e39492"}, + {file = "huggingface_hub-0.34.3.tar.gz", hash = "sha256:d58130fd5aa7408480681475491c0abd7e835442082fbc3ef4d45b6c39f83853"}, ] [package.dependencies] filelock = "*" fsspec = ">=2023.5.0" -hf-xet = {version = ">=1.1.2,<2.0.0", markers = "platform_machine == \"x86_64\" or platform_machine == \"amd64\" or platform_machine == \"arm64\" or platform_machine == \"aarch64\""} +hf-xet = {version = ">=1.1.3,<2.0.0", markers = "platform_machine == \"x86_64\" or platform_machine == \"amd64\" or platform_machine == \"arm64\" or platform_machine == \"aarch64\""} packaging = ">=20.9" pyyaml = ">=5.1" requests = "*" @@ -388,16 +386,16 @@ tqdm = ">=4.42.1" typing-extensions = ">=3.7.4.3" [package.extras] -all = ["InquirerPy (==0.3.4)", "Jinja2", "Pillow", "aiohttp", "authlib (>=1.3.2)", "fastapi", "gradio (>=4.0.0)", "httpx", "itsdangerous", "jedi", "libcst (==1.4.0)", "mypy (==1.15.0)", "mypy (>=1.14.1,<1.15.0)", "numpy", "pytest (>=8.1.1,<8.2.2)", "pytest-asyncio", "pytest-cov", "pytest-env", "pytest-mock", "pytest-rerunfailures", "pytest-vcr", "pytest-xdist", "ruff (>=0.9.0)", "soundfile", "types-PyYAML", "types-requests", "types-simplejson", "types-toml", "types-tqdm", "types-urllib3", "typing-extensions (>=4.8.0)", "urllib3 (<2.0)"] +all = ["InquirerPy (==0.3.4)", "Jinja2", "Pillow", "aiohttp", "authlib (>=1.3.2)", "fastapi", "gradio (>=4.0.0)", "httpx", "itsdangerous", "jedi", "libcst (>=1.4.0)", "mypy (==1.15.0)", "mypy (>=1.14.1,<1.15.0)", "numpy", "pytest (>=8.1.1,<8.2.2)", "pytest-asyncio", "pytest-cov", "pytest-env", "pytest-mock", "pytest-rerunfailures", "pytest-vcr", "pytest-xdist", "ruff (>=0.9.0)", "soundfile", "types-PyYAML", "types-requests", "types-simplejson", "types-toml", "types-tqdm", "types-urllib3", "typing-extensions (>=4.8.0)", "urllib3 (<2.0)"] cli = ["InquirerPy (==0.3.4)"] -dev = ["InquirerPy (==0.3.4)", "Jinja2", "Pillow", "aiohttp", "authlib (>=1.3.2)", "fastapi", "gradio (>=4.0.0)", "httpx", "itsdangerous", "jedi", "libcst (==1.4.0)", "mypy (==1.15.0)", "mypy (>=1.14.1,<1.15.0)", "numpy", "pytest (>=8.1.1,<8.2.2)", "pytest-asyncio", "pytest-cov", "pytest-env", "pytest-mock", "pytest-rerunfailures", "pytest-vcr", "pytest-xdist", "ruff (>=0.9.0)", "soundfile", "types-PyYAML", "types-requests", "types-simplejson", "types-toml", "types-tqdm", "types-urllib3", "typing-extensions (>=4.8.0)", "urllib3 (<2.0)"] +dev = ["InquirerPy (==0.3.4)", "Jinja2", "Pillow", "aiohttp", "authlib (>=1.3.2)", "fastapi", "gradio (>=4.0.0)", "httpx", "itsdangerous", "jedi", "libcst (>=1.4.0)", "mypy (==1.15.0)", "mypy (>=1.14.1,<1.15.0)", "numpy", "pytest (>=8.1.1,<8.2.2)", "pytest-asyncio", "pytest-cov", "pytest-env", "pytest-mock", "pytest-rerunfailures", "pytest-vcr", "pytest-xdist", "ruff (>=0.9.0)", "soundfile", "types-PyYAML", "types-requests", "types-simplejson", "types-toml", "types-tqdm", "types-urllib3", "typing-extensions (>=4.8.0)", "urllib3 (<2.0)"] fastai = ["fastai (>=2.4)", "fastcore (>=1.3.27)", "toml"] hf-transfer = ["hf-transfer (>=0.1.4)"] hf-xet = ["hf-xet (>=1.1.2,<2.0.0)"] inference = ["aiohttp"] mcp = ["aiohttp", "mcp (>=1.8.0)", "typer"] oauth = ["authlib (>=1.3.2)", "fastapi", "httpx", "itsdangerous"] -quality = ["libcst (==1.4.0)", "mypy (==1.15.0)", "mypy (>=1.14.1,<1.15.0)", "ruff (>=0.9.0)"] +quality = ["libcst (>=1.4.0)", "mypy (==1.15.0)", "mypy (>=1.14.1,<1.15.0)", "ruff (>=0.9.0)"] tensorflow = ["graphviz", "pydot", "tensorflow"] tensorflow-testing = ["keras (<3.0)", "tensorflow"] testing = ["InquirerPy (==0.3.4)", "Jinja2", "Pillow", "aiohttp", "authlib (>=1.3.2)", "fastapi", "gradio (>=4.0.0)", "httpx", "itsdangerous", "jedi", "numpy", "pytest (>=8.1.1,<8.2.2)", "pytest-asyncio", "pytest-cov", "pytest-env", "pytest-mock", "pytest-rerunfailures", "pytest-vcr", "pytest-xdist", "soundfile", "urllib3 (<2.0)"] @@ -839,26 +837,26 @@ files = [ [[package]] name = "tokenizers" -version = "0.21.2" +version = "0.21.4" description = "" optional = false python-versions = ">=3.9" files = [ - {file = "tokenizers-0.21.2-cp39-abi3-macosx_10_12_x86_64.whl", hash = "sha256:342b5dfb75009f2255ab8dec0041287260fed5ce00c323eb6bab639066fef8ec"}, - {file = "tokenizers-0.21.2-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:126df3205d6f3a93fea80c7a8a266a78c1bd8dd2fe043386bafdd7736a23e45f"}, - {file = "tokenizers-0.21.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4a32cd81be21168bd0d6a0f0962d60177c447a1aa1b1e48fa6ec9fc728ee0b12"}, - {file = "tokenizers-0.21.2-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:8bd8999538c405133c2ab999b83b17c08b7fc1b48c1ada2469964605a709ef91"}, - {file = "tokenizers-0.21.2-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5e9944e61239b083a41cf8fc42802f855e1dca0f499196df37a8ce219abac6eb"}, - {file = "tokenizers-0.21.2-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:514cd43045c5d546f01142ff9c79a96ea69e4b5cda09e3027708cb2e6d5762ab"}, - {file = "tokenizers-0.21.2-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b1b9405822527ec1e0f7d8d2fdb287a5730c3a6518189c968254a8441b21faae"}, - {file = "tokenizers-0.21.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fed9a4d51c395103ad24f8e7eb976811c57fbec2af9f133df471afcd922e5020"}, - {file = "tokenizers-0.21.2-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:2c41862df3d873665ec78b6be36fcc30a26e3d4902e9dd8608ed61d49a48bc19"}, - {file = "tokenizers-0.21.2-cp39-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:ed21dc7e624e4220e21758b2e62893be7101453525e3d23264081c9ef9a6d00d"}, - {file = "tokenizers-0.21.2-cp39-abi3-musllinux_1_2_i686.whl", hash = "sha256:0e73770507e65a0e0e2a1affd6b03c36e3bc4377bd10c9ccf51a82c77c0fe365"}, - {file = "tokenizers-0.21.2-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:106746e8aa9014a12109e58d540ad5465b4c183768ea96c03cbc24c44d329958"}, - {file = "tokenizers-0.21.2-cp39-abi3-win32.whl", hash = "sha256:cabda5a6d15d620b6dfe711e1af52205266d05b379ea85a8a301b3593c60e962"}, - {file = "tokenizers-0.21.2-cp39-abi3-win_amd64.whl", hash = "sha256:58747bb898acdb1007f37a7bbe614346e98dc28708ffb66a3fd50ce169ac6c98"}, - {file = "tokenizers-0.21.2.tar.gz", hash = "sha256:fdc7cffde3e2113ba0e6cc7318c40e3438a4d74bbc62bf04bcc63bdfb082ac77"}, + {file = "tokenizers-0.21.4-cp39-abi3-macosx_10_12_x86_64.whl", hash = "sha256:2ccc10a7c3bcefe0f242867dc914fc1226ee44321eb618cfe3019b5df3400133"}, + {file = "tokenizers-0.21.4-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:5e2f601a8e0cd5be5cc7506b20a79112370b9b3e9cb5f13f68ab11acd6ca7d60"}, + {file = "tokenizers-0.21.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:39b376f5a1aee67b4d29032ee85511bbd1b99007ec735f7f35c8a2eb104eade5"}, + {file = "tokenizers-0.21.4-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:2107ad649e2cda4488d41dfd031469e9da3fcbfd6183e74e4958fa729ffbf9c6"}, + {file = "tokenizers-0.21.4-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3c73012da95afafdf235ba80047699df4384fdc481527448a078ffd00e45a7d9"}, + {file = "tokenizers-0.21.4-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f23186c40395fc390d27f519679a58023f368a0aad234af145e0f39ad1212732"}, + {file = "tokenizers-0.21.4-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cc88bb34e23a54cc42713d6d98af5f1bf79c07653d24fe984d2d695ba2c922a2"}, + {file = "tokenizers-0.21.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:51b7eabb104f46c1c50b486520555715457ae833d5aee9ff6ae853d1130506ff"}, + {file = "tokenizers-0.21.4-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:714b05b2e1af1288bd1bc56ce496c4cebb64a20d158ee802887757791191e6e2"}, + {file = "tokenizers-0.21.4-cp39-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:1340ff877ceedfa937544b7d79f5b7becf33a4cfb58f89b3b49927004ef66f78"}, + {file = "tokenizers-0.21.4-cp39-abi3-musllinux_1_2_i686.whl", hash = "sha256:3c1f4317576e465ac9ef0d165b247825a2a4078bcd01cba6b54b867bdf9fdd8b"}, + {file = "tokenizers-0.21.4-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:c212aa4e45ec0bb5274b16b6f31dd3f1c41944025c2358faaa5782c754e84c24"}, + {file = "tokenizers-0.21.4-cp39-abi3-win32.whl", hash = "sha256:6c42a930bc5f4c47f4ea775c91de47d27910881902b0f20e4990ebe045a415d0"}, + {file = "tokenizers-0.21.4-cp39-abi3-win_amd64.whl", hash = "sha256:475d807a5c3eb72c59ad9b5fcdb254f6e17f53dfcbb9903233b0dfa9c943b597"}, + {file = "tokenizers-0.21.4.tar.gz", hash = "sha256:fa23f85fbc9a02ec5c6978da172cdcbac23498c3ca9f3645c5c68740ac007880"}, ] [package.dependencies] diff --git a/pyproject.toml b/pyproject.toml index 796063575..f9afb9bcf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "cohere" [tool.poetry] name = "cohere" -version = "5.16.1" +version = "5.16.2" description = "" readme = "README.md" authors = [] diff --git a/src/cohere/__init__.py b/src/cohere/__init__.py index 90f13dc44..ac5002d98 100644 --- a/src/cohere/__init__.py +++ b/src/cohere/__init__.py @@ -27,6 +27,7 @@ ChatContentStartEventDelta, ChatContentStartEventDeltaMessage, ChatContentStartEventDeltaMessageContent, + ChatContentStartEventDeltaMessageContentType, ChatDataMetrics, ChatDebugEvent, ChatDocument, @@ -205,6 +206,7 @@ TextResponseFormatV2, TextSystemMessageV2ContentItem, TextToolContent, + ThinkingAssistantMessageResponseContentItem, TokenizeResponse, Tool, ToolCall, @@ -325,6 +327,7 @@ "ChatContentStartEventDelta", "ChatContentStartEventDeltaMessage", "ChatContentStartEventDeltaMessageContent", + "ChatContentStartEventDeltaMessageContentType", "ChatDataMetrics", "ChatDebugEvent", "ChatDocument", @@ -536,6 +539,7 @@ "TextResponseFormatV2", "TextSystemMessageV2ContentItem", "TextToolContent", + "ThinkingAssistantMessageResponseContentItem", "TokenizeResponse", "TooManyRequestsError", "Tool", diff --git a/src/cohere/base_client.py b/src/cohere/base_client.py index f23b4f613..8374d3ea6 100644 --- a/src/cohere/base_client.py +++ b/src/cohere/base_client.py @@ -146,6 +146,7 @@ def chat_stream( *, message: str, accepts: typing.Optional[typing.Literal["text/event-stream"]] = None, + raw_prompting: typing.Optional[bool] = OMIT, model: typing.Optional[str] = OMIT, preamble: typing.Optional[str] = OMIT, chat_history: typing.Optional[typing.Sequence[Message]] = OMIT, @@ -186,6 +187,12 @@ def chat_stream( accepts : typing.Optional[typing.Literal["text/event-stream"]] Pass text/event-stream to receive the streamed response as server-sent events. The default is `\n` delimited events. + raw_prompting : typing.Optional[bool] + When enabled, the user's prompt will be sent to the model without + any pre-processing. + + Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + model : typing.Optional[str] The name of a compatible [Cohere model](https://docs.cohere.com/docs/models) or the ID of a [fine-tuned](https://docs.cohere.com/docs/chat-fine-tuning) model. @@ -407,6 +414,7 @@ def chat_stream( with self._raw_client.chat_stream( message=message, accepts=accepts, + raw_prompting=raw_prompting, model=model, preamble=preamble, chat_history=chat_history, @@ -439,6 +447,7 @@ def chat( *, message: str, accepts: typing.Optional[typing.Literal["text/event-stream"]] = None, + raw_prompting: typing.Optional[bool] = OMIT, model: typing.Optional[str] = OMIT, preamble: typing.Optional[str] = OMIT, chat_history: typing.Optional[typing.Sequence[Message]] = OMIT, @@ -478,6 +487,12 @@ def chat( accepts : typing.Optional[typing.Literal["text/event-stream"]] Pass text/event-stream to receive the streamed response as server-sent events. The default is `\n` delimited events. + raw_prompting : typing.Optional[bool] + When enabled, the user's prompt will be sent to the model without + any pre-processing. + + Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + model : typing.Optional[str] The name of a compatible [Cohere model](https://docs.cohere.com/docs/models) or the ID of a [fine-tuned](https://docs.cohere.com/docs/chat-fine-tuning) model. @@ -710,6 +725,7 @@ def chat( _response = self._raw_client.chat( message=message, accepts=accepts, + raw_prompting=raw_prompting, model=model, preamble=preamble, chat_history=chat_history, @@ -1586,6 +1602,7 @@ async def chat_stream( *, message: str, accepts: typing.Optional[typing.Literal["text/event-stream"]] = None, + raw_prompting: typing.Optional[bool] = OMIT, model: typing.Optional[str] = OMIT, preamble: typing.Optional[str] = OMIT, chat_history: typing.Optional[typing.Sequence[Message]] = OMIT, @@ -1626,6 +1643,12 @@ async def chat_stream( accepts : typing.Optional[typing.Literal["text/event-stream"]] Pass text/event-stream to receive the streamed response as server-sent events. The default is `\n` delimited events. + raw_prompting : typing.Optional[bool] + When enabled, the user's prompt will be sent to the model without + any pre-processing. + + Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + model : typing.Optional[str] The name of a compatible [Cohere model](https://docs.cohere.com/docs/models) or the ID of a [fine-tuned](https://docs.cohere.com/docs/chat-fine-tuning) model. @@ -1855,6 +1878,7 @@ async def main() -> None: async with self._raw_client.chat_stream( message=message, accepts=accepts, + raw_prompting=raw_prompting, model=model, preamble=preamble, chat_history=chat_history, @@ -1888,6 +1912,7 @@ async def chat( *, message: str, accepts: typing.Optional[typing.Literal["text/event-stream"]] = None, + raw_prompting: typing.Optional[bool] = OMIT, model: typing.Optional[str] = OMIT, preamble: typing.Optional[str] = OMIT, chat_history: typing.Optional[typing.Sequence[Message]] = OMIT, @@ -1927,6 +1952,12 @@ async def chat( accepts : typing.Optional[typing.Literal["text/event-stream"]] Pass text/event-stream to receive the streamed response as server-sent events. The default is `\n` delimited events. + raw_prompting : typing.Optional[bool] + When enabled, the user's prompt will be sent to the model without + any pre-processing. + + Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + model : typing.Optional[str] The name of a compatible [Cohere model](https://docs.cohere.com/docs/models) or the ID of a [fine-tuned](https://docs.cohere.com/docs/chat-fine-tuning) model. @@ -2167,6 +2198,7 @@ async def main() -> None: _response = await self._raw_client.chat( message=message, accepts=accepts, + raw_prompting=raw_prompting, model=model, preamble=preamble, chat_history=chat_history, diff --git a/src/cohere/core/client_wrapper.py b/src/cohere/core/client_wrapper.py index d84b7d06e..fb671cabc 100644 --- a/src/cohere/core/client_wrapper.py +++ b/src/cohere/core/client_wrapper.py @@ -22,10 +22,10 @@ def __init__( def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { - "User-Agent": "cohere/5.16.1", + "User-Agent": "cohere/5.16.2", "X-Fern-Language": "Python", "X-Fern-SDK-Name": "cohere", - "X-Fern-SDK-Version": "5.16.1", + "X-Fern-SDK-Version": "5.16.2", } if self._client_name is not None: headers["X-Client-Name"] = self._client_name diff --git a/src/cohere/finetuning/client.py b/src/cohere/finetuning/client.py index 0e000f2b3..66e68345a 100644 --- a/src/cohere/finetuning/client.py +++ b/src/cohere/finetuning/client.py @@ -44,6 +44,8 @@ def list_finetuned_models( request_options: typing.Optional[RequestOptions] = None, ) -> ListFinetunedModelsResponse: """ + Returns a list of fine-tuned models that the user has access to. + Parameters ---------- page_size : typing.Optional[int] @@ -88,6 +90,8 @@ def create_finetuned_model( self, *, request: FinetunedModel, request_options: typing.Optional[RequestOptions] = None ) -> CreateFinetunedModelResponse: """ + Creates a new fine-tuned model. The model will be trained on the dataset specified in the request body. The training process may take some time, and the model will be available once the training is complete. + Parameters ---------- request : FinetunedModel @@ -128,6 +132,8 @@ def get_finetuned_model( self, id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> GetFinetunedModelResponse: """ + Retrieve a fine-tuned model by its ID. + Parameters ---------- id : str @@ -160,6 +166,9 @@ def delete_finetuned_model( self, id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> DeleteFinetunedModelResponse: """ + Deletes a fine-tuned model. The model will be removed from the system and will no longer be available for use. + This operation is irreversible. + Parameters ---------- id : str @@ -198,6 +207,8 @@ def update_finetuned_model( request_options: typing.Optional[RequestOptions] = None, ) -> UpdateFinetunedModelResponse: """ + Updates the fine-tuned model with the given ID. The model will be updated with the new settings and name provided in the request body. + Parameters ---------- id : str @@ -255,6 +266,10 @@ def list_events( request_options: typing.Optional[RequestOptions] = None, ) -> ListEventsResponse: """ + Returns a list of events that occurred during the life-cycle of the fine-tuned model. + The events are ordered by creation time, with the most recent event first. + The list can be paginated using `page_size` and `page_token` parameters. + Parameters ---------- finetuned_model_id : str @@ -313,6 +328,10 @@ def list_training_step_metrics( request_options: typing.Optional[RequestOptions] = None, ) -> ListTrainingStepMetricsResponse: """ + Returns a list of metrics measured during the training of a fine-tuned model. + The metrics are ordered by step number, with the most recent step first. + The list can be paginated using `page_size` and `page_token` parameters. + Parameters ---------- finetuned_model_id : str @@ -375,6 +394,8 @@ async def list_finetuned_models( request_options: typing.Optional[RequestOptions] = None, ) -> ListFinetunedModelsResponse: """ + Returns a list of fine-tuned models that the user has access to. + Parameters ---------- page_size : typing.Optional[int] @@ -427,6 +448,8 @@ async def create_finetuned_model( self, *, request: FinetunedModel, request_options: typing.Optional[RequestOptions] = None ) -> CreateFinetunedModelResponse: """ + Creates a new fine-tuned model. The model will be trained on the dataset specified in the request body. The training process may take some time, and the model will be available once the training is complete. + Parameters ---------- request : FinetunedModel @@ -475,6 +498,8 @@ async def get_finetuned_model( self, id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> GetFinetunedModelResponse: """ + Retrieve a fine-tuned model by its ID. + Parameters ---------- id : str @@ -515,6 +540,9 @@ async def delete_finetuned_model( self, id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> DeleteFinetunedModelResponse: """ + Deletes a fine-tuned model. The model will be removed from the system and will no longer be available for use. + This operation is irreversible. + Parameters ---------- id : str @@ -561,6 +589,8 @@ async def update_finetuned_model( request_options: typing.Optional[RequestOptions] = None, ) -> UpdateFinetunedModelResponse: """ + Updates the fine-tuned model with the given ID. The model will be updated with the new settings and name provided in the request body. + Parameters ---------- id : str @@ -626,6 +656,10 @@ async def list_events( request_options: typing.Optional[RequestOptions] = None, ) -> ListEventsResponse: """ + Returns a list of events that occurred during the life-cycle of the fine-tuned model. + The events are ordered by creation time, with the most recent event first. + The list can be paginated using `page_size` and `page_token` parameters. + Parameters ---------- finetuned_model_id : str @@ -692,6 +726,10 @@ async def list_training_step_metrics( request_options: typing.Optional[RequestOptions] = None, ) -> ListTrainingStepMetricsResponse: """ + Returns a list of metrics measured during the training of a fine-tuned model. + The metrics are ordered by step number, with the most recent step first. + The list can be paginated using `page_size` and `page_token` parameters. + Parameters ---------- finetuned_model_id : str diff --git a/src/cohere/finetuning/raw_client.py b/src/cohere/finetuning/raw_client.py index 8b0f001a6..54e65b0f2 100644 --- a/src/cohere/finetuning/raw_client.py +++ b/src/cohere/finetuning/raw_client.py @@ -44,6 +44,8 @@ def list_finetuned_models( request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[ListFinetunedModelsResponse]: """ + Returns a list of fine-tuned models that the user has access to. + Parameters ---------- page_size : typing.Optional[int] @@ -164,6 +166,8 @@ def create_finetuned_model( self, *, request: FinetunedModel, request_options: typing.Optional[RequestOptions] = None ) -> HttpResponse[CreateFinetunedModelResponse]: """ + Creates a new fine-tuned model. The model will be trained on the dataset specified in the request body. The training process may take some time, and the model will be available once the training is complete. + Parameters ---------- request : FinetunedModel @@ -271,6 +275,8 @@ def get_finetuned_model( self, id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> HttpResponse[GetFinetunedModelResponse]: """ + Retrieve a fine-tuned model by its ID. + Parameters ---------- id : str @@ -374,6 +380,9 @@ def delete_finetuned_model( self, id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> HttpResponse[DeleteFinetunedModelResponse]: """ + Deletes a fine-tuned model. The model will be removed from the system and will no longer be available for use. + This operation is irreversible. + Parameters ---------- id : str @@ -483,6 +492,8 @@ def update_finetuned_model( request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[UpdateFinetunedModelResponse]: """ + Updates the fine-tuned model with the given ID. The model will be updated with the new settings and name provided in the request body. + Parameters ---------- id : str @@ -612,6 +623,10 @@ def list_events( request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[ListEventsResponse]: """ + Returns a list of events that occurred during the life-cycle of the fine-tuned model. + The events are ordered by creation time, with the most recent event first. + The list can be paginated using `page_size` and `page_token` parameters. + Parameters ---------- finetuned_model_id : str @@ -740,6 +755,10 @@ def list_training_step_metrics( request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[ListTrainingStepMetricsResponse]: """ + Returns a list of metrics measured during the training of a fine-tuned model. + The metrics are ordered by step number, with the most recent step first. + The list can be paginated using `page_size` and `page_token` parameters. + Parameters ---------- finetuned_model_id : str @@ -864,6 +883,8 @@ async def list_finetuned_models( request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[ListFinetunedModelsResponse]: """ + Returns a list of fine-tuned models that the user has access to. + Parameters ---------- page_size : typing.Optional[int] @@ -984,6 +1005,8 @@ async def create_finetuned_model( self, *, request: FinetunedModel, request_options: typing.Optional[RequestOptions] = None ) -> AsyncHttpResponse[CreateFinetunedModelResponse]: """ + Creates a new fine-tuned model. The model will be trained on the dataset specified in the request body. The training process may take some time, and the model will be available once the training is complete. + Parameters ---------- request : FinetunedModel @@ -1091,6 +1114,8 @@ async def get_finetuned_model( self, id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> AsyncHttpResponse[GetFinetunedModelResponse]: """ + Retrieve a fine-tuned model by its ID. + Parameters ---------- id : str @@ -1194,6 +1219,9 @@ async def delete_finetuned_model( self, id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> AsyncHttpResponse[DeleteFinetunedModelResponse]: """ + Deletes a fine-tuned model. The model will be removed from the system and will no longer be available for use. + This operation is irreversible. + Parameters ---------- id : str @@ -1303,6 +1331,8 @@ async def update_finetuned_model( request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[UpdateFinetunedModelResponse]: """ + Updates the fine-tuned model with the given ID. The model will be updated with the new settings and name provided in the request body. + Parameters ---------- id : str @@ -1432,6 +1462,10 @@ async def list_events( request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[ListEventsResponse]: """ + Returns a list of events that occurred during the life-cycle of the fine-tuned model. + The events are ordered by creation time, with the most recent event first. + The list can be paginated using `page_size` and `page_token` parameters. + Parameters ---------- finetuned_model_id : str @@ -1560,6 +1594,10 @@ async def list_training_step_metrics( request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[ListTrainingStepMetricsResponse]: """ + Returns a list of metrics measured during the training of a fine-tuned model. + The metrics are ordered by step number, with the most recent step first. + The list can be paginated using `page_size` and `page_token` parameters. + Parameters ---------- finetuned_model_id : str diff --git a/src/cohere/raw_base_client.py b/src/cohere/raw_base_client.py index c5a4c4108..3f2c473bf 100644 --- a/src/cohere/raw_base_client.py +++ b/src/cohere/raw_base_client.py @@ -74,6 +74,7 @@ def chat_stream( *, message: str, accepts: typing.Optional[typing.Literal["text/event-stream"]] = None, + raw_prompting: typing.Optional[bool] = OMIT, model: typing.Optional[str] = OMIT, preamble: typing.Optional[str] = OMIT, chat_history: typing.Optional[typing.Sequence[Message]] = OMIT, @@ -114,6 +115,12 @@ def chat_stream( accepts : typing.Optional[typing.Literal["text/event-stream"]] Pass text/event-stream to receive the streamed response as server-sent events. The default is `\n` delimited events. + raw_prompting : typing.Optional[bool] + When enabled, the user's prompt will be sent to the model without + any pre-processing. + + Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + model : typing.Optional[str] The name of a compatible [Cohere model](https://docs.cohere.com/docs/models) or the ID of a [fine-tuned](https://docs.cohere.com/docs/chat-fine-tuning) model. @@ -322,6 +329,7 @@ def chat_stream( "v1/chat", method="POST", json={ + "raw_prompting": raw_prompting, "message": message, "model": model, "preamble": preamble, @@ -534,6 +542,7 @@ def chat( *, message: str, accepts: typing.Optional[typing.Literal["text/event-stream"]] = None, + raw_prompting: typing.Optional[bool] = OMIT, model: typing.Optional[str] = OMIT, preamble: typing.Optional[str] = OMIT, chat_history: typing.Optional[typing.Sequence[Message]] = OMIT, @@ -573,6 +582,12 @@ def chat( accepts : typing.Optional[typing.Literal["text/event-stream"]] Pass text/event-stream to receive the streamed response as server-sent events. The default is `\n` delimited events. + raw_prompting : typing.Optional[bool] + When enabled, the user's prompt will be sent to the model without + any pre-processing. + + Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + model : typing.Optional[str] The name of a compatible [Cohere model](https://docs.cohere.com/docs/models) or the ID of a [fine-tuned](https://docs.cohere.com/docs/chat-fine-tuning) model. @@ -781,6 +796,7 @@ def chat( "v1/chat", method="POST", json={ + "raw_prompting": raw_prompting, "message": message, "model": model, "preamble": preamble, @@ -2973,6 +2989,7 @@ async def chat_stream( *, message: str, accepts: typing.Optional[typing.Literal["text/event-stream"]] = None, + raw_prompting: typing.Optional[bool] = OMIT, model: typing.Optional[str] = OMIT, preamble: typing.Optional[str] = OMIT, chat_history: typing.Optional[typing.Sequence[Message]] = OMIT, @@ -3013,6 +3030,12 @@ async def chat_stream( accepts : typing.Optional[typing.Literal["text/event-stream"]] Pass text/event-stream to receive the streamed response as server-sent events. The default is `\n` delimited events. + raw_prompting : typing.Optional[bool] + When enabled, the user's prompt will be sent to the model without + any pre-processing. + + Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + model : typing.Optional[str] The name of a compatible [Cohere model](https://docs.cohere.com/docs/models) or the ID of a [fine-tuned](https://docs.cohere.com/docs/chat-fine-tuning) model. @@ -3221,6 +3244,7 @@ async def chat_stream( "v1/chat", method="POST", json={ + "raw_prompting": raw_prompting, "message": message, "model": model, "preamble": preamble, @@ -3433,6 +3457,7 @@ async def chat( *, message: str, accepts: typing.Optional[typing.Literal["text/event-stream"]] = None, + raw_prompting: typing.Optional[bool] = OMIT, model: typing.Optional[str] = OMIT, preamble: typing.Optional[str] = OMIT, chat_history: typing.Optional[typing.Sequence[Message]] = OMIT, @@ -3472,6 +3497,12 @@ async def chat( accepts : typing.Optional[typing.Literal["text/event-stream"]] Pass text/event-stream to receive the streamed response as server-sent events. The default is `\n` delimited events. + raw_prompting : typing.Optional[bool] + When enabled, the user's prompt will be sent to the model without + any pre-processing. + + Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + model : typing.Optional[str] The name of a compatible [Cohere model](https://docs.cohere.com/docs/models) or the ID of a [fine-tuned](https://docs.cohere.com/docs/chat-fine-tuning) model. @@ -3680,6 +3711,7 @@ async def chat( "v1/chat", method="POST", json={ + "raw_prompting": raw_prompting, "message": message, "model": model, "preamble": preamble, diff --git a/src/cohere/types/__init__.py b/src/cohere/types/__init__.py index aa81109f3..5e2d456fd 100644 --- a/src/cohere/types/__init__.py +++ b/src/cohere/types/__init__.py @@ -11,6 +11,7 @@ from .assistant_message_response_content_item import ( AssistantMessageResponseContentItem, TextAssistantMessageResponseContentItem, + ThinkingAssistantMessageResponseContentItem, ) from .assistant_message_v2content import AssistantMessageV2Content from .assistant_message_v2content_item import AssistantMessageV2ContentItem, TextAssistantMessageV2ContentItem @@ -28,6 +29,7 @@ from .chat_content_start_event_delta import ChatContentStartEventDelta from .chat_content_start_event_delta_message import ChatContentStartEventDeltaMessage from .chat_content_start_event_delta_message_content import ChatContentStartEventDeltaMessageContent +from .chat_content_start_event_delta_message_content_type import ChatContentStartEventDeltaMessageContentType from .chat_data_metrics import ChatDataMetrics from .chat_debug_event import ChatDebugEvent from .chat_document import ChatDocument @@ -248,6 +250,7 @@ "ChatContentStartEventDelta", "ChatContentStartEventDeltaMessage", "ChatContentStartEventDeltaMessageContent", + "ChatContentStartEventDeltaMessageContentType", "ChatDataMetrics", "ChatDebugEvent", "ChatDocument", @@ -426,6 +429,7 @@ "TextResponseFormatV2", "TextSystemMessageV2ContentItem", "TextToolContent", + "ThinkingAssistantMessageResponseContentItem", "TokenizeResponse", "Tool", "ToolCall", diff --git a/src/cohere/types/assistant_message_response_content_item.py b/src/cohere/types/assistant_message_response_content_item.py index e8eaad67f..713617c64 100644 --- a/src/cohere/types/assistant_message_response_content_item.py +++ b/src/cohere/types/assistant_message_response_content_item.py @@ -23,6 +23,17 @@ class Config: extra = pydantic.Extra.allow +class ThinkingAssistantMessageResponseContentItem(UncheckedBaseModel): + value: typing.Optional[typing.Any] = None + type: typing.Literal["thinking"] = "thinking" + + if not IS_PYDANTIC_V2: + + class Config: + smart_union = True + + AssistantMessageResponseContentItem = typing_extensions.Annotated[ - TextAssistantMessageResponseContentItem, UnionMetadata(discriminant="type") + typing.Union[TextAssistantMessageResponseContentItem, ThinkingAssistantMessageResponseContentItem], + UnionMetadata(discriminant="type"), ] diff --git a/src/cohere/types/chat_content_start_event_delta_message_content.py b/src/cohere/types/chat_content_start_event_delta_message_content.py index 3f61a7760..fa53677a1 100644 --- a/src/cohere/types/chat_content_start_event_delta_message_content.py +++ b/src/cohere/types/chat_content_start_event_delta_message_content.py @@ -5,11 +5,12 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2 from ..core.unchecked_base_model import UncheckedBaseModel +from .chat_content_start_event_delta_message_content_type import ChatContentStartEventDeltaMessageContentType class ChatContentStartEventDeltaMessageContent(UncheckedBaseModel): text: typing.Optional[str] = None - type: typing.Optional[typing.Literal["text"]] = None + type: typing.Optional[ChatContentStartEventDeltaMessageContentType] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow") # type: ignore # Pydantic v2 diff --git a/src/cohere/types/chat_content_start_event_delta_message_content_type.py b/src/cohere/types/chat_content_start_event_delta_message_content_type.py new file mode 100644 index 000000000..e088f9e49 --- /dev/null +++ b/src/cohere/types/chat_content_start_event_delta_message_content_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ChatContentStartEventDeltaMessageContentType = typing.Union[typing.Literal["text", "thinking"], typing.Any] diff --git a/src/cohere/types/chat_message_end_event_delta.py b/src/cohere/types/chat_message_end_event_delta.py index f3a27cd1d..607e20469 100644 --- a/src/cohere/types/chat_message_end_event_delta.py +++ b/src/cohere/types/chat_message_end_event_delta.py @@ -5,6 +5,8 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2 from ..core.unchecked_base_model import UncheckedBaseModel +from .chat_finish_reason import ChatFinishReason +from .usage import Usage class ChatMessageEndEventDelta(UncheckedBaseModel): @@ -13,6 +15,9 @@ class ChatMessageEndEventDelta(UncheckedBaseModel): An error message if an error occurred during the generation. """ + finish_reason: typing.Optional[ChatFinishReason] = None + usage: typing.Optional[Usage] = None + if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow") # type: ignore # Pydantic v2 else: diff --git a/src/cohere/types/citation.py b/src/cohere/types/citation.py index f951677fd..92c7f486c 100644 --- a/src/cohere/types/citation.py +++ b/src/cohere/types/citation.py @@ -30,6 +30,11 @@ class Citation(UncheckedBaseModel): """ sources: typing.Optional[typing.List[Source]] = None + content_index: typing.Optional[int] = pydantic.Field(default=None) + """ + Index of the content block in which this citation appears. + """ + type: typing.Optional[CitationType] = None if IS_PYDANTIC_V2: diff --git a/src/cohere/types/citation_type.py b/src/cohere/types/citation_type.py index 33ca2f980..b59744e6d 100644 --- a/src/cohere/types/citation_type.py +++ b/src/cohere/types/citation_type.py @@ -2,4 +2,4 @@ import typing -CitationType = typing.Union[typing.Literal["TEXT_CONTENT", "PLAN"], typing.Any] +CitationType = typing.Union[typing.Literal["TEXT_CONTENT", "THINKING_CONTENT", "PLAN"], typing.Any] diff --git a/src/cohere/v2/client.py b/src/cohere/v2/client.py index 3d638fa50..0e680ecfa 100644 --- a/src/cohere/v2/client.py +++ b/src/cohere/v2/client.py @@ -52,6 +52,7 @@ def chat_stream( strict_tools: typing.Optional[bool] = OMIT, documents: typing.Optional[typing.Sequence[V2ChatStreamRequestDocumentsItem]] = OMIT, citation_options: typing.Optional[CitationOptions] = OMIT, + raw_prompting: typing.Optional[bool] = OMIT, response_format: typing.Optional[ResponseFormatV2] = OMIT, safety_mode: typing.Optional[V2ChatStreamRequestSafetyMode] = OMIT, max_tokens: typing.Optional[int] = OMIT, @@ -93,6 +94,12 @@ def chat_stream( citation_options : typing.Optional[CitationOptions] + raw_prompting : typing.Optional[bool] + When enabled, the user's prompt will be sent to the model without + any pre-processing. + + Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + response_format : typing.Optional[ResponseFormatV2] safety_mode : typing.Optional[V2ChatStreamRequestSafetyMode] @@ -188,6 +195,7 @@ def chat_stream( strict_tools=strict_tools, documents=documents, citation_options=citation_options, + raw_prompting=raw_prompting, response_format=response_format, safety_mode=safety_mode, max_tokens=max_tokens, @@ -213,6 +221,7 @@ def chat( strict_tools: typing.Optional[bool] = OMIT, documents: typing.Optional[typing.Sequence[V2ChatRequestDocumentsItem]] = OMIT, citation_options: typing.Optional[CitationOptions] = OMIT, + raw_prompting: typing.Optional[bool] = OMIT, response_format: typing.Optional[ResponseFormatV2] = OMIT, safety_mode: typing.Optional[V2ChatRequestSafetyMode] = OMIT, max_tokens: typing.Optional[int] = OMIT, @@ -254,6 +263,12 @@ def chat( citation_options : typing.Optional[CitationOptions] + raw_prompting : typing.Optional[bool] + When enabled, the user's prompt will be sent to the model without + any pre-processing. + + Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + response_format : typing.Optional[ResponseFormatV2] safety_mode : typing.Optional[V2ChatRequestSafetyMode] @@ -347,6 +362,7 @@ def chat( strict_tools=strict_tools, documents=documents, citation_options=citation_options, + raw_prompting=raw_prompting, response_format=response_format, safety_mode=safety_mode, max_tokens=max_tokens, @@ -563,6 +579,7 @@ async def chat_stream( strict_tools: typing.Optional[bool] = OMIT, documents: typing.Optional[typing.Sequence[V2ChatStreamRequestDocumentsItem]] = OMIT, citation_options: typing.Optional[CitationOptions] = OMIT, + raw_prompting: typing.Optional[bool] = OMIT, response_format: typing.Optional[ResponseFormatV2] = OMIT, safety_mode: typing.Optional[V2ChatStreamRequestSafetyMode] = OMIT, max_tokens: typing.Optional[int] = OMIT, @@ -604,6 +621,12 @@ async def chat_stream( citation_options : typing.Optional[CitationOptions] + raw_prompting : typing.Optional[bool] + When enabled, the user's prompt will be sent to the model without + any pre-processing. + + Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + response_format : typing.Optional[ResponseFormatV2] safety_mode : typing.Optional[V2ChatStreamRequestSafetyMode] @@ -707,6 +730,7 @@ async def main() -> None: strict_tools=strict_tools, documents=documents, citation_options=citation_options, + raw_prompting=raw_prompting, response_format=response_format, safety_mode=safety_mode, max_tokens=max_tokens, @@ -733,6 +757,7 @@ async def chat( strict_tools: typing.Optional[bool] = OMIT, documents: typing.Optional[typing.Sequence[V2ChatRequestDocumentsItem]] = OMIT, citation_options: typing.Optional[CitationOptions] = OMIT, + raw_prompting: typing.Optional[bool] = OMIT, response_format: typing.Optional[ResponseFormatV2] = OMIT, safety_mode: typing.Optional[V2ChatRequestSafetyMode] = OMIT, max_tokens: typing.Optional[int] = OMIT, @@ -774,6 +799,12 @@ async def chat( citation_options : typing.Optional[CitationOptions] + raw_prompting : typing.Optional[bool] + When enabled, the user's prompt will be sent to the model without + any pre-processing. + + Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + response_format : typing.Optional[ResponseFormatV2] safety_mode : typing.Optional[V2ChatRequestSafetyMode] @@ -875,6 +906,7 @@ async def main() -> None: strict_tools=strict_tools, documents=documents, citation_options=citation_options, + raw_prompting=raw_prompting, response_format=response_format, safety_mode=safety_mode, max_tokens=max_tokens, diff --git a/src/cohere/v2/raw_client.py b/src/cohere/v2/raw_client.py index bab47736f..12b221fe3 100644 --- a/src/cohere/v2/raw_client.py +++ b/src/cohere/v2/raw_client.py @@ -61,6 +61,7 @@ def chat_stream( strict_tools: typing.Optional[bool] = OMIT, documents: typing.Optional[typing.Sequence[V2ChatStreamRequestDocumentsItem]] = OMIT, citation_options: typing.Optional[CitationOptions] = OMIT, + raw_prompting: typing.Optional[bool] = OMIT, response_format: typing.Optional[ResponseFormatV2] = OMIT, safety_mode: typing.Optional[V2ChatStreamRequestSafetyMode] = OMIT, max_tokens: typing.Optional[int] = OMIT, @@ -102,6 +103,12 @@ def chat_stream( citation_options : typing.Optional[CitationOptions] + raw_prompting : typing.Optional[bool] + When enabled, the user's prompt will be sent to the model without + any pre-processing. + + Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + response_format : typing.Optional[ResponseFormatV2] safety_mode : typing.Optional[V2ChatStreamRequestSafetyMode] @@ -189,6 +196,7 @@ def chat_stream( "citation_options": convert_and_respect_annotation_metadata( object_=citation_options, annotation=CitationOptions, direction="write" ), + "raw_prompting": raw_prompting, "response_format": convert_and_respect_annotation_metadata( object_=response_format, annotation=ResponseFormatV2, direction="write" ), @@ -385,6 +393,7 @@ def chat( strict_tools: typing.Optional[bool] = OMIT, documents: typing.Optional[typing.Sequence[V2ChatRequestDocumentsItem]] = OMIT, citation_options: typing.Optional[CitationOptions] = OMIT, + raw_prompting: typing.Optional[bool] = OMIT, response_format: typing.Optional[ResponseFormatV2] = OMIT, safety_mode: typing.Optional[V2ChatRequestSafetyMode] = OMIT, max_tokens: typing.Optional[int] = OMIT, @@ -426,6 +435,12 @@ def chat( citation_options : typing.Optional[CitationOptions] + raw_prompting : typing.Optional[bool] + When enabled, the user's prompt will be sent to the model without + any pre-processing. + + Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + response_format : typing.Optional[ResponseFormatV2] safety_mode : typing.Optional[V2ChatRequestSafetyMode] @@ -513,6 +528,7 @@ def chat( "citation_options": convert_and_respect_annotation_metadata( object_=citation_options, annotation=CitationOptions, direction="write" ), + "raw_prompting": raw_prompting, "response_format": convert_and_respect_annotation_metadata( object_=response_format, annotation=ResponseFormatV2, direction="write" ), @@ -1144,6 +1160,7 @@ async def chat_stream( strict_tools: typing.Optional[bool] = OMIT, documents: typing.Optional[typing.Sequence[V2ChatStreamRequestDocumentsItem]] = OMIT, citation_options: typing.Optional[CitationOptions] = OMIT, + raw_prompting: typing.Optional[bool] = OMIT, response_format: typing.Optional[ResponseFormatV2] = OMIT, safety_mode: typing.Optional[V2ChatStreamRequestSafetyMode] = OMIT, max_tokens: typing.Optional[int] = OMIT, @@ -1185,6 +1202,12 @@ async def chat_stream( citation_options : typing.Optional[CitationOptions] + raw_prompting : typing.Optional[bool] + When enabled, the user's prompt will be sent to the model without + any pre-processing. + + Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + response_format : typing.Optional[ResponseFormatV2] safety_mode : typing.Optional[V2ChatStreamRequestSafetyMode] @@ -1272,6 +1295,7 @@ async def chat_stream( "citation_options": convert_and_respect_annotation_metadata( object_=citation_options, annotation=CitationOptions, direction="write" ), + "raw_prompting": raw_prompting, "response_format": convert_and_respect_annotation_metadata( object_=response_format, annotation=ResponseFormatV2, direction="write" ), @@ -1468,6 +1492,7 @@ async def chat( strict_tools: typing.Optional[bool] = OMIT, documents: typing.Optional[typing.Sequence[V2ChatRequestDocumentsItem]] = OMIT, citation_options: typing.Optional[CitationOptions] = OMIT, + raw_prompting: typing.Optional[bool] = OMIT, response_format: typing.Optional[ResponseFormatV2] = OMIT, safety_mode: typing.Optional[V2ChatRequestSafetyMode] = OMIT, max_tokens: typing.Optional[int] = OMIT, @@ -1509,6 +1534,12 @@ async def chat( citation_options : typing.Optional[CitationOptions] + raw_prompting : typing.Optional[bool] + When enabled, the user's prompt will be sent to the model without + any pre-processing. + + Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + response_format : typing.Optional[ResponseFormatV2] safety_mode : typing.Optional[V2ChatRequestSafetyMode] @@ -1596,6 +1627,7 @@ async def chat( "citation_options": convert_and_respect_annotation_metadata( object_=citation_options, annotation=CitationOptions, direction="write" ), + "raw_prompting": raw_prompting, "response_format": convert_and_respect_annotation_metadata( object_=response_format, annotation=ResponseFormatV2, direction="write" ), From 3dcf677c02742bcb4e57515c301e3b886e4b6bb7 Mon Sep 17 00:00:00 2001 From: Billy Trend Date: Mon, 4 Aug 2025 13:35:11 +0100 Subject: [PATCH 2/8] Update ci --- .github/workflows/ci.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dab59dbf9..6346ce3d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,13 +71,12 @@ jobs: poetry install --with test,test_integration echo "Going to uninstall cohere package, and install the current version from the repo" - cd ../../../cohere-python && echo "Current dir $(pwd)" - echo "Current dir $(ls)" - pip uninstall cohere - pip install . + + poetry remove cohere + poetry add ../../../cohere-python cd ../langchain-cohere/libs/cohere - echo "Current cohere installation: $(pip freeze | grep cohere)" + echo "Current cohere installation: $(poetry show cohere)" make test make integration_test echo "tests passed" From 7e5a223685f40ccfb57223f8edfc99818d9e8ce0 Mon Sep 17 00:00:00 2001 From: Billy Trend Date: Mon, 4 Aug 2025 13:37:31 +0100 Subject: [PATCH 3/8] Don't cd --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6346ce3d4..eb79943f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,7 +74,6 @@ jobs: poetry remove cohere poetry add ../../../cohere-python - cd ../langchain-cohere/libs/cohere echo "Current cohere installation: $(poetry show cohere)" make test From 87e9f0606b7ad7df79a2ad305353cf4e31be17e4 Mon Sep 17 00:00:00 2001 From: Billy Trend Date: Mon, 4 Aug 2025 13:48:26 +0100 Subject: [PATCH 4/8] Enhance CI workflow to ignore changes in poetry.lock and pyproject.toml for clean working tree checks --- .github/workflows/ci.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb79943f8..a9907190d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,9 +85,15 @@ jobs: STATUS="$(git status)" echo "$STATUS" - # grep will exit non-zero if the target message isn't found, - # and `set -e` above will cause the step to fail. - echo "$STATUS" | grep 'nothing to commit, working tree clean' + # Ignore changes to poetry.lock and pyproject.toml when checking for a clean working tree + CHANGED=$(git status --porcelain | grep -vE 'poetry.lock|pyproject.toml') + if [ -z "$CHANGED" ]; then + echo "No relevant changes detected." + else + echo "Unexpected changes detected:" + echo "$CHANGED" + exit 1 + fi env: COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }} From d3484d426d57d49ebc1aee63f0a100670aae966f Mon Sep 17 00:00:00 2001 From: Billy Trend Date: Mon, 4 Aug 2025 13:51:19 +0100 Subject: [PATCH 5/8] Update CI workflow to only fail on relevant changes, ignoring poetry.lock and pyproject.toml --- .github/workflows/ci.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a9907190d..d38e89af8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,13 +82,11 @@ jobs: set -eu - STATUS="$(git status)" - echo "$STATUS" - - # Ignore changes to poetry.lock and pyproject.toml when checking for a clean working tree + # Only fail if there are changes other than poetry.lock and pyproject.toml CHANGED=$(git status --porcelain | grep -vE 'poetry.lock|pyproject.toml') if [ -z "$CHANGED" ]; then echo "No relevant changes detected." + exit 0 else echo "Unexpected changes detected:" echo "$CHANGED" From 360106b3ca1d5115d967dc28af3c4896d1c1bba1 Mon Sep 17 00:00:00 2001 From: Billy Trend Date: Mon, 4 Aug 2025 13:54:31 +0100 Subject: [PATCH 6/8] Remove unnecessary set -eu command from CI workflow --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d38e89af8..70d90000b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,8 +80,6 @@ jobs: make integration_test echo "tests passed" - set -eu - # Only fail if there are changes other than poetry.lock and pyproject.toml CHANGED=$(git status --porcelain | grep -vE 'poetry.lock|pyproject.toml') if [ -z "$CHANGED" ]; then From 9e298a5d8e714298b633f1095cef77e50da95ec0 Mon Sep 17 00:00:00 2001 From: Billy Trend Date: Mon, 4 Aug 2025 13:57:56 +0100 Subject: [PATCH 7/8] Refactor CI workflow to reset poetry changes and improve clean working tree checks --- .github/workflows/ci.yml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70d90000b..2167c5bc0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,22 +74,24 @@ jobs: poetry remove cohere poetry add ../../../cohere-python + cd ../langchain-cohere/libs/cohere echo "Current cohere installation: $(poetry show cohere)" make test make integration_test echo "tests passed" - # Only fail if there are changes other than poetry.lock and pyproject.toml - CHANGED=$(git status --porcelain | grep -vE 'poetry.lock|pyproject.toml') - if [ -z "$CHANGED" ]; then - echo "No relevant changes detected." - exit 0 - else - echo "Unexpected changes detected:" - echo "$CHANGED" - exit 1 - fi + # reset poetry changes + git checkout -- poetry.lock pyproject.toml + + set -eu + + STATUS="$(git status)" + echo "$STATUS" + + # grep will exit non-zero if the target message isn't found, + # and `set -e` above will cause the step to fail. + echo "$STATUS" | grep 'nothing to commit, working tree clean' env: COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }} From 10a5773bb45ded26b5ce628f20992e699a17c155 Mon Sep 17 00:00:00 2001 From: Billy Trend Date: Mon, 4 Aug 2025 13:59:20 +0100 Subject: [PATCH 8/8] Remove unnecessary directory change in langchain-cohere CI workflow --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2167c5bc0..c04552f43 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,7 +74,6 @@ jobs: poetry remove cohere poetry add ../../../cohere-python - cd ../langchain-cohere/libs/cohere echo "Current cohere installation: $(poetry show cohere)" make test