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
47.15k stars 6.7k forks source link

Agent Mode of gpt-3.5-turbo have only Function Calling #2517

Closed xiangpingjiang closed 5 months ago

xiangpingjiang commented 7 months ago

Self Checks

Dify version

0.5.6

Cloud or Self Hosted

Cloud

Steps to reproduce

Use the Agent Assistant and set the Agent Assistant. Agent Mode just has Function Calling

✔️ Expected Behavior

there are two options , Function Calling and ReAct

❌ Actual Behavior

just one option Function Calling

dosubot[bot] commented 7 months ago

🤖

Hello again, @xiangpingjiang! It's great to see you back and reaching out. Hope you've been well!

Based on the context provided, it seems that the isFunctionCall prop in the Dify codebase is used to determine the Agent Mode. If isFunctionCall is true, the Agent Mode is set to Function Calling. If isFunctionCall is false, the Agent Mode should be set to ReAct.

However, you mentioned that you're only seeing the Function Calling option and not the ReAct option. This suggests that the isFunctionCall prop is always true when the component is rendered.

To resolve this issue, you would need to investigate why isFunctionCall is always true. This could be due to a variety of reasons, such as a bug in the code that sets the isFunctionCall prop, or a problem with the state management in the application.

Unfortunately, without more information about the Dify codebase and how the isFunctionCall prop is being set, it's difficult for me to provide a more specific solution. If you could provide more details about how the isFunctionCall prop is being set and managed, I might be able to provide a more targeted solution.

As for the ReAct option, it's possible that it was removed or not yet implemented in the version of Dify you're using (v0.5.6). You might want to check the release notes or the commit history of the Dify repository to see if there's any mention of the ReAct option being removed or not yet implemented.

I hope this helps! If you have any more questions or need further clarification, feel free to ask.

Sources

#### About Dosu This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot.
crazywoola commented 7 months ago

Can you add a screenshot as well? The information you provide seems not enough for us to infer what's going on here.

image

By default it only has tools function opened. If you want to add more features. Please click add features button below.

image
xiangpingjiang commented 7 months ago
Screenshot 2024-02-22 at 11 20 16
xiangpingjiang commented 7 months ago

hello @crazywoola What should I do if I want set the ReAct mode for my Agent Assistant?

crazywoola commented 7 months ago

hello @crazywoola What should I do if I want set the ReAct mode for my Agent Assistant?

Well you should wait for the new version I think.

xiangpingjiang commented 7 months ago

@crazywoola Is there an issue to track the feature ?

crazywoola commented 7 months ago

cc @Yeuoly

crazywoola commented 7 months ago

hello @crazywoola What should I do if I want set the ReAct mode for my Agent Assistant?

Well you should wait for the new version I think.

Here it is.

Yeuoly commented 7 months ago

That's our design, we will force all models support Function Calling to use it instead of ReAct, I guess you want to do some tests with different models, or is there any scenarios require it? I think Function calling could have a better performance.

xiangpingjiang commented 7 months ago

@Yeuoly Yes, I want to do a test. But Are you sure that Function calling has better performance for all models?

follow the doc https://docs.dify.ai/user-guide/creating-dify-apps/prompt-engineering/agent-assistant#agent-settings For model series that do not support Function Calling, we have implemented the ReAct inference framework to achieve similar effects.

Yeuoly commented 7 months ago

Then you can try to read our source code and do some simple modifications here https://github.com/langgenius/dify/blob/main/api/core/app_runner/assistant_app_runner.py#L205

You can just make all models use AssistantCotApplicationRunner

xiangpingjiang commented 7 months ago

so did you decide to abandon the ReAct feature ?

Yeuoly commented 7 months ago

It's not abandoned I thought, you can find React mode if you change the model to Gemini Pro if you want, people use Dify for production wants a better performance, and as for the model supports Function calling in Dify, Function Calling does have a better performance.

xiangpingjiang commented 7 months ago

@Yeuoly But Gemini Pro supports also Function calling https://cloud.google.com/vertex-ai/docs/generative-ai/multimodal/function-calling .

Dify didn't support Function Calling for Gemini Pro?

crazywoola commented 7 months ago

@Yeuoly But Gemini Pro supports also Function calling https://cloud.google.com/vertex-ai/docs/generative-ai/multimodal/function-calling .

Dify didn't support Function Calling for Gemini Pro?

It does support fc in Gemini Pro.

xiangpingjiang commented 7 months ago

ok, so which models we can use ReAct mode in dify ?

Yeuoly commented 7 months ago

@Yeuoly But Gemini Pro supports also Function calling https://cloud.google.com/vertex-ai/docs/generative-ai/multimodal/function-calling . Dify didn't support Function Calling for Gemini Pro?

It does support fc in Gemini Pro.

There is an issue in generativeai causes function call does not work now https://github.com/langchain-ai/langchain/discussions/17621

dosubot[bot] commented 6 months ago

Hi, @xiangpingjiang,

I'm helping the team manage their backlog and am marking this issue as stale. From what I understand, the issue was reported regarding the Agent Mode of gpt-3.5-turbo in Dify version 0.5.6, which only had the option for Function Calling instead of both Function Calling and ReAct as expected. The conversation in the comments led to the resolution, where Yeuoly explained the design decision to force all models to support Function Calling instead of ReAct.

Could you please confirm if this issue is still relevant to the latest version of the repository? If it is, please let the team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days.

Thank you!