-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement "tool" and "file" capabilities
Still not completely finished, currently a work in progress
- Loading branch information
1 parent
82b8e53
commit fa40ab2
Showing
4 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from .message import Conversation | ||
|
||
|
||
class File: | ||
''' | ||
Class used to represent files created by the model | ||
''' | ||
|
||
def __init__(self, sha: str, name: str, mime: str, conversation: Conversation): | ||
self.sha = sha | ||
self.name = name | ||
self.mime = mime | ||
|
||
self.conversation = conversation | ||
self.url = self.get_url() | ||
|
||
def get_url(self) -> str: | ||
print(self.conversation) | ||
print(dir(self.conversation)) | ||
print(self.conversation.id) | ||
return f"https://huggingface.co/chat/conversation/{self.conversation.id}/output/{self.sha}" | ||
|
||
def __str__(self) -> str: | ||
return f"File(url={self.url}, sha={self.sha}, name={self.name}, mime={self.mime})" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class Tool: | ||
''' | ||
Class used to represent tools used by the model | ||
''' | ||
|
||
uuid: str | ||
result: str | ||
|
||
def __str__(self) -> str: | ||
return f"Tool(uuid={self.uuid}, result={self.result})" |