|
2 | 2 | import base64 |
3 | 3 | import json |
4 | 4 | import threading |
5 | | -from typing import Callable, Optional, Awaitable, Union, Any, Literal |
| 5 | +from typing import Callable, Optional, Awaitable, Union, Any, Literal, Dict, Tuple |
6 | 6 | import asyncio |
7 | 7 | from concurrent.futures import ThreadPoolExecutor |
8 | 8 | from enum import Enum |
@@ -119,7 +119,7 @@ class ClientTools: |
119 | 119 | """ |
120 | 120 |
|
121 | 121 | def __init__(self) -> None: |
122 | | - self.tools: dict[str, tuple[Union[Callable[[dict], Any], Callable[[dict], Awaitable[Any]]], bool]] = {} |
| 122 | + self.tools: Dict[str, Tuple[Union[Callable[[dict], Any], Callable[[dict], Awaitable[Any]]], bool]] = {} |
123 | 123 | self.lock = threading.Lock() |
124 | 124 | self._loop = None |
125 | 125 | self._thread = None |
@@ -296,11 +296,10 @@ def __init__( |
296 | 296 | self.client_tools.start() |
297 | 297 |
|
298 | 298 | self._thread = None |
299 | | - self._ws: Optional[ClientConnection] = None |
| 299 | + self._ws: Optional[Connection] = None |
300 | 300 | self._should_stop = threading.Event() |
301 | 301 | self._conversation_id = None |
302 | 302 | self._last_interrupt_id = 0 |
303 | | - self._ws = None |
304 | 303 |
|
305 | 304 | def start_session(self): |
306 | 305 | """Starts the conversation session. |
@@ -491,16 +490,6 @@ def send_response(response): |
491 | 490 | else: |
492 | 491 | pass # Ignore all other message types. |
493 | 492 |
|
494 | | - def send_contextual_update(self, text: str): |
495 | | - if not self._ws: |
496 | | - raise RuntimeError("WebSocket is not connected") |
497 | | - |
498 | | - payload = { |
499 | | - "type": "contextual_update", |
500 | | - "text": text, |
501 | | - } |
502 | | - self._ws.send(json.dumps(payload)) |
503 | | - |
504 | 493 | def _get_wss_url(self): |
505 | 494 | base_ws_url = self.client._client_wrapper.get_environment().wss |
506 | 495 | return f"{base_ws_url}/v1/convai/conversation?agent_id={self.agent_id}" |
|
0 commit comments