Spaces:
Runtime error
Runtime error
| import os | |
| import openai | |
| from typing import Dict, List, Optional | |
| from pydantic import BaseModel, Field, SecretStr | |
| from utils.summarizer import get_analyze_result | |
| from workcell.integrations.types import MarkdownMixin | |
| class Input(BaseModel): | |
| keywords: List[str] = Field(default=["backend development", "micro services", 'dev-ops', 'OKR'], max_items=20, | |
| description="List of keyword to describe your work this week.") | |
| openai_api_key: Optional[SecretStr] = Field( | |
| ..., description="OpenAI API key, provide if you have, or use our default key (may reach tier limit)." | |
| ) | |
| def generate_weekly_report(input: Input) -> MarkdownMixin: | |
| """Returns a weekly report by several keywords, generated by OpenAI GPT3 API.""" | |
| openai.api_key = os.getenv('SECRET_OPENAI_WORKCELL_WEBPAGE_QA') | |
| # return summarization | |
| text = input.keywords | |
| analyze = get_analyze_result(text) | |
| output = MarkdownMixin( | |
| data = analyze | |
| ) | |
| return output |