pub struct StreamHandler { /* private fields */ }Expand description
Stream handler for Claude API streaming responses
Implementations§
Source§impl StreamHandler
impl StreamHandler
Sourcepub fn new(
config: Arc<RwLock<AnthropicConfig>>,
client: Client,
cost_tracker: Arc<RwLock<CostTracker>>,
) -> Self
pub fn new( config: Arc<RwLock<AnthropicConfig>>, client: Client, cost_tracker: Arc<RwLock<CostTracker>>, ) -> Self
Create a new stream handler
§Arguments
config- API configurationclient- HTTP client to usecost_tracker- Cost tracker to update
Sourcepub async fn stream_message(
&self,
request: MessageRequest,
) -> Result<Pin<Box<dyn Stream<Item = Result<StreamEvent>> + Send>>>
pub async fn stream_message( &self, request: MessageRequest, ) -> Result<Pin<Box<dyn Stream<Item = Result<StreamEvent>> + Send>>>
Sourcepub async fn stream_complete(
&self,
request: MessageRequest,
) -> Result<(String, Usage)>
pub async fn stream_complete( &self, request: MessageRequest, ) -> Result<(String, Usage)>
Auto Trait Implementations§
impl !RefUnwindSafe for StreamHandler
impl !UnwindSafe for StreamHandler
impl Freeze for StreamHandler
impl Send for StreamHandler
impl Sync for StreamHandler
impl Unpin for StreamHandler
impl UnsafeUnpin for StreamHandler
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