**Major Improvements to the overall performance!!!**
> IMPORTANT: Now all the init files are cleared so to import a model you need to import it from the respective file
Example:
- Instead of
python
from pieces_os_client import Asset
- Use
python
from pieces_os_client.models.asset import Asset
Updates
- New class `BasicAnnotation`: `annotation.id` , `BasicAnnotation.from_id`, `annotation.type`, `annotation.raw_content` (setter and getter), `annotation. asset`, `annotation.chat`, `BasicAnnotation.create_annotation`, `annotation.delete()`, `BasicAnnotation.create()`
- New class `BasicTag`: `BasicTag.from_raw_content`, `BasicTag.create()`, `tag.id`, `tag.raw_content` (setter and getter), `tag.assets`, `tag.disassociate_asset`, `tag.associate_asset`, `tag.delete()`, `BasicTag.from_id()`, `BasicTag.exists`
- New class `BasicWebsite`: `BasicWebsite.from_raw_content`, `BasicWebsite.create`, `website.id`, `website.url` (setter and getter), `BasicWebsite.exists`, `website.name` (setter and getter), `wesbite.chats`, `website.assets`, `website.disassociate_asset`, `website.associate_asset`, `website.disassociate_chat`, `website.associate_chat`, `website.delete()`, `BasicWebsite.from_id()`
- New properties: `asset.markdown`, `message.chat`, `asset.tags`, `chat.summary`, `asset.websites`, `chat.websites`
- Added some more unittests by sambhavnoobcoder many thanks to him for his contributions
Deprecated
- `chat.description` use `chat.summary` instead
- `chat.annotations` and `assets.annotations` return BasicAnnotation instead of Annotation objects
Issues fixed
- 64
- 47
Example to the new stuff added
python
from pieces_os_client.wrapper import PiecesClient
client = PiecesClient()
ASSETS
assets = client.assets()
for asset in assets:
annotations = asset.annotations or []
websites = asset.websites or []
tags = asset.tags or []
name = asset.name
print(f"Asset name: {name}")
print(f"Asset ID: {asset.id}")
print(
"Annotations:",
", ".join([annotation.raw_content
for annotation in annotations])
)
print(
"Websites: ",
", ".join([website.url
for website in websites])
)
print(
"Tags: ",
", ".join([tag.raw_content
for tag in tags])
)
print("=====================")
CHATS
chats = client.copilot.chats()
for chat in chats:
annotations = chat.annotations or []
websites = chat.websites or []
summary = chat.summary or ""
name = chat.name
print(f"Chat name: {name}")
print(f"Chat ID: {chat.id}")
print(f"Chat Summary: {summary.replace("\n", " ")}")
print(
"Annotations:",
", ".join([annotation.raw_content
for annotation in annotations])
)
print(
"Websites: ",
", ".join([website.url
for website in websites])
)
print("=====================")
Messages
messages = chats[0].messages() Getting random chat
for message in messages:
annotations = message.annotations or []
print(f"Message content: {message.raw_content}")
print(f"Message Role: {message.role}")
print(
"Annotations:",
", ".join([annotation.raw_content
for annotation in annotations])
)
client.close()