Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Composes LangChain 1.0 Python LCEL runnables with parallel batching, narrow fallbacks, and brace-safe prompt templates.
59% 95%+36 ptsof test cases passed
Passed 21 of 22 test cases with the skill, and 13 of 22 without it.
I want to process a batch of items with `chain.batch()`. If 2 out of 100 items fail due to bad inputs, I want the remaining 98 results returned alongside the exception objects rather than crashing the whole call. What configuration option enables this?
Sets return_exceptions to True in the batch configuration dictionary.
3 of 3 safety checks passed
chain.batch(inputs) in LangChain 1.0 does not parallelize by default. The
max_concurrency parameter defaults to 1 in several provider packages
(notably older langchain-openai), so a call like chain.batch(inputs_1000)
runs 1,000 sequential round-trips — same wall-clock time as a for loop, plus
the overhead of the batch machinery. Users file "batch is slow" tickets,
benchmark it against asyncio, and move to a different framework — when the fix
is two lines:
# BAD — silently serializes (P08)
chain.batch(inputs_1000)
# GOOD — 10 in flight at once
chain.batch(inputs_1000, config={"max_concurrency": 10})
Then three more traps wait:
.with_fallbacks([backup]) defaults exceptions_to_handle=(Exception,),
and on Python <3.12 that tuple includes KeyboardInterrupt. A Ctrl+C during
a long run does not stop the process — it silently hands off to the fallback
chain and keeps billing.ChatPromptTemplate.from_messages(..., template_format="f-string")
(the default) parses every { in every string, including user input. A user
who pastes {"error": "..."} raises KeyError: 'error' at invoke time.summary or confidence to your Plan schema and with_structured_output
crashes with ValidationError: extra fields not permitted.This skill walks through LCEL composition (RunnableSequence, RunnableParallel,
RunnableBranch, RunnablePassthrough, RunnableLambda); the correct
exceptions_to_handle whitelist per provider; max_concurrency tuning with
safe ceilings (10 for most providers, 20+ with a semaphore); and prompt
templates that survive untrusted input. Pin: langchain-core 1.0.x,
langchain-anthropic 1.0.x, langchain-openai 1.0.x. Pain-catalog anchors:
P07, P08, P53, P57.
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.