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.32k stars 6.37k forks source link

Cannot set model provider's configurate_methods to "fetch-from-remote" #6641

Closed jasonhp closed 5 days ago

jasonhp commented 1 month ago

Self Checks

Dify version

0.6.15

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

In any model provider’s yaml config. Set configurate_methods to fetch-from-remote and start the backend server.

✔️ Expected Behavior

According to the doc api/core/model_runtime/docs/en_US/provider_scale_out.md, dify supports fetching model list from remote. The server should fetch model list from the provider if configurate_methods is set to fetch-from-remote.

❌ Actual Behavior

The server cannot start. With error: Input should be 'predefined-model' or 'customizable-model' [type=enum, input_value='fetch-from-remote', input_type=str].

dosubot[bot] commented 1 month ago

Hello @jasonhp 👋, I'm here to assist you with any issues or questions you have regarding the Dify project. If you need help with bugs, have questions, or want to become a contributor, I'm here to help while you wait for a human maintainer.

To resolve the issue where setting configurate_methods to fetch-from-remote in the model provider's YAML configuration causes the server to fail to start, you need to ensure that fetch-from-remote is correctly recognized as a valid configuration method. According to the documentation, fetch-from-remote is consistent with the predefined-model configuration method.

Here is an example configuration:

provider: anthropic  # Provider identifier
label:  # Provider display name, can be set in en_US English and zh_Hans Chinese, zh_Hans will default to en_US if not set.
  en_US: Anthropic
icon_small:  # Small provider icon, stored in the _assets directory under the corresponding provider implementation directory, same language strategy as label
  en_US: icon_s_en.png
icon_large:  # Large provider icon, stored in the _assets directory under the corresponding provider implementation directory, same language strategy as label
  en_US: icon_l_en.png
supported_model_types:  # Supported model types, Anthropic only supports LLM
- llm
configurate_methods:  # Supported configuration methods, including fetch-from-remote
- predefined-model
- customizable-model
- fetch-from-remote
provider_credential_schema:  # Provider credential rules, as Anthropic only supports predefined models, unified provider credential rules need to be defined
  credential_form_schemas:  # List of credential form items
  - variable: anthropic_api_key  # Credential parameter variable name
    label:  # Display name
      en_US: API Key
    type: secret-input  # Form type, here secret-input represents an encrypted information input box, showing masked information when editing.
    required: true  # Whether required
    placeholder:  # Placeholder information
      zh_Hans: Enter your API Key here
      en_US: Enter your API Key
  - variable: anthropic_api_url
    label:
      en_US: API URL
    type: text-input  # Form type, here text-input represents a text input box
    required: false
    placeholder:
      zh_Hans: Enter your API URL here
      en_US: Enter your API URL

Ensure that the configurate_methods field includes fetch-from-remote as shown above. This should resolve the server startup error by correctly recognizing fetch-from-remote as a valid configuration method [1][2][3].

To continue talking to Dosu, mention @dosu.