Skip to content

Commit

Permalink
Add asset_type into the DocumentChunkAsset struct (#63)
Browse files Browse the repository at this point in the history
This PR adds the asset_type field to the assets to make it possible to
identify what the assets contain.
  • Loading branch information
artemiyatcohere authored Dec 13, 2024
1 parent d7a896b commit 14514bf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
14 changes: 14 additions & 0 deletions cohere/compass/models/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -134,6 +147,7 @@ def status(self) -> CompassDocumentStatus:


class DocumentChunkAsset(BaseModel):
asset_type: AssetType
content_type: str
asset_data: str

Expand Down
2 changes: 2 additions & 0 deletions cohere/compass/models/search.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "compass-sdk"
version = "0.9.4"
version = "0.10.0"
authors = []
description = "Compass SDK"
readme = "README.md"
Expand Down

0 comments on commit 14514bf

Please sign in to comment.