-
Notifications
You must be signed in to change notification settings - Fork 770
Emit errors from open ai realtime model #1968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
✅ Changeset File DetectedThe following changeset entries were found:
Change description: |
type: Literal["realtime_model_error"] = "realtime_model_error" | ||
timestamp: float | ||
label: str | ||
error: any = Field(..., exclude=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to wrap this with our own Error class (similar to APIError). Just not a lot of structure in the errors from the different web socket events in the realtime models.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can still use APIError. There is the message field, I think it's OK
livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/realtime/realtime_model.py
Outdated
Show resolved
Hide resolved
type: Literal["realtime_model_error"] = "realtime_model_error" | ||
timestamp: float | ||
label: str | ||
error: any = Field(..., exclude=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can still use APIError. There is the message field, I think it's OK
@@ -318,7 +319,17 @@ async def _recv_task() -> None: | |||
msg = await ws_conn.receive() | |||
if msg.type == aiohttp.WSMsgType.CLOSED: | |||
if not closing: | |||
raise Exception("OpenAI S2S connection closed unexpectedly") | |||
error = Exception("OpenAI S2S connection closed unexpectedly") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be APIConnectionError here?
type="realtime_model_error", | ||
timestamp=time.time(), | ||
label=self._realtime_model._label, | ||
error=event.error, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's be consistent and give an Exception here, let's use APIError?
we may not have all the details, but I think it's fine for now
…e-model-error-handling
…vekit/agents into shubhra/realtime-model-error-handling
@@ -16,6 +17,7 @@ | |||
|
|||
from livekit import rtc | |||
from livekit.agents import io, llm, utils | |||
from livekit.agents._exceptions import APIConnectionError, APIError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from livekit.agents._exceptions import APIConnectionError, APIError | |
from livekit.agents import APIConnectionError, APIError |
No description provided.