Skip to main content

A client for interacting with endpoints of the FutureHouse service.

Project description

crow-client

A client for interacting with endpoints of the FutureHouse crow service.

Installation

uv pip install crow-client

Usage

The CrowClient provides simple functions to deploy and monitor your crow.

In the case of environments the deployment looks like this

from pathlib import Path
from crow_client import CrowClient
from crow_client.models import CrowDeploymentConfig

client = CrowClient()

crow = CrowDeploymentConfig(
    path=Path("../envs/dummy_env"),
    environment="dummy_env.env.DummyEnv",
    requires_aviary_internal=False,
    environment_variables={"SAMPLE_ENV_VAR": "sample_val"},
    agent="ldp.agent.SimpleAgent",
)

client.create_crow(crow)

# checks the status
client.get_build_status()

For functional environments we don't need to pass the file path and can pass the environment builder instead

from aviary.core import fenv
import numpy as np


def function_to_use_here(inpste: str):
    a = np.array(np.asmatrix("1 2; 3 4"))
    return inpste


@fenv.start()
def my_env(topic: str):
    """
    Here is the doc string describing the task.
    """
    a = np.array(np.asmatrix("1 2; 3 4"))
    return f"Write a sad story about {topic}", {"chosen_topic": topic}


@my_env.tool()
def print_story(story: str, state) -> None:
    """Print the story and complete the task"""
    print(story)
    print(function_to_use_here(story))
    state.reward = 1
    state.done = True


from crow_client import CrowClient
from crow_client.models import CrowDeploymentConfig, Stage
from crow_client.clients.rest_client import generate_requirements

client = CrowClient(stage=Stage.LOCAL)

crow = CrowDeploymentConfig(
    functional_environment=my_env,
    environment="my_env",
    requires_aviary_internal=False,
    environment_variables={"SAMPLE_ENV_VAR": "sample_val"},
    agent="ldp.agent.SimpleAgent",
    requirements=generate_requirements(my_env, globals()),
)

client.create_crow(crow)

This client also provides functions that let you send tasks to an existing crow:

from crow_client import CrowJob

client = CrowClient()

job_data = {"name": "your-job-name", "query": "your task"}
client.create_job(job_data)

# checks the status
client.get_job()

The CrowJobClient provides an interface for managing environment states and agent interactions in the FutureHouse crow service.

from crow_client import CrowJobClient
from crow_client.models.app import Stage

client = CrowJobClient(
    environment="your_environment_name",
    agent="your_agent_id",
    auth_token="your_auth_token",
    base_uri=Stage.DEV,
    trajectory_id=None,
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

futurehouse_client-0.0.1.tar.gz (145.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

futurehouse_client-0.0.1-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file futurehouse_client-0.0.1.tar.gz.

File metadata

  • Download URL: futurehouse_client-0.0.1.tar.gz
  • Upload date:
  • Size: 145.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.3

File hashes

Hashes for futurehouse_client-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a156689f95ca76a5a0faa6016bac91c61c158c7053d46e2720fe9aa53b350340
MD5 7311320c544f4539eef590fa36aafc02
BLAKE2b-256 757d4759908bbd7374483a0e2f1d3be9759eda33e838e45b12d6200af8b28065

See more details on using hashes here.

File details

Details for the file futurehouse_client-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for futurehouse_client-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1c49369cae516954a2475eb2919e20a1f0eca055904f5f38ee08641c251d8f93
MD5 856135a5d5a45ee736930af714a4a083
BLAKE2b-256 b477374af11a11ca5da3810a7732f87f4c7a3e442f01ee365b03a31aa42a223b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page