futurehouse-client 0.3.20.dev55__tar.gz → 0.3.20.dev105__tar.gz

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.
Files changed (29) hide show
  1. {futurehouse_client-0.3.20.dev55/futurehouse_client.egg-info → futurehouse_client-0.3.20.dev105}/PKG-INFO +39 -44
  2. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/README.md +38 -43
  3. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/futurehouse_client/clients/job_client.py +1 -1
  4. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/futurehouse_client/clients/rest_client.py +6 -16
  5. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/futurehouse_client/models/app.py +1 -1
  6. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/futurehouse_client/models/rest.py +5 -5
  7. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/futurehouse_client/version.py +2 -2
  8. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105/futurehouse_client.egg-info}/PKG-INFO +39 -44
  9. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/tests/test_rest.py +2 -2
  10. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/LICENSE +0 -0
  11. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/docs/__init__.py +0 -0
  12. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/docs/client_notebook.ipynb +0 -0
  13. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/futurehouse_client/__init__.py +0 -0
  14. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/futurehouse_client/clients/__init__.py +0 -0
  15. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/futurehouse_client/models/__init__.py +0 -0
  16. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/futurehouse_client/models/client.py +0 -0
  17. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/futurehouse_client/py.typed +0 -0
  18. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/futurehouse_client/utils/__init__.py +0 -0
  19. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/futurehouse_client/utils/auth.py +0 -0
  20. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/futurehouse_client/utils/general.py +0 -0
  21. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/futurehouse_client/utils/module_utils.py +0 -0
  22. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/futurehouse_client/utils/monitoring.py +0 -0
  23. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/futurehouse_client.egg-info/SOURCES.txt +0 -0
  24. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/futurehouse_client.egg-info/dependency_links.txt +0 -0
  25. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/futurehouse_client.egg-info/requires.txt +0 -0
  26. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/futurehouse_client.egg-info/top_level.txt +0 -0
  27. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/pyproject.toml +0 -0
  28. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/setup.cfg +0 -0
  29. {futurehouse_client-0.3.20.dev55 → futurehouse_client-0.3.20.dev105}/tests/test_client.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: futurehouse-client
3
- Version: 0.3.20.dev55
3
+ Version: 0.3.20.dev105
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
@@ -274,20 +274,19 @@ uv pip install futurehouse-client
274
274
 
275
275
  ```python
276
276
  from futurehouse_client import FutureHouseClient, JobNames
277
- from pathlib import Path
278
- from aviary.core import DummyEnv
279
- import ldp
280
277
 
281
- client = FutureHouseClient(
282
- api_key="your_api_key",
283
- )
278
+ # Set your API key to FUTUREHOUSE_API_KEY environment variable,
279
+ # or pass it as a string literal to the api_key parameter
280
+ client = FutureHouseClient()
284
281
 
285
282
  task_data = {
286
283
  "name": JobNames.CROW,
287
- "query": "Which neglected diseases had a treatment developed by artificial intelligence?",
284
+ "query": (
285
+ "Which neglected diseases had a treatment developed"
286
+ " by artificial intelligence?"
287
+ ),
288
288
  }
289
-
290
- task_response = client.run_tasks_until_done(task_data)
289
+ (task_response,) = client.run_tasks_until_done(task_data)
291
290
  ```
292
291
 
293
292
  A quickstart example can be found in the [client_notebook.ipynb](https://futurehouse.gitbook.io/futurehouse-cookbook/futurehouse-client/docs/client_notebook) file, where we show how to submit and retrieve a job task, pass runtime configuration to the agent, and ask follow-up questions to the previous job.
@@ -304,9 +303,10 @@ To create a `FutureHouseClient`, you need to pass an FutureHouse platform api ke
304
303
  ```python
305
304
  from futurehouse_client import FutureHouseClient
306
305
 
307
- client = FutureHouseClient(
308
- api_key="your_api_key",
309
- )
306
+ # Set your API key to FUTUREHOUSE_API_KEY environment variable
307
+ client = FutureHouseClient()
308
+ # Or pass it as a string literal to the api_key parameter
309
+ client = FutureHouseClient(api_key="your_api_key")
310
310
  ```
311
311
 
312
312
  ## Authentication
@@ -333,17 +333,13 @@ Using `JobNames`, the task submission looks like this:
333
333
  ```python
334
334
  from futurehouse_client import FutureHouseClient, JobNames
335
335
 
336
- client = FutureHouseClient(
337
- api_key="your_api_key",
338
- )
336
+ client = FutureHouseClient()
339
337
 
340
338
  task_data = {
341
339
  "name": JobNames.OWL,
342
340
  "query": "Has anyone tested therapeutic exerkines in humans or NHPs?",
343
341
  }
344
-
345
- task_response = client.run_tasks_until_done(task_data)
346
-
342
+ (task_response,) = client.run_tasks_until_done(task_data)
347
343
  print(task_response.answer)
348
344
  ```
349
345
 
@@ -363,8 +359,7 @@ async def main():
363
359
  "name": JobNames.OWL,
364
360
  "query": "Has anyone tested therapeutic exerkines in humans or NHPs?",
365
361
  }
366
-
367
- task_response = await client.arun_tasks_until_done(task_data)
362
+ (task_response,) = await client.arun_tasks_until_done(task_data)
368
363
  print(task_response.answer)
369
364
  return task_id
370
365
 
@@ -382,9 +377,7 @@ from futurehouse_client import FutureHouseClient, JobNames
382
377
 
383
378
 
384
379
  async def main():
385
- client = FutureHouseClient(
386
- api_key="your_api_key",
387
- )
380
+ client = FutureHouseClient()
388
381
 
389
382
  task_data = [
390
383
  {
@@ -393,10 +386,12 @@ async def main():
393
386
  },
394
387
  {
395
388
  "name": JobNames.CROW,
396
- "query": "Are there any clinically validated therapeutic exerkines for humans?",
389
+ "query": (
390
+ "Are there any clinically validated"
391
+ " therapeutic exerkines for humans?"
392
+ ),
397
393
  },
398
394
  ]
399
-
400
395
  task_responses = await client.arun_tasks_until_done(task_data)
401
396
  print(task_responses[0].answer)
402
397
  print(task_responses[1].answer)
@@ -423,17 +418,14 @@ if __name__ == "__main__":
423
418
  from futurehouse_client import FutureHouseClient, JobNames
424
419
  from futurehouse_client.models.app import TaskRequest
425
420
 
426
- client = FutureHouseClient(
427
- api_key="your_api_key",
428
- )
421
+ client = FutureHouseClient()
429
422
 
430
- task_response = client.run_tasks_until_done(
423
+ (task_response,) = client.run_tasks_until_done(
431
424
  TaskRequest(
432
425
  name=JobNames.OWL,
433
426
  query="Has anyone tested therapeutic exerkines in humans or NHPs?",
434
427
  )
435
428
  )
436
-
437
429
  print(task_response.answer)
438
430
  ```
439
431
 
@@ -455,14 +447,13 @@ client = FutureHouseClient(
455
447
  api_key="your_api_key",
456
448
  )
457
449
 
458
- task_response = client.run_tasks_until_done(
450
+ (task_response,) = client.run_tasks_until_done(
459
451
  TaskRequest(
460
452
  name=JobNames.OWL,
461
453
  query="Has anyone tested therapeutic exerkines in humans or NHPs?",
462
454
  ),
463
455
  verbose=True,
464
456
  )
465
-
466
457
  print(task_response.environment_frame)
467
458
  ```
468
459
 
@@ -487,17 +478,21 @@ client = FutureHouseClient(
487
478
  api_key="your_api_key",
488
479
  )
489
480
 
490
- task_data = {"name": JobNames.CROW, "query": "How many species of birds are there?"}
491
-
481
+ task_data = {
482
+ "name": JobNames.CROW,
483
+ "query": "How many species of birds are there?",
484
+ }
492
485
  task_id = client.create_task(task_data)
493
486
 
494
487
  continued_task_data = {
495
488
  "name": JobNames.CROW,
496
- "query": "From the previous answer, specifically,how many species of crows are there?",
489
+ "query": (
490
+ "From the previous answer,"
491
+ " specifically, how many species of crows are there?"
492
+ ),
497
493
  "runtime_config": {"continued_task_id": task_id},
498
494
  }
499
-
500
- task_result = client.run_tasks_until_done(continued_task_data)
495
+ (task_response,) = client.run_tasks_until_done(continued_task_data)
501
496
  ```
502
497
 
503
498
  ## Asynchronous tasks
@@ -505,14 +500,14 @@ task_result = client.run_tasks_until_done(continued_task_data)
505
500
  Sometimes you may want to submit many jobs, while querying results at a later time. In this way you can do other things while waiting for a response. The platform API supports this as well rather than waiting for a result.
506
501
 
507
502
  ```python
508
- from futurehouse_client import FutureHouseClient
509
-
510
- client = FutureHouseClient(
511
- api_key="your_api_key",
512
- )
503
+ from futurehouse_client import FutureHouseClient, JobNames
513
504
 
514
- task_data = {"name": JobNames.CROW, "query": "How many species of birds are there?"}
505
+ client = FutureHouseClient()
515
506
 
507
+ task_data = {
508
+ "name": JobNames.CROW,
509
+ "query": "How many species of birds are there?",
510
+ }
516
511
  task_id = client.create_task(task_data)
517
512
 
518
513
  # move on to do other things
@@ -24,20 +24,19 @@ uv pip install futurehouse-client
24
24
 
25
25
  ```python
26
26
  from futurehouse_client import FutureHouseClient, JobNames
27
- from pathlib import Path
28
- from aviary.core import DummyEnv
29
- import ldp
30
27
 
31
- client = FutureHouseClient(
32
- api_key="your_api_key",
33
- )
28
+ # Set your API key to FUTUREHOUSE_API_KEY environment variable,
29
+ # or pass it as a string literal to the api_key parameter
30
+ client = FutureHouseClient()
34
31
 
35
32
  task_data = {
36
33
  "name": JobNames.CROW,
37
- "query": "Which neglected diseases had a treatment developed by artificial intelligence?",
34
+ "query": (
35
+ "Which neglected diseases had a treatment developed"
36
+ " by artificial intelligence?"
37
+ ),
38
38
  }
39
-
40
- task_response = client.run_tasks_until_done(task_data)
39
+ (task_response,) = client.run_tasks_until_done(task_data)
41
40
  ```
42
41
 
43
42
  A quickstart example can be found in the [client_notebook.ipynb](https://futurehouse.gitbook.io/futurehouse-cookbook/futurehouse-client/docs/client_notebook) file, where we show how to submit and retrieve a job task, pass runtime configuration to the agent, and ask follow-up questions to the previous job.
@@ -54,9 +53,10 @@ To create a `FutureHouseClient`, you need to pass an FutureHouse platform api ke
54
53
  ```python
55
54
  from futurehouse_client import FutureHouseClient
56
55
 
57
- client = FutureHouseClient(
58
- api_key="your_api_key",
59
- )
56
+ # Set your API key to FUTUREHOUSE_API_KEY environment variable
57
+ client = FutureHouseClient()
58
+ # Or pass it as a string literal to the api_key parameter
59
+ client = FutureHouseClient(api_key="your_api_key")
60
60
  ```
61
61
 
62
62
  ## Authentication
@@ -83,17 +83,13 @@ Using `JobNames`, the task submission looks like this:
83
83
  ```python
84
84
  from futurehouse_client import FutureHouseClient, JobNames
85
85
 
86
- client = FutureHouseClient(
87
- api_key="your_api_key",
88
- )
86
+ client = FutureHouseClient()
89
87
 
90
88
  task_data = {
91
89
  "name": JobNames.OWL,
92
90
  "query": "Has anyone tested therapeutic exerkines in humans or NHPs?",
93
91
  }
94
-
95
- task_response = client.run_tasks_until_done(task_data)
96
-
92
+ (task_response,) = client.run_tasks_until_done(task_data)
97
93
  print(task_response.answer)
98
94
  ```
99
95
 
@@ -113,8 +109,7 @@ async def main():
113
109
  "name": JobNames.OWL,
114
110
  "query": "Has anyone tested therapeutic exerkines in humans or NHPs?",
115
111
  }
116
-
117
- task_response = await client.arun_tasks_until_done(task_data)
112
+ (task_response,) = await client.arun_tasks_until_done(task_data)
118
113
  print(task_response.answer)
119
114
  return task_id
120
115
 
@@ -132,9 +127,7 @@ from futurehouse_client import FutureHouseClient, JobNames
132
127
 
133
128
 
134
129
  async def main():
135
- client = FutureHouseClient(
136
- api_key="your_api_key",
137
- )
130
+ client = FutureHouseClient()
138
131
 
139
132
  task_data = [
140
133
  {
@@ -143,10 +136,12 @@ async def main():
143
136
  },
144
137
  {
145
138
  "name": JobNames.CROW,
146
- "query": "Are there any clinically validated therapeutic exerkines for humans?",
139
+ "query": (
140
+ "Are there any clinically validated"
141
+ " therapeutic exerkines for humans?"
142
+ ),
147
143
  },
148
144
  ]
149
-
150
145
  task_responses = await client.arun_tasks_until_done(task_data)
151
146
  print(task_responses[0].answer)
152
147
  print(task_responses[1].answer)
@@ -173,17 +168,14 @@ if __name__ == "__main__":
173
168
  from futurehouse_client import FutureHouseClient, JobNames
174
169
  from futurehouse_client.models.app import TaskRequest
175
170
 
176
- client = FutureHouseClient(
177
- api_key="your_api_key",
178
- )
171
+ client = FutureHouseClient()
179
172
 
180
- task_response = client.run_tasks_until_done(
173
+ (task_response,) = client.run_tasks_until_done(
181
174
  TaskRequest(
182
175
  name=JobNames.OWL,
183
176
  query="Has anyone tested therapeutic exerkines in humans or NHPs?",
184
177
  )
185
178
  )
186
-
187
179
  print(task_response.answer)
188
180
  ```
189
181
 
@@ -205,14 +197,13 @@ client = FutureHouseClient(
205
197
  api_key="your_api_key",
206
198
  )
207
199
 
208
- task_response = client.run_tasks_until_done(
200
+ (task_response,) = client.run_tasks_until_done(
209
201
  TaskRequest(
210
202
  name=JobNames.OWL,
211
203
  query="Has anyone tested therapeutic exerkines in humans or NHPs?",
212
204
  ),
213
205
  verbose=True,
214
206
  )
215
-
216
207
  print(task_response.environment_frame)
217
208
  ```
218
209
 
@@ -237,17 +228,21 @@ client = FutureHouseClient(
237
228
  api_key="your_api_key",
238
229
  )
239
230
 
240
- task_data = {"name": JobNames.CROW, "query": "How many species of birds are there?"}
241
-
231
+ task_data = {
232
+ "name": JobNames.CROW,
233
+ "query": "How many species of birds are there?",
234
+ }
242
235
  task_id = client.create_task(task_data)
243
236
 
244
237
  continued_task_data = {
245
238
  "name": JobNames.CROW,
246
- "query": "From the previous answer, specifically,how many species of crows are there?",
239
+ "query": (
240
+ "From the previous answer,"
241
+ " specifically, how many species of crows are there?"
242
+ ),
247
243
  "runtime_config": {"continued_task_id": task_id},
248
244
  }
249
-
250
- task_result = client.run_tasks_until_done(continued_task_data)
245
+ (task_response,) = client.run_tasks_until_done(continued_task_data)
251
246
  ```
252
247
 
253
248
  ## Asynchronous tasks
@@ -255,14 +250,14 @@ task_result = client.run_tasks_until_done(continued_task_data)
255
250
  Sometimes you may want to submit many jobs, while querying results at a later time. In this way you can do other things while waiting for a response. The platform API supports this as well rather than waiting for a result.
256
251
 
257
252
  ```python
258
- from futurehouse_client import FutureHouseClient
259
-
260
- client = FutureHouseClient(
261
- api_key="your_api_key",
262
- )
253
+ from futurehouse_client import FutureHouseClient, JobNames
263
254
 
264
- task_data = {"name": JobNames.CROW, "query": "How many species of birds are there?"}
255
+ client = FutureHouseClient()
265
256
 
257
+ task_data = {
258
+ "name": JobNames.CROW,
259
+ "query": "How many species of birds are there?",
260
+ }
266
261
  task_id = client.create_task(task_data)
267
262
 
268
263
  # move on to do other things
@@ -73,7 +73,7 @@ class JobNames(StrEnum):
73
73
 
74
74
  @staticmethod
75
75
  def get_response_object_from_job(job_name: str) -> type[TaskResponse]:
76
- return JobNames._get_response_mapping()[job_name]
76
+ return JobNames._get_response_mapping().get(job_name, TaskResponse)
77
77
 
78
78
  def get_response_object(self) -> type[TaskResponse]:
79
79
  return self._get_response_mapping()[self.name]
@@ -139,6 +139,7 @@ retry_if_connection_error = retry_if_exception_type((
139
139
  DEFAULT_AGENT_TIMEOUT: int = 2400 # seconds
140
140
 
141
141
 
142
+ # pylint: disable=too-many-public-methods
142
143
  class RestClient:
143
144
  REQUEST_TIMEOUT: ClassVar[float] = 30.0 # sec
144
145
  MAX_RETRY_ATTEMPTS: ClassVar[int] = 3
@@ -169,7 +170,7 @@ class RestClient:
169
170
  self.base_url = service_uri or stage.value
170
171
  self.stage = stage
171
172
  self.auth_type = auth_type
172
- self.api_key = api_key
173
+ self.api_key = api_key or os.environ.get("FUTUREHOUSE_API_KEY")
173
174
  self._clients: dict[str, Client | AsyncClient] = {}
174
175
  self.headers = headers or {}
175
176
  self.jwt = jwt
@@ -1419,15 +1420,9 @@ class RestClient:
1419
1420
  if not (world_model_id or name) or (world_model_id and name):
1420
1421
  raise ValueError("Provide either 'world_model_id' or 'name', but not both.")
1421
1422
 
1422
- params = {
1423
- "id": str(world_model_id) if world_model_id else None,
1424
- "name": name,
1425
- }
1426
- # Filter out None values before making the request
1427
- params = {k: v for k, v in params.items() if v is not None}
1428
-
1429
1423
  try:
1430
- response = self.client.get("/v0.1/world-model", params=params)
1424
+ identifier = str(world_model_id) if world_model_id else name
1425
+ response = self.client.get(f"/v0.1/world-models/{identifier}")
1431
1426
  response.raise_for_status()
1432
1427
  return WorldModelResponse.model_validate(response.json())
1433
1428
  except HTTPStatusError as e:
@@ -1465,14 +1460,9 @@ class RestClient:
1465
1460
  if not (world_model_id or name) or (world_model_id and name):
1466
1461
  raise ValueError("Provide either 'world_model_id' or 'name', but not both.")
1467
1462
 
1468
- params = {
1469
- "id": str(world_model_id) if world_model_id else None,
1470
- "name": name,
1471
- }
1472
- params = {k: v for k, v in params.items() if v is not None}
1473
-
1474
1463
  try:
1475
- response = await self.async_client.get("/v0.1/world-model", params=params)
1464
+ identifier = str(world_model_id) if world_model_id else name
1465
+ response = await self.async_client.get(f"/v0.1/world-models/{identifier}")
1476
1466
  response.raise_for_status()
1477
1467
  return WorldModelResponse.model_validate(response.json())
1478
1468
  except HTTPStatusError as e:
@@ -610,7 +610,7 @@ class RuntimeConfig(BaseModel):
610
610
  default=None,
611
611
  description="Optional job identifier for a continued job",
612
612
  )
613
- world_model_id: UUID | None = Field(
613
+ world_model_id: UUID | str | None = Field(
614
614
  default=None,
615
615
  description="Optional world model identifier for the task",
616
616
  )
@@ -46,10 +46,10 @@ class WorldModel(BaseModel):
46
46
  """
47
47
 
48
48
  content: str
49
- prior: UUID | None = None
49
+ prior: UUID | str | None = None
50
50
  name: str | None = None
51
51
  description: str | None = None
52
- trajectory_id: UUID | None = None
52
+ trajectory_id: UUID | str | None = None
53
53
  model_metadata: JsonValue | None = None
54
54
 
55
55
 
@@ -60,12 +60,12 @@ class WorldModelResponse(BaseModel):
60
60
  This model is received from the API.
61
61
  """
62
62
 
63
- id: UUID
64
- prior: UUID | None
63
+ id: UUID | str
64
+ prior: UUID | str | None
65
65
  name: str
66
66
  description: str | None
67
67
  content: str
68
- trajectory_id: UUID | None
68
+ trajectory_id: UUID | str | None
69
69
  email: str | None
70
70
  model_metadata: JsonValue | None
71
71
  enabled: bool
@@ -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.dev55'
21
- __version_tuple__ = version_tuple = (0, 3, 20, 'dev55')
20
+ __version__ = version = '0.3.20.dev105'
21
+ __version_tuple__ = version_tuple = (0, 3, 20, 'dev105')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: futurehouse-client
3
- Version: 0.3.20.dev55
3
+ Version: 0.3.20.dev105
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
@@ -274,20 +274,19 @@ uv pip install futurehouse-client
274
274
 
275
275
  ```python
276
276
  from futurehouse_client import FutureHouseClient, JobNames
277
- from pathlib import Path
278
- from aviary.core import DummyEnv
279
- import ldp
280
277
 
281
- client = FutureHouseClient(
282
- api_key="your_api_key",
283
- )
278
+ # Set your API key to FUTUREHOUSE_API_KEY environment variable,
279
+ # or pass it as a string literal to the api_key parameter
280
+ client = FutureHouseClient()
284
281
 
285
282
  task_data = {
286
283
  "name": JobNames.CROW,
287
- "query": "Which neglected diseases had a treatment developed by artificial intelligence?",
284
+ "query": (
285
+ "Which neglected diseases had a treatment developed"
286
+ " by artificial intelligence?"
287
+ ),
288
288
  }
289
-
290
- task_response = client.run_tasks_until_done(task_data)
289
+ (task_response,) = client.run_tasks_until_done(task_data)
291
290
  ```
292
291
 
293
292
  A quickstart example can be found in the [client_notebook.ipynb](https://futurehouse.gitbook.io/futurehouse-cookbook/futurehouse-client/docs/client_notebook) file, where we show how to submit and retrieve a job task, pass runtime configuration to the agent, and ask follow-up questions to the previous job.
@@ -304,9 +303,10 @@ To create a `FutureHouseClient`, you need to pass an FutureHouse platform api ke
304
303
  ```python
305
304
  from futurehouse_client import FutureHouseClient
306
305
 
307
- client = FutureHouseClient(
308
- api_key="your_api_key",
309
- )
306
+ # Set your API key to FUTUREHOUSE_API_KEY environment variable
307
+ client = FutureHouseClient()
308
+ # Or pass it as a string literal to the api_key parameter
309
+ client = FutureHouseClient(api_key="your_api_key")
310
310
  ```
311
311
 
312
312
  ## Authentication
@@ -333,17 +333,13 @@ Using `JobNames`, the task submission looks like this:
333
333
  ```python
334
334
  from futurehouse_client import FutureHouseClient, JobNames
335
335
 
336
- client = FutureHouseClient(
337
- api_key="your_api_key",
338
- )
336
+ client = FutureHouseClient()
339
337
 
340
338
  task_data = {
341
339
  "name": JobNames.OWL,
342
340
  "query": "Has anyone tested therapeutic exerkines in humans or NHPs?",
343
341
  }
344
-
345
- task_response = client.run_tasks_until_done(task_data)
346
-
342
+ (task_response,) = client.run_tasks_until_done(task_data)
347
343
  print(task_response.answer)
348
344
  ```
349
345
 
@@ -363,8 +359,7 @@ async def main():
363
359
  "name": JobNames.OWL,
364
360
  "query": "Has anyone tested therapeutic exerkines in humans or NHPs?",
365
361
  }
366
-
367
- task_response = await client.arun_tasks_until_done(task_data)
362
+ (task_response,) = await client.arun_tasks_until_done(task_data)
368
363
  print(task_response.answer)
369
364
  return task_id
370
365
 
@@ -382,9 +377,7 @@ from futurehouse_client import FutureHouseClient, JobNames
382
377
 
383
378
 
384
379
  async def main():
385
- client = FutureHouseClient(
386
- api_key="your_api_key",
387
- )
380
+ client = FutureHouseClient()
388
381
 
389
382
  task_data = [
390
383
  {
@@ -393,10 +386,12 @@ async def main():
393
386
  },
394
387
  {
395
388
  "name": JobNames.CROW,
396
- "query": "Are there any clinically validated therapeutic exerkines for humans?",
389
+ "query": (
390
+ "Are there any clinically validated"
391
+ " therapeutic exerkines for humans?"
392
+ ),
397
393
  },
398
394
  ]
399
-
400
395
  task_responses = await client.arun_tasks_until_done(task_data)
401
396
  print(task_responses[0].answer)
402
397
  print(task_responses[1].answer)
@@ -423,17 +418,14 @@ if __name__ == "__main__":
423
418
  from futurehouse_client import FutureHouseClient, JobNames
424
419
  from futurehouse_client.models.app import TaskRequest
425
420
 
426
- client = FutureHouseClient(
427
- api_key="your_api_key",
428
- )
421
+ client = FutureHouseClient()
429
422
 
430
- task_response = client.run_tasks_until_done(
423
+ (task_response,) = client.run_tasks_until_done(
431
424
  TaskRequest(
432
425
  name=JobNames.OWL,
433
426
  query="Has anyone tested therapeutic exerkines in humans or NHPs?",
434
427
  )
435
428
  )
436
-
437
429
  print(task_response.answer)
438
430
  ```
439
431
 
@@ -455,14 +447,13 @@ client = FutureHouseClient(
455
447
  api_key="your_api_key",
456
448
  )
457
449
 
458
- task_response = client.run_tasks_until_done(
450
+ (task_response,) = client.run_tasks_until_done(
459
451
  TaskRequest(
460
452
  name=JobNames.OWL,
461
453
  query="Has anyone tested therapeutic exerkines in humans or NHPs?",
462
454
  ),
463
455
  verbose=True,
464
456
  )
465
-
466
457
  print(task_response.environment_frame)
467
458
  ```
468
459
 
@@ -487,17 +478,21 @@ client = FutureHouseClient(
487
478
  api_key="your_api_key",
488
479
  )
489
480
 
490
- task_data = {"name": JobNames.CROW, "query": "How many species of birds are there?"}
491
-
481
+ task_data = {
482
+ "name": JobNames.CROW,
483
+ "query": "How many species of birds are there?",
484
+ }
492
485
  task_id = client.create_task(task_data)
493
486
 
494
487
  continued_task_data = {
495
488
  "name": JobNames.CROW,
496
- "query": "From the previous answer, specifically,how many species of crows are there?",
489
+ "query": (
490
+ "From the previous answer,"
491
+ " specifically, how many species of crows are there?"
492
+ ),
497
493
  "runtime_config": {"continued_task_id": task_id},
498
494
  }
499
-
500
- task_result = client.run_tasks_until_done(continued_task_data)
495
+ (task_response,) = client.run_tasks_until_done(continued_task_data)
501
496
  ```
502
497
 
503
498
  ## Asynchronous tasks
@@ -505,14 +500,14 @@ task_result = client.run_tasks_until_done(continued_task_data)
505
500
  Sometimes you may want to submit many jobs, while querying results at a later time. In this way you can do other things while waiting for a response. The platform API supports this as well rather than waiting for a result.
506
501
 
507
502
  ```python
508
- from futurehouse_client import FutureHouseClient
509
-
510
- client = FutureHouseClient(
511
- api_key="your_api_key",
512
- )
503
+ from futurehouse_client import FutureHouseClient, JobNames
513
504
 
514
- task_data = {"name": JobNames.CROW, "query": "How many species of birds are there?"}
505
+ client = FutureHouseClient()
515
506
 
507
+ task_data = {
508
+ "name": JobNames.CROW,
509
+ "query": "How many species of birds are there?",
510
+ }
516
511
  task_id = client.create_task(task_data)
517
512
 
518
513
  # move on to do other things
@@ -697,7 +697,7 @@ async def test_world_model_acreate_and_aget(admin_client: RestClient):
697
697
  model_by_id = await admin_client.aget_world_model(model_id)
698
698
  model_by_name = await admin_client.aget_world_model(name=model.name)
699
699
 
700
- assert model_by_id.id == model_id == model_by_name.id
700
+ assert str(model_by_id.id) == str(model_id) == str(model_by_name.id)
701
701
  assert model_by_id.content == model.content == model_by_name.content
702
702
 
703
703
  updated_model = WorldModel(
@@ -728,7 +728,7 @@ def test_world_model_create_and_get(admin_client: RestClient):
728
728
  model_by_id = admin_client.get_world_model(model_id)
729
729
  model_by_name = admin_client.get_world_model(name=model.name)
730
730
 
731
- assert model_by_id.id == model_id == model_by_name.id
731
+ assert str(model_by_id.id) == str(model_id) == str(model_by_name.id)
732
732
  assert model_by_id.content == model.content == model_by_name.content
733
733
 
734
734
  updated_model = WorldModel(