agent: hard-code max_results=10 in brave_search

This commit is contained in:
Olivier Chafik 2024-10-02 19:13:28 +01:00
parent 26e76f9704
commit 6b4a454735
2 changed files with 9 additions and 7 deletions

View file

@ -1,9 +1,10 @@
from pydantic import Field
import aiohttp import aiohttp
import itertools import itertools
import json import json
import logging import logging
import os import os
from typing import Dict, List from typing import Annotated, Dict, List
import urllib.parse import urllib.parse
@ -28,19 +29,20 @@ _result_keys_by_type = {
} }
async def brave_search(query: str, max_results: int = 10) -> List[Dict]: async def brave_search(*, query: str) -> List[Dict]:
''' '''
Search the Brave Search API for the specified query. Search the Brave Search API for the specified query.
Parameters: Parameters:
query (str): The query to search for. query (str): The query to search for.
max_results (int): The maximum number of results to return (defaults to 10)
Returns: Returns:
List[Dict]: The search results. List[Dict]: The search results.
''' '''
logging.debug('[brave_search] Searching for %s', query) logging.debug('[brave_search] Searching for %s', query)
max_results = 10
url = f'https://api.search.brave.com/res/v1/web/search?q={urllib.parse.quote(query)}' url = f'https://api.search.brave.com/res/v1/web/search?q={urllib.parse.quote(query)}'
headers = { headers = {
'Accept': 'application/json', 'Accept': 'application/json',