File size: 995 Bytes
4e09d45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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=["name: weanalyze", "MIT", 'computer science', 'google'], max_items=20, 
                                description="List of keyword to describe your education or work experience.")
    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_resume(input: Input) -> MarkdownMixin:
    """Returns a resume 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