Skip to content

Commit 4c59f14

Browse files
authored
chore(toolbox-langchain): remove add_headers feature (#279)
* chore!: remove addHeaders feature * lint * remove files * remove files * Update test_async_client.py
1 parent 0a04704 commit 4c59f14

File tree

5 files changed

+8
-66
lines changed

5 files changed

+8
-66
lines changed

packages/toolbox-langchain/README.md

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -231,27 +231,16 @@ that fresh credentials or header values can be used.
231231

232232
### Configuration
233233

234-
You can configure these dynamic headers in two ways:
234+
You can configure these dynamic headers as follows:
235235

236-
1. **During Client Initialization**
237-
238-
```python
239-
from toolbox_langchain import ToolboxClient
240-
241-
client = ToolboxClient(
242-
"toolbox-url",
243-
client_headers={"header1": header1_getter, "header2": header2_getter, ...}
244-
)
245-
```
246-
247-
1. **After Client Initialization**
248-
249-
```python
250-
from toolbox_langchain import ToolboxClient
236+
```python
237+
from toolbox_langchain import ToolboxClient
251238

252-
client = ToolboxClient("toolbox-url")
253-
client.add_headers({"header1": header1_getter, "header2": header2_getter, ...})
254-
```
239+
client = ToolboxClient(
240+
"toolbox-url",
241+
client_headers={"header1": header1_getter, "header2": header2_getter, ...}
242+
)
243+
```
255244

256245
### Authenticating with Google Cloud Servers
257246

packages/toolbox-langchain/src/toolbox_langchain/async_client.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -190,18 +190,3 @@ def load_toolset(
190190
strict: bool = False,
191191
) -> list[AsyncToolboxTool]:
192192
raise NotImplementedError("Synchronous methods not supported by async client.")
193-
194-
def add_headers(
195-
self,
196-
headers: Mapping[str, Union[Callable[[], str], Callable[[], Awaitable[str]]]],
197-
) -> None:
198-
"""
199-
Add headers to be included in each request sent through this client.
200-
201-
Args:
202-
headers: Headers to include in each request sent through this client.
203-
204-
Raises:
205-
ValueError: If any of the headers are already registered in the client.
206-
"""
207-
self.__core_client.add_headers(headers)

packages/toolbox-langchain/src/toolbox_langchain/client.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -291,18 +291,3 @@ def load_toolset(
291291
for core_sync_tool in core_sync_tools:
292292
tools.append(ToolboxTool(core_tool=core_sync_tool))
293293
return tools
294-
295-
def add_headers(
296-
self,
297-
headers: Mapping[str, Union[Callable[[], str], Callable[[], Awaitable[str]]]],
298-
) -> None:
299-
"""
300-
Add headers to be included in each request sent through this client.
301-
302-
Args:
303-
headers: Headers to include in each request sent through this client.
304-
305-
Raises:
306-
ValueError: If any of the headers are already registered in the client.
307-
"""
308-
self.__core_client.add_headers(headers)

packages/toolbox-langchain/tests/test_async_client.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,3 @@ async def test_init_with_client_headers(
350350
mock_core_client_constructor.assert_called_once_with(
351351
url=URL, session=mock_session, client_headers=headers
352352
)
353-
354-
async def test_add_headers(self, mock_client):
355-
"""Tests that add_headers calls the core client's add_headers."""
356-
headers = {"X-Another-Header": lambda: "dynamic_value"}
357-
mock_client.add_headers(headers)
358-
mock_client._AsyncToolboxClient__core_client.add_headers.assert_called_once_with(
359-
headers
360-
)

packages/toolbox-langchain/tests/test_client.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -429,12 +429,3 @@ def test_init_with_client_headers(self, mock_core_client_constructor):
429429
mock_core_client_constructor.assert_called_once_with(
430430
url=URL, client_headers=headers
431431
)
432-
433-
@patch("toolbox_langchain.client.ToolboxCoreSyncClient")
434-
def test_add_headers(self, mock_core_client_constructor):
435-
"""Tests that add_headers calls the core client's add_headers."""
436-
mock_core_instance = mock_core_client_constructor.return_value
437-
client = ToolboxClient(URL)
438-
headers = {"X-Another-Header": "dynamic_value"}
439-
client.add_headers(headers)
440-
mock_core_instance.add_headers.assert_called_once_with(headers)

0 commit comments

Comments
 (0)