From 4fa0a48d880a24bcc339231e5d7b0cc7a8272370 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 6 Jul 2025 17:50:05 +0000 Subject: [PATCH] Add attachments --- docs/core/entity/ai-task.md | 60 ++++--------------------------------- 1 file changed, 6 insertions(+), 54 deletions(-) diff --git a/docs/core/entity/ai-task.md b/docs/core/entity/ai-task.md index 2ce56690..05098e4e 100644 --- a/docs/core/entity/ai-task.md +++ b/docs/core/entity/ai-task.md @@ -39,7 +39,11 @@ class MyAITaskEntity(AITaskEntity): # Use the chat_log to maintain conversation context. A common # pattern is to share an implementation between conversation and AI # task entities to process the chat log. - # await self._async_handle_chat_log(chat_log) + # await self._async_handle_chat_log( + # chat_log, + # task.structure, + # task.attachments + # ) text = ... if not task.structure: @@ -63,59 +67,7 @@ A `GenDataTask` object contains the following data: | `task_name` | `str` | Name/identifier for the task | `instructions` | `str` | Natural language instructions for the AI | `structure` | `dict` \| `None` | Optional schema for structured output validation - -## Services - -### Generate Data - -The `ai_task.generate_data` service allows users to request AI-generated content or structured data. - -#### Parameters - -| Name | Type | Required | Description -| ---- | ---- | -------- | ----------- -| `task_name` | `str` | Yes | Name/identifier for the task -| `instructions` | `str` | Yes | Natural language instructions for the AI -| `entity_id` | `str` | No | Specific AI task entity to use. Falls back to preferred entity if not specified. -| `structure` | `dict` | No | Schema for structured output validation - -#### Service Response - -```python -{ - "conversation_id": "unique_conversation_id", - "data": "generated_content_or_structured_data" -} -``` - -#### Examples - -**Basic text generation:** -```yaml -service: ai_task.generate_data -data: - task_name: "weather_summary" - instructions: "Generate a funny weather notification" - entity_id: "ai_task.my_ai_assistant" -``` - -**Structured data generation:** -```yaml -service: ai_task.generate_data -data: - task_name: "user_profile" - instructions: "Create a fake user profile" - structure: - name: - description: "Full name" - required: true - selector: - text: {} - email: - description: "Email address" - selector: - text: {} -``` +| `attachments` | `list[PlayMediaWithId]` | List of attachments to include in the task. ## Structured Output Schema