From 547fd6f83794f00a0d9207f4607159bb09a4d4e2 Mon Sep 17 00:00:00 2001 From: artemiyatcohere Date: Fri, 13 Dec 2024 14:19:46 +0000 Subject: [PATCH 1/3] Revert "Add asset_type field to the assets structures (#60)" (#66) This reverts commit 3a5d494a3b5c9389854de3897b0d5b1981340d0b. --- cohere/compass/models/documents.py | 13 ------------- cohere/compass/models/search.py | 3 --- 2 files changed, 16 deletions(-) diff --git a/cohere/compass/models/documents.py b/cohere/compass/models/documents.py index 585e589..daf1933 100644 --- a/cohere/compass/models/documents.py +++ b/cohere/compass/models/documents.py @@ -22,20 +22,7 @@ class CompassDocumentMetadata(ValidatedModel): parent_document_id: str = "" -class AssetType(str, Enum): - def __str__(self) -> str: - return self.value - - # A page that has been rendered as an image - PAGE_IMAGE = "page_image" - # A Markdown representation of a page's content - PAGE_MARKDOWN = "page_markdown" - # A dump of the text extracted from a document - DOCUMENT_TEXT = "document_text" - - class CompassDocumentChunkAsset(BaseModel): - asset_type: AssetType content_type: str asset_data: str diff --git a/cohere/compass/models/search.py b/cohere/compass/models/search.py index 8fe847a..9cbd8b2 100644 --- a/cohere/compass/models/search.py +++ b/cohere/compass/models/search.py @@ -5,11 +5,8 @@ # 3rd party imports from pydantic import BaseModel -from cohere.compass.models.documents import AssetType - class AssetInfo(BaseModel): - asset_type: AssetType content_type: str presigned_url: str From d7a896b0a8bf7488271d14578f9b5bfc5047727b Mon Sep 17 00:00:00 2001 From: artemiyatcohere Date: Fri, 13 Dec 2024 14:26:25 +0000 Subject: [PATCH 2/3] Pyproject version bump 0.9.3 to 0.9.4 (#67) This pull request updates the version of the `compass-sdk` package to `0.9.4`. - The `version` field in the `[tool.poetry]` section is updated from `0.9.3` to `0.9.4`. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d5c737d..d10f63a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "compass-sdk" -version = "0.9.3" +version = "0.9.4" authors = [] description = "Compass SDK" readme = "README.md" From 14514bf7ce3d0f95c477a1c9de109efc4f7b4627 Mon Sep 17 00:00:00 2001 From: artemiyatcohere Date: Fri, 13 Dec 2024 14:41:23 +0000 Subject: [PATCH 3/3] Add asset_type into the DocumentChunkAsset struct (#63) This PR adds the asset_type field to the assets to make it possible to identify what the assets contain. --- cohere/compass/models/documents.py | 14 ++++++++++++++ cohere/compass/models/search.py | 2 ++ pyproject.toml | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/cohere/compass/models/documents.py b/cohere/compass/models/documents.py index daf1933..ecccc73 100644 --- a/cohere/compass/models/documents.py +++ b/cohere/compass/models/documents.py @@ -22,7 +22,20 @@ class CompassDocumentMetadata(ValidatedModel): parent_document_id: str = "" +class AssetType(str, Enum): + def __str__(self) -> str: + return self.value + + # A page that has been rendered as an image + PAGE_IMAGE = "page_image" + # A Markdown representation of a page's content + PAGE_MARKDOWN = "page_markdown" + # A dump of the text extracted from a document + DOCUMENT_TEXT = "document_text" + + class CompassDocumentChunkAsset(BaseModel): + asset_type: AssetType content_type: str asset_data: str @@ -134,6 +147,7 @@ def status(self) -> CompassDocumentStatus: class DocumentChunkAsset(BaseModel): + asset_type: AssetType content_type: str asset_data: str diff --git a/cohere/compass/models/search.py b/cohere/compass/models/search.py index 9cbd8b2..8a3af34 100644 --- a/cohere/compass/models/search.py +++ b/cohere/compass/models/search.py @@ -1,12 +1,14 @@ # Python imports from enum import Enum from typing import Any, Dict, List, Optional +from cohere.compass.models.documents import AssetType # 3rd party imports from pydantic import BaseModel class AssetInfo(BaseModel): + asset_type: AssetType content_type: str presigned_url: str diff --git a/pyproject.toml b/pyproject.toml index d10f63a..c441d69 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "compass-sdk" -version = "0.9.4" +version = "0.10.0" authors = [] description = "Compass SDK" readme = "README.md"