"content":"please show me a video and an image of (based on the text) 'a boy is running' and dub it",# noqa: E501
},
{
"role":"assistant",
"content":'[{{"task": "video_generator", "id": 0, "dep": [-1], "args": {{"prompt": "a boy is running" }}}}, {{"task": "text_reader", "id": 1, "dep": [-1], "args": {{"text": "a boy is running" }}}}, {{"task": "image_generator", "id": 2, "dep": [-1], "args": {{"prompt": "a boy is running" }}}}]',# noqa: E501
},
{
"role":"user",
"content":"Give you some pictures e1.jpg, e2.png, e3.jpg, help me count the number of sheep?",# noqa: E501
},
{
"role":"assistant",
"content":'[ {{"task": "image_qa", "id": 0, "dep": [-1], "args": {{"image": "e1.jpg", "question": "How many sheep in the picture"}}}}, {{"task": "image_qa", "id": 1, "dep": [-1], "args": {{"image": "e2.jpg", "question": "How many sheep in the picture"}}}}, {{"task": "image_qa", "id": 2, "dep": [-1], "args": {{"image": "e3.jpg", "question": "How many sheep in the picture"}}}}]',# noqa: E501
},
]
classTaskPlaningChain(LLMChain):
"""Chain to execute tasks."""
@classmethod
deffrom_llm(
cls,
llm:BaseLanguageModel,
demos:List[Dict]=DEMONSTRATIONS,
verbose:bool=True,
)->LLMChain:
"""Get the response parser."""
system_template="""#1 Task Planning Stage: The AI assistant can parse user input to several tasks: [{{"task": task, "id": task_id, "dep": dependency_task_id, "args": {{"input name": text may contain <resource-dep_id>}}}}]. The special tag "dep_id" refer to the one generated text/image/audio in the dependency task (Please consider whether the dependency task generates resources of this type.) and "dep_id" must be in "dep" list. The "dep" field denotes the ids of the previous prerequisite tasks which generate a new resource that the current task relies on. The task MUST be selected from the following tools (along with tool description, input name and output type): {tools}. There may be multiple tasks of the same type. Think step by step about all the tasks needed to resolve the user's request. Parse out as few tasks as possible while ensuring that the user request can be resolved. Pay attention to the dependencies and order among tasks. If the user input can't be parsed, you need to reply empty JSON []."""# noqa: E501