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
52.36k stars 7.64k forks source link

Regarding the model provider's function call support-related issues #10967

Open limusen75 opened 11 hours ago

limusen75 commented 11 hours ago

Self Checks

Provide a description of requested docs changes

In the model provider list, it is written that OpenAI API-Compatible does not support function calling. However, in the OpenAI API-Compatible settings, there is an option for function calling, and I found that when I select to support function calling, Dify does not send the tools to the model during debugging. On the other hand, when I select not to support function calling, Dify sends the tools to the model in a React way during debugging. Could you please clarify whether the function calling option in OpenAI API-Compatible is a frontend bug or an outdated documentation issue in the model provider list? 微信图片_20241122133152 微信图片_20241122133245

dosubot[bot] commented 11 hours ago

@limusen75 Hello there! I'm here to help you with any bugs, questions, or contributions. Let's work together to solve the issue you're facing.

The discrepancy you're observing between the documentation and the actual behavior of the OpenAI API-Compatible settings in Dify might be due to outdated documentation or a frontend issue. The current implementation in Dify does support function calling, as indicated by the presence of options for "function_call" and "tool_call" in the settings. When function calling is enabled, Dify should handle tools differently compared to when it is disabled.

If the documentation states that function calling is not supported, it may need updating to reflect the current capabilities of the platform. On the other hand, if the frontend is not behaving as expected (e.g., not sending tools when function calling is enabled), it could be a bug that needs addressing.

To resolve this, it would be beneficial to verify the documentation's accuracy and ensure that the frontend implementation aligns with the backend capabilities. If the issue persists, it might be worth reporting it for further investigation by the maintainers.

To continue talking to Dosu, mention @dosu.

crazywoola commented 10 hours ago

https://github.com/langgenius/dify/blob/70ddc0ce4354b3985d77f3a7ea3995199b6bfd4c/api/core/model_runtime/model_providers/openai_api_compatible/llm/llm.py#L60-L72

Maybe the docs is outdated.

limusen75 commented 7 hours ago

@crazywoola I'm currently using the OpenAI API-Compatible configuration model llama3.1-70b-Instruct, with function calling enabled. However, when I send a request to the model using Dify, the request does not include the 'tools' parameter. Here are some related test screenshots: 微信图片_20241122162913 微信图片_20241122163723 微信图片_20241122164115