The SDK client.retrieval.query(...) can fail to parse valid API responses when retrieval results contain score: null.
Observed with knowhere-python-sdk==0.5.0 against staging after parsing a local markdown file and then calling:
query_result = client.retrieval.query(
query="Which Knowhere SDK abilities does this document describe?",
use_agentic=False,
)
The server response includes results like:
{
"chunk_type": "text",
"score": null,
"content": "...",
"source": {
"source_file_name": "knowhere-demo-document.md",
"document_id": "doc_...",
"section_path": "Knowhere SDK Demo Document"
}
}
The SDK raises a Pydantic validation error before returning the response:
ValidationError: results.0.score
Input should be a valid number [type=float_type, input_value=None, input_type=NoneType]
Expected behavior: RetrievalResult.score should accept None if the API can return null, or the SDK should normalize null scores before model validation.
This blocks simple SDK demos that use the public client.retrieval.query(...) method because parsing works, but query crashes during response validation.
The SDK
client.retrieval.query(...)can fail to parse valid API responses when retrieval results containscore: null.Observed with
knowhere-python-sdk==0.5.0against staging after parsing a local markdown file and then calling:The server response includes results like:
{ "chunk_type": "text", "score": null, "content": "...", "source": { "source_file_name": "knowhere-demo-document.md", "document_id": "doc_...", "section_path": "Knowhere SDK Demo Document" } }The SDK raises a Pydantic validation error before returning the response:
Expected behavior:
RetrievalResult.scoreshould acceptNoneif the API can return null, or the SDK should normalize null scores before model validation.This blocks simple SDK demos that use the public
client.retrieval.query(...)method because parsing works, but query crashes during response validation.