Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/API_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ bash run_api.sh

**Endpoint:** `POST /miner_availabilities/miner_availabilities`

**Description:** Fetches miner availabilities based on provided UIDs.
**Description:** Fetches miner availabilities based on provided UIDs. **Note: Specifying UIDs is deprecated.**

**Request Body:**

- JSON array of integers or null (optional).
- JSON array of integers or null (optional, deprecated).

---

Expand Down Expand Up @@ -169,13 +169,13 @@ Web Retrieval

**Endpoint:** `GET /web_retrieval`

**Description:** Retrieves a list websites about a search query
**Description:** Retrieves a list websites about a search query. **Note: The `uids` parameter is deprecated.**

**Parameters:**

- **search_query** (str): The search term you'd like to look up
- **n_miners** (int, optional): How many miners to query
- **uids**: (list[int], optional): which specific uids to query (Deprecated)
- **uids**: (list[int], optional, deprecated): which specific uids to query

---

Expand Down
24 changes: 11 additions & 13 deletions validator_api/gpt_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def completions(request: CompletionsRequest, api_key: str = Depends(valida
- Mixture of miners

## Request Parameters:
- **uids** (List[int], optional): Specific miner UIDs to query. If not provided, miners will be selected automatically.
- **uids** (List[int], optional, deprecated): Specific miner UIDs to query. If not provided, miners will be selected automatically. **Note: This parameter is deprecated and will be removed in a future version.**
- **messages** (List[dict]): List of message objects with 'role' and 'content' keys. Required.
- **seed** (int, optional): Random seed for reproducible results.
- **task** (str, optional): Task identifier to filter available miners.
Expand Down Expand Up @@ -81,6 +81,7 @@ async def completions(request: CompletionsRequest, api_key: str = Depends(valida
# By setting default, we are allowing a user to use whatever model we define as the standard, could also set to None.
body["model"] = "mrfakename/mistral-small-3.1-24b-instruct-2503-hf"
body["seed"] = int(body.get("seed") or random.randint(0, 1000000))

uids = filter_available_uids(
task=body.get("task"),
model=body.get("model"),
Expand All @@ -89,6 +90,7 @@ async def completions(request: CompletionsRequest, api_key: str = Depends(valida
n_top_incentive=shared_settings.API_TOP_UIDS_SAMPLE,
explore=shared_settings.API_UIDS_EXPLORE,
)

if not uids:
raise HTTPException(status_code=500, detail="No available miners")

Expand Down Expand Up @@ -121,7 +123,7 @@ async def test_time_inference(request: TestTimeInferenceRequest):
## Request Parameters:
- **messages** (List[dict]): List of message objects with 'role' and 'content' keys. Required.
- **model** (str, optional): Optional model identifier to use for inference.
- **uids** (List[int], optional): Optional list of specific miner UIDs to query.
- **uids** (List[int], optional, deprecated): Optional list of specific miner UIDs to query. **Note: This parameter is deprecated and will be removed in a future version.**

## Response:
The response is streamed as server-sent events (SSE) with each step of reasoning.
Expand Down Expand Up @@ -181,7 +183,7 @@ async def submit_chain_of_thought_job(
/v1/chat/completions/jobs/{job_id} endpoint.

## Request Parameters:
- **uids** (List[int], optional): Specific miner UIDs to query. If not provided, miners will be selected automatically.
- **uids** (List[int], optional, deprecated): Specific miner UIDs to query. If not provided, miners will be selected automatically. **Note: This parameter is deprecated and will be removed in a future version.**
- **messages** (List[dict]): List of message objects with 'role' and 'content' keys. Required.
- **model** (str, optional): Model identifier to filter available miners.

Expand Down Expand Up @@ -213,17 +215,13 @@ async def submit_chain_of_thought_job(
)

body["seed"] = int(body.get("seed") or random.randint(0, 1000000))

uids = (
[int(uid) for uid in body.get("uids")]
if body.get("uids")
else filter_available_uids(
task=body.get("task"),
model=body.get("model"),
test=shared_settings.API_TEST_MODE,
n_miners=shared_settings.API_TOP_UIDS_TO_STREAM,
)
uids = filter_available_uids(
task=body.get("task"),
model=body.get("model"),
test=shared_settings.API_TEST_MODE,
n_miners=shared_settings.API_TOP_MINERS_TO_STREAM,
)
uids = [uid.map(int) for uid in uids]

if not uids:
raise HTTPException(status_code=500, detail="No available miners")
Expand Down
9 changes: 6 additions & 3 deletions validator_api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ def add_tools(self):

uids: Optional[List[int]] = Field(
default=None,
description="List of specific miner UIDs to query. If not provided, miners will be selected automatically.",
description="[DEPRECATED] This field will be removed in a future version. List of specific miner UIDs to query. If not provided, miners will be selected automatically. Please consider alternative mechanisms for miner selection if available.",
example=[1, 2, 3],
deprecated=True,
)
messages: List[Dict[str, str]] = Field(
...,
Expand Down Expand Up @@ -105,8 +106,9 @@ class WebRetrievalRequest(BaseModel):

uids: Optional[List[int]] = Field(
default=None,
description="List of specific miner UIDs to query. If not provided, miners will be selected automatically.",
description="[DEPRECATED] This field will be removed in a future version. List of specific miner UIDs to query. If not provided, miners will be selected automatically. Please consider alternative mechanisms for miner selection if available.",
example=[1, 2, 3],
deprecated=True,
)
search_query: str = Field(
..., description="The query to search for on the web.", example="latest advancements in quantum computing"
Expand Down Expand Up @@ -150,8 +152,9 @@ class TestTimeInferenceRequest(BaseModel):

uids: Optional[List[int]] = Field(
default=None,
description="List of specific miner UIDs to query. If not provided, miners will be selected automatically.",
description="[DEPRECATED] This field will be removed in a future version. List of specific miner UIDs to query. If not provided, miners will be selected automatically. Please consider alternative mechanisms for miner selection if available.",
example=[1, 2, 3],
deprecated=True,
)
messages: List[Dict[str, str]] = Field(
...,
Expand Down
1 change: 1 addition & 0 deletions validator_api/web_retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ async def web_retrieval( # noqa: C901
api_key: str = Depends(validate_api_key),
):
"""Launch *all* requested miners in parallel, return immediately when the first miner delivers a valid result."""

# Requesting UIDs is deprecated.
uids: np.ndarray = get_uids(sampling_mode="random", k=shared_settings.API_EXTRA_UIDS_QUERY)

Expand Down