Skip to content

Commit 701578b

Browse files
authored
chore(toolbox-llamaindex): remove add_headers feature (#280)
* chore!: remove addHeaders feature * lint * remove files
1 parent 4c59f14 commit 701578b

File tree

5 files changed

+8
-62
lines changed

5 files changed

+8
-62
lines changed

packages/toolbox-llamaindex/README.md

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

205205
### Configuration
206206

207-
You can configure these dynamic headers in two ways:
207+
You can configure these dynamic headers as follows:
208208

209-
1. **During Client Initialization**
210-
211-
```python
212-
from toolbox_llamaindex import ToolboxClient
213-
214-
client = ToolboxClient(
215-
"toolbox-url",
216-
client_headers={"header1": header1_getter, "header2": header2_getter, ...}
217-
)
218-
```
219-
220-
1. **After Client Initialization**
221-
222-
```python
223-
from toolbox_llamaindex import ToolboxClient
209+
```python
210+
from toolbox_llamaindex import ToolboxClient
224211

225-
client = ToolboxClient("toolbox-url")
226-
client.add_headers({"header1": header1_getter, "header2": header2_getter, ...})
227-
```
212+
client = ToolboxClient(
213+
"toolbox-url",
214+
client_headers={"header1": header1_getter, "header2": header2_getter, ...}
215+
)
216+
```
228217

229218
### Authenticating with Google Cloud Servers
230219

packages/toolbox-llamaindex/src/toolbox_llamaindex/async_client.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -190,16 +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-
Args:
201-
headers: Headers to include in each request sent through this client.
202-
Raises:
203-
ValueError: If any of the headers are already registered in the client.
204-
"""
205-
self.__core_client.add_headers(headers)

packages/toolbox-llamaindex/src/toolbox_llamaindex/client.py

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

packages/toolbox-llamaindex/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-llamaindex/tests/test_client.py

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

0 commit comments

Comments
 (0)