Replies: 1 comment 2 replies
-
🤖 Hello @hafsalm, I'm Dosu, an AI bot here to assist you with your queries and issues about langchainjs while you wait for a human maintainer. I'm here to help solve bugs, answer your questions, and guide you on becoming a contributor. Remember, no question is too big or too small. Let's work together on this! To implement streaming responses in Langchain when integrating it with Node-llama-cpp, you can follow these steps:
import { LlamaCpp } from "langchain/llms/llama_cpp";
const model = new LlamaCpp({
modelPath: "/Replace/with/path/to/your/model/gguf-llama2-q4_0.bin",
streaming: true,
callbacks: [
{
handleLLMNewToken(token: string) {
process.stdout.write(token);
},
},
],
});
await model.call("Where do Llamas come from?"); The You can find more details and examples in the following sources:
I hope this helps! If you have any other questions, feel free to ask. Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
How do I implement streaming responses in Langchain when integrating it with Node-llama-cpp? Are there specific features or configurations in Node-llama-cpp or Langchain that support and facilitate streaming behavior when used in conjunction?
Thank you in advance for your help and support!
Beta Was this translation helpful? Give feedback.
All reactions