diff --git a/examples/mcp/sse_example/main.py b/examples/mcp/sse_example/main.py index 7c1137d2c..dffdc5665 100644 --- a/examples/mcp/sse_example/main.py +++ b/examples/mcp/sse_example/main.py @@ -15,7 +15,8 @@ async def run(mcp_server: MCPServer): name="Assistant", instructions="Use the tools to answer the questions.", mcp_servers=[mcp_server], - model_settings=ModelSettings(tool_choice="required"), + model="gpt-4o", + model_settings=ModelSettings(tool_choice="auto", temperature=0.08, top_p=0.8), ) # Use the `add` tool to add two numbers @@ -36,6 +37,11 @@ async def run(mcp_server: MCPServer): result = await Runner.run(starting_agent=agent, input=message) print(result.final_output) + message = "What's the capital of France?" + print(f"\n\nRunning: {message}") + result = await Runner.run(starting_agent=agent, input=message) + print(result.final_output) + async def main(): async with MCPServerSse( @@ -67,7 +73,7 @@ async def main(): print("Starting SSE server at http://localhost:8000/sse ...") # Run `uv run server.py` to start the SSE server - process = subprocess.Popen(["uv", "run", server_file]) + process = subprocess.Popen(["uv", "run", "--python", "3.10", server_file]) # Give it 3 seconds to start time.sleep(3)