feat: add support for extra headers in Tavily API requests (#55335)

* feat: add support for extra headers in Tavily API requests

* test(tavily-client): add unit tests for X-Client-Source header in API calls

* fix(tavily): add client source attribution (#55335) (thanks @lakshyaag-tavily)

---------

Co-authored-by: Nimrod Gutman <nimrod.gutman@gmail.com>
This commit is contained in:
Lakshya Agarwal
2026-03-28 04:36:59 -04:00
committed by GitHub
parent 6777764a6b
commit 4dfd2cd60c
4 changed files with 63 additions and 0 deletions

View File

@@ -100,6 +100,7 @@ export async function postTrustedWebToolsJson<T>(
body: Record<string, unknown>;
errorLabel: string;
maxErrorBytes?: number;
extraHeaders?: Record<string, string>;
},
parseResponse: (response: Response) => Promise<T>,
): Promise<T> {
@@ -110,6 +111,7 @@ export async function postTrustedWebToolsJson<T>(
init: {
method: "POST",
headers: {
...params.extraHeaders,
Accept: "application/json",
Authorization: `Bearer ${params.apiKey}`,
"Content-Type": "application/json",