File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,14 +45,11 @@ class ReActAgent(Assistant):
4545 name : str = Field (default = "ReActAgent" )
4646 type : str = Field (default = "ReActAgent" )
4747 api_key : Optional [str ] = Field (default_factory = lambda : os .getenv ("OPENAI_API_KEY" ))
48- tavily_api_key : Optional [str ] = Field (
49- default_factory = lambda : os .getenv ("TAVILY_API_KEY" )
50- )
5148 system_prompt : Optional [str ] = Field (default = AGENT_SYSTEM_MESSAGE )
5249 function_call_tool : FunctionCallTool = Field (
5350 default = TavilyTool .builder ()
5451 .name ("TavilyTestTool" )
55- .api_key (tavily_api_key )
52+ .api_key (os . getenv ( "TAVILY_API_KEY" ) )
5653 .max_tokens (6000 )
5754 .search_depth ("advanced" )
5855 .build ()
Original file line number Diff line number Diff line change 66
77import pytest
88
9+ # Set a dummy TAVILY_API_KEY to prevent initialization errors
10+ os .environ ["TAVILY_API_KEY" ] = "test-tavily-key"
11+
912# Now import after setting the environment variable
1013from grafi .agents .react_agent import ReActAgent
1114from grafi .agents .react_agent import ReActAgentBuilder
1215from grafi .tools .function_calls .impl .tavily_tool import TavilyTool
1316
1417
15- # Set environment variable before any imports to prevent API key errors
16- # os.environ["TAVILY_API_KEY"] = "mock-api-key-for-testing"
17-
18-
1918@pytest .fixture (autouse = True )
2019def mock_tavily_client ():
2120 """Automatically mock TavilyClient for all tests."""
You can’t perform that action at this time.
0 commit comments