nominal_api/proto/
nominal.ai.v1.rs

1// This file is @generated by prost-build.
2/// StreamChatRequest is a request to stream chat messages for workbook AI agent
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct StreamChatRequest {
5    #[prost(message, repeated, tag = "1")]
6    pub messages: ::prost::alloc::vec::Vec<ModelMessage>,
7    /// JSON-serialized representation of INotebook
8    #[prost(string, optional, tag = "2")]
9    pub notebook_as_json: ::core::option::Option<::prost::alloc::string::String>,
10    /// The current tab visible in the workbook from the user's perspective
11    #[prost(int32, optional, tag = "3")]
12    pub selected_tab_index: ::core::option::Option<i32>,
13    /// Optional: image files to provide to the agent
14    #[prost(message, repeated, tag = "4")]
15    pub images: ::prost::alloc::vec::Vec<ImagePart>,
16}
17/// ModelMessage is a discriminated union of system, user, assistant, and tool messages.
18/// Each message type has its own structure and content.
19#[derive(Clone, PartialEq, ::prost::Message)]
20pub struct ModelMessage {
21    #[prost(oneof = "model_message::Kind", tags = "1, 2")]
22    pub kind: ::core::option::Option<model_message::Kind>,
23}
24/// Nested message and enum types in `ModelMessage`.
25pub mod model_message {
26    #[derive(Clone, PartialEq, ::prost::Oneof)]
27    pub enum Kind {
28        #[prost(message, tag = "1")]
29        User(super::UserModelMessage),
30        #[prost(message, tag = "2")]
31        Assistant(super::AssistantModelMessage),
32    }
33}
34/// A user message containing text
35#[derive(Clone, PartialEq, ::prost::Message)]
36pub struct UserModelMessage {
37    #[prost(message, repeated, tag = "1")]
38    pub text: ::prost::alloc::vec::Vec<UserContentPart>,
39}
40/// An assistant message containing text
41#[derive(Clone, PartialEq, ::prost::Message)]
42pub struct AssistantModelMessage {
43    #[prost(message, repeated, tag = "1")]
44    pub content_parts: ::prost::alloc::vec::Vec<AssistantContentPart>,
45}
46#[derive(Clone, PartialEq, ::prost::Message)]
47pub struct UserContentPart {
48    #[prost(oneof = "user_content_part::Part", tags = "1")]
49    pub part: ::core::option::Option<user_content_part::Part>,
50}
51/// Nested message and enum types in `UserContentPart`.
52pub mod user_content_part {
53    #[derive(Clone, PartialEq, ::prost::Oneof)]
54    pub enum Part {
55        #[prost(message, tag = "1")]
56        Text(super::TextPart),
57    }
58}
59/// Content part for assistant messages: can be text, reasoning, or mutation.
60#[derive(Clone, PartialEq, ::prost::Message)]
61pub struct AssistantContentPart {
62    #[prost(oneof = "assistant_content_part::Part", tags = "1, 2")]
63    pub part: ::core::option::Option<assistant_content_part::Part>,
64}
65/// Nested message and enum types in `AssistantContentPart`.
66pub mod assistant_content_part {
67    #[derive(Clone, PartialEq, ::prost::Oneof)]
68    pub enum Part {
69        #[prost(message, tag = "1")]
70        Text(super::TextPart),
71        #[prost(message, tag = "2")]
72        Reasoning(super::ReasoningPart),
73    }
74}
75/// Text part for user or assistant messages.
76#[derive(Clone, PartialEq, ::prost::Message)]
77pub struct TextPart {
78    #[prost(string, tag = "1")]
79    pub text: ::prost::alloc::string::String,
80}
81/// User-supplied image part.
82#[derive(Clone, PartialEq, ::prost::Message)]
83pub struct ImagePart {
84    /// The base64-encoded image data
85    #[prost(bytes = "vec", tag = "1")]
86    pub data: ::prost::alloc::vec::Vec<u8>,
87    /// The media type of the image (e.g. "image/png", "image/jpeg")
88    #[prost(string, optional, tag = "2")]
89    pub media_type: ::core::option::Option<::prost::alloc::string::String>,
90    /// Optional: the filename of the image
91    #[prost(string, optional, tag = "3")]
92    pub filename: ::core::option::Option<::prost::alloc::string::String>,
93}
94/// Reasoning part for assistant messages.
95#[derive(Clone, PartialEq, ::prost::Message)]
96pub struct ReasoningPart {
97    #[prost(string, tag = "1")]
98    pub reasoning: ::prost::alloc::string::String,
99}
100/// StreamChatResponse is a discriminated union response to a StreamChatRequest
101#[derive(Clone, PartialEq, ::prost::Message)]
102pub struct StreamChatResponse {
103    #[prost(
104        oneof = "stream_chat_response::Response",
105        tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10"
106    )]
107    pub response: ::core::option::Option<stream_chat_response::Response>,
108}
109/// Nested message and enum types in `StreamChatResponse`.
110pub mod stream_chat_response {
111    #[derive(Clone, PartialEq, ::prost::Oneof)]
112    pub enum Response {
113        #[prost(message, tag = "1")]
114        Finish(super::Finish),
115        #[prost(message, tag = "2")]
116        Error(super::Error),
117        #[prost(message, tag = "3")]
118        TextStart(super::TextStart),
119        #[prost(message, tag = "4")]
120        TextDelta(super::TextDelta),
121        #[prost(message, tag = "5")]
122        TextEnd(super::TextEnd),
123        #[prost(message, tag = "6")]
124        ReasoningStart(super::ReasoningStart),
125        #[prost(message, tag = "7")]
126        ReasoningDelta(super::ReasoningDelta),
127        #[prost(message, tag = "8")]
128        ReasoningEnd(super::ReasoningEnd),
129        #[prost(message, tag = "9")]
130        WorkbookMutation(super::WorkbookMutation),
131        #[prost(message, tag = "10")]
132        ToolAction(super::ToolAction),
133    }
134}
135/// Indicates the end of a chat session
136#[derive(Clone, Copy, PartialEq, ::prost::Message)]
137pub struct Finish {}
138/// An error that occurred during the chat session
139#[derive(Clone, PartialEq, ::prost::Message)]
140pub struct Error {
141    #[prost(string, tag = "1")]
142    pub message: ::prost::alloc::string::String,
143}
144/// Indicates the start of a text message from the agent
145#[derive(Clone, PartialEq, ::prost::Message)]
146pub struct TextStart {
147    /// uniquely identifies the text message (e.g. uuid) so that the client can
148    /// merge parallel message streams (if it happens).
149    #[prost(string, tag = "1")]
150    pub id: ::prost::alloc::string::String,
151}
152/// A delta (continuation) of a text message from the agent
153#[derive(Clone, PartialEq, ::prost::Message)]
154pub struct TextDelta {
155    #[prost(string, tag = "1")]
156    pub id: ::prost::alloc::string::String,
157    /// The next chunk of text
158    #[prost(string, tag = "2")]
159    pub delta: ::prost::alloc::string::String,
160}
161/// Indicates the end of a text message from the agent
162#[derive(Clone, PartialEq, ::prost::Message)]
163pub struct TextEnd {
164    #[prost(string, tag = "1")]
165    pub id: ::prost::alloc::string::String,
166}
167/// Indicates the start of a reasoning message from the agent
168#[derive(Clone, PartialEq, ::prost::Message)]
169pub struct ReasoningStart {
170    #[prost(string, tag = "1")]
171    pub id: ::prost::alloc::string::String,
172}
173/// A delta (continuation) of a reasoning message from the agent
174#[derive(Clone, PartialEq, ::prost::Message)]
175pub struct ReasoningDelta {
176    #[prost(string, tag = "1")]
177    pub id: ::prost::alloc::string::String,
178    /// The next chunk of reasoning
179    #[prost(string, tag = "2")]
180    pub delta: ::prost::alloc::string::String,
181}
182/// Indicates the end of a reasoning message from the agent
183#[derive(Clone, PartialEq, ::prost::Message)]
184pub struct ReasoningEnd {
185    #[prost(string, tag = "1")]
186    pub id: ::prost::alloc::string::String,
187}
188/// Add a new tab to the workbook
189#[derive(Clone, PartialEq, ::prost::Message)]
190pub struct AddTabMutation {
191    /// if tab_name is not provided, we'll name it "New Tab"
192    #[prost(string, optional, tag = "1")]
193    pub tab_name: ::core::option::Option<::prost::alloc::string::String>,
194}
195/// this is the "result" of the mutation
196#[derive(Clone, PartialEq, ::prost::Message)]
197pub struct AddOrUpdatePanelMutation {
198    /// JSON-serialized representation of IVizDefinition
199    #[prost(string, tag = "1")]
200    pub panel_as_json: ::prost::alloc::string::String,
201    #[prost(string, tag = "2")]
202    pub panel_id: ::prost::alloc::string::String,
203    #[prost(int32, tag = "3")]
204    pub tab_index: i32,
205}
206#[derive(Clone, PartialEq, ::prost::Message)]
207pub struct RemovePanelsMutation {
208    #[prost(string, repeated, tag = "1")]
209    pub panel_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
210}
211/// AddOrReplaceVariableMutation is a mutation to add or replace a variable in the workbook
212#[derive(Clone, PartialEq, ::prost::Message)]
213pub struct AddOrReplaceVariableMutation {
214    #[prost(string, tag = "1")]
215    pub compute_spec_as_json: ::prost::alloc::string::String,
216    /// if variable_name is not provided, we'll assume it's a new variable and auto-generate a unique name
217    #[prost(string, optional, tag = "2")]
218    pub variable_name: ::core::option::Option<::prost::alloc::string::String>,
219    #[prost(string, optional, tag = "3")]
220    pub display_name: ::core::option::Option<::prost::alloc::string::String>,
221}
222/// DeleteVariablesMutation is a mutation to delete variables from the workbook
223#[derive(Clone, PartialEq, ::prost::Message)]
224pub struct DeleteVariablesMutation {
225    #[prost(string, repeated, tag = "1")]
226    pub variable_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
227}
228/// WorkbookMutation is a mutation to the workbook
229#[derive(Clone, PartialEq, ::prost::Message)]
230pub struct WorkbookMutation {
231    #[prost(string, tag = "1")]
232    pub id: ::prost::alloc::string::String,
233    #[prost(oneof = "workbook_mutation::Mutation", tags = "2, 3, 4, 5, 6")]
234    pub mutation: ::core::option::Option<workbook_mutation::Mutation>,
235}
236/// Nested message and enum types in `WorkbookMutation`.
237pub mod workbook_mutation {
238    #[derive(Clone, PartialEq, ::prost::Oneof)]
239    pub enum Mutation {
240        #[prost(message, tag = "2")]
241        AddTab(super::AddTabMutation),
242        #[prost(message, tag = "3")]
243        AddOrUpdatePanel(super::AddOrUpdatePanelMutation),
244        #[prost(message, tag = "4")]
245        RemovePanels(super::RemovePanelsMutation),
246        #[prost(message, tag = "5")]
247        AddOrReplaceVariable(super::AddOrReplaceVariableMutation),
248        #[prost(message, tag = "6")]
249        DeleteVariables(super::DeleteVariablesMutation),
250    }
251}
252/// this is a concise descirption of a tool call that the agent is making internally
253/// without revealing too much detail about the tool call, it informs the user what the agent is doing
254/// at a high level. the format is: `{tool_action_verb} {tool_target}` for example:
255/// "Search channels for My Datasource"
256#[derive(Clone, PartialEq, ::prost::Message)]
257pub struct ToolAction {
258    #[prost(string, tag = "1")]
259    pub id: ::prost::alloc::string::String,
260    /// "Thought", "Read", "Find", "Look-up", etc.
261    #[prost(string, tag = "2")]
262    pub tool_action_verb: ::prost::alloc::string::String,
263    /// "workbook", "channel", "variable", "panel", etc.
264    #[prost(string, optional, tag = "3")]
265    pub tool_target: ::core::option::Option<::prost::alloc::string::String>,
266}
267/// Generated client implementations.
268pub mod workbook_agent_service_client {
269    #![allow(
270        unused_variables,
271        dead_code,
272        missing_docs,
273        clippy::wildcard_imports,
274        clippy::let_unit_value,
275    )]
276    use tonic::codegen::*;
277    use tonic::codegen::http::Uri;
278    /// WorkbookAgentService provides AI-powered assistance for workbook operations
279    #[derive(Debug, Clone)]
280    pub struct WorkbookAgentServiceClient<T> {
281        inner: tonic::client::Grpc<T>,
282    }
283    impl WorkbookAgentServiceClient<tonic::transport::Channel> {
284        /// Attempt to create a new client by connecting to a given endpoint.
285        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
286        where
287            D: TryInto<tonic::transport::Endpoint>,
288            D::Error: Into<StdError>,
289        {
290            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
291            Ok(Self::new(conn))
292        }
293    }
294    impl<T> WorkbookAgentServiceClient<T>
295    where
296        T: tonic::client::GrpcService<tonic::body::Body>,
297        T::Error: Into<StdError>,
298        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
299        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
300    {
301        pub fn new(inner: T) -> Self {
302            let inner = tonic::client::Grpc::new(inner);
303            Self { inner }
304        }
305        pub fn with_origin(inner: T, origin: Uri) -> Self {
306            let inner = tonic::client::Grpc::with_origin(inner, origin);
307            Self { inner }
308        }
309        pub fn with_interceptor<F>(
310            inner: T,
311            interceptor: F,
312        ) -> WorkbookAgentServiceClient<InterceptedService<T, F>>
313        where
314            F: tonic::service::Interceptor,
315            T::ResponseBody: Default,
316            T: tonic::codegen::Service<
317                http::Request<tonic::body::Body>,
318                Response = http::Response<
319                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
320                >,
321            >,
322            <T as tonic::codegen::Service<
323                http::Request<tonic::body::Body>,
324            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
325        {
326            WorkbookAgentServiceClient::new(InterceptedService::new(inner, interceptor))
327        }
328        /// Compress requests with the given encoding.
329        ///
330        /// This requires the server to support it otherwise it might respond with an
331        /// error.
332        #[must_use]
333        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
334            self.inner = self.inner.send_compressed(encoding);
335            self
336        }
337        /// Enable decompressing responses.
338        #[must_use]
339        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
340            self.inner = self.inner.accept_compressed(encoding);
341            self
342        }
343        /// Limits the maximum size of a decoded message.
344        ///
345        /// Default: `4MB`
346        #[must_use]
347        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
348            self.inner = self.inner.max_decoding_message_size(limit);
349            self
350        }
351        /// Limits the maximum size of an encoded message.
352        ///
353        /// Default: `usize::MAX`
354        #[must_use]
355        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
356            self.inner = self.inner.max_encoding_message_size(limit);
357            self
358        }
359        /// StreamChat handles bidirectional streaming chat for workbook AI agent
360        pub async fn stream_chat(
361            &mut self,
362            request: impl tonic::IntoRequest<super::StreamChatRequest>,
363        ) -> std::result::Result<
364            tonic::Response<tonic::codec::Streaming<super::StreamChatResponse>>,
365            tonic::Status,
366        > {
367            self.inner
368                .ready()
369                .await
370                .map_err(|e| {
371                    tonic::Status::unknown(
372                        format!("Service was not ready: {}", e.into()),
373                    )
374                })?;
375            let codec = tonic::codec::ProstCodec::default();
376            let path = http::uri::PathAndQuery::from_static(
377                "/nominal.ai.v1.WorkbookAgentService/StreamChat",
378            );
379            let mut req = request.into_request();
380            req.extensions_mut()
381                .insert(
382                    GrpcMethod::new("nominal.ai.v1.WorkbookAgentService", "StreamChat"),
383                );
384            self.inner.server_streaming(req, path, codec).await
385        }
386    }
387}