Spaces:
Sleeping
Sleeping
File size: 688 Bytes
a5164b3 86166ac 766af75 86166ac a5164b3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import os
from langchain_openai import ChatOpenAI
from langchain_community.tools import BraveSearch # web search
from langchain.tools import Calculator # for basic math
from langchain.tools.python.tool import PythonAstREPLTool # for logic/math problems
# 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"
) |