Next.js Discord

Discord Forum

Need help on AI SDK Usage (Langchain + Replicate)

Unanswered
Prairie yellowjacket posted this in #help-forum
Open in Discord
Prairie yellowjacketOP
I have an API route for an app im building that lets you create and chat with AI Persona's:

I am using Langchain and Llama-2-70b-chat via replicate but cant get it to work. stream from LangChainStream() just doesnt return anything. What am I doing wrong? BTW my memoryManager middleware is essentially a DAL, it would be way too cluttered if I did everything in one api route.

All langchain examples are with OpenAI lolll, so I'm a bit lost. I am also very new to edge runtimes

1 Reply

Prairie yellowjacketOP
the piece commented code:

// var Readable = require("stream").Readable;
// let s = new Readable();
// s.push(res);
// s.push(null);


This piece of code made it work when I was using regular serverless, but when I switched to edge, the require keyword broke the route so I had to comment it out. i was also returning s instead of stream