-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
I have a class with a function I want to use as a tool in an Agent Framework agent.
def search_flows(self, category: Literal["Data", ...], issue: str) -> str:
(There are more options for the Literal, I just don't want to list them all. They're all strings though.)
But when I try to run the agent, I get the following error:
Exception has occurred: PydanticUserError
search_flows_inputis not fully defined; you should defineData, then callsearch_flows_input.model_rebuild().
The 'Data' there seems to be a reference to the first Literal value? It's just a string though, I don't know how I would define it any more than it already is.
I have determined that it's definitely the Literal that's the issue here though because if I change the function to:
def search_flows(self, category: str, issue: str) -> str:
Then it does run. Of course, I can't guarantee that category is in a fixed set of values this way, which is the reason I wanted to use a Literal here.
Is this a bug or is there some other method I should be using to restrict values like this?
Metadata
Metadata
Assignees
Labels
Type
Projects
Status