newton
newton•12mo ago

JS/TS Langchain SDK - Langfuse

Hey there, Im using the JS/Lanchain version of the library and hitting a few road bumps > https://langfuse.com/docs/integrations/langchain/typescript#create-a-simple-llm-call-using-langchain docs dont 100% lineup with what langchain is expecting w.g. new LLMChain is expecting 1 object but the docs have 2. There is a callback function inside of that object but when I add it I get Type 'CallbackHandler' is missing the following properties from type 'BaseCallbackHandler': lc_serializable, awaitHandlers. Docs make it look easy to integrate but cant quite get it to come together.
JS/TS Langchain SDK - Langfuse
Fully async and typed SDK, runs in Node.js, edge, Deno
38 Replies
newton
newton•12mo ago
Happy to share move info if its useful
No description
Marc
Marc•12mo ago
Thanks, currently having a look Do you get the same error when adding the handler to the .run?
chain.call({ input: "Hello world" }, { callbacks: [handler] })
chain.call({ input: "Hello world" }, { callbacks: [handler] })
Currently upgrading our tests as the error sounds to me like there was a change in the interface of the Langchain handlers for JS
newton
newton•12mo ago
No description
newton
newton•12mo ago
Yeah same thing on the call "langchain": "^0.0.150", What version are your tests on?
Marc
Marc•12mo ago
does the run take a second argument? it was on 0.0.133, just now upgrading to 0.0.157
newton
newton•12mo ago
No description
newton
newton•12mo ago
Yeah the call can take the second ill go back to 133 and test that on my end
Marc
Marc•12mo ago
on which version of the langfuse-langchain sdk are you? (just to double check)
newton
newton•12mo ago
"langfuse-langchain": "^1.0.22",
Marc
Marc•12mo ago
Trying to reproduce on langfuse-langchain 1.0.22 and langchain 0.0.157; I do not get type errors
No description
Marc
Marc•12mo ago
good catch with the LLMChain not taking two arguments while the .run takes two, I'll update the docs did you get the same error?
newton
newton•12mo ago
Yeah same error, nuked node_modules just in case as well. Must be something on my end then.
Marc
Marc•12mo ago
are you on typescript?
newton
newton•12mo ago
I am, apps is built in nestjs
Marc
Marc•12mo ago
Happy to check if I get the same error with your tsconfig