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

fix: Async callback for langchain #353

Merged
merged 4 commits into from
Oct 26, 2023

Conversation

frostming
Copy link
Collaborator

Signed-off-by: Frost Ming me@frostming.com

Signed-off-by: Frost Ming <me@frostming.com>
Signed-off-by: Frost Ming <me@frostming.com>

async def on_llm_new_token(self, token: str, **kwargs: Any) -> None:
if token is not None and token != "":
print(token, end="")
Copy link
Owner

Choose a reason for hiding this comment

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

seems we need drop this print

Copy link
Collaborator Author

@frostming frostming Oct 26, 2023

Choose a reason for hiding this comment

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

Haha, that is to display the text to console in stream mode. Intended.
All other bots have such prints, too

Copy link
Owner

Choose a reason for hiding this comment

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

copy that!

@yihong0618
Copy link
Owner

@dongjing007 can you also give a look?

Signed-off-by: Frost Ming <me@frostming.com>
Signed-off-by: Frost Ming <me@frostming.com>
@dongjing007
Copy link
Contributor

@dongjing007 can you also give a look?

ok

@dongjing007
Copy link
Contributor

Asynchronous solutions are even more elegant and praiseworthy. 👍 @frostming @yihong0618

@frostming
Copy link
Collaborator Author

Asynchronous solutions are even more elegant and praiseworthy. 👍 @frostming @yihong0618

Yeah, we don't have to wait for the chain run complete to get the TTS.

@yihong0618 yihong0618 merged commit d8b06d4 into yihong0618:main Oct 26, 2023
2 checks passed
@frostming frostming deleted the feat/async-langchain branch October 27, 2023 01:03
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.

3 participants