crewAI icon indicating copy to clipboard operation
crewAI copied to clipboard

Manage different output formats for each task??

Open cielonet opened this issue 2 years ago • 1 comments

Is there currently a way to manage the tasks so that for each output/response by the agent/s of that task I can designate a pydantic base model/class as a partial_variable perhaps to the prompt template?

Here: langchain output parser

For example: task1 -> output is a desired data structure (i.e. pydantic base model) task2 -> input is a formatted/parsed* response from task1 -> output is another desired data structure

*the input to task2 could even be a value (str,list) from a field/parameter from parsed output(model_dump_json()) in task1?

Thank you.

cielonet avatar Jan 17 '24 03:01 cielonet

I like how Instructor approached this - patching the OpenAI client, adding a response_model parameter, and encapsulating all the validation logic in that patched client.

zholti avatar Jan 17 '24 11:01 zholti

Love it, I really like the Instructor approach as well, maybe we could use them in here 🤔 marking as feature accepted

joaomdmoura avatar Jan 21 '24 19:01 joaomdmoura

seems duplicate of #160 so I'm closing this in favor of that but still planning on exploring instructor

joaomdmoura avatar Jan 21 '24 19:01 joaomdmoura