Added client name header (#6413)

- added client_name header to the 4 tavily tools to classify incoming requests as 'crewai' requests.

- This is for internal analysis

Co-authored-by: Lorenze Jay <63378463+lorenzejay@users.noreply.github.com>
This commit is contained in:
Mani
2026-07-06 17:20:59 -04:00
committed by GitHub
parent 2b90117e88
commit 56edf1f95f
4 changed files with 16 additions and 8 deletions

View File

@@ -87,9 +87,11 @@ class TavilyExtractorTool(BaseTool):
"""
super().__init__(**kwargs)
if TAVILY_AVAILABLE:
self.client = TavilyClient(api_key=self.api_key, proxies=self.proxies)
self.client = TavilyClient(
api_key=self.api_key, proxies=self.proxies, client_name="crewai"
)
self.async_client = AsyncTavilyClient(
api_key=self.api_key, proxies=self.proxies
api_key=self.api_key, proxies=self.proxies, client_name="crewai"
)
else:
try:

View File

@@ -54,8 +54,10 @@ class TavilyGetResearchTool(BaseTool):
super().__init__(**kwargs)
if TAVILY_AVAILABLE:
api_key = os.getenv("TAVILY_API_KEY")
self._client = TavilyClient(api_key=api_key)
self._async_client = AsyncTavilyClient(api_key=api_key)
self._client = TavilyClient(api_key=api_key, client_name="crewai")
self._async_client = AsyncTavilyClient(
api_key=api_key, client_name="crewai"
)
else:
try:
import subprocess

View File

@@ -90,8 +90,10 @@ class TavilyResearchTool(BaseTool):
super().__init__(**kwargs)
if TAVILY_AVAILABLE:
api_key = os.getenv("TAVILY_API_KEY")
self._client = TavilyClient(api_key=api_key)
self._async_client = AsyncTavilyClient(api_key=api_key)
self._client = TavilyClient(api_key=api_key, client_name="crewai")
self._async_client = AsyncTavilyClient(
api_key=api_key, client_name="crewai"
)
else:
try:
import subprocess

View File

@@ -115,9 +115,11 @@ class TavilySearchTool(BaseTool):
def __init__(self, **kwargs: Any):
super().__init__(**kwargs)
if TAVILY_AVAILABLE:
self.client = TavilyClient(api_key=self.api_key, proxies=self.proxies)
self.client = TavilyClient(
api_key=self.api_key, proxies=self.proxies, client_name="crewai"
)
self.async_client = AsyncTavilyClient(
api_key=self.api_key, proxies=self.proxies
api_key=self.api_key, proxies=self.proxies, client_name="crewai"
)
else:
try: