From 5494b6f8020d7f6e7abab8b63cb21d65ff534107 Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 7 Nov 2025 12:35:47 -0400 Subject: [PATCH] Fix ContentVariantTool to implement required SimpleTool abstract methods - Add get_tool_fields() stub method (required by SimpleTool ABC) - Add prepare_prompt() implementation using chat-style prompt - Tool now successfully instantiates and can be registered - All 4 tools (chat, contentvariant, listmodels, version) working --- tools/contentvariant.py | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/tools/contentvariant.py b/tools/contentvariant.py index 92e5fd8..3cdd122 100644 --- a/tools/contentvariant.py +++ b/tools/contentvariant.py @@ -72,8 +72,22 @@ class ContentVariantTool(SimpleTool): def get_request_model(self): return ContentVariantRequest - def format_request_for_model(self, request: ContentVariantRequest) -> dict: - """Format the content variant request for the AI model""" + def get_tool_fields(self) -> dict: + """ + Tool-specific field definitions for ContentVariant. + + Note: This method isn't used since we override get_input_schema(), + but it's required by the SimpleTool abstract base class. + """ + return { + "content": { + "type": "string", + "description": "Base content or topic to create variations from", + } + } + + async def prepare_prompt(self, request: ContentVariantRequest) -> str: + """Prepare the content variant prompt""" prompt_parts = [f"Generate {request.variation_count} variations of this content:"] prompt_parts.append(f"\n**Base Content:**\n{request.content}") @@ -94,18 +108,9 @@ class ContentVariantTool(SimpleTool): "testing angles, and predicted audience responses." ) - formatted_request = { - "prompt": "\n".join(prompt_parts), - "files": request.files or [], - "images": request.images or [], - "continuation_id": request.continuation_id, - "model": request.model, - "temperature": request.temperature, - "thinking_mode": request.thinking_mode, - "use_websearch": request.use_websearch, - } - - return formatted_request + # Use SimpleTool's chat-style prompt preparation + request.prompt = "\n".join(prompt_parts) + return self.prepare_chat_style_prompt(request) def get_input_schema(self) -> dict: """Return the JSON schema for this tool's input"""