A client for interacting with endpoints of the FutureHouse service.
Project description
FutureHouse Platform API Documentation
Documentation and tutorials for futurehouse-client, a client for interacting with endpoints of the FutureHouse platform.
- Installation
- Quickstart
- Functionalities
- Authentication
- Task submission
- Task Continuation
- Task retrieval
Installation
uv pip install futurehouse-client
Quickstart
from futurehouse_client import FutureHouseClient, JobNames
from pathlib import Path
from aviary.core import DummyEnv
import ldp
client = FutureHouseClient(
api_key="your_api_key",
)
task_data = {
"name": JobNames.CROW,
"query": "Which neglected diseases had a treatment developed by artificial intelligence?",
}
task_run_id = client.create_task(task_data)
task_status = client.get_task(task_run_id)
A quickstart example can be found in the client_notebook.ipynb 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.
Functionalities
FutureHouse client implements a RestClient (called FutureHouseClient) with the following functionalities:
- Task submission:
create_task(TaskRequest) - Task status:
get_task(task_id)
To create a FutureHouseClient, you need to pass an FutureHouse platform api key (see Authentication):
from futurehouse_client import FutureHouseClient
client = FutureHouseClient(
api_key="your_api_key",
)
Authentication
In order to use the FutureHouseClient, you need to authenticate yourself. Authentication is done by providing an API key, which can be obtained directly from your profile page in the FutureHouse platform.
Task submission
In the futurehouse platform, we define the deployed combination of an agent and an environment as a job. To invoke a job, we need to submit a task (also called a query) to it.
FutureHouseClient can be used to submit tasks/queries to available jobs in the FutureHouse platform. Using a FutureHouseClient instance, you can submit tasks to the platform by calling the create_task method, which receives a TaskRequest (or a dictionary with kwargs) and returns the task id.
Aiming to make the submission of tasks as simple as possible, we have created a JobNames enum that contains the available task types.
The available supported jobs are:
| Alias | Job Name | Task type | Description |
|---|---|---|---|
JobNames.CROW |
job-futurehouse-paperqa2 |
Fast Search | Ask a question of scientific data sources, and receive a high-accuracy, cited response. Built with PaperQA2. |
JobNames.FALCON |
job-futurehouse-paperqa2-deep |
Deep Search | Use a plethora of sources to deeply research. Receive a detailed, structured report as a response. |
JobNames.OWL |
job-futurehouse-hasanyone |
Precedent Search | Formerly known as HasAnyone, query if anyone has ever done something in science. |
JobNames.DUMMY |
job-futurehouse-dummy |
Dummy Task | This is a dummy task. Mainly for testing purposes. |
Using JobNames, the client automatically adapts the job name to the current stage.
The task submission looks like this:
from futurehouse_client import FutureHouseClient, JobNames
client = FutureHouseClient(
api_key="your_api_key",
)
task_data = {
"name": JobNames.OWL,
"query": "Has anyone tested therapeutic exerkines in humans or NHPs?",
}
task_id = client.create_task(task_data)
TaskRequest has the following fields:
| Field | Type | Description |
|---|---|---|
| id | UUID | Optional job identifier. A UUID will be generated if not provided |
| name | str | Name of the job to execute eg. job-futurehouse-paperqa2, or using the JobNames for convenience: JobNames.CROW |
| query | str | Query or task to be executed by the job |
| runtime_config | RuntimeConfig | Optional runtime parameters for the job |
runtime_config can receive a AgentConfig object with the desired kwargs. Check the available AgentConfig fields in the LDP documentation. Besides the AgentConfig object, we can also pass timeout and max_steps to limit the execution time and the number of steps the agent can take.
Other especialised configurations are also available but are outside the scope of this documentation.
Task Continuation
Once a task is submitted and the answer is returned, FutureHouse platform allow you to ask follow-up questions to the previous task.
It is also possible through the platform API.
To accomplish that, we can use the runtime_config we discussed in the Task submission section.
from futurehouse_client import FutureHouseClient, JobNames
client = FutureHouseClient(
api_key="your_api_key",
)
task_data = {"name": JobNames.CROW, "query": "How many species of birds are there?"}
task_id = client.create_task(task_data)
continued_task_data = {
"name": JobNames.CROW,
"query": "From the previous answer, specifically,how many species of crows are there?",
"runtime_config": {"continued_task_id": task_id},
}
continued_task_id = client.create_task(continued_task_data)
Task retrieval
Once a task is submitted, you can retrieve it by calling the get_task method, which receives a task id and returns a TaskResponse object.
from futurehouse_client import FutureHouseClient
client = FutureHouseClient(
api_key="your_api_key",
)
task_id = "task_id"
task_status = client.get_task(task_id)
task_status contains information about the task. For instance, its status, task, environment_name and agent_name, and other fields specific to the job.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file futurehouse_client-0.0.6.tar.gz.
File metadata
- Download URL: futurehouse_client-0.0.6.tar.gz
- Upload date:
- Size: 137.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79d80b516d8d6819194abd82bd93c405dc85c7cef622f6a390cdb94e5d99d481
|
|
| MD5 |
907851c0c755839a8e2a599c7166f86a
|
|
| BLAKE2b-256 |
c302af1627d7003f6194c0c513785175fb2ea0371aa7dac1e679befcd2a4fea5
|
File details
Details for the file futurehouse_client-0.0.6-py3-none-any.whl.
File metadata
- Download URL: futurehouse_client-0.0.6-py3-none-any.whl
- Upload date:
- Size: 26.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07d5aad809013bf7ec4bcf980bc493461ecb42ec08938bd84405d400b662e857
|
|
| MD5 |
ad67749d7b7ee9fb2f6183b9eb7ffff7
|
|
| BLAKE2b-256 |
4cee071e62e0cebfab92683c503b5a770a8784cb4c213e41d5197a52839dd7db
|