We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello,
We are using langserve js client the following way
const remoteChain = new RemoteRunnable({ url: url, options: { headers:someHeader, }, });
Then we stream the request as
remoteChain.stream( { chat_history: chat_history, question: question }, { metadata: { run_id: id, }, }, );
Digging in the code it looks like stream is calling under the hood js fetch function the following way as seen here: https://github.com/langchain-ai/langchainjs/blob/dbb3b59623ee5ce4bf675bbf41a6e3e044ae0802/langchain-core/src/runnables/remote.ts#L278
private async post<Body>(path: string, body: Body) { return fetch(`${this.url}${path}`, { method: "POST", body: JSON.stringify(serialize(body)), headers: { "Content-Type": "application/json", ...this.options?.headers, }, signal: AbortSignal.timeout(this.options?.timeout ?? 60000), }); }
The best would be to be able to pass an additional parameter to fetch: credentials see here section how to pass cookies. The updated version could be:
credentials
private async post<Body>(path: string, body: Body) { return fetch(`${this.url}${path}`, { method: "POST", body: JSON.stringify(serialize(body)), headers: { "Content-Type": "application/json", ...this.options?.headers, }, signal: AbortSignal.timeout(this.options?.timeout ?? 60000), credentials: this.options?.credentials ?? 'same-origin', // same-origin is fetch default credentials value }); }
with and update to remoteRunnableOption as
type RemoteRunnableOptions = { timeout?: number; headers?: Record<string, unknown>; credentials?: string; };
or hardcoded for example:
private async post<Body>(path: string, body: Body) { return fetch(`${this.url}${path}`, { method: "POST", body: JSON.stringify(serialize(body)), headers: { "Content-Type": "application/json", ...this.options?.headers, }, signal: AbortSignal.timeout(this.options?.timeout ?? 60000), credentials: 'include', }); }
Thank you !
The text was updated successfully, but these errors were encountered:
You can configure this in the fetchRequestOptions
https://v02.api.js.langchain.com/classes/_langchain_core.runnables_remote.RemoteRunnable.html
const remoteChain = new RemoteRunnable({ url: url, fetchRequestOptions: {credentials: 'include'} });
Sorry, something went wrong.
No branches or pull requests
Hello,
We are using langserve js client the following way
Then we stream the request as
Digging in the code it looks like stream is calling under the hood js fetch function the following way as seen here: https://github.com/langchain-ai/langchainjs/blob/dbb3b59623ee5ce4bf675bbf41a6e3e044ae0802/langchain-core/src/runnables/remote.ts#L278
The best would be to be able to pass an additional parameter to fetch:
credentials
see here section how to pass cookies.The updated version could be:
with and update to remoteRunnableOption as
or hardcoded for example:
Thank you !
The text was updated successfully, but these errors were encountered: