Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to stream response token by token #30

Closed
ranfdev opened this issue Feb 22, 2024 · 1 comment · Fixed by #38
Closed

Option to stream response token by token #30

ranfdev opened this issue Feb 22, 2024 · 1 comment · Fixed by #38
Labels
enhancement New feature or request
Milestone

Comments

@ranfdev
Copy link

ranfdev commented Feb 22, 2024

No description provided.

@zhudotexe
Copy link
Owner

Although streaming wasn't in our original design since we felt like it was unnecessary for most academic and many production-system use cases, I've been thinking about methods to implement it with the following constraints:

  • No breaking changes - existing 0.x code should not need to account for a new return type, for example
  • Minimal added complexity to the Engine interface, optimally it should be an optional implementation s.t. streaming code can still interchange with non-streaming engines
  • Compatibility with function calling - this might end up piggybacking off the optional constraint above

In my mind the interface would look something like:

async for msg_stream in kani.full_round_stream(...):
	# design consideration: what message stream would function calls emit?
	# msg_stream should be a StreamManager object so that you can access header data like role before consuming
	async for token in msg_stream:
		# stream code here

	# to get the full content as a ChatMessage - this would consume the full stream if called before finished
	msg = await msg_stream.message()

I don't think this'll be implemented in 0.x but I'd like to implement this as a 1.x feature.

@zhudotexe zhudotexe added the enhancement New feature or request label Feb 23, 2024
@zhudotexe zhudotexe added this to the 1.0 milestone Feb 23, 2024
@zhudotexe zhudotexe mentioned this issue Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants