You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(embedding): validate batch results before accepting vectors #401
Implementation is completed through merged #403; this issue remains closed as completed.
SDK 0.11.0 publication for Dify 1.19.0 is tracked separately in #413.
OAICompatEmbeddingModel._invoke accepts malformed batches and appends vectors in response order.
For three inputs in batches of two, an empty first response still triggers the second request and returns just one vector.
Validate each batch before accepting vectors or sending another request:
Require one nonempty vector per input, consistent dimensions and finite numeric values.
Require complete, unique, valid integer indices when present, and restore input order.
Keep valid responses without indices in response order; reject mixed or invalid index metadata.
Stop at the first invalid batch through the SDK invocation-error path.
Preserve usage aggregation for valid batches and close owned responses on success and failure.
Update #396's HTTP tests to cover valid indexed/unindexed responses, reordered vectors, malformed batches and no further requests after failure.
Check Gitee AI and SiliconFlow; document rejection of malformed responses and reordering of indexed results.
From #394 and the review in #396.
Activity