Skip to content

Commit

Permalink
update assistant type
Browse files Browse the repository at this point in the history
  • Loading branch information
ashpreetbedi committed Jan 9, 2024
1 parent 2163687 commit 2d9da05
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
3 changes: 0 additions & 3 deletions phi/agent/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@


class PythonAgent(Agent):
name: str = "python_agent"
description: str = "achieve tasks using Python code"

files: Optional[List[File]] = None
file_information: Optional[str] = None

Expand Down
8 changes: 4 additions & 4 deletions phi/assistant/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

try:
from openai import OpenAI
from openai.types.beta.assistant import Assistant as OpenAIAssistant
from openai.types.beta.assistant import Assistant as OpenAIAssistantType
from openai.types.beta.assistant_deleted import AssistantDeleted as OpenAIAssistantDeleted
except ImportError:
logger.error("`openai` not installed")
Expand Down Expand Up @@ -76,7 +76,7 @@ class Assistant(BaseModel):
# Enable monitoring on phidata.com
monitoring: bool = False

openai_assistant: Optional[OpenAIAssistant] = None
openai_assistant: Optional[OpenAIAssistantType] = None

model_config = ConfigDict(arbitrary_types_allowed=True)

Expand Down Expand Up @@ -112,7 +112,7 @@ def __enter__(self):
def __exit__(self, exc_type, exc_value, traceback):
self.delete()

def load_from_openai(self, openai_assistant: OpenAIAssistant):
def load_from_openai(self, openai_assistant: OpenAIAssistantType):
self.id = openai_assistant.id
self.object = openai_assistant.object
self.created_at = openai_assistant.created_at
Expand Down Expand Up @@ -169,7 +169,7 @@ def create(self) -> "Assistant":
def get_id(self) -> Optional[str]:
return self.id or self.openai_assistant.id if self.openai_assistant else None

def get_from_openai(self) -> OpenAIAssistant:
def get_from_openai(self) -> OpenAIAssistantType:
_assistant_id = self.get_id()
if _assistant_id is None:
raise AssistantIdNotSet("Assistant.id not set")
Expand Down
1 change: 0 additions & 1 deletion phi/conversation/conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,6 @@ def _run(self, message: Optional[Union[List[Dict], str]] = None, stream: bool =
"tasks": all_tasks_meta_data,
"messages": [m.model_dump(exclude_none=True) for m in all_tasks_messages if m is not None],
"references": [r.model_dump(exclude_none=True) for r in all_tasks_references if r is not None],
"markdown": self.markdown,
}
event_data = {
"user_message": message,
Expand Down

0 comments on commit 2d9da05

Please sign in to comment.