langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
45.24k stars 6.35k forks source link

The request for the arrangement page is normal, but when the API is called, the error is reported #7361

Open catdddmouse opened 3 weeks ago

catdddmouse commented 3 weeks ago

Self Checks

Dify version

0.7.0

Cloud or Self Hosted

Cloud

Steps to reproduce

  1. It is normal to call the customized gemini-1.5-flash-lastest through the orchestration page image
  2. An error is reported when calling through the api interface. image The error message is as shown in the figure
    {
    "code": "completion_request_error",
    "message": "[openai_api_compatible] Error: 'model'",
    "status": 400
    }

✔️ Expected Behavior

Can be called normally through the api interface

❌ Actual Behavior

{
  "code": "completion_request_error",
  "message": "[openai_api_compatible] Error: 'model'",
  "status": 400
}
dosubot[bot] commented 3 weeks ago

@catdddmouse Hello there! I'm a bot designed to help you with bug fixes, answer questions, and guide you on becoming a contributor. If you need any assistance, feel free to ask.

To resolve the 400 Bad Request error with the message "[openai_api_compatible] Error: 'model'" when calling the API for the arrangement page in Dify version 0.7.0 (Cloud), follow these steps:

  1. Check the Model Name: Ensure that the model name you are using is correctly specified and supported. For example, valid model names include gpt-3.5-turbo and gpt-4.

  2. Set the Model in the Application: Make sure you have selected the correct model in the application settings. You can do this by navigating to 提示词编排 --> 模型及参数 --> 语言模型 and selecting the appropriate model.

  3. Verify API Key and Quota: Ensure that your OpenAI API key is valid and that you have not exceeded your quota. If you encounter issues with the API key, you may need to check your plan and billing details.

  4. Update Model Settings: If you are using a custom API domain or a different model provider, ensure that the settings are correctly configured in 设置 --> 模型供应商 --> OpenAI --> 编辑 API.

If the issue persists, review the specific API request being made and ensure that all required parameters, including the model parameter, are correctly included in the request.

Example of setting the model in the API request:

{
  "model": "gpt-3.5-turbo",
  "prompt": "Your prompt here",
  "max_tokens": 100
}

Ensure that the model field is correctly specified as shown above [1].

To continue talking to Dosu, mention @dosu.