Broken withRetry()'s "stopAfterAttempt" parameter, keep defaulting to 3 even when I specify a different number #6943
Replies: 3 comments 6 replies
-
Hey there, @knamnguyen! 👋 I'm here to help you with your code snags and answer any questions you have. I can also guide you on how to contribute. Let's squash those bugs together! The issue you're experiencing, where the
If none of these steps resolve the issue, consider creating a minimal reproducible example and testing it in isolation to see if the problem persists. This can help identify if the issue is specific to your environment or setup. |
Beta Was this translation helpful? Give feedback.
-
@dosu the code works and retry the correct number of timeswhen I reduced the code to export const chain= RunnableSequence.from([
ChatPromptTemplate.fromTemplate(prompt),
model,
parser,
]).withRetry({
stopAfterAttempt: 5,
}); Looks like the issue in my original code is that I tried to add a withConfig() after a withRetry(). Is this not the right way to add default config to my Runnable? |
Beta Was this translation helpful? Give feedback.
-
@dosu Is it possible that my auto-formatting feature on the ide is messing up the syntax causing the code not to work? It looks like withRetry() should be directly after the Runnable and not on a new line |
Beta Was this translation helpful? Give feedback.
-
Checked other resources
Commit to Help
Example Code
Description
I'm trying to set up a Runnable with an output parser. I have tried setting different numbers for the "stopAfterAttempt" field for withRetry(), but when I invoke the chain with
the following exception is returned:
When I check the trace on langsmith it always retries exactly 3 times, no matter what value I set for stopAfterAttempt.
Appreciate anyone who can help!
System Info
platform windows
node 20.12.2
pnpm 9.10.0
[email protected] | MIT | deps: 12 | versions: 297
Typescript bindings for langchain
https://github.com/langchain-ai/langchainjs/tree/main/langchain/
keywords: llm, ai, gpt3, chain, prompt, prompt engineering, chatgpt, machine learning, ml, openai, embeddings, vectorstores
dist
.tarball: https://registry.npmjs.org/langchain/-/langchain-0.3.2.tgz
.shasum: aec3e679d3d6c36f469448380affa475c92fbd86
.integrity: sha512-kd2kz1cS/PIVrLEDFlrZsAasQfPLbY1UqCZbRKa3/QcpB33/n6xPDvXSMfBuKhvNj0bjW6MXDR9HZTduXjJBgg==
.unpackedSize: 2.9 MB
dependencies:
@langchain/openai: >=0.1.0 <0.4.0 js-yaml: ^4.1.0 openapi-types: ^12.1.3 yaml: ^2.2.1
@langchain/textsplitters: >=0.0.0 <0.2.0 jsonpointer: ^5.0.1 p-retry: 4 zod-to-json-schema: ^3.22.3
js-tiktoken: ^1.0.12 langsmith: ^0.1.56-rc.1 uuid: ^10.0.0 zod: ^3.22.4
maintainers:
dist-tags:
latest: 0.3.2 next: 0.3.2-rc.0 tag-for-publishing-older-releases: 0.2.20
published 3 weeks ago by jacoblee93 [email protected]
Beta Was this translation helpful? Give feedback.
All reactions