rig icon indicating copy to clipboard operation
rig copied to clipboard

feat: multi turn streaming example

Open JazzyMcJazz opened this issue 8 months ago • 2 comments

Closes #412

Small change, that enables calling agent.stream_competion(...).await?.stream().await?; inside Box::pin(async_stream::stream! { ... });.

The implementation hopefully handles wasm32 arch.

I have added a multi_turn_streaming.rs example. It is based on the previous version of the multi_turn_agent.rs example.

I considered implementing multi turn functionality like the new PromptRequest implementation, but it seemed too daunting a task, and this simple change enables for customised multi turn logic.

JazzyMcJazz avatar Apr 22 '25 23:04 JazzyMcJazz

I have added a multi_turn_streaming.rs example. It is based on the previous version of the multi_turn_agent.rs example. I considered implementing multi turn functionality like the new PromptRequest implementation, but it seemed too daunting a task, and this simple change enables for customised multi turn logic.

Great job spearheading this, I was looking to add some multi_turn for streaming but it was a bit much for my branch, esp considering the upcoming #388 streaming api improvements. The inclusion of Send is fixed by that branch, but we'll revisit this branch soon when #388 gets merged and use it for adding better streaming examples like multi turn and reasoning loops.

0xMochan avatar Apr 23 '25 19:04 0xMochan

@0xMochan thanks for merging #388. I have refactored the example to work with the changes in that PR.

JazzyMcJazz avatar May 07 '25 20:05 JazzyMcJazz

Hi @joshua-mo-143, thank you for letting me know. I have updated the example to use the new traits.

  • There seems to be a new lint for the error type because all of the enum variants have the same postfix

Can you elaborate on this if it is still an issue? I am unsure if there is something I should change.

JazzyMcJazz avatar Jun 17 '25 17:06 JazzyMcJazz

Hi @joshua-mo-143, thank you for letting me know. I have updated the example to use the new traits.

  • There seems to be a new lint for the error type because all of the enum variants have the same postfix

Can you elaborate on this if it is still an issue? I am unsure if there is something I should change.

Should be fine, I think. There was an error in the release pipeline because we'd added a new crate that used some new breaking changes from rig-core.

joshua-mo-143 avatar Jun 17 '25 18:06 joshua-mo-143