Skip to content

Commit

Permalink
Improve spelling
Browse files Browse the repository at this point in the history
  • Loading branch information
allenporter committed Aug 3, 2024
1 parent f4045af commit f05bfa5
Show file tree
Hide file tree
Showing 23 changed files with 94 additions and 72 deletions.
4 changes: 2 additions & 2 deletions datasets/anomaly/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Anomolies
## Anomalies

This dataset is used for classifying area summaries as anomolies vs classifying
This dataset is used for classifying area summaries as anomalies vs classifying
as operating normally
4 changes: 2 additions & 2 deletions datasets/assist-mini/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Mini Evaluation dataset for Home Assistant assist actions

This is a variation on the `assist` dataset that tests far fewer entites, devices,
This is a variation on the `assist` dataset that tests far fewer entities, devices,
and areas at once. This is designed given poor performance of local models on the
`assist` baseline to help with even smaller tasks to get right.

This is a dataset for the Home Assistant LLM API ([blog post](https://developers.home-assistant.io/blog/2024/05/20/llm-api/)).

See the `home-assistant-datasets assist` command for more details on how to
run evalations.
run evaluations.

See [../assist/README.md](../assist/README.md) for details on how the dataset
is configured including the inventory fixtures, and the eval tasks.
4 changes: 2 additions & 2 deletions datasets/assist-mini/home1-us-vacuum/vacuum.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
category: vacuum
tests:
- sentences:
- Start vaccuum in the living room
- Start vacuum in the living room
- Start Roborock Downstairs vacuum
setup:
vacuum.roborock_downstairs:
Expand All @@ -12,7 +12,7 @@ tests:
state: cleaning
- sentences:
- Return Roborock Downstairs to base
- Return vaccuum in the living room to base
- Return vacuum in the living room to base
setup:
vacuum.roborock_downstairs:
state: cleaning
Expand Down
7 changes: 4 additions & 3 deletions datasets/assist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This is a dataset for the Home Assistant LLM API ([blog post](https://developers.home-assistant.io/blog/2024/05/20/llm-api/)).

See the `home-assistant-datasets assist` command for more details on how to
run evalations.
run evaluations.

## Dataset details

Expand Down Expand Up @@ -116,13 +116,14 @@ $ pip3 install -e /workspaces/core
```

You will need the [synthetic-home custom component](https://github.com/allenporter/synthetic-home)
and you can either install it in a separate direcotry like this:
and you can either install it in a separate directory like this:

```bash
$ export PYTHONPATH="${PYTHONPATH}:/workspaces/home-assistant-synthetic-home/"
```

Or using a `custom_components` directory in the local directory if you have multiple
custom components you wnat to evaluate:
custom components you want to evaluate:

```bash
$ export PYTHONPATH="${PYTHONPATH}:${PWD}"
Expand Down
2 changes: 1 addition & 1 deletion datasets/intents/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This is a dataset for the Home Assistant LLM API ([blog post](https://developers.home-assistant.io/blog/2024/05/20/llm-api/)) imported from the home assistant intents repo.

See the `home-assistant-datasets assist` command for more details on how to
run evalations.
run evaluations.

## Dataset details

Expand Down
15 changes: 8 additions & 7 deletions generation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
This directory contains notebooks and seeds for generating the datasets.

The phases of generating data are currently:

- Generate a description of a Home ([notebook](homes.ipynb))
- Generate the Areas of the Home useful for automation ([notebook](areas.ipynb))
- Generate the devices in each area ([notebook](devices.ipynb))
Expand All @@ -20,17 +21,17 @@ The data is generated in a format that can be consumed by https://github.com/all

The next phase needed is to generate useful state data for triggering those actions.

### Notebook Development enviroment
### Notebook Development environment

This is an example of how to prepare the python venv for use with the jupyet notebooks:

1. Create the virtual environment

```bash
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install --upgrade pip
$ pip3 install -r requirements_dev.txt
```
```bash
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install --upgrade pip
$ pip3 install -r requirements_dev.txt
```

1. Open the notebook and select the venv interpreter and kernel
8 changes: 4 additions & 4 deletions generation/archive/area-summary.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
"which will be fed as input into other agents. The user will feed in details about\n",
"areas and devices in the home, and you will respond with a summary of the status of the area.\n",
"\n",
"Your summaries are succint, and do not mention boring details or things that seem\n",
"Your summaries are succinct, and do not mention boring details or things that seem\n",
"very mundane or minor. A one sentence summary is best.\n",
"\n",
"\n",
Expand Down Expand Up @@ -240,7 +240,7 @@
" if unit_of_measurement := attributes.get('unit_of_measurement'):\n",
" state_value = f\"{state_value} {unit_of_measurement}\"\n",
"\n",
" data.append(f\" {friendly_name} ({entity_name}): {state_value}\") \n",
" data.append(f\" {friendly_name} ({entity_name}): {state_value}\")\n",
" return data\n",
"\n",
"for area in home.areas:\n",
Expand Down Expand Up @@ -283,7 +283,7 @@
"source": [
"OVERALL_PROMPT = f\"\"\"\n",
"You are an agent running in Home Assistant that is the overall house summary\n",
"agent. Other agents have summarized invidivual areas, and you are responsible\n",
"agent. Other agents have summarized individual areas, and you are responsible\n",
"for picking out the important details, ignoring the mundane. You write succinct,\n",
"1 sentence summaries of the entire house that can be displayed on a dashboard.\n",
"You don't need to comment on every area, and can omit any that are mundane.\n",
Expand Down Expand Up @@ -323,7 +323,7 @@
"- Attic: The attic temperature is high.\n",
"- Front Door The front door is being used and the porch is dimmed.\n",
"\n",
"Summary: \n",
"Summary:\n",
"\"\"\"\n",
"\n",
"response = model.complete(OVERALL_PROMPT, message)\n",
Expand Down
6 changes: 3 additions & 3 deletions generation/devices.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
"- Balcony\n",
"\n",
"Output:\n",
"# thought: I will genearate a set of devices commonly found in a New York City Apartment\n",
"# thought: I will generate a set of devices commonly found in a New York City Apartment\n",
"# thought: Given the compact nature of the living space, the devices may focus on essential functionalities and convenience for the resident\n",
"Living Room:\n",
"- name: Lamp\n",
Expand Down Expand Up @@ -310,15 +310,15 @@
"You are an expert in smart home automation and are generating data used to\n",
"evaluate the performance of a smart home system Home Assistant on tasks like\n",
"summarization, performing actions, or being an independent agent managing\n",
"automations and maintenace tasks.\n",
"automations and maintenance tasks.\n",
"\n",
"You use your knowledge about the world to generate details about homes that\n",
"can be used for synthetic smart home automation data. For example, an apartment\n",
"may have a smart thermostat, a house may have a smart garage door opener or\n",
"smart lock and camera, and all houses may have a smart light or weather feed\n",
"air quality, or a smart speaker or television. The needs of a home owner\n",
"may vary if they are a single person or family, or where in the world they\n",
"live. For example, a high rise aparment probably does not have a backyard.\n",
"live. For example, a high rise apartment probably does not have a backyard.\n",
"\n",
"Do not be cliche. Do not assume everyone has a smart watch. Don't assume\n",
"every room has a smart light just because it is listed, but of course many will.\n",
Expand Down
34 changes: 17 additions & 17 deletions generation/seeds/devices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
home:
name: Coastal Bungalow
thoughts:
- The bungalow in a seaside village may be a vacation home or a tranquil retreat.
- The cozy living room with a fireplace hints at a cozy atmosphere, and there may
be smart climate control for comfort.
- The outdoor shower is convenient for beach days, so there may be smart water heating
systems.
- The bungalow in a seaside village may be a vacation home or a tranquil retreat.
- The cozy living room with a fireplace hints at a cozy atmosphere, and there may
be smart climate control for comfort.
- The outdoor shower is convenient for beach days, so there may be smart water heating
systems.
desc: Bungalow in a seaside village in Norway
areas:
- Living Room
Expand All @@ -20,7 +20,7 @@ devices:
- name: Living Room
device_type: light-dimmable
device_info:
model: Enbrighten Z-Wave
model: Enbrighten Z-Wave
manufacturer: GE
sw_version: 2.3.29-7
- name: Thermostat
Expand All @@ -42,7 +42,7 @@ devices:
- name: Port light
device_type: light
device_info:
model: Enbrighten Z-Wave
model: Enbrighten Z-Wave
manufacturer: GE
sw_version: 2.3.29-7
Outdoor Shower:
Expand All @@ -57,17 +57,17 @@ devices:
home:
name: Home2
thoughts:
- The apartment with city views may cater to a single person or a couple.
- The shared rooftop terrace could have restrictions on device installations.
- In-unit laundry suggests convenience, so there may be a smart washer and dryer.
- The apartment with city views may cater to a single person or a couple.
- The shared rooftop terrace could have restrictions on device installations.
- In-unit laundry suggests convenience, so there may be a smart washer and dryer.
desc: Apartment in urban area in New York City, USA
areas:
- Living Room
- Kitchen
- Bedroom
- Balcony
devices-thoughts:
- I will genearate a set of devices commonly found in a New York City Apartment
- I will generate a set of devices commonly found in a New York City Apartment
- Given the compact nature of the living space, the devices may focus on essential functionalities and convenience for the resident
devices:
Living Room:
Expand Down Expand Up @@ -113,12 +113,12 @@ devices:
home:
name: Loft Industrial
thoughts:
- The industrial loft with an open space and high ceilings may have a modern and
minimalist design.
- The panoramic windows offer plenty of natural light, ideal for a smart lighting
system.
- The rooftop terrace could be a great spot for outdoor entertainment, so there
may be smart speakers or a sound system.
- The industrial loft with an open space and high ceilings may have a modern and
minimalist design.
- The panoramic windows offer plenty of natural light, ideal for a smart lighting
system.
- The rooftop terrace could be a great spot for outdoor entertainment, so there
may be smart speakers or a sound system.
desc: Industrial loft in Barcelona, Spain
areas:
- Living Space
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ response: anomaly
uuid: 1e4a7577-5d18-4dc5-b292-92ac333efa93
task_id: d23ea7aac86432d2b3137e86965178ff96336f895742bdfa6dc627f67073dde5-anomaly
task:
text: The smart plugs connected to the refridgerator is currently off.
text: The smart plugs connected to the refrigerator is currently off.
label: anomaly
response: anomaly
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
uuid: 1845a3d9-359e-4043-bbde-593687853c79
task_id: d23ea7aac86432d2b3137e86965178ff96336f895742bdfa6dc627f67073dde5-anomaly
task:
text: The smart plugs connected to the refridgerator is currently off.
text: The smart plugs connected to the refrigerator is currently off.
label: anomaly
response: anomaly
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ response: normal
uuid: eb56c6db-7127-491c-aa9c-eafc23e830e4
task_id: d23ea7aac86432d2b3137e86965178ff96336f895742bdfa6dc627f67073dde5-anomaly
task:
text: The smart plugs connected to the refridgerator is currently off.
text: The smart plugs connected to the refrigerator is currently off.
label: anomaly
response: anomaly
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ response: normal
uuid: 383a566a-f7d6-4694-976c-9a0717432ed2
task_id: d23ea7aac86432d2b3137e86965178ff96336f895742bdfa6dc627f67073dde5-anomaly
task:
text: The smart plugs connected to the refridgerator is currently off.
text: The smart plugs connected to the refrigerator is currently off.
label: anomaly
response: anomaly
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ response: normal
uuid: 5e37847c-31ab-4de2-85c3-1ae45c2b2dbe
task_id: d23ea7aac86432d2b3137e86965178ff96336f895742bdfa6dc627f67073dde5-anomaly
task:
text: The smart plugs connected to the refridgerator is currently off.
text: The smart plugs connected to the refrigerator is currently off.
label: anomaly
response: normal
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ response: anomaly
uuid: 70a75c30-e7c6-4a9b-b5a5-a0c78afa9b22
task_id: d23ea7aac86432d2b3137e86965178ff96336f895742bdfa6dc627f67073dde5-anomaly
task:
text: The smart plugs connected to the refridgerator is currently off.
text: The smart plugs connected to the refrigerator is currently off.
label: anomaly
response: anomaly
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
],
)
def model_id_fixture(request: pytest.FixtureRequest) -> str:
"""Fiture that defines which model is being evaluated."""
"""Fixture that defines which model is being evaluated."""
return request.param


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


AREA_SUMMARY_PROMPT = """
Please summarize the status of an area of the home. Your summaries are succint,
Please summarize the status of an area of the home. Your summaries are succinct,
and do not mention boring details or things that seem very mundane or minor. A
one sentence summary is best.
Expand Down Expand Up @@ -52,7 +52,6 @@
"""



def make_prompt(area_name: str) -> str:
"""Create a prompt for the agent to summarize the area."""
return AREA_PROMPT.format(
Expand Down Expand Up @@ -81,25 +80,32 @@ async def async_process(self, hass: HomeAssistant, text: str) -> str:
return response["speech"]["plain"]["speech"]



async def async_run_eval(hass: HomeAssistant, config: dict[str, Any]) -> None:
"""Run the evaluation."""

eval_dir = pathlib.Path(config["eval_dir"])
os.makedirs(eval_dir, exist_ok=True)

# Find the conversation agent id to evaluate based on the domain in the config file
config_entry_ids = [ entry.entry_id for entry in hass.config_entries.async_entries() if entry.domain in config["conversation_agent_domain"] ]
config_entry_ids = [
entry.entry_id
for entry in hass.config_entries.async_entries()
if entry.domain in config["conversation_agent_domain"]
]
if len(config_entry_ids) > 1:
raise ValueError("Found more than one config entry for domain {config['convesation_agent_domain']}")
raise ValueError(
"Found more than one config entry for domain {config['convesation_agent_domain']}"
)
if not config_entry_ids:
raise ValueError("Found no config entry for domain {config['convesation_agent_domain']}")
raise ValueError(
"Found no config entry for domain {config['convesation_agent_domain']}"
)
conversation_agent_id = config_entry_ids[0]

agent = ConversationAgent(conversation_agent_id)

area_registry = ar.async_get(hass)
area_names = [ area.name for area in area_registry.async_list_areas() ]
area_names = [area.name for area in area_registry.async_list_areas()]

_LOGGER.info("Loaded %s areas to evaluate", len(area_names))

Expand Down
Loading

0 comments on commit f05bfa5

Please sign in to comment.