import os import openai from typing import Dict, List from pydantic import BaseModel, Field from utils.summarizer import get_analyze_result from utils.extractor import get_html_text from workcell.integrations.types import MarkdownMixin class Input(BaseModel): url: str = Field(default="https://openai.com/blog/introducing-chatgpt-and-whisper-apis", description="An url string which you want to analyze automatically.") def analyze_url(input: Input) -> MarkdownMixin: """Returns a thought provoking discussion questions from url provided, generated by OpenAI GPT3 API.""" openai.api_key = os.getenv('SECRET_OPENAI_WORKCELL_WEBPAGE_QA') # return summarization text = get_html_text(input.url) markdown = get_analyze_result(text) output = MarkdownMixin( data=markdown ) return output