diff --git a/CHANGELOG.md b/CHANGELOG.md index 549142418..16fa33b43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 4.25 +- [#303] (https://github.com/cohere-ai/cohere-python/pull/303) + - Allow uploading of evaluation data + ## 4.24 - [#296] (https://github.com/cohere-ai/cohere-python/pull/296) - Allow passing of delimiter for csv diff --git a/cohere/client.py b/cohere/client.py index a23e2fcdb..47dfcd2d5 100644 --- a/cohere/client.py +++ b/cohere/client.py @@ -751,6 +751,7 @@ def create_dataset( name: str, data: BinaryIO, dataset_type: str, + eval_data: Optional[BinaryIO] = None, keep_fields: Union[str, List[str]] = None, optional_fields: Union[str, List[str]] = None, parse_info: Optional[ParseInfo] = None, @@ -761,6 +762,7 @@ def create_dataset( name (str): The name of your dataset data (BinaryIO): The data to be uploaded and validated dataset_type (str): The type of dataset you want to upload + eval_data (BinaryIO): (optional) If the dataset type supports it upload evaluation data keep_fields (Union[str, List[str]]): (optional) A list of fields you want to keep in the dataset that are required optional_fields (Union[str, List[str]]): (optional) A list of fields you want to keep in the dataset that are optional parse_info: ParseInfo: (optional) information on how to parse the raw data @@ -768,6 +770,8 @@ def create_dataset( Dataset: Dataset object. """ files = {"file": data} + if eval_data: + files["eval_file"] = eval_data params = { "name": name, "type": dataset_type, diff --git a/cohere/client_async.py b/cohere/client_async.py index e3cb2d9d3..ff983d55c 100644 --- a/cohere/client_async.py +++ b/cohere/client_async.py @@ -489,6 +489,7 @@ async def create_dataset( name: str, data: BinaryIO, dataset_type: str, + eval_data: Optional[BinaryIO] = None, keep_fields: Union[str, List[str]] = None, optional_fields: Union[str, List[str]] = None, parse_info: Optional[ParseInfo] = None, @@ -499,6 +500,7 @@ async def create_dataset( name (str): The name of your dataset data (BinaryIO): The data to be uploaded and validated dataset_type (str): The type of dataset you want to upload + eval_data (BinaryIO): (optional) If the dataset type supports it upload evaluation data keep_fields (Union[str, List[str]]): (optional) A list of fields you want to keep in the dataset that are required optional_fields (Union[str, List[str]]): (optional) A list of fields you want to keep in the dataset that are optional parse_info: ParseInfo: (optional) information on how to parse the raw data @@ -506,6 +508,8 @@ async def create_dataset( AsyncDataset: Dataset object. """ files = {"file": data} + if eval_data: + files["eval_file"] = eval_data params = { "name": name, "type": dataset_type, diff --git a/pyproject.toml b/pyproject.toml index 252606212..7d9b456eb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cohere" -version = "4.24" +version = "4.25" description = "" authors = ["Cohere"] readme = "README.md"