patrick2
patrick2•9mo ago

LCEL Batch

Hi 🙂 I'm facing some weird behavior when using a LCEL chain with batch() instead of invoke ... is that something anyone or the team occured already? Basically I'm running the chain on multiple inputs for an eval run.
langfuse_handler = CallbackHandler(public_key=LANGFUSE_CONF["PUBLIC_KEY"], secret_key=LANGFUSE_CONF["SECRET_KEY"], host=LANGFUSE_CONF["HOST"])
...
chain.batch(eval_questions, config={"callbacks": [langfuse_handler]})
langfuse_handler = CallbackHandler(public_key=LANGFUSE_CONF["PUBLIC_KEY"], secret_key=LANGFUSE_CONF["SECRET_KEY"], host=LANGFUSE_CONF["HOST"])
...
chain.batch(eval_questions, config={"callbacks": [langfuse_handler]})
It yields into multiple errors in on_chain_start and on_chain_end`: eg
File "/Users/.../langfuse/callback.py", line 239, in on_chain_start
self.runs[run_id] = self.runs[parent_run_id].span(
KeyError: UUID('8d96860b-caf8-4d04-852f-9f3525f945f9')
2024-01-11 17:40:33,740:ERROR - run not found
File "/Users/.../langfuse/callback.py", line 239, in on_chain_start
self.runs[run_id] = self.runs[parent_run_id].span(
KeyError: UUID('8d96860b-caf8-4d04-852f-9f3525f945f9')
2024-01-11 17:40:33,740:ERROR - run not found
`
File "/Users/.../langfuse/callback.py", line 396, in on_chain_end
raise Exception("run not found")
Exception: run not found
File "/Users/.../langfuse/callback.py", line 396, in on_chain_end
raise Exception("run not found")
Exception: run not found
UI shows 1 run recorded run, others seem to be empty. Is batch behavior so far not supported, or any clues 🙂 ? Thanks to the team!
No description
5 Replies
Max
Max•9mo ago
Hi @patrick2, we do not support LCEL yet. Something that is on our list to improve.
FAST Jo
FAST Jo•9mo ago
Well LCEL with the invoke method works though... 😀 chain.invoke(question, config={"callbacks": [langfuse_handler]})
Max
Max•9mo ago
Thanks @FAST Jo !
patrick2
patrick2•9mo ago
thx - yeah that's workaround even though its only sequential then 🙂 btw is it possible to add tags / names to when using the langchain integration in invoke?
Max
Max•8mo ago
Hi, currenlty this is not possible, but looking into these.