Replies: 1 comment 2 replies
-
|
Hi @nmccann, you are correct, we have a way in SK Python to exclude certain function arguments from the LLM: https://github.com/microsoft/semantic-kernel/blob/dc7c1c048488a8b611b5382d0d7efe05608a9fa0/python/semantic_kernel/functions/kernel_function_decorator.py#L34C89-L36C68. @eavanvalkenburg are we tracking anything in MAF to support similar functionality like we had in SK? param: Annotated[str, {"include_in_function_choices": False}]As proposed by @nmccann, it'd be: param: Annotated[str, SkipJsonSchema] |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
With the recent introduction of
kwargsflowing through to tools, it is now possible to have anai_functionthat does this:And call it like so:
With this, the agent's LLM will see that
search_toolexpects aqueryparameter that should be astr, and it will populate that parameter. Thedeterministic_filterwill end up propagating through to thekwargsand ensure that the filter is always the same, and not subject to the whims of the LLM.This
kwargsapproach is nice, but has downsides. For one, additional work is needed to extract the value fromkwargsbefore it can be used (and potentially requires casting it to the desired type). Without looking at the implementation, it's unclear whatkwargsare applicable for thesearch_tool, or what type they should be.An alternative would be:
In my testing the end result is the same, because the value from
kwargstakes priority over the LLM's generated value. However this isn't ideal as the LLM potentially wastes tokens on parameters it shouldn't worry about, and creates ambiguity about whether the value of the parameter is deterministic or not.My idea would be to leverage some of Pydantic's capabilities (maybe combining SkipJSONSchema with
Annotated) to denote a parameter as ignored for the purposes of the tool's representation to the LLM.I thought SemanticKernel had something similar, but the closest thing I was able to find with some quick searching was this which doesn't seem to have been implemented.
Edit: In my testing, the second example actually uses the LLM's generated value if you omit
**kwargs: Anyfrom the function definition. I'm not sure why that would be the case.Beta Was this translation helpful? Give feedback.
All reactions