Skip to content

Conversation

@JazzyMcJazz
Copy link
Contributor

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.

@joshua-mo-143 joshua-mo-143 self-requested a review April 23, 2025 16:50
@0xMochan
Copy link
Contributor

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.

@joshua-mo-143 joshua-mo-143 removed their request for review April 23, 2025 19:52
@JazzyMcJazz JazzyMcJazz changed the title feat: Add Send to StreamingCompletionModel trait feat: multi turn streaming example May 7, 2025
@JazzyMcJazz
Copy link
Contributor Author

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

@joshua-mo-143 joshua-mo-143 self-requested a review June 5, 2025 13:31
Copy link
Contributor

@joshua-mo-143 joshua-mo-143 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @JazzyMcJazz, we recently merged a large PR (#440) that will probably change some of the implementation details for the example:

  • StreamingCompletionModel is now folded into CompletionModel
  • You'll probably need to import rig::completion::CompletionClient and rig::completion::ProviderClient
  • There seems to be a new lint for the error type because all of the enum variants have the same postfix

If you need help updating the example so it is compliant with the new changes, let me know!

@JazzyMcJazz
Copy link
Contributor Author

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.

@joshua-mo-143
Copy link
Contributor

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.

Copy link
Contributor

@joshua-mo-143 joshua-mo-143 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm - looks great!

@joshua-mo-143 joshua-mo-143 merged commit ecdcb6b into 0xPlaygrounds:main Jun 17, 2025
5 checks passed
@github-actions github-actions bot mentioned this pull request Jun 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add Send to StreamingCompletionModel trait

3 participants