Replies: 2 comments
-
Hi @nblog, thanks for your question. Here are my thoughts:
To make sure I do understand your use-case well enough to help, I do have some clarifying questions for you:
Can you help me understand what setting a custom prompt before invoking the function means? A normal chat flow with a model is:
This same flow happens in both a chat completion scenario and an agent-based scenario. The only thing that differs is the context that it is run -- whether as a chat bot type set up, a particular workflow kicking it off, or as part of an agent group chat. Is your "custom prompt" part of the original ask to the model, or does it get used at some other point in the process?
Similar to my question above, I'm not sure I understand "should I use a separate prompt for each function, or is there a way to dynamically generate prompts based on the function being invoked?" The tool is advertised to the model based on its JSON Schema. You can visit the following blog post to see how the native function gets turned into this JSON schema. If you want to provide more context to the model you can make sure you provide semantically meaningful and descriptive function names, descriptions, and arguments as they are all sent to the model. This would help with your comment about
What do you mean you want function selection (without arguments) to identify the most relevant function for user input? Based on the sample function you provided above (
I haven't specifically tried this, but I suppose you could experiment with a filter to help with this? This part of the flow still isn't clear for me, so if you can elaborate more, it would help. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your suggestion! After careful consideration, I decided to use an agent group approach. This allows me to debug each agent individually and then integrate them into a group, which aligns better with my needs—especially as I anticipate having multiple agents in the future. Currently, I am facing challenges with the tool-agent. My plugin contains over 100 functions, many of which have complex rules. Initially, I tried embedding these rules directly into the function descriptions, like this: @kernel_function(description=\
"""
- Adjust partitions by expanding or shrinking using unallocated space on either the left or right side.
- Function Description:
- Resize or move a partition.
- Function Rules:
- Expand Partition:
- Can only use unallocated space adjacent to the partition.
- Shrink Partition:
- Can shrink the partition, but it must remain larger than the used space.
- Function Hints:
- When expanding, check for unallocated space adjacent to the partition.
- When shrinking, ensure the resulting size is greater than the used space.
- Partition Layout:
[ Reserved | C: | Unallocated1 | D: | E: | Unallocated2 ]
- Correct:
- `D:` can expand using `Unallocated1` on the left, but the starting offset must be recalculated.
- Incorrect:
- `D:` cannot expand using `Unallocated2` on the right because it would cross the `E:` partition.
""")
def resize_move_partition():
... However, this approach has two major issues:
To address this, I switched to a function selection approach. Instead of including detailed rules in the function descriptions, I now provide only the function names and concise descriptions. The goal is to identify the most relevant function based on the user’s question. For example:
Once the function is identified, I plan to use its detailed rules and logic to guide the next steps. For example:
Additionally, I want to leverage prompt templates to dynamically select the appropriate model based on the complexity of the function. For example:
Given the above, I would greatly appreciate any guidance, suggestions, or examples on:
Thank you in advance for your help! |
Beta Was this translation helpful? Give feedback.
-
I am working in a Python environment and have a slightly more complex requirement than the examples provided in the Python
sample
code. The examples seem insufficient to fully cover my use case.I want to implement an AgentGroupChat with the following structure:
AgentGroup:
Workflow:
chat-agent
or thetool-agent
.Requirements:
tool-agent: A tool-based agent capable of invoking native functions (involving plugins).
Problem:
The native functions in the plugins are numerous and some have complex or non-standard rules. For example:
Desired Workflow:
I want the
tool-agent
to:Example Code:
I want to provide the following prompt to guide the model when selecting and invoking the
resize_move_partition
function:I am unsure how to:
Additional Notes:
By providing this detailed issue, I hope to clarify the requirements and challenges I am facing. Any guidance, suggestions, or examples would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions