futurehouse-client 0.3.20.dev112__py3-none-any.whl → 0.3.20.dev196__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- futurehouse_client/__init__.py +0 -8
- futurehouse_client/clients/rest_client.py +141 -34
- futurehouse_client/models/__init__.py +3 -0
- futurehouse_client/models/app.py +5 -0
- futurehouse_client/version.py +2 -2
- {futurehouse_client-0.3.20.dev112.dist-info → futurehouse_client-0.3.20.dev196.dist-info}/METADATA +63 -28
- {futurehouse_client-0.3.20.dev112.dist-info → futurehouse_client-0.3.20.dev196.dist-info}/RECORD +10 -11
- futurehouse_client/utils/world_model_tools.py +0 -52
- {futurehouse_client-0.3.20.dev112.dist-info → futurehouse_client-0.3.20.dev196.dist-info}/WHEEL +0 -0
- {futurehouse_client-0.3.20.dev112.dist-info → futurehouse_client-0.3.20.dev196.dist-info}/licenses/LICENSE +0 -0
- {futurehouse_client-0.3.20.dev112.dist-info → futurehouse_client-0.3.20.dev196.dist-info}/top_level.txt +0 -0
futurehouse_client/__init__.py
CHANGED
@@ -8,11 +8,6 @@ from .models.app import (
|
|
8
8
|
TaskResponse,
|
9
9
|
TaskResponseVerbose,
|
10
10
|
)
|
11
|
-
from .utils.world_model_tools import (
|
12
|
-
create_world_model_tool,
|
13
|
-
search_world_model_tool,
|
14
|
-
make_world_model_tools,
|
15
|
-
)
|
16
11
|
|
17
12
|
__all__ = [
|
18
13
|
"FinchTaskResponse",
|
@@ -24,7 +19,4 @@ __all__ = [
|
|
24
19
|
"TaskRequest",
|
25
20
|
"TaskResponse",
|
26
21
|
"TaskResponseVerbose",
|
27
|
-
"create_world_model_tool",
|
28
|
-
"search_world_model_tool",
|
29
|
-
"make_world_model_tools",
|
30
22
|
]
|
@@ -111,8 +111,10 @@ class WorldModelFetchError(RestClientError):
|
|
111
111
|
class WorldModelCreationError(RestClientError):
|
112
112
|
"""Raised when there's an error creating a world model."""
|
113
113
|
|
114
|
-
|
115
|
-
|
114
|
+
|
115
|
+
class TrajectoryGroupError(RestClientError):
|
116
|
+
"""Raised when there's an error with trajectory group operations."""
|
117
|
+
|
116
118
|
|
117
119
|
class InvalidTaskDescriptionError(Exception):
|
118
120
|
"""Raised when the task description is invalid or empty."""
|
@@ -535,8 +537,15 @@ class RestClient:
|
|
535
537
|
wait=wait_exponential(multiplier=RETRY_MULTIPLIER, max=MAX_RETRY_WAIT),
|
536
538
|
retry=retry_if_connection_error,
|
537
539
|
)
|
538
|
-
def create_task(
|
539
|
-
|
540
|
+
def create_task(
|
541
|
+
self,
|
542
|
+
task_data: TaskRequest | dict[str, Any],
|
543
|
+
):
|
544
|
+
"""Create a new futurehouse task.
|
545
|
+
|
546
|
+
Args:
|
547
|
+
task_data: The task request data
|
548
|
+
"""
|
540
549
|
if isinstance(task_data, dict):
|
541
550
|
task_data = TaskRequest.model_validate(task_data)
|
542
551
|
|
@@ -563,8 +572,15 @@ class RestClient:
|
|
563
572
|
wait=wait_exponential(multiplier=RETRY_MULTIPLIER, max=MAX_RETRY_WAIT),
|
564
573
|
retry=retry_if_connection_error,
|
565
574
|
)
|
566
|
-
async def acreate_task(
|
567
|
-
|
575
|
+
async def acreate_task(
|
576
|
+
self,
|
577
|
+
task_data: TaskRequest | dict[str, Any],
|
578
|
+
):
|
579
|
+
"""Create a new futurehouse task.
|
580
|
+
|
581
|
+
Args:
|
582
|
+
task_data: The task request data
|
583
|
+
"""
|
568
584
|
if isinstance(task_data, dict):
|
569
585
|
task_data = TaskRequest.model_validate(task_data)
|
570
586
|
|
@@ -573,6 +589,7 @@ class RestClient:
|
|
573
589
|
task_data.name.name,
|
574
590
|
self.stage,
|
575
591
|
)
|
592
|
+
|
576
593
|
response = await self.async_client.post(
|
577
594
|
"/v0.1/crows", json=task_data.model_dump(mode="json")
|
578
595
|
)
|
@@ -1478,25 +1495,6 @@ class RestClient:
|
|
1478
1495
|
except Exception as e:
|
1479
1496
|
raise WorldModelFetchError(f"An unexpected error occurred: {e}") from e
|
1480
1497
|
|
1481
|
-
@retry(
|
1482
|
-
stop=stop_after_attempt(MAX_RETRY_ATTEMPTS),
|
1483
|
-
wait=wait_exponential(multiplier=RETRY_MULTIPLIER, max=MAX_RETRY_WAIT),
|
1484
|
-
retry=retry_if_connection_error,
|
1485
|
-
)
|
1486
|
-
def search_world_models(self, query: str, size: int = 10) -> list[str]:
|
1487
|
-
"""Search for world models.
|
1488
|
-
|
1489
|
-
Args:
|
1490
|
-
query: The search query.
|
1491
|
-
size: The number of results to return.
|
1492
|
-
|
1493
|
-
Returns:
|
1494
|
-
A list of world model names.
|
1495
|
-
"""
|
1496
|
-
response = self.client.get(f"/v0.1/world-models/search/{query}", params={"size": size})
|
1497
|
-
response.raise_for_status()
|
1498
|
-
return response.json()
|
1499
|
-
|
1500
1498
|
@retry(
|
1501
1499
|
stop=stop_after_attempt(MAX_RETRY_ATTEMPTS),
|
1502
1500
|
wait=wait_exponential(multiplier=RETRY_MULTIPLIER, max=MAX_RETRY_WAIT),
|
@@ -1575,25 +1573,134 @@ class RestClient:
|
|
1575
1573
|
wait=wait_exponential(multiplier=RETRY_MULTIPLIER, max=MAX_RETRY_WAIT),
|
1576
1574
|
retry=retry_if_connection_error,
|
1577
1575
|
)
|
1578
|
-
|
1579
|
-
"""
|
1576
|
+
def create_trajectory_group(self, name: str) -> str:
|
1577
|
+
"""Create a new trajectory group.
|
1578
|
+
|
1579
|
+
Args:
|
1580
|
+
name: The name for the trajectory group
|
1581
|
+
|
1582
|
+
Returns:
|
1583
|
+
UUID of the created trajectory group
|
1584
|
+
|
1585
|
+
Raises:
|
1586
|
+
TrajectoryGroupError: If there's an error creating the trajectory group
|
1587
|
+
"""
|
1588
|
+
try:
|
1589
|
+
data = {"name": name}
|
1590
|
+
response = self.client.post("/v0.1/trajectory-groups", json=data)
|
1591
|
+
response.raise_for_status()
|
1592
|
+
return response.json()
|
1593
|
+
except HTTPStatusError as e:
|
1594
|
+
raise TrajectoryGroupError(
|
1595
|
+
f"Error creating trajectory group: {e.response.status_code} - {e.response.text}"
|
1596
|
+
) from e
|
1597
|
+
except Exception as e:
|
1598
|
+
raise TrajectoryGroupError(f"Error creating trajectory group: {e}") from e
|
1599
|
+
|
1600
|
+
@retry(
|
1601
|
+
stop=stop_after_attempt(MAX_RETRY_ATTEMPTS),
|
1602
|
+
wait=wait_exponential(multiplier=RETRY_MULTIPLIER, max=MAX_RETRY_WAIT),
|
1603
|
+
retry=retry_if_connection_error,
|
1604
|
+
)
|
1605
|
+
def add_trajectory_to_group(self, group_id: str, trajectory_id: str) -> None:
|
1606
|
+
"""Add a trajectory to a group.
|
1607
|
+
|
1608
|
+
Args:
|
1609
|
+
group_id: The UUID of the trajectory group
|
1610
|
+
trajectory_id: The UUID of the trajectory to add
|
1611
|
+
|
1612
|
+
Raises:
|
1613
|
+
TrajectoryGroupError: If there's an error adding the trajectory to the group
|
1614
|
+
"""
|
1615
|
+
try:
|
1616
|
+
data = {"trajectory_id": trajectory_id}
|
1617
|
+
response = self.client.post(
|
1618
|
+
f"/v0.1/trajectory-groups/{group_id}/trajectories", json=data
|
1619
|
+
)
|
1620
|
+
response.raise_for_status()
|
1621
|
+
except HTTPStatusError as e:
|
1622
|
+
if e.response.status_code == codes.NOT_FOUND:
|
1623
|
+
raise TrajectoryGroupError(
|
1624
|
+
f"Trajectory group {group_id} or trajectory {trajectory_id} not found"
|
1625
|
+
) from e
|
1626
|
+
if e.response.status_code == codes.FORBIDDEN:
|
1627
|
+
raise TrajectoryGroupError(
|
1628
|
+
f"Permission denied to add trajectory to group {group_id}"
|
1629
|
+
) from e
|
1630
|
+
raise TrajectoryGroupError(
|
1631
|
+
f"Error adding trajectory to group: {e.response.status_code} - {e.response.text}"
|
1632
|
+
) from e
|
1633
|
+
except Exception as e:
|
1634
|
+
raise TrajectoryGroupError(f"Error adding trajectory to group: {e}") from e
|
1635
|
+
|
1636
|
+
@retry(
|
1637
|
+
stop=stop_after_attempt(MAX_RETRY_ATTEMPTS),
|
1638
|
+
wait=wait_exponential(multiplier=RETRY_MULTIPLIER, max=MAX_RETRY_WAIT),
|
1639
|
+
retry=retry_if_connection_error,
|
1640
|
+
)
|
1641
|
+
async def acreate_trajectory_group(self, name: str) -> str:
|
1642
|
+
"""Asynchronously create a new trajectory group.
|
1580
1643
|
|
1581
1644
|
Args:
|
1582
|
-
|
1645
|
+
name: The name for the trajectory group
|
1646
|
+
|
1647
|
+
Returns:
|
1648
|
+
UUID of the created trajectory group
|
1583
1649
|
|
1584
1650
|
Raises:
|
1585
|
-
|
1651
|
+
TrajectoryGroupError: If there's an error creating the trajectory group
|
1586
1652
|
"""
|
1587
1653
|
try:
|
1588
|
-
|
1654
|
+
data = {"name": name}
|
1655
|
+
response = await self.async_client.post(
|
1656
|
+
"/v0.1/trajectory-groups", json=data
|
1657
|
+
)
|
1589
1658
|
response.raise_for_status()
|
1659
|
+
return response.json()
|
1590
1660
|
except HTTPStatusError as e:
|
1591
|
-
raise
|
1592
|
-
f"Error
|
1661
|
+
raise TrajectoryGroupError(
|
1662
|
+
f"Error creating trajectory group: {e.response.status_code} - {e.response.text}"
|
1593
1663
|
) from e
|
1594
1664
|
except Exception as e:
|
1595
|
-
raise
|
1596
|
-
|
1665
|
+
raise TrajectoryGroupError(f"Error creating trajectory group: {e}") from e
|
1666
|
+
|
1667
|
+
@retry(
|
1668
|
+
stop=stop_after_attempt(MAX_RETRY_ATTEMPTS),
|
1669
|
+
wait=wait_exponential(multiplier=RETRY_MULTIPLIER, max=MAX_RETRY_WAIT),
|
1670
|
+
retry=retry_if_connection_error,
|
1671
|
+
)
|
1672
|
+
async def aadd_trajectory_to_group(self, group_id: str, trajectory_id: str) -> None:
|
1673
|
+
"""Asynchronously add a trajectory to a group.
|
1674
|
+
|
1675
|
+
Args:
|
1676
|
+
group_id: The UUID of the trajectory group
|
1677
|
+
trajectory_id: The UUID of the trajectory to add
|
1678
|
+
|
1679
|
+
Raises:
|
1680
|
+
TrajectoryGroupError: If there's an error adding the trajectory to the group
|
1681
|
+
"""
|
1682
|
+
try:
|
1683
|
+
data = {"trajectory_id": trajectory_id}
|
1684
|
+
response = await self.async_client.post(
|
1685
|
+
f"/v0.1/trajectory-groups/{group_id}/trajectories", json=data
|
1686
|
+
)
|
1687
|
+
response.raise_for_status()
|
1688
|
+
except HTTPStatusError as e:
|
1689
|
+
if e.response.status_code == codes.NOT_FOUND:
|
1690
|
+
raise TrajectoryGroupError(
|
1691
|
+
f"Trajectory group {group_id} or trajectory {trajectory_id} not found"
|
1692
|
+
) from e
|
1693
|
+
if e.response.status_code == codes.FORBIDDEN:
|
1694
|
+
raise TrajectoryGroupError(
|
1695
|
+
f"Permission denied to add trajectory to group {group_id}"
|
1696
|
+
) from e
|
1697
|
+
raise TrajectoryGroupError(
|
1698
|
+
f"Error adding trajectory to group: {e.response.status_code} - {e.response.text}"
|
1699
|
+
) from e
|
1700
|
+
except Exception as e:
|
1701
|
+
raise TrajectoryGroupError(f"Error adding trajectory to group: {e}") from e
|
1702
|
+
|
1703
|
+
|
1597
1704
|
def get_installed_packages() -> dict[str, str]:
|
1598
1705
|
"""Returns a dictionary of installed packages and their versions."""
|
1599
1706
|
return {
|
@@ -13,6 +13,7 @@ from .app import (
|
|
13
13
|
TaskResponse,
|
14
14
|
TaskResponseVerbose,
|
15
15
|
)
|
16
|
+
from .rest import WorldModel, WorldModelResponse
|
16
17
|
|
17
18
|
__all__ = [
|
18
19
|
"AuthType",
|
@@ -28,4 +29,6 @@ __all__ = [
|
|
28
29
|
"TaskRequest",
|
29
30
|
"TaskResponse",
|
30
31
|
"TaskResponseVerbose",
|
32
|
+
"WorldModel",
|
33
|
+
"WorldModelResponse",
|
31
34
|
]
|
futurehouse_client/models/app.py
CHANGED
@@ -652,6 +652,11 @@ class TaskRequest(BaseModel):
|
|
652
652
|
description="Optional task identifier",
|
653
653
|
alias="id",
|
654
654
|
)
|
655
|
+
group_id: UUID | None = Field(
|
656
|
+
default=None,
|
657
|
+
description="Optional group identifier for the task",
|
658
|
+
alias="group_id",
|
659
|
+
)
|
655
660
|
name: "str | JobNames" = Field(
|
656
661
|
description="Name of the crow to execute eg. paperqa-crow"
|
657
662
|
)
|
futurehouse_client/version.py
CHANGED
@@ -17,5 +17,5 @@ __version__: str
|
|
17
17
|
__version_tuple__: VERSION_TUPLE
|
18
18
|
version_tuple: VERSION_TUPLE
|
19
19
|
|
20
|
-
__version__ = version = '0.3.20.
|
21
|
-
__version_tuple__ = version_tuple = (0, 3, 20, '
|
20
|
+
__version__ = version = '0.3.20.dev196'
|
21
|
+
__version_tuple__ = version_tuple = (0, 3, 20, 'dev196')
|
{futurehouse_client-0.3.20.dev112.dist-info → futurehouse_client-0.3.20.dev196.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: futurehouse-client
|
3
|
-
Version: 0.3.20.
|
3
|
+
Version: 0.3.20.dev196
|
4
4
|
Summary: A client for interacting with endpoints of the FutureHouse service.
|
5
5
|
Author-email: FutureHouse technical staff <hello@futurehouse.org>
|
6
6
|
License: Apache License
|
@@ -217,7 +217,7 @@ Requires-Dist: cloudpickle
|
|
217
217
|
Requires-Dist: fhaviary
|
218
218
|
Requires-Dist: httpx
|
219
219
|
Requires-Dist: ldp>=0.22.0
|
220
|
-
Requires-Dist: litellm
|
220
|
+
Requires-Dist: litellm
|
221
221
|
Requires-Dist: pydantic
|
222
222
|
Requires-Dist: python-dotenv
|
223
223
|
Requires-Dist: tenacity
|
@@ -250,7 +250,8 @@ Dynamic: license-file
|
|
250
250
|
|
251
251
|
# FutureHouse Platform API Documentation
|
252
252
|
|
253
|
-
Documentation and tutorials for futurehouse-client,
|
253
|
+
Documentation and tutorials for futurehouse-client,
|
254
|
+
a client for interacting with endpoints of the FutureHouse platform.
|
254
255
|
|
255
256
|
<!--TOC-->
|
256
257
|
|
@@ -289,16 +290,25 @@ task_data = {
|
|
289
290
|
(task_response,) = client.run_tasks_until_done(task_data)
|
290
291
|
```
|
291
292
|
|
292
|
-
A quickstart example can be found in the [client_notebook.ipynb]
|
293
|
+
A quickstart example can be found in the [client_notebook.ipynb][1] file,
|
294
|
+
where we show how to submit and retrieve a job task,
|
295
|
+
pass runtime configuration to the agent,
|
296
|
+
and ask follow-up questions to the previous job.
|
297
|
+
|
298
|
+
[1]: https://futurehouse.gitbook.io/futurehouse-cookbook/futurehouse-client/docs/client_notebook
|
293
299
|
|
294
300
|
## Functionalities
|
295
301
|
|
296
302
|
FutureHouse client implements a RestClient (called `FutureHouseClient`) with the following functionalities:
|
297
303
|
|
298
|
-
- [Simple task running](#simple-task-running):
|
299
|
-
|
304
|
+
- [Simple task running](#simple-task-running):
|
305
|
+
`run_tasks_until_done(TaskRequest)` or `await arun_tasks_until_done(TaskRequest)`
|
306
|
+
- [Asynchronous tasks](#asynchronous-tasks):
|
307
|
+
`get_task(task_id)` or `aget_task(task_id)`
|
308
|
+
and `create_task(TaskRequest)` or `acreate_task(TaskRequest)`
|
300
309
|
|
301
|
-
To create a `FutureHouseClient`,
|
310
|
+
To create a `FutureHouseClient`,
|
311
|
+
you need to pass an FutureHouse platform api key (see [Authentication](#authentication)):
|
302
312
|
|
303
313
|
```python
|
304
314
|
from futurehouse_client import FutureHouseClient
|
@@ -311,22 +321,33 @@ client = FutureHouseClient(api_key="your_api_key")
|
|
311
321
|
|
312
322
|
## Authentication
|
313
323
|
|
314
|
-
In order to use the `FutureHouseClient`, you need to authenticate yourself.
|
324
|
+
In order to use the `FutureHouseClient`, you need to authenticate yourself.
|
325
|
+
Authentication is done by providing an API key,
|
326
|
+
which can be obtained directly from your [profile page in the FutureHouse platform][2].
|
327
|
+
|
328
|
+
[2]: https://platform.futurehouse.org/profile
|
315
329
|
|
316
330
|
## Simple task running
|
317
331
|
|
318
|
-
In the FutureHouse platform,
|
319
|
-
|
320
|
-
|
332
|
+
In the FutureHouse platform,
|
333
|
+
we define the deployed combination of an agent and an environment as a `job`.
|
334
|
+
To invoke a job, we need to submit a `task` (also called a `query`) to it.
|
335
|
+
`FutureHouseClient` can be used to submit tasks/queries to available jobs in the FutureHouse platform.
|
336
|
+
Using a `FutureHouseClient` instance,
|
337
|
+
you can submit tasks to the platform by calling the `create_task` method,
|
338
|
+
which receives a `TaskRequest` (or a dictionary with `kwargs`) and returns the task id.
|
339
|
+
Aiming to make the submission of tasks as simple as possible,
|
340
|
+
we have created a `JobNames` `enum` that contains the available task types.
|
321
341
|
|
322
342
|
The available supported jobs are:
|
323
|
-
|
324
|
-
|
|
325
|
-
|
|
326
|
-
| `JobNames.
|
327
|
-
| `JobNames.
|
328
|
-
| `JobNames.
|
329
|
-
| `JobNames.
|
343
|
+
|
344
|
+
| Alias | Job Name | Task type | Description |
|
345
|
+
| ------------------ | ------------------------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
346
|
+
| `JobNames.CROW` | `job-futurehouse-paperqa2` | Fast Search | Ask a question of scientific data sources, and receive a high-accuracy, cited response. Built with [PaperQA2](https://github.com/Future-House/paper-qa). |
|
347
|
+
| `JobNames.FALCON` | `job-futurehouse-paperqa2-deep` | Deep Search | Use a plethora of sources to deeply research. Receive a detailed, structured report as a response. |
|
348
|
+
| `JobNames.OWL` | `job-futurehouse-hasanyone` | Precedent Search | Formerly known as HasAnyone, query if anyone has ever done something in science. |
|
349
|
+
| `JobNames.PHOENIX` | `job-futurehouse-phoenix` | Chemistry Tasks | A new iteration of ChemCrow, Phoenix uses cheminformatics tools to do chemistry. Good for planning synthesis and designing new molecules. |
|
350
|
+
| `JobNames.DUMMY` | `job-futurehouse-dummy` | Dummy Task | This is a dummy task. Mainly for testing purposes. |
|
330
351
|
|
331
352
|
Using `JobNames`, the task submission looks like this:
|
332
353
|
|
@@ -369,7 +390,8 @@ if __name__ == "__main__":
|
|
369
390
|
task_id = asyncio.run(main())
|
370
391
|
```
|
371
392
|
|
372
|
-
Note that in either the sync or the async code,
|
393
|
+
Note that in either the sync or the async code,
|
394
|
+
collections of tasks can be given to the client to run them in a batch:
|
373
395
|
|
374
396
|
```python
|
375
397
|
import asyncio
|
@@ -412,7 +434,12 @@ if __name__ == "__main__":
|
|
412
434
|
| query | str | Query or task to be executed by the job |
|
413
435
|
| runtime_config | RuntimeConfig | Optional runtime parameters for the job |
|
414
436
|
|
415
|
-
`runtime_config` can receive a `AgentConfig` object with the desired kwargs.
|
437
|
+
`runtime_config` can receive a `AgentConfig` object with the desired kwargs.
|
438
|
+
Check the available `AgentConfig` fields in the [LDP documentation][3].
|
439
|
+
Besides the `AgentConfig` object,
|
440
|
+
we can also pass `timeout` and `max_steps` to limit the execution time and the number of steps the agent can take.
|
441
|
+
|
442
|
+
[3]: https://github.com/Future-House/ldp/blob/main/src/ldp/agent/agent.py#L87
|
416
443
|
|
417
444
|
```python
|
418
445
|
from futurehouse_client import FutureHouseClient, JobNames
|
@@ -429,7 +456,8 @@ client = FutureHouseClient()
|
|
429
456
|
print(task_response.answer)
|
430
457
|
```
|
431
458
|
|
432
|
-
A `TaskResponse` will be returned from using our agents.
|
459
|
+
A `TaskResponse` will be returned from using our agents.
|
460
|
+
For Owl, Crow, and Falcon, we default to a subclass, `PQATaskResponse` which has some key attributes:
|
433
461
|
|
434
462
|
| Field | Type | Description |
|
435
463
|
| --------------------- | ---- | ------------------------------------------------------------------------------- |
|
@@ -437,7 +465,8 @@ A `TaskResponse` will be returned from using our agents. For Owl, Crow, and Falc
|
|
437
465
|
| formatted_answer | str | Specially formatted answer with references. |
|
438
466
|
| has_successful_answer | bool | Flag for whether the agent was able to find a good answer to your query or not. |
|
439
467
|
|
440
|
-
If using the `verbose` setting, much more data can be pulled down from your `TaskResponse`,
|
468
|
+
If using the `verbose` setting, much more data can be pulled down from your `TaskResponse`,
|
469
|
+
which will exist across all agents (not just Owl, Crow, and Falcon).
|
441
470
|
|
442
471
|
```python
|
443
472
|
from futurehouse_client import FutureHouseClient, JobNames
|
@@ -460,16 +489,18 @@ print(task_response.environment_frame)
|
|
460
489
|
In that case, a `TaskResponseVerbose` will have the following fields:
|
461
490
|
|
462
491
|
| Field | Type | Description |
|
463
|
-
| ----------------- | ---- | ---------------------------------------------------------------------------------------------------------------------- |
|
492
|
+
| ----------------- | ---- | ---------------------------------------------------------------------------------------------------------------------- |
|
464
493
|
| agent_state | dict | Large object with all agent states during the progress of your task. |
|
465
494
|
| environment_frame | dict | Large nested object with all environment data, for PQA environments it includes contexts, paper metadata, and answers. |
|
466
|
-
| metadata | dict | Extra metadata about your query. |
|
495
|
+
| metadata | dict | Extra metadata about your query. |
|
467
496
|
|
468
497
|
## Task Continuation
|
469
498
|
|
470
|
-
Once a task is submitted and the answer is returned,
|
499
|
+
Once a task is submitted and the answer is returned,
|
500
|
+
FutureHouse platform allow you to ask follow-up questions to the previous task.
|
471
501
|
It is also possible through the platform API.
|
472
|
-
To accomplish that,
|
502
|
+
To accomplish that,
|
503
|
+
we can use the `runtime_config` we discussed in the [Simple task running](#simple-task-running) section.
|
473
504
|
|
474
505
|
```python
|
475
506
|
from futurehouse_client import FutureHouseClient, JobNames
|
@@ -497,7 +528,9 @@ continued_task_data = {
|
|
497
528
|
|
498
529
|
## Asynchronous tasks
|
499
530
|
|
500
|
-
Sometimes you may want to submit many jobs, while querying results at a later time.
|
531
|
+
Sometimes you may want to submit many jobs, while querying results at a later time.
|
532
|
+
In this way you can do other things while waiting for a response.
|
533
|
+
The platform API supports this as well rather than waiting for a result.
|
501
534
|
|
502
535
|
```python
|
503
536
|
from futurehouse_client import FutureHouseClient, JobNames
|
@@ -515,4 +548,6 @@ task_id = client.create_task(task_data)
|
|
515
548
|
task_status = client.get_task(task_id)
|
516
549
|
```
|
517
550
|
|
518
|
-
`task_status` contains information about the task.
|
551
|
+
`task_status` contains information about the task.
|
552
|
+
For instance, its `status`, `task`, `environment_name` and `agent_name`, and other fields specific to the job.
|
553
|
+
You can continually query the status until it's `success` before moving on.
|
{futurehouse_client-0.3.20.dev112.dist-info → futurehouse_client-0.3.20.dev196.dist-info}/RECORD
RENAMED
@@ -1,11 +1,11 @@
|
|
1
|
-
futurehouse_client/__init__.py,sha256=
|
1
|
+
futurehouse_client/__init__.py,sha256=BztM_ntbgmIEjzvnBWcvPhvLjM8xGDFCK0Upf3-nIn8,488
|
2
2
|
futurehouse_client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
-
futurehouse_client/version.py,sha256=
|
3
|
+
futurehouse_client/version.py,sha256=ajDpFNAiJ6I3fYkoEBeu8VxH5XgyeyKdOFsM__tugkA,530
|
4
4
|
futurehouse_client/clients/__init__.py,sha256=-HXNj-XJ3LRO5XM6MZ709iPs29YpApss0Q2YYg1qMZw,280
|
5
5
|
futurehouse_client/clients/job_client.py,sha256=D51_qTxya6g5Wfg_ZfJdP031TV_YDJeXkGMiYAJ1qRc,11962
|
6
|
-
futurehouse_client/clients/rest_client.py,sha256=
|
7
|
-
futurehouse_client/models/__init__.py,sha256=
|
8
|
-
futurehouse_client/models/app.py,sha256=
|
6
|
+
futurehouse_client/clients/rest_client.py,sha256=aN5v9iyGplEfFaospYIGGstrAtiOgv0uFIKd51y4WrE,66890
|
7
|
+
futurehouse_client/models/__init__.py,sha256=kQ4R7VEuRxO0IQEW_sk9CndBL7zzl8rUKI24ddyYLM0,647
|
8
|
+
futurehouse_client/models/app.py,sha256=LSaKx83Yo0yBLpqhKrDw4DWxj4apNaWFyjM_dZnTxuI,29105
|
9
9
|
futurehouse_client/models/client.py,sha256=n4HD0KStKLm6Ek9nL9ylP-bkK10yzAaD1uIDF83Qp_A,1828
|
10
10
|
futurehouse_client/models/rest.py,sha256=AwPMcB1ruoqaI8NIhX2ZzN8UuX6XsaQ7uzeSE8EpwKk,1573
|
11
11
|
futurehouse_client/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -13,9 +13,8 @@ futurehouse_client/utils/auth.py,sha256=tgWELjKfg8eWme_qdcRmc8TjQN9DVZuHHaVXZNHL
|
|
13
13
|
futurehouse_client/utils/general.py,sha256=A_rtTiYW30ELGEZlWCIArO7q1nEmqi8hUlmBRYkMQ_c,767
|
14
14
|
futurehouse_client/utils/module_utils.py,sha256=aFyd-X-pDARXz9GWpn8SSViUVYdSbuy9vSkrzcVIaGI,4955
|
15
15
|
futurehouse_client/utils/monitoring.py,sha256=UjRlufe67kI3VxRHOd5fLtJmlCbVA2Wqwpd4uZhXkQM,8728
|
16
|
-
futurehouse_client/
|
17
|
-
futurehouse_client-0.3.20.
|
18
|
-
futurehouse_client-0.3.20.
|
19
|
-
futurehouse_client-0.3.20.
|
20
|
-
futurehouse_client-0.3.20.
|
21
|
-
futurehouse_client-0.3.20.dev112.dist-info/RECORD,,
|
16
|
+
futurehouse_client-0.3.20.dev196.dist-info/licenses/LICENSE,sha256=oQ9ZHjUi-_6GfP3gs14FlPb0OlGwE1QCCKFGnJ4LD2I,11341
|
17
|
+
futurehouse_client-0.3.20.dev196.dist-info/METADATA,sha256=hwUUzi7oZJjmRPk8PuwIwBpE5TeXXossw2IpotAwHIA,26805
|
18
|
+
futurehouse_client-0.3.20.dev196.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
19
|
+
futurehouse_client-0.3.20.dev196.dist-info/top_level.txt,sha256=TRuLUCt_qBnggdFHCX4O_BoCu1j2X43lKfIZC-ElwWY,19
|
20
|
+
futurehouse_client-0.3.20.dev196.dist-info/RECORD,,
|
@@ -1,52 +0,0 @@
|
|
1
|
-
from futurehouse_client.clients.rest_client import RestClient
|
2
|
-
from futurehouse_client.models.app import Stage
|
3
|
-
from futurehouse_client.models.rest import WorldModel
|
4
|
-
from uuid import UUID
|
5
|
-
from aviary.core import Tool
|
6
|
-
|
7
|
-
|
8
|
-
class WorldModelTools:
|
9
|
-
CLIENT = RestClient(
|
10
|
-
stage = Stage.DEV,
|
11
|
-
api_key="Dk7WJRLpqTFNxp5dYRoj6A.platformv01.eyJqdGkiOiI4ODAyZmZiNy1hNjM2LTRkMWYtYWE4NC1lZTQzYTMzMzRjZGMiLCJzdWIiOiJuN1dJbGU5VDljZ1BkTjd2OUJlM0pEUlpZVTgyIiwiaWF0IjoxNzQ5MDc2NzYzfQ.vThmFNLChP54DZBwB+qeMTB6CvAQ1IVXkTcpB0+efZ0",
|
12
|
-
)
|
13
|
-
|
14
|
-
@staticmethod
|
15
|
-
def create_world_model(name: str, description: str, content: str) -> UUID:
|
16
|
-
"""Create a new world model.
|
17
|
-
|
18
|
-
Args:
|
19
|
-
name: The name of the world model.
|
20
|
-
description: A description of the world model.
|
21
|
-
content: The content/data of the world model.
|
22
|
-
|
23
|
-
Returns:
|
24
|
-
UUID: The ID of the newly created world model.
|
25
|
-
"""
|
26
|
-
world_model = WorldModel(
|
27
|
-
name=name,
|
28
|
-
description=description,
|
29
|
-
content=content,
|
30
|
-
)
|
31
|
-
return WorldModelTools.CLIENT.create_world_model(world_model)
|
32
|
-
|
33
|
-
@staticmethod
|
34
|
-
def search_world_models(query: str) -> list[str]:
|
35
|
-
"""Search for world models using a text query.
|
36
|
-
|
37
|
-
Args:
|
38
|
-
query: The search query string to match against world model content.
|
39
|
-
|
40
|
-
Returns:
|
41
|
-
list[str]: A list of world model IDs that match the search query.
|
42
|
-
"""
|
43
|
-
return WorldModelTools.CLIENT.search_world_models(query, size=1)
|
44
|
-
|
45
|
-
create_world_model_tool = Tool.from_function(WorldModelTools.create_world_model)
|
46
|
-
search_world_model_tool = Tool.from_function(WorldModelTools.search_world_models)
|
47
|
-
|
48
|
-
def make_world_model_tools() -> list[Tool]:
|
49
|
-
return [
|
50
|
-
search_world_model_tool,
|
51
|
-
create_world_model_tool,
|
52
|
-
]
|
{futurehouse_client-0.3.20.dev112.dist-info → futurehouse_client-0.3.20.dev196.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|
File without changes
|