Runnable Sequences Changed between 0.1.36 and now and I don't understand how to rewrite my code #6808
Replies: 1 comment 2 replies
-
To rewrite your code to work with the new
Additionally, you can use custom functions as import { RunnableSequence } from "@langchain/core/runnables";
const storyPrompt = ChatPromptTemplate.fromTemplate("Tell me a short story about {topic}");
const storyModel = new ChatOpenAI({ model: "gpt-4o" });
const chainWithCoercedFunction = RunnableSequence.from([
storyPrompt,
storyModel,
(input) => input.content.slice(0, 5),
]);
await chainWithCoercedFunction.invoke({ "topic": "bears" }); By following these steps and examples, you can adapt your code to work with the new The |
Beta Was this translation helpful? Give feedback.
-
Checked other resources
Commit to Help
Example Code
Description
I have chains that look like this. And this is no longer how the RunnableSequence interface works and I am struggling to figure out how to rewrite this code with the new RunnableSequence interfaces
System Info
node v18.19.1
npm 10.2.4
Beta Was this translation helpful? Give feedback.
All reactions