Skip to content

Commit

Permalink
Fix remote runnable in browser environments (Extends #6529) (#6537)
Browse files Browse the repository at this point in the history
* stream to streamEvents

* Fetch impl fix

* switch back

* switch back

* Fix

* Comment

---------

Co-authored-by: mcgear <michael.gearhardt@gmail.com>
Co-authored-by: Michael Gearhardt <michael.gearhardt@fathym.com>
  • Loading branch information
3 people committed Aug 15, 2024
1 parent a93505f commit 4425d27
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion langchain-core/src/runnables/remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,13 @@ export class RemoteRunnable<

private options?: RemoteRunnableOptions;

// Wrap the default fetch call due to issues with illegal invocations
// from the browser:
// https://stackoverflow.com/questions/69876859/why-does-bind-fix-failed-to-execute-fetch-on-window-illegal-invocation-err
// eslint-disable-next-line @typescript-eslint/no-explicit-any
fetchImplementation: (...args: any[]) => any = fetch;
fetchImplementation: (...args: any[]) => any = (...args: any[]) =>
// @ts-expect-error Broad typing to support a range of fetch implementations
fetch(...args);

// eslint-disable-next-line @typescript-eslint/no-explicit-any
fetchRequestOptions?: Record<string, any>;
Expand Down

0 comments on commit 4425d27

Please sign in to comment.