From c800f4451e2e0ffae03106a9a64f6d4eecee758b Mon Sep 17 00:00:00 2001 From: Raphael Cristal Date: Thu, 14 Sep 2023 13:53:27 +0200 Subject: [PATCH 1/3] add eval data --- cohere/client.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cohere/client.py b/cohere/client.py index a23e2fcdb..9f5383efc 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, @@ -768,6 +769,8 @@ def create_dataset( Dataset: Dataset object. """ files = {"file": data} + if eval_data: + files["eval_file"] = eval_data params = { "name": name, "type": dataset_type, From 81767982a334b0e53f519812e0d4c99823da964a Mon Sep 17 00:00:00 2001 From: Raphael Cristal Date: Thu, 14 Sep 2023 14:45:53 +0200 Subject: [PATCH 2/3] add async --- cohere/client.py | 1 + cohere/client_async.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/cohere/client.py b/cohere/client.py index 9f5383efc..47dfcd2d5 100644 --- a/cohere/client.py +++ b/cohere/client.py @@ -762,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 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, From 8a0ebb28e0f7fdd10918c47d1b4209c272d00350 Mon Sep 17 00:00:00 2001 From: Raphael Cristal Date: Thu, 14 Sep 2023 14:48:39 +0200 Subject: [PATCH 3/3] changelog + bump version --- CHANGELOG.md | 4 ++++ pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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/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"