Skip to content

Commit 846a06b

Browse files
committed
reduce changes
1 parent b71e885 commit 846a06b

File tree

3 files changed

+100
-126
lines changed

3 files changed

+100
-126
lines changed

examples/clients/simple-sampling-client/mcp_simple_sampling_client/main.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import json
66
import typing
77

8+
import httpx
89
import pydantic_settings
9-
import requests
1010

1111
import mcp
1212
from mcp.client.streamable_http import streamablehttp_client
@@ -77,7 +77,7 @@ def get_llm_response(
7777

7878
extra_arguments = {} if tools is None else {"tool_choice": "auto", "tools": tools}
7979

80-
chat_completion = requests.post(
80+
chat_completion = httpx.post(
8181
self.api_url,
8282
json={
8383
"messages": updated_chat_history,
@@ -92,9 +92,10 @@ def get_llm_response(
9292
"Content-Type": "application/json",
9393
},
9494
timeout=300,
95-
).json()
95+
)
96+
chat_completion.raise_for_status()
9697

97-
return chat_completion
98+
return chat_completion.json()
9899

99100
async def fetch_mcp_tools(self: "SamplingClient") -> list[Tool]:
100101
"""List available tools."""

examples/clients/simple-sampling-client/pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ classifiers = [
3737
"Typing :: Typed",
3838
]
3939
dependencies = [
40+
"httpx>=0.27.1",
4041
"mcp>=1.16.0,<2",
41-
"pydantic>=2.11.10,<3",
42-
"pydantic-settings>=2.11.0,<3",
43-
"requests>=2.32.5,<3",
42+
"pydantic>=2.11.0,<3.0.0",
43+
"pydantic-settings>=2.5.2",
4444
]
4545

4646
[project.scripts]

0 commit comments

Comments
 (0)