Skip to content

Commit

Permalink
🌿 Fern Regeneration -- December 20, 2024 (#624)
Browse files Browse the repository at this point in the history
* SDK regeneration

* Fixes

* Update error

* Fix CI

* ignore type

* aws deps

---------

Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
Co-authored-by: Billy Trend <billy@cohere.com>
  • Loading branch information
fern-api[bot] and billytrend-cohere authored Dec 20, 2024
1 parent 05fe9e7 commit bb92887
Show file tree
Hide file tree
Showing 10 changed files with 172 additions and 1,144 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ jobs:
version: 1.5.1
virtualenvs-in-project: false
- name: Install dependencies
run: poetry install --extras aws
run: poetry install
- name: Install aws deps
run: poetry run pip install boto3 sagemaker botocore
- name: Test
run: poetry run pytest .
env:
Expand Down
1,251 changes: 128 additions & 1,123 deletions poetry.lock

Large diffs are not rendered by default.

8 changes: 1 addition & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cohere"
version = "5.13.3"
version = "5.13.4"
description = ""
readme = "README.md"
authors = []
Expand Down Expand Up @@ -32,16 +32,13 @@ Repository = 'https://github.com/cohere-ai/cohere-python'

[tool.poetry.dependencies]
python = "^3.9"
boto3 = { version="^1.34.0", optional = true}
fastavro = "^1.9.4"
httpx = ">=0.21.2"
httpx-sse = "0.4.0"
parameterized = "^0.9.0"
pydantic = ">= 1.9.2"
pydantic-core = "^2.18.2"
requests = "^2.0.0"
sagemaker = { version="^2.232.1", optional = true}
numpy = { version="^1.26", optional = true}
tokenizers = ">=0.15,<1"
types-requests = "^2.0.0"
typing_extensions = ">= 4.0.0"
Expand Down Expand Up @@ -69,6 +66,3 @@ line-length = 120
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.extras]
aws=["sagemaker", "boto3"]
16 changes: 12 additions & 4 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ With `prompt_truncation` set to "AUTO_PRESERVE_ORDER", some elements from `chat_

With `prompt_truncation` set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a `TooManyTokens` error will be returned.

Compatible Deployments:
Compatible Deployments:
- AUTO: Cohere Platform Only
- AUTO_PRESERVE_ORDER: Azure, AWS Sagemaker/Bedrock, Private Deployments

Expand Down Expand Up @@ -537,6 +537,8 @@ Safety modes are not yet configurable in combination with `tools`, `tool_results

**Note**: This parameter is only compatible with models [Command R 08-2024](https://docs.cohere.com/docs/command-r#august-2024-release), [Command R+ 08-2024](https://docs.cohere.com/docs/command-r-plus#august-2024-release) and newer.

**Note**: `command-r7b-12-2024` only supports `"CONTEXTUAL"` and `"STRICT"` modes.

Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments


Expand Down Expand Up @@ -708,7 +710,7 @@ With `prompt_truncation` set to "AUTO_PRESERVE_ORDER", some elements from `chat_

With `prompt_truncation` set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a `TooManyTokens` error will be returned.

Compatible Deployments:
Compatible Deployments:
- AUTO: Cohere Platform Only
- AUTO_PRESERVE_ORDER: Azure, AWS Sagemaker/Bedrock, Private Deployments

Expand Down Expand Up @@ -1022,6 +1024,8 @@ Safety modes are not yet configurable in combination with `tools`, `tool_results

**Note**: This parameter is only compatible with models [Command R 08-2024](https://docs.cohere.com/docs/command-r#august-2024-release), [Command R+ 08-2024](https://docs.cohere.com/docs/command-r-plus#august-2024-release) and newer.

**Note**: `command-r7b-12-2024` only supports `"CONTEXTUAL"` and `"STRICT"` modes.

Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments


Expand Down Expand Up @@ -2431,7 +2435,7 @@ When `tools` is passed (without `tool_results`), the `text` content in the respo

**strict_tools:** `typing.Optional[bool]`

When set to `true`, tool calls in the Assistant message will be forced to follow the tool definition strictly. Learn more in the [Strict Tools guide](https://docs.cohere.com/docs/structured-outputs-json#structured-outputs-tools).
When set to `true`, tool calls in the Assistant message will be forced to follow the tool definition strictly. Learn more in the [Structured Outputs (Tools) guide](https://docs.cohere.com/docs/structured-outputs-json#structured-outputs-tools).

**Note**: The first few requests with a new set of tools will take longer to process.

Expand Down Expand Up @@ -2476,6 +2480,8 @@ Safety modes are not yet configurable in combination with `tools`, `tool_results

**Note**: This parameter is only compatible with models [Command R 08-2024](https://docs.cohere.com/v2/docs/command-r#august-2024-release), [Command R+ 08-2024](https://docs.cohere.com/v2/docs/command-r-plus#august-2024-release) and newer.

**Note**: `command-r7b-12-2024` only supports `"CONTEXTUAL"` and `"STRICT"` modes.


</dd>
</dl>
Expand Down Expand Up @@ -2701,7 +2707,7 @@ When `tools` is passed (without `tool_results`), the `text` content in the respo

**strict_tools:** `typing.Optional[bool]`

When set to `true`, tool calls in the Assistant message will be forced to follow the tool definition strictly. Learn more in the [Strict Tools guide](https://docs.cohere.com/docs/structured-outputs-json#structured-outputs-tools).
When set to `true`, tool calls in the Assistant message will be forced to follow the tool definition strictly. Learn more in the [Structured Outputs (Tools) guide](https://docs.cohere.com/docs/structured-outputs-json#structured-outputs-tools).

**Note**: The first few requests with a new set of tools will take longer to process.

Expand Down Expand Up @@ -2746,6 +2752,8 @@ Safety modes are not yet configurable in combination with `tools`, `tool_results

**Note**: This parameter is only compatible with models [Command R 08-2024](https://docs.cohere.com/v2/docs/command-r#august-2024-release), [Command R+ 08-2024](https://docs.cohere.com/v2/docs/command-r-plus#august-2024-release) and newer.

**Note**: `command-r7b-12-2024` only supports `"CONTEXTUAL"` and `"STRICT"` modes.


</dd>
</dl>
Expand Down
8 changes: 8 additions & 0 deletions src/cohere/base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,8 @@ def chat_stream(
**Note**: This parameter is only compatible with models [Command R 08-2024](https://docs.cohere.com/docs/command-r#august-2024-release), [Command R+ 08-2024](https://docs.cohere.com/docs/command-r-plus#august-2024-release) and newer.
**Note**: `command-r7b-12-2024` only supports `"CONTEXTUAL"` and `"STRICT"` modes.
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
Expand Down Expand Up @@ -974,6 +976,8 @@ def chat(
**Note**: This parameter is only compatible with models [Command R 08-2024](https://docs.cohere.com/docs/command-r#august-2024-release), [Command R+ 08-2024](https://docs.cohere.com/docs/command-r-plus#august-2024-release) and newer.
**Note**: `command-r7b-12-2024` only supports `"CONTEXTUAL"` and `"STRICT"` modes.
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
Expand Down Expand Up @@ -3418,6 +3422,8 @@ async def chat_stream(
**Note**: This parameter is only compatible with models [Command R 08-2024](https://docs.cohere.com/docs/command-r#august-2024-release), [Command R+ 08-2024](https://docs.cohere.com/docs/command-r-plus#august-2024-release) and newer.
**Note**: `command-r7b-12-2024` only supports `"CONTEXTUAL"` and `"STRICT"` modes.
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
Expand Down Expand Up @@ -3977,6 +3983,8 @@ async def chat(
**Note**: This parameter is only compatible with models [Command R 08-2024](https://docs.cohere.com/docs/command-r#august-2024-release), [Command R+ 08-2024](https://docs.cohere.com/docs/command-r-plus#august-2024-release) and newer.
**Note**: `command-r7b-12-2024` only supports `"CONTEXTUAL"` and `"STRICT"` modes.
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
Expand Down
2 changes: 1 addition & 1 deletion src/cohere/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "cohere",
"X-Fern-SDK-Version": "5.13.3",
"X-Fern-SDK-Version": "5.13.4",
}
if self._client_name is not None:
headers["X-Client-Name"] = self._client_name
Expand Down
7 changes: 4 additions & 3 deletions src/cohere/manually_maintained/lazy_aws_deps.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@

warning = "AWS dependencies are not installed. Please install boto3, botocore, and sagemaker."

def lazy_sagemaker():
try:
import sagemaker as sage # type: ignore
return sage
except ImportError:
raise ImportError("Sagemaker not available. Please install sagemaker.")
raise ImportError(warning)

def lazy_boto3():
try:
import boto3 # type: ignore
return boto3
except ImportError:
raise ImportError("Boto3 not available. Please install lazy_boto3().")
raise ImportError(warning)

def lazy_botocore():
try:
import botocore # type: ignore
return botocore
except ImportError:
raise ImportError("Botocore not available. Please install botocore.")
raise ImportError(warning)

2 changes: 2 additions & 0 deletions src/cohere/types/citation_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class CitationOptions(UncheckedBaseModel):
"""
Defaults to `"accurate"`.
Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results, `"fast"` results or no results.
**Note**: `command-r7b-12-2024` only supports `"fast"` and `"off"` modes. Its default is `"fast"`.
"""

if IS_PYDANTIC_V2:
Expand Down
2 changes: 1 addition & 1 deletion src/cohere/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def dataset_generator(dataset: Dataset):
if not part.url:
raise ValueError("Dataset part does not have a url")
resp = requests.get(part.url, stream=True)
for record in reader(resp.raw):
for record in reader(resp.raw): # type: ignore
yield record


Expand Down
16 changes: 12 additions & 4 deletions src/cohere/v2/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def chat_stream(
strict_tools : typing.Optional[bool]
When set to `true`, tool calls in the Assistant message will be forced to follow the tool definition strictly. Learn more in the [Strict Tools guide](https://docs.cohere.com/docs/structured-outputs-json#structured-outputs-tools).
When set to `true`, tool calls in the Assistant message will be forced to follow the tool definition strictly. Learn more in the [Structured Outputs (Tools) guide](https://docs.cohere.com/docs/structured-outputs-json#structured-outputs-tools).
**Note**: The first few requests with a new set of tools will take longer to process.
Expand All @@ -113,6 +113,8 @@ def chat_stream(
**Note**: This parameter is only compatible with models [Command R 08-2024](https://docs.cohere.com/v2/docs/command-r#august-2024-release), [Command R+ 08-2024](https://docs.cohere.com/v2/docs/command-r-plus#august-2024-release) and newer.
**Note**: `command-r7b-12-2024` only supports `"CONTEXTUAL"` and `"STRICT"` modes.
max_tokens : typing.Optional[int]
The maximum number of tokens the model will generate as part of the response.
Expand Down Expand Up @@ -436,7 +438,7 @@ def chat(
strict_tools : typing.Optional[bool]
When set to `true`, tool calls in the Assistant message will be forced to follow the tool definition strictly. Learn more in the [Strict Tools guide](https://docs.cohere.com/docs/structured-outputs-json#structured-outputs-tools).
When set to `true`, tool calls in the Assistant message will be forced to follow the tool definition strictly. Learn more in the [Structured Outputs (Tools) guide](https://docs.cohere.com/docs/structured-outputs-json#structured-outputs-tools).
**Note**: The first few requests with a new set of tools will take longer to process.
Expand All @@ -457,6 +459,8 @@ def chat(
**Note**: This parameter is only compatible with models [Command R 08-2024](https://docs.cohere.com/v2/docs/command-r#august-2024-release), [Command R+ 08-2024](https://docs.cohere.com/v2/docs/command-r-plus#august-2024-release) and newer.
**Note**: `command-r7b-12-2024` only supports `"CONTEXTUAL"` and `"STRICT"` modes.
max_tokens : typing.Optional[int]
The maximum number of tokens the model will generate as part of the response.
Expand Down Expand Up @@ -1166,7 +1170,7 @@ async def chat_stream(
strict_tools : typing.Optional[bool]
When set to `true`, tool calls in the Assistant message will be forced to follow the tool definition strictly. Learn more in the [Strict Tools guide](https://docs.cohere.com/docs/structured-outputs-json#structured-outputs-tools).
When set to `true`, tool calls in the Assistant message will be forced to follow the tool definition strictly. Learn more in the [Structured Outputs (Tools) guide](https://docs.cohere.com/docs/structured-outputs-json#structured-outputs-tools).
**Note**: The first few requests with a new set of tools will take longer to process.
Expand All @@ -1187,6 +1191,8 @@ async def chat_stream(
**Note**: This parameter is only compatible with models [Command R 08-2024](https://docs.cohere.com/v2/docs/command-r#august-2024-release), [Command R+ 08-2024](https://docs.cohere.com/v2/docs/command-r-plus#august-2024-release) and newer.
**Note**: `command-r7b-12-2024` only supports `"CONTEXTUAL"` and `"STRICT"` modes.
max_tokens : typing.Optional[int]
The maximum number of tokens the model will generate as part of the response.
Expand Down Expand Up @@ -1518,7 +1524,7 @@ async def chat(
strict_tools : typing.Optional[bool]
When set to `true`, tool calls in the Assistant message will be forced to follow the tool definition strictly. Learn more in the [Strict Tools guide](https://docs.cohere.com/docs/structured-outputs-json#structured-outputs-tools).
When set to `true`, tool calls in the Assistant message will be forced to follow the tool definition strictly. Learn more in the [Structured Outputs (Tools) guide](https://docs.cohere.com/docs/structured-outputs-json#structured-outputs-tools).
**Note**: The first few requests with a new set of tools will take longer to process.
Expand All @@ -1539,6 +1545,8 @@ async def chat(
**Note**: This parameter is only compatible with models [Command R 08-2024](https://docs.cohere.com/v2/docs/command-r#august-2024-release), [Command R+ 08-2024](https://docs.cohere.com/v2/docs/command-r-plus#august-2024-release) and newer.
**Note**: `command-r7b-12-2024` only supports `"CONTEXTUAL"` and `"STRICT"` modes.
max_tokens : typing.Optional[int]
The maximum number of tokens the model will generate as part of the response.
Expand Down

0 comments on commit bb92887

Please sign in to comment.