A client for interacting with endpoints of the FutureHouse service.
Project description
FutureHouse Platform API Documentation
Documentation and tutorials for crow-client, a client for interacting with endpoints of the FutureHouse crow service.
FutureHouse's mascot is the crow. Therefore, some objects are named after the crow as a homage.
- Installation
- Quickstart
- Functionalities
- Authentication
- Job submission
- Job Continuation
- Job retrieval
Installation
uv pip install crow-client
Quickstart
from crow_client import CrowClient, JobNames
from pathlib import Path
from aviary.core import DummyEnv
import ldp
client = CrowClient(
stage=Stage.DEV,
auth_type=AuthType.API_KEY,
api_key="your_api_key",
)
job_data = {
"name": JobNames.CROW,
"query": "Has anyone tested therapeutic exerkines in humans or NHPs?",
}
job_run_id = client.create_job(job_data)
job_status = client.get_job(job_run_id)
A quickstart example can be found in the crow_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
Crow-client implements a RestClient (called CrowClient) with the following functionalities:
- Authentication:
auth_client - Job submission:
create_job(JobRequest) - Job status:
get_job(job_id)
To create a CrowClient, you need to pass the following parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
| stage | Stage | Stage.DEV | Where the job will be submitted? |
| organization | str | None | None | Which organization to use? |
| auth_type | AuthType | AuthType.API_KEY | Which authentication method to use? |
| api_key | str | None | None | The API key to use for authentication, if using auth_type=AuthType.API_KEY. |
To instantiate a Client, we can use the following code:
from crow_client import CrowClient
from crow_client.models import Stage, AuthType
client = CrowClient(
stage=Stage.DEV,
organization="your_organization",
auth_type=AuthType.API_KEY,
api_key="your_api_key",
)
Stages
The stage is where your job will be submitted. This parameter can be one of the following:
| Name | Description |
|---|---|
| Stage.DEV | Development environment at https://dev.api.platform.futurehouse.org |
| Stage.PROD | Production environment at https://api.platform.futurehouse.org |
Authentication
In order to use the CrowClient, 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.
Job submission
CrowClient can be used to submit jobs to the FutureHouse platform. Using a CrowClient instance, you can submit jobs to the platform by calling the create_job method, which receives a JobRequest (or a dictionary with kwargs) and returns the job id.
Aiming to make the submission of jobs as simple as possible, we have created a JobNames enum that contains the available job 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 job submission looks like this:
from crow_client import CrowClient, JobNames
from crow_client.models import AuthType, Stage
client = CrowClient(
stage=Stage.DEV,
auth_type=AuthType.API_KEY,
api_key="your_api_key",
)
job_data = {
"name": JobNames.CROW,
"query": "Has anyone tested therapeutic exerkines in humans or NHPs?",
}
job_id = client.create_job(job_data)
JobRequest 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.
Job Continuation
Once a job is submitted and the answer is returned, FutureHouse platform allow you to ask follow-up questions to the previous job.
It is also possible through the platform API.
To accomplish that, we can use the runtime_config we discussed in the Job submission section.
from crow_client import CrowClient, JobNames
from crow_client.models import AuthType, Stage
client = CrowClient(
stage=Stage.DEV,
auth_type=AuthType.API_KEY,
api_key="your_api_key",
)
job_data = {"name": JobNames.CROW, "query": "How many species of birds are there?"}
job_id = client.create_job(job_data)
continued_job_data = {
"name": JobNames.CROW,
"query": "From the previous answer, specifically,how many species of crows are there?",
"runtime_config": {"continued_job_id": job_id},
}
continued_job_id = client.create_job(continued_job_data)
Job retrieval
Once a job is submitted, you can retrieve it by calling the get_job method, which receives a job id and returns a JobResponse object.
from crow_client import CrowClient
from crow_client.models import AuthType
client = CrowClient(
auth_type=AuthType.API_KEY,
api_key="your_api_key",
)
job_id = "job_id"
job_status = client.get_job(job_id)
job_status contains information about the job. 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.2.tar.gz.
File metadata
- Download URL: futurehouse_client-0.0.2.tar.gz
- Upload date:
- Size: 134.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cf08aaf0d73f45d983482f4fdef93752a41dc994c7f8a9628e1cf82f7b190eb
|
|
| MD5 |
3846062ee9c75a790ecefe2571cf5d7c
|
|
| BLAKE2b-256 |
a68ebacdba47c4297933b678120c4d8a05b31bf3ae2ddfde2e1a0afc94b1d23a
|
File details
Details for the file futurehouse_client-0.0.2-py3-none-any.whl.
File metadata
- Download URL: futurehouse_client-0.0.2-py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
493d3ce52485db56e2b44e51f7d7395efe5c0e0ef0a4998b7463e6945e6ef909
|
|
| MD5 |
b3d476a2146bdd196c759dcfcfd5cd95
|
|
| BLAKE2b-256 |
9a265178cc3b3441483b713ed398ad90bc64c4632d4a12bb0a2f9f1bb7d46cb0
|