Skip to content

Commit 0e52f41

Browse files
RobLe3claude
andcommitted
fix: add min_reputation + model to DiscoverOptions; closes #4
Add min_reputation and model fields to DiscoverOptions (parity with TypeScript and Rust SDKs). Wire both into discover_async() query params. Add test_discover_passes_min_reputation_and_model verifying both params appear in the outgoing request URL. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5c875ed commit 0e52f41

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

‎src/iicp_client/client.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ async def discover_async(
6060
params["region"] = opts.region or self._cfg.region
6161
if opts.qos:
6262
params["qos"] = opts.qos
63+
if opts.min_reputation is not None:
64+
params["min_reputation"] = opts.min_reputation
65+
if opts.model:
66+
params["model"] = opts.model
6367

6468
import time
6569
t0 = time.monotonic()

‎src/iicp_client/types.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ class ChatResponse:
9191
class DiscoverOptions:
9292
region: str | None = None
9393
qos: str | None = None
94+
min_reputation: float | None = None
95+
model: str | None = None
9496
limit: int = 10
9597

9698

‎tests/test_client.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,3 +221,16 @@ def test_sdk06_node_token_not_in_error():
221221
assert secret not in err.message
222222
assert secret not in str(err)
223223
assert secret not in repr(err)
224+
225+
@respx.mock
226+
def test_discover_passes_min_reputation_and_model():
227+
"""SDK-04 parity: DiscoverOptions.min_reputation + model are sent as query params."""
228+
route = respx.get(DISCOVER_URL).mock(return_value=httpx.Response(200, json=GOOD_NODES))
229+
client = IicpClient(ClientConfig(directory_url=DIRECTORY))
230+
client.discover(
231+
"urn:iicp:intent:llm:chat:v1",
232+
DiscoverOptions(min_reputation=0.7, model="phi3:mini"),
233+
)
234+
url = str(route.calls[0].request.url)
235+
assert "min_reputation=0.7" in url
236+
assert "model=phi3%3Amini" in url or "model=phi3:mini" in url

0 commit comments

Comments
 (0)