Replies: 2 comments
-
Hey @philbo, great to see you diving into the depths of LangChain JS again! Hope this quest brings you some intriguing puzzles to solve. 🚀 Based on the information provided and the current state of the LangChain JS repository, it appears that the The Here is the relevant code snippet from the if (!response.ok) {
const json = await response.json();
const error = new Error(
`RemoteRunnable call failed with status code ${response.status}: ${json.message}`
);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(error as any).response = response;
throw error;
} (Source: langchain-core/src/runnables/remote.ts) As for customizing the error handling in the It's worth noting that the (Source: langchain-core/src/runnables/tests/runnable_remote.test.ts) Given this, it seems that handling Server-Sent Event I hope this information is helpful. If you have further questions or need more clarification, please let me know. Sources
|
Beta Was this translation helpful? Give feedback.
-
I managed to extend the message parsing by reusing the langchain library functions
|
Beta Was this translation helpful? Give feedback.
-
Checked other resources
Commit to Help
Example Code
Description
Langserve provides a way for an "error" event to be sent when requesting the
/stream
endpoint, for example something like:As the response code is
200
the existing error handling (correctly) does not raise an error.The Python RemoteRunnable client appears to support a way to handle this type of event.
Is there any mechanism in the Javascript RemoteRunnable client to handle errors sent from streaming endpoints?
System Info
[email protected]
dependencies:
@anthropic-ai/sdk: ^0.9.1 @langchain/core: ~0.1.44 binary-extensions: ^2.2.0 js-tiktoken: ^1.0.7 jsonpointer: ^5.0.1 langsmith: ~0.1.7 openapi-types: ^12.1.3 uuid: ^9.0.0 zod-to-json-schema: ^3.22.3
@langchain/community: ~0.0.36 @langchain/openai: ~0.0.19 expr-eval: ^2.0.2 js-yaml: ^4.1.0 langchainhub: ~0.0.8 ml-distance: ^4.0.0 p-retry: 4 yaml: ^2.2.1 zod: ^3.22.4
linux
Node v19.9.0
Beta Was this translation helpful? Give feedback.
All reactions