|
54 | 54 | "metadata": {},
|
55 | 55 | "source": [
|
56 | 56 | "In the futurehouse platform, we refer to the deployed combination of agent and environment as a `job`.\n",
|
57 |
| - "Submitting task to a futurehouse job is done by calling the `create_task` method, which receives a `TaskRequest` object." |
| 57 | + "Submitting task to a futurehouse job is done by calling the `run_tasks_until_done` method, which receives a `TaskRequest` object.\n", |
| 58 | + "\n", |
| 59 | + "For convenience, one can use the `run_tasks_until_done` method, which submits the task and returns a list of `TaskResponse` objects." |
58 | 60 | ]
|
59 | 61 | },
|
60 | 62 | {
|
|
67 | 69 | " name=JobNames.from_string(\"crow\"),\n",
|
68 | 70 | " query=\"What is the molecule known to have the greatest solubility in water?\",\n",
|
69 | 71 | ")\n",
|
70 |
| - "task_response = client.run_tasks_until_done(task_data)\n", |
| 72 | + "responses = client.run_tasks_until_done(task_data)\n", |
| 73 | + "task_response = responses[0]\n", |
71 | 74 | "\n",
|
72 | 75 | "print(f\"Job status: {task_response.status}\")\n",
|
73 | 76 | "print(f\"Job answer: \\n{task_response.formatted_answer}\")"
|
|
77 | 80 | "cell_type": "markdown",
|
78 | 81 | "metadata": {},
|
79 | 82 | "source": [
|
80 |
| - "You can also pass a `runtime_config` to the `create_task` method, which will be used to configure the agent on runtime.\n", |
| 83 | + "You can also pass a `runtime_config` to the `run_tasks_until_done` method, which will be used to configure the agent on runtime.\n", |
81 | 84 | "Here, we will define a agent configuration and include it in the `TaskRequest`. This agent is used to decide the next action to take.\n",
|
82 | 85 | "We will also use the `max_steps` parameter to limit the number of steps the agent will take."
|
83 | 86 | ]
|
|
100 | 103 | " query=\"How many moons does earth have?\",\n",
|
101 | 104 | " runtime_config=RuntimeConfig(agent=agent, max_steps=10),\n",
|
102 | 105 | ")\n",
|
103 |
| - "task_response = client.run_tasks_until_done(task_data)\n", |
| 106 | + "responses = client.run_tasks_until_done(task_data)\n", |
| 107 | + "task_response = responses[0]\n", |
104 | 108 | "\n",
|
105 | 109 | "print(f\"Job status: {task_response.status}\")\n",
|
106 | 110 | "print(f\"Job answer: \\n{task_response.formatted_answer}\")"
|
|
115 | 119 | "The platform allows to ask follow-up questions to the previous job.\n",
|
116 | 120 | "To accomplish that, we can use the `runtime_config` to pass the `task_id` of the previous task.\n",
|
117 | 121 | "\n",
|
118 |
| - "Notice that `create_task` accepts both a `TaskRequest` object and a dictionary with keywords arguments." |
| 122 | + "Notice that `run_tasks_until_done` accepts both a `TaskRequest` object and a dictionary with keywords arguments." |
119 | 123 | ]
|
120 | 124 | },
|
121 | 125 | {
|
|
128 | 132 | " name=JobNames.CROW, query=\"How many species of birds are there?\"\n",
|
129 | 133 | ")\n",
|
130 | 134 | "\n",
|
131 |
| - "task_response = client.run_tasks_until_done(task_data)\n", |
| 135 | + "responses = client.run_tasks_until_done(task_data)\n", |
| 136 | + "task_response = responses[0]\n", |
132 | 137 | "\n",
|
133 | 138 | "print(f\"First job status: {task_response.status}\")\n",
|
134 | 139 | "print(f\"First job answer: \\n{task_response.formatted_answer}\")"
|
|
146 | 151 | " \"runtime_config\": {\"continued_job_id\": task_response.task_id},\n",
|
147 | 152 | "}\n",
|
148 | 153 | "\n",
|
149 |
| - "continued_task_response = client.run_tasks_until_done(continued_job_data)\n", |
| 154 | + "responses = client.run_tasks_until_done(continued_job_data)\n", |
| 155 | + "continued_task_response = responses[0]\n", |
150 | 156 | "\n",
|
151 | 157 | "\n",
|
152 | 158 | "print(f\"Continued job status: {continued_task_response.status}\")\n",
|
|
0 commit comments