Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Workflow Knowledge to Plugins #7333

Closed
waghmare-omkar opened this issue Jul 17, 2024 · 6 comments
Closed

Introduce Workflow Knowledge to Plugins #7333

waghmare-omkar opened this issue Jul 17, 2024 · 6 comments
Labels
agents chat history function_calling stale Issue is stale because it has been open for 90 days with no activity

Comments

@waghmare-omkar
Copy link

Today, plugins are collections of functions that perform atomic actions. This design is beneficial as it exposes the Large Language Model (LLM) to a variety of specific actions it can perform. However, when these atomic actions are highly domain-specific, the LLM may not be fully aware of the typical sequence in which these actions should be executed.

Example Scenario

Consider a plugin designed to manage database entries with the following functions:

  1. Add_Entry
  2. Update_Entry
  3. Delete_Entry
  4. Open_Transaction
  5. Close_Transaction

To add an entry to a database, the typical sequence of functions would be:

  1. Open_Transaction
  2. Add_Entry
  3. Close_Transaction

Currently, if you ask the LLM to add an entry to the database, it might directly call the Add_Entry function without executing the necessary Open_Transaction and Close_Transaction steps. This indicates that the LLM lacks awareness of the domain-specific workflow that should be followed when interacting with a database.

Proposed Solution

From a plugin authoring perspective, there should be a way for plugin authors to specify workflows that involve the functions they have defined. This would enable the LLM to understand and execute the correct sequence of actions for domain-specific tasks.

Benefits

  • Improved Accuracy: Ensures that the LLM follows the correct sequence of actions for domain-specific tasks.
  • Enhanced Usability: Allows plugin authors to define and enforce workflows, making it easier for users to perform complex operations without needing to understand the underlying sequence of functions.
  • Flexibility: Provides a framework for handling domain-specific workflows, which can be applied to various use cases beyond just database operations.

Notes

While the database example provided could be implemented such that the Add_Entry function internally handles transaction management, the larger point is about the concept of "workflows." This feature would be beneficial across different domains where specific sequences of actions are necessary.

By introducing workflow knowledge to plugins, we can significantly enhance the capability and usability of LLMs in performing complex, domain-specific tasks.

@moonbox3
Copy link
Contributor

Hi @waghmare-omkar ,

Thank you for your suggestion.

Currently, the models we work with do not support a built-in "workflow" component. When we send a JSON payload to the model, it includes model settings, key-value pair (role-content) messages, and a tool choice/tools.

To guide the model in following a specific sequence of actions, like the workflow you mentioned, we typically rely on prompt engineering. This involves crafting a specific system message that outlines the desired workflow. Additionally, one may add a more detailed description to the kernel function, which is included as part of the tools JSON sent to the model.

Your example scenario can be addressed by including the workflow in the system message. For instance, the request payload to the model might look like this:

{
    "model": "gpt-4",
    "max_tokens": 2000,
    "stream": true,
    "temperature": 0.7,
    "top_p": 0.8,
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "database-open_transaction",
                "description": "This function opens a database transaction. It should be called before adding or updating entries.",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "value1": {
                            "type": "integer",
                            "description": "The first number to add"
                        },
                        "value2": {
                            "type": "integer",
                            "description": "The second number to add"
                        }
                    },
                    "required": ["value1", "value2"]
                }
            }
        }
    ],
    "tool_choice": "auto",
    "messages": [
        {
            "role": "system",
            "content": "To add an entry to a database, use the functions in this order: Open_Transaction, Add_Entry, and then Close_Transaction."
        },
        {
            "role": "user",
            "content": "Add this information to the database..."
        }
    ]
}

This way, the model is guided to follow the correct sequence of actions. We can enhance this approach by incorporating detailed descriptions and specifying the order of operations in the system message. This is only an example and can be tailored to fit your specific application.

@matthewbolanos
Copy link
Member

We just discussed this internally, and we realize that there is likely a need for a plugin author to generate a system prompt that can then be injected into an agent. We'll be doing some design activities on our side to figure out the best way of solving this.

We believe that this might be better solved with multi-agent patterns, so we're going to tag it as such and follow back up once we've validated our hypothesis.

@waghmare-omkar
Copy link
Author

waghmare-omkar commented Jul 19, 2024 via email

@waghmare-omkar
Copy link
Author

waghmare-omkar commented Jul 19, 2024 via email

Copy link

This issue is stale because it has been open for 90 days with no activity.

@github-actions github-actions bot added the stale Issue is stale because it has been open for 90 days with no activity label Oct 18, 2024
Copy link

github-actions bot commented Nov 1, 2024

This issue was closed because it has been inactive for 14 days since being marked as stale.

@github-actions github-actions bot closed this as completed Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agents chat history function_calling stale Issue is stale because it has been open for 90 days with no activity
Projects
None yet
Development

No branches or pull requests

4 participants