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
35.78k stars 4.83k forks source link

OpenAI argues that "functions" are outdated, so why comment on "tools" and still utilize "functions" in code? #2410

Closed goldenquant closed 3 months ago

goldenquant commented 4 months ago

Self Checks

Provide a description of the help you need

OpenAI argues that "functions" are outdated, so why comment on "tools" and still utilize "functions" in code?

code:api\core\model_runtime\model_providers\openai\llm\llm.py image

dosubot[bot] commented 4 months ago

🤖

Hey there, @highjim! Great to see you diving into another intriguing topic with us. 😄

The use of "functions" in the dify code does not necessarily mean that they are outdated or not in line with OpenAI's recommendations. In the context of this code, "functions" are used as a part of the OpenAIFunctionsAgent class, which is a part of the dify's architecture.

The OpenAIFunctionsAgent class is designed to interact with the OpenAI API and perform specific tasks. The "functions" in this context are methods that are part of this class, and they are used to perform specific tasks such as invoking the LLM (Language Model), formatting prompts, and handling the responses from the LLM.

The use of "functions" in this context is a common practice in object-oriented programming, where classes have methods (functions) that define the behavior of the objects of that class. This does not contradict OpenAI's recommendations or practices.

In fact, OpenAI's GPT-3 models are designed to be used with a variety of programming paradigms, including object-oriented programming, and the use of functions is a fundamental part of these paradigms.

Therefore, the use of "functions" in the dify code is not outdated, but rather a part of the design of the software that is in line with common programming practices and OpenAI's recommendations. You can refer to the api/core/agent/agent/openai_function_call.py for more details.

As for the specific functions being used in the api\core\model_runtime\model_providers\openai\llm\llm.py file of the dify codebase, they are mainly used to interact with the OpenAI API and perform specific tasks such as invoking the LLM, formatting prompts, handling the responses from the LLM, and so on. You can refer to the api/core/model_runtime/model_providers/openai/llm/llm.py for more details.

Regarding your question about OpenAI's argument that "functions" are outdated, I wasn't able to find any specific argument made by OpenAI in this regard within the dify repository or elsewhere. It would be helpful if you could provide more context or references to where OpenAI made this argument.

Sources


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.

takatost commented 4 months ago

We encountered some unicode encoding issues with the model we're developing that supports tool_calls. So for now, we've decided to put the support for tool_calls on hold. We'll get around to fixing it when we have some free time.

freefish1218 commented 4 months ago

We encountered some unicode encoding issues with the model we're developing that supports tool_calls. So for now, we've decided to put the support for tool_calls on hold. We'll get around to fixing it when we have some free time.

Is it possible to raise the priority of this issue as it causes the 'Smart Assistant' to be completely unusable?

Yeuoly commented 4 months ago

Why would it causes the 'Smart Assistant' to be completely unusable? Is there a use case? I would love to know the details.

freefish1218 commented 4 months ago

Why would it causes the 'Smart Assistant' to be completely unusable? Is there a use case? I would love to know the details.

The problem is model related, if you use the 1106-preview you get all sorts of freaked out

Yeuoly commented 4 months ago

It seems that function calling does work with gpt-4-1106-preview in my case

image

do you mean gpt-4-vision-preview? If so, both tool calls and function calling are not permitted by gpt-4-vision-preview currently.

github-actions[bot] commented 3 months ago

Close due to it's no longer active, if you have any questions, you can reopen it.