pub struct OpenaiEventDataParser {
pub id: String,
pub object: String,
pub created: u64,
pub model: String,
pub content: String,
pub think_content: String,
/* private fields */
}
Fields§
§id: String
§object: String
§created: u64
§model: String
§content: String
§think_content: String
Implementations§
Source§impl OpenaiEventDataParser
impl OpenaiEventDataParser
pub fn update_id_if_empty(&mut self, id: &str)
pub fn update_model_if_empty(&mut self, model: &str)
pub fn set_system_fingerprint(&mut self, system_fingerprint: Option<String>)
pub fn set_finish_reason(&mut self, finish_reason: Option<FinishReason>)
pub fn parse_str(&mut self, data: &str) -> Result<Option<ToolCall>, Error>
pub fn push_content(&mut self, content: &str)
pub fn push_thinking(&mut self, content: &str)
pub fn push_tool_call(&mut self, tool_call: ToolCall)
Trait Implementations§
Source§impl Clone for OpenaiEventDataParser
impl Clone for OpenaiEventDataParser
Source§fn clone(&self) -> OpenaiEventDataParser
fn clone(&self) -> OpenaiEventDataParser
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for OpenaiEventDataParser
impl Debug for OpenaiEventDataParser
Source§impl Default for OpenaiEventDataParser
impl Default for OpenaiEventDataParser
Source§fn default() -> OpenaiEventDataParser
fn default() -> OpenaiEventDataParser
Returns the “default value” for a type. Read more
Source§impl EventDataParser<Chunk> for OpenaiEventDataParser
impl EventDataParser<Chunk> for OpenaiEventDataParser
type Error = Infallible
type Output = Option<ToolCall>
type UnarayResponse = Response
Source§fn parse(&mut self, data: &Chunk) -> Result<Option<ToolCall>, Infallible>
fn parse(&mut self, data: &Chunk) -> Result<Option<ToolCall>, Infallible>
tool will return actionable data(like tool call) during the stream.
For example, openai may return mutilple tool_calls during the stream, this method will return a complete tool_call when the parser can.
We don’t need to wait for the stream to complete to get all the tool_calls.
Source§fn response(self) -> ChatCompletionResponse
fn response(self) -> ChatCompletionResponse
response will return the unaray response from the parsed stream data.
Source§impl PartialEq for OpenaiEventDataParser
impl PartialEq for OpenaiEventDataParser
impl StructuralPartialEq for OpenaiEventDataParser
Auto Trait Implementations§
impl Freeze for OpenaiEventDataParser
impl RefUnwindSafe for OpenaiEventDataParser
impl Send for OpenaiEventDataParser
impl Sync for OpenaiEventDataParser
impl Unpin for OpenaiEventDataParser
impl UnwindSafe for OpenaiEventDataParser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more