Spaces:
Sleeping
Sleeping
File size: 532 Bytes
a5164b3 86166ac a5164b3 86166ac a5164b3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import os
from langchain_openai import ChatOpenAI
from langchain_community.tools import BraveSearch
# gpt-4.1-nano (cheaper for debugging) with temperature 0 for less randomness
# for benchmarking use gpt-4.1-mini or 04-mini
llm = ChatOpenAI(model="gpt-4.1-nano", temperature=0)
search_tool = BraveSearch.from_api_key(
api_key=os.getenv("BRAVE_SEARCH_API"),
search_kwargs={"count": 4}, # returns the 4 best results and their URL
description="Web search using Brave"
) |