From b2915ed077ab29ca70bf99601cfa96528c853c70 Mon Sep 17 00:00:00 2001 From: Dirk Brand Date: Sat, 21 Dec 2024 09:43:05 +0200 Subject: [PATCH] Style fixes --- cookbook/tools/zoom_tools.py | 9 ++++++--- phi/model/cohere/chat.py | 8 ++++---- phi/tools/calcom.py | 2 +- phi/tools/github.py | 2 +- phi/tools/zoom.py | 2 +- phi/vectordb/qdrant/qdrant.py | 2 +- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/cookbook/tools/zoom_tools.py b/cookbook/tools/zoom_tools.py index fa45119ab..1d5f1a595 100644 --- a/cookbook/tools/zoom_tools.py +++ b/cookbook/tools/zoom_tools.py @@ -31,10 +31,10 @@ def get_access_token(self) -> str: """ Obtain or refresh the access token for Zoom API. - to get the account_id ,client_id ,client_secret + To get the account_id, client_id, client_secret https://developers.zoom.us/docs/internal-apps/create/ - for oauth 2.0 + For oauth 2.0 https://developers.zoom.us/docs/integrations/oauth/ Returns: A string containing the access token or an empty string if token retrieval fails. @@ -47,7 +47,10 @@ def get_access_token(self) -> str: try: response = requests.post( - self.token_url, headers=headers, data=data, auth=(self.client_id, self.client_secret) + self.token_url, + headers=headers, + data=data, + auth=(self.client_id, self.client_secret), # type: ignore ) response.raise_for_status() diff --git a/phi/model/cohere/chat.py b/phi/model/cohere/chat.py index eae45cc66..6e3945c55 100644 --- a/phi/model/cohere/chat.py +++ b/phi/model/cohere/chat.py @@ -12,7 +12,7 @@ from phi.utils.tools import get_function_call_for_tool_call try: - from cohere import Client as CohereClient + from cohere import Client as CohereClient, ToolCall from cohere.types.tool import Tool as CohereTool from cohere.types.non_streamed_chat_response import NonStreamedChatResponse from cohere.types.streamed_chat_response import ( @@ -286,7 +286,7 @@ def _handle_tool_calls( self, assistant_message: Message, messages: List[Message], - response_tool_calls: List[Any], + response_tool_calls: List[ToolCall], model_response: ModelResponse, ) -> Optional[Any]: """ @@ -295,7 +295,7 @@ def _handle_tool_calls( Args: assistant_message (Message): The assistant message. messages (List[Message]): The list of messages. - response_tool_calls (List[Any]): The list of response tool calls. + response_tool_calls (List[ToolCall]): The list of response tool calls. model_response (ModelResponse): The model response. Returns: @@ -420,7 +420,7 @@ def response(self, messages: List[Message], tool_results: Optional[List[ToolResu tool_results = self._handle_tool_calls( assistant_message=assistant_message, messages=messages, - response_tool_calls=response_tool_calls, + response_tool_calls=response_tool_calls, # type: ignore model_response=model_response, ) diff --git a/phi/tools/calcom.py b/phi/tools/calcom.py index b3407e767..6ee9fa182 100644 --- a/phi/tools/calcom.py +++ b/phi/tools/calcom.py @@ -110,7 +110,7 @@ def get_available_slots( "eventTypeId": self.event_type_id, } - response = requests.get(url, headers=self._get_headers(), params=querystring) + response = requests.get(url, headers=self._get_headers(), params=querystring) # type: ignore if response.status_code == 200: slots = response.json()["data"]["slots"] available_slots = [] diff --git a/phi/tools/github.py b/phi/tools/github.py index 823de67a3..c54ab10ad 100644 --- a/phi/tools/github.py +++ b/phi/tools/github.py @@ -48,7 +48,7 @@ def __init__( def authenticate(self): """Authenticate with GitHub using the provided access token.""" - auth = Auth.Token(self.access_token) + auth = Auth.Token(self.access_token) # type: ignore if self.base_url: logger.debug(f"Authenticating with GitHub Enterprise at {self.base_url}") return Github(base_url=self.base_url, auth=auth) diff --git a/phi/tools/zoom.py b/phi/tools/zoom.py index 1c332a01a..dfe6d8327 100644 --- a/phi/tools/zoom.py +++ b/phi/tools/zoom.py @@ -123,7 +123,7 @@ def get_upcoming_meetings(self, user_id: str = "me") -> str: params = {"type": "upcoming", "page_size": 30} try: - response = requests.get(url, headers=headers, params=params) + response = requests.get(url, headers=headers, params=params) # type: ignore response.raise_for_status() meetings = response.json() diff --git a/phi/vectordb/qdrant/qdrant.py b/phi/vectordb/qdrant/qdrant.py index 79a7d386c..b58098c09 100644 --- a/phi/vectordb/qdrant/qdrant.py +++ b/phi/vectordb/qdrant/qdrant.py @@ -83,7 +83,7 @@ def client(self) -> QdrantClient: https=self.https, api_key=self.api_key, prefix=self.prefix, - timeout=self.timeout, + timeout=self.timeout, # type: ignore host=self.host, path=self.path, **self.kwargs,