payload in validate_credentials does not contain input_type #6983

Closed
opened 2026-02-21 18:18:14 -05:00 by yindo · 6 comments
Owner

Originally created by @pohndorff on GitHub (Nov 28, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.12.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. In Settings -> Model Provider -> OpenAI-API-compatible add new Model
  2. Select Text Embedding, Model Name: "nvidia/nv-embedqa-mistral-7b-v2", API Key: XXX, API endpoint URL: http:///nim-embedding/v1, Model context size: 4096

✔️ Expected Behavior

200, configuration successful

https://github.com/langgenius/dify/blob/0f1133729f71dcc2ebe9921ebff6e996557b2efb/api/core/model_runtime/model_providers/openai_api_compatible/text_embedding/text_embedding.py#L148

probably correct payload
payload = {"input": "ping", "model": model, "input_type": "query"}

Actual Behavior

Error 400, configuration cannot finish

Originally created by @pohndorff on GitHub (Nov 28, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.12.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 1. In Settings -> Model Provider -> OpenAI-API-compatible add new Model 2. Select Text Embedding, Model Name: "nvidia/nv-embedqa-mistral-7b-v2", API Key: XXX, API endpoint URL: http://<Base URL>/nim-embedding/v1, Model context size: 4096 ### ✔️ Expected Behavior 200, configuration successful https://github.com/langgenius/dify/blob/0f1133729f71dcc2ebe9921ebff6e996557b2efb/api/core/model_runtime/model_providers/openai_api_compatible/text_embedding/text_embedding.py#L148 probably correct payload `payload = {"input": "ping", "model": model, "input_type": "query"}` ### ❌ Actual Behavior Error 400, configuration cannot finish
yindo added the 🐞 bug label 2026-02-21 18:18:14 -05:00
yindo closed this issue 2026-02-21 18:18:14 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 28, 2024):

Hey @pohndorff! 👋 I'm here to help you with bugs, questions, and becoming a contributor.

I found a similar unsolved discussion regarding a 400 error when requesting an embedding model: 请求 embedding 模型是报错 [openai_api_compatible] Error: API request failed with status code 400 [1].

Regarding your issue, it seems that the absence of the input_type field in the payload might be causing the 400 error. The correct payload should likely include the input_type field, as you mentioned: payload = {"input": "ping", "model": model, "input_type": "query"}. This field might be necessary for the API to correctly interpret the request. You might want to ensure that this field is included in your payload when configuring the model.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Nov 28, 2024): <!-- Greeting --> Hey @pohndorff! 👋 I'm here to help you with bugs, questions, and becoming a contributor. <!-- Answer --> I found a similar unsolved discussion regarding a 400 error when requesting an embedding model: [请求 embedding 模型是报错 [openai_api_compatible] Error: API request failed with status code 400](https://github.com/langgenius/dify/discussions/6130) <sup>[[1]](https://github.com/langgenius/dify/discussions/6130)</sup>. Regarding your issue, it seems that the absence of the `input_type` field in the payload might be causing the 400 error. The correct payload should likely include the `input_type` field, as you mentioned: `payload = {"input": "ping", "model": model, "input_type": "query"}`. This field might be necessary for the API to correctly interpret the request. You might want to ensure that this field is included in your payload when configuring the model. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@yihong0618 commented on GitHub (Nov 28, 2024):

better choose here instead of OpenAI-API-compatible
image

@yihong0618 commented on GitHub (Nov 28, 2024): better choose here instead of OpenAI-API-compatible ![image](https://github.com/user-attachments/assets/489d2441-1fb3-4e27-b332-a81a594349e9)
Author
Owner

@pohndorff commented on GitHub (Dec 1, 2024):

@yihong0618 mistral is locally deployed on nim, not via NVIDIA cloud. difys NIM-connector does not support models other than LLM.

@pohndorff commented on GitHub (Dec 1, 2024): @yihong0618 mistral is locally deployed on nim, not via NVIDIA cloud. difys NIM-connector does not support models other than LLM.
Author
Owner

@yihong0618 commented on GitHub (Dec 1, 2024):

Yes I checked your method, add "input_type": "query" but it seems a special case for nim local, I did not test others like llm instead of embeddings, can you confirm that, only embedding failed for nim? I think we can add a special case for it, if the error and param only nim embedding had it.
Thanks

@yihong0618 commented on GitHub (Dec 1, 2024): Yes I checked your method, add `"input_type": "query"` but it seems a special case for nim local, I did not test others like llm instead of embeddings, can you confirm that, only embedding failed for nim? I think we can add a special case for it, if the error and param only nim embedding had it. Thanks
Author
Owner

@pohndorff commented on GitHub (Dec 1, 2024):

LLMs are working as intended. It's just embedding models.

EDIT: The additional parameter "input_type" will be mandatory for all embedding models that are retrieval optimized.

@pohndorff commented on GitHub (Dec 1, 2024): LLMs are working as intended. It's just embedding models. EDIT: The additional parameter `"input_type"` will be mandatory for all embedding models that are retrieval optimized.
Author
Owner

@yihong0618 commented on GitHub (Dec 1, 2024):

LLMs are working as intended. It's just embedding models.

EDIT: The additional parameter "input_type" will be mandatory for all embedding models that are retrieval optimized.

https://github.com/langgenius/dify/pull/11239

@yihong0618 commented on GitHub (Dec 1, 2024): > LLMs are working as intended. It's just embedding models. > > EDIT: The additional parameter `"input_type"` will be mandatory for all embedding models that are retrieval optimized. https://github.com/langgenius/dify/pull/11239
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6983