Skip to content

Commit

Permalink
include extra headers in langserve adapters
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Levinger authored and salmenus committed Mar 27, 2024
1 parent 7d22aca commit 6404d9b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/js/langchain/src/langserve/adapter/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export class LangServeFetchAdapter extends LangServeAbstractAdapter {
const body = this.getRequestBody(message, extras.conversationHistory);
const response = await fetch(this.endpointUrl, {
method: 'POST',
headers: {
...extras.headers,
'Content-Type': 'application/json'
},
body,
});

Expand Down
5 changes: 4 additions & 1 deletion packages/js/langchain/src/langserve/adapter/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ export class LangServeStreamAdapter extends LangServeAbstractAdapter {
const body = this.getRequestBody(message, extras.conversationHistory);
fetch(this.endpointUrl, {
method: 'POST',
headers: {'Content-Type': 'application/json'},
headers: {
...extras.headers,
'Content-Type': 'application/json'
},
body,
})
.then(async (response) => {
Expand Down

0 comments on commit 6404d9b

Please sign in to comment.