OpenAI-API-compatible methods cannot retrieve knowledge bases. #13286

Closed
opened 2026-02-21 19:11:27 -05:00 by yindo · 1 comment
Owner

Originally created by @lzcmagic on GitHub (Apr 24, 2025).

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

1.2.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When using Google's official API in Agent mode, I can successfully retrieve the knowledge base. However, with the same Agent setup, switching to an OpenAI-API-compatible approach (e.g., Gemini integration) fails to retrieve the knowledge base

Agent Config

app:
  description: ''
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: agent-chat
  name: test
  use_icon_as_answer_icon: false
dependencies:
- current_identifier: null
  type: marketplace
  value:
    marketplace_plugin_unique_identifier: langgenius/gemini:0.1.5@012c9e0467a11910db974e0436348e93a376fdc96381946a3db2c56708377381
kind: app
model_config:
  agent_mode:
    enabled: true
    max_iteration: 5
    prompt: null
    strategy: function_call
    tools: []
  annotation_reply:
    enabled: false
  chat_prompt_config: {}
  completion_prompt_config: {}
  dataset_configs:
    datasets:
      datasets:
      - dataset:
          enabled: true
          id: 2ac548e0-f2bd-4843-b6d1-c0532621f84b
    reranking_enable: false
    reranking_mode: reranking_model
    reranking_model:
      reranking_model_name: ''
      reranking_provider_name: ''
    retrieval_model: multiple
    top_k: 4
  dataset_query_variable: ''
  external_data_tools: []
  file_upload:
    allowed_file_extensions:
    - .JPG
    - .JPEG
    - .PNG
    - .GIF
    - .WEBP
    - .SVG
    - .MP4
    - .MOV
    - .MPEG
    - .MPGA
    allowed_file_types:
    - image
    - document
    allowed_file_upload_methods:
    - remote_url
    - local_file
    enabled: true
    image:
      detail: high
      enabled: true
      number_limits: 3
      transfer_methods:
      - remote_url
      - local_file
    number_limits: 3
  model:
    completion_params:
      stop: []
    mode: chat
    name: gemini-2.0-flash
    provider: langgenius/gemini/google
  more_like_this:
    enabled: false
  opening_statement: ''
  pre_prompt: ''
  prompt_type: simple
  retriever_resource:
    enabled: true
  sensitive_word_avoidance:
    configs: []
    enabled: false
    type: ''
  speech_to_text:
    enabled: false
  suggested_questions: []
  suggested_questions_after_answer:
    enabled: false
  text_to_speech:
    enabled: false
    language: ''
    voice: ''
  user_input_form: []
version: 0.1.5

Agent Screenshot

Image

Offical API Result

Image

Compatible API Result

Image

✔️ Expected Behavior

It is expected that both methods can retrieve the knowledge base normally

Actual Behavior

OpenAI-API-compatible did not work for me

Screenshot

Image

Originally created by @lzcmagic on GitHub (Apr 24, 2025). ### 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 1.2.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce When using Google's official API in Agent mode, I can successfully retrieve the knowledge base. However, with the same Agent setup, switching to an OpenAI-API-compatible approach (e.g., Gemini integration) fails to retrieve the knowledge base > Agent Config ```code app: description: '' icon: 🤖 icon_background: '#FFEAD5' mode: agent-chat name: test use_icon_as_answer_icon: false dependencies: - current_identifier: null type: marketplace value: marketplace_plugin_unique_identifier: langgenius/gemini:0.1.5@012c9e0467a11910db974e0436348e93a376fdc96381946a3db2c56708377381 kind: app model_config: agent_mode: enabled: true max_iteration: 5 prompt: null strategy: function_call tools: [] annotation_reply: enabled: false chat_prompt_config: {} completion_prompt_config: {} dataset_configs: datasets: datasets: - dataset: enabled: true id: 2ac548e0-f2bd-4843-b6d1-c0532621f84b reranking_enable: false reranking_mode: reranking_model reranking_model: reranking_model_name: '' reranking_provider_name: '' retrieval_model: multiple top_k: 4 dataset_query_variable: '' external_data_tools: [] file_upload: allowed_file_extensions: - .JPG - .JPEG - .PNG - .GIF - .WEBP - .SVG - .MP4 - .MOV - .MPEG - .MPGA allowed_file_types: - image - document allowed_file_upload_methods: - remote_url - local_file enabled: true image: detail: high enabled: true number_limits: 3 transfer_methods: - remote_url - local_file number_limits: 3 model: completion_params: stop: [] mode: chat name: gemini-2.0-flash provider: langgenius/gemini/google more_like_this: enabled: false opening_statement: '' pre_prompt: '' prompt_type: simple retriever_resource: enabled: true sensitive_word_avoidance: configs: [] enabled: false type: '' speech_to_text: enabled: false suggested_questions: [] suggested_questions_after_answer: enabled: false text_to_speech: enabled: false language: '' voice: '' user_input_form: [] version: 0.1.5 ``` > Agent Screenshot ![Image](https://github.com/user-attachments/assets/de6389db-864b-4adc-b375-13635875c47c) > Offical API Result ![Image](https://github.com/user-attachments/assets/9d3b26c0-33b5-4ade-8137-99506baddf1f) > Compatible API Result ![Image](https://github.com/user-attachments/assets/47720199-f7f3-42e0-ad48-46af4ba81c5a) ### ✔️ Expected Behavior It is expected that both methods can retrieve the knowledge base normally ### ❌ Actual Behavior OpenAI-API-compatible did not work for me > Screenshot ![Image](https://github.com/user-attachments/assets/4feebd0b-6684-480f-965c-4489f92ce039)
yindo closed this issue 2026-02-21 19:11:27 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Apr 24, 2025):

I found a similar open issue titled "OpenAI-API-compatible methods cannot retrieve knowledge bases" [1]. The suggested solution for this issue is to consider switching to using either the Qwen or Deepseek AI model instead of the problematic model, as there might be incompatibility issues between certain AI models and the RAGFLOW system, which can result in malformed queries. Additionally, ensure there is no OpenAI service outage by checking their status page, as this could also affect the retrieval process.

Furthermore, it is important to verify that the API Key and endpoint URL are correctly set in your configuration. Also, ensure that the model type and other parameters such as context size and completion mode are appropriately configured according to the requirements of the OpenAI-API-compatible provider you are using [2].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Apr 24, 2025): <!-- Answer --> I found a similar open issue titled "OpenAI-API-compatible methods cannot retrieve knowledge bases" <sup>[[1]](https://github.com/langgenius/dify/issues/18590)</sup>. The suggested solution for this issue is to consider switching to using either the Qwen or Deepseek AI model instead of the problematic model, as there might be incompatibility issues between certain AI models and the RAGFLOW system, which can result in malformed queries. Additionally, ensure there is no OpenAI service outage by checking their status page, as this could also affect the retrieval process. Furthermore, it is important to verify that the API Key and endpoint URL are correctly set in your configuration. Also, ensure that the model type and other parameters such as context size and completion mode are appropriately configured according to the requirements of the OpenAI-API-compatible provider you are using <sup>[[2]](https://github.com/langgenius/dify/issues/11572)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/e63fd410-c063-41d8-82f8-6ab41ae9bbe1?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/e63fd410-c063-41d8-82f8-6ab41ae9bbe1?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/e63fd410-c063-41d8-82f8-6ab41ae9bbe1?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/e63fd410-c063-41d8-82f8-6ab41ae9bbe1?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/e63fd410-c063-41d8-82f8-6ab41ae9bbe1?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/e63fd410-c063-41d8-82f8-6ab41ae9bbe1?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/e63fd410-c063-41d8-82f8-6ab41ae9bbe1?feedback_type=other)</sup>
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#13286