More assistant events (#18032)

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2024-09-18 18:07:39 -06:00 committed by GitHub
parent eef44aff7f
commit b43b800a54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 66 additions and 5 deletions

View file

@ -44,7 +44,6 @@ pub enum AssistantKind {
Panel,
Inline,
}
impl Display for AssistantKind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
@ -58,6 +57,31 @@ impl Display for AssistantKind {
}
}
#[derive(Default, Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum AssistantPhase {
#[default]
Response,
Invoked,
Accepted,
Rejected,
}
impl Display for AssistantPhase {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
match self {
Self::Response => "response",
Self::Invoked => "invoked",
Self::Accepted => "accepted",
Self::Rejected => "rejected",
}
)
}
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
pub enum Event {
@ -121,6 +145,8 @@ pub struct AssistantEvent {
pub conversation_id: Option<String>,
/// The kind of assistant (Panel, Inline)
pub kind: AssistantKind,
#[serde(default)]
pub phase: AssistantPhase,
/// Name of the AI model used (gpt-4o, claude-3-5-sonnet, etc)
pub model: String,
pub response_latency: Option<Duration>,