From 30bd00bcf7622606ddbb0bc064df61039691d41d Mon Sep 17 00:00:00 2001 From: Olivier Chafik Date: Fri, 25 Oct 2024 02:00:47 +0100 Subject: [PATCH] `agent`: fix tools setup --- examples/agent/Dockerfile.tools | 3 ++- examples/agent/tools/search.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/agent/Dockerfile.tools b/examples/agent/Dockerfile.tools index fb3d474e8..54413a793 100644 --- a/examples/agent/Dockerfile.tools +++ b/examples/agent/Dockerfile.tools @@ -3,7 +3,8 @@ FROM python:3.12-slim RUN python -m pip install --upgrade pip && \ apt clean cache -COPY requirements.txt tools/*.py /root/ +COPY requirements.txt /root/ +COPY tools /root/tools WORKDIR /root RUN pip install -r requirements.txt diff --git a/examples/agent/tools/search.py b/examples/agent/tools/search.py index c89ac59c5..bd416f892 100644 --- a/examples/agent/tools/search.py +++ b/examples/agent/tools/search.py @@ -70,6 +70,7 @@ async def brave_search(*, query: str) -> List[Dict]: if not response.ok: raise Exception(response.text) response.raise_for_status() - results = list(itertools.islice(extract_results(response.json()), max_results)) - print(json.dumps(dict(query=query, response=response, results=results), indent=2)) + response_json = response.json() + results = list(itertools.islice(extract_results(response_json), max_results)) + print(json.dumps(dict(query=query, response=response_json, results=results), indent=2)) return results