Skip to content

Commit 97249b4

Browse files
vicjayjayclaude
andcommitted
fix: use input_type instead of task for NVIDIA NIM embeddings
NVIDIA NIM API now strictly validates request bodies and rejects unknown fields. The task parameter (used by Jina and others) causes a 400 error: "Extra inputs are not permitted, input: 'passage'". Route by provider: NVIDIA endpoints get input_type, others get task. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e7fbcc1 commit 97249b4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/embedder.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,14 @@ export class Embedder {
453453
encoding_format: "float",
454454
};
455455

456-
if (task) payload.task = task;
456+
if (task) {
457+
// NVIDIA NIM uses input_type; other providers (Jina etc.) use task
458+
if (this._baseURL && /nvidia\.com/i.test(this._baseURL)) {
459+
payload.input_type = task;
460+
} else {
461+
payload.task = task;
462+
}
463+
}
457464
if (this._normalized !== undefined) payload.normalized = this._normalized;
458465

459466
// Some OpenAI-compatible providers support requesting a specific vector size.

0 commit comments

Comments
 (0)