Skip to content

community[patch]: llama cpp stream generation and abort by invoke method #4942

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

Merged
merged 5 commits into from
Apr 3, 2024

Conversation

wizardAEI
Copy link
Contributor

Hi ! Recently, I have been using LangChain to develop my own application.

When using Llama CPP, I noticed that the streaming generation solution mentioned in the documentation cannot be paused.

However, after consulting the official documentation of node-llama-cpp, I found that the streaming and pausing functions can also be achieved using invoke : https://withcatai.github.io/node-llama-cpp/guide/chat-session#response-streaming.

It only requires a slight modification of the onToken method to resolve this issue. Therefore, I made some changes to the LLM CPP part.

and there is test results:
image

Copy link

vercel bot commented Apr 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 3, 2024 5:13am
langchainjs-docs ✅ Ready (Inspect) Visit Preview Apr 3, 2024 5:13am

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. auto:improvement Medium size change to existing code to handle new use-cases labels Apr 1, 2024
@jacoblee93 jacoblee93 changed the title llama cpp stream generation and abort by invoke method community[patch]: llama cpp stream generation and abort by invoke method Apr 3, 2024
@jacoblee93
Copy link
Collaborator

Thank you! Nice catch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:improvement Medium size change to existing code to handle new use-cases size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants