Skip to content

Goal Agent

Goal

Given a context, create a goal

User story

I want to automatically extract and infer goals from text, so that I can quickly understand the main objectives

Variations

  • Create a metric driven product or business goal
  • Create a list of n goals with a quantitative metric

Example

Input

I have lots of youtube podcasts I want to watch. But I don't have the time to do so. Would be great if I can just put in a url or video id and get back a summary with all the main points. Saves me so much time.

Output

Simple Goal : Develop a tool to summarize YouTube podcasts

Complex Goal : Develop a tool to summarize YouTube podcasts with 90% accuracy in 6 months

List of Simple Goals (min_length = 3) :

  1. Develop a video summary system
  2. Allow input of URLs or video IDs
  3. Generate summaries of major points from videos

List of Complex Goals (min_length = 5) :

  1. Develop a tool that achieves 80% accuracy in summarizing YouTube podcast videos.
  2. Create a system that generates summaries for YouTube podcasts in under 5 minutes.
  3. Implement a feature to support URL and video ID input methods for YouTube podcast summaries.
  4. Enhance the interface to be more user-friendly, aiming for 90% user satisfaction.
  5. Integrate a notification system to alert users within 1 minute when their podcast summary is ready.

Code

Simple Goal
class SimpleGoal(BaseModel):
    """Given a context, extract and generate a concise and straightforward main goal based on a specified action and target."""

    action: str = Field(...,
                        description="The decisive action to be executed, using strong and directive verbs")
    target: str = Field(...,
                        description="The specific item or resource on which the action is to be performed, described in simple language.")
    goal: Annotated[str, StringConstraints(max_length=50)] = Field(...,
                                                                   description="A concise, imperative sentence that combines the action and the target into a clear, understandable main goal.")

Complex goal

class ComplexGoal(BaseModel):
    """Extract and articulate a specific, measurable business or product goal from a given context,
    integrating quantitative and qualitative aspects with a clear timeframe."""

    verb: str = Field(..., description="A clear, singular action.")
    quantitative_metric: str = Field(..., description="The numerical part of the goal, expressed as either a number or a percentage.",
                                      examples=["20%", "30 minutes", "90%", "5 additional metropolitan areas", "3-5"])
    qualitative_metric: str = Field(..., description="A concise description of what the goal targets, without the numeric component.",
                                     examples=["increase the number of bookings", "reduce average wait time for pickups",
                                               "achieve a customer satisfaction rate", "expand service",
                                               "increase recycling rate of collected rubbish"])
    focus: str = Field(..., description="A concise, well-defined area of impact.")
    timeframe: str = Field(None, description="A specific, achievable deadline, optional.")
    goal: Annotated[str, StringConstraints(max_length=100)] = Field(..., description="A succinct, declarative sentence that integrates the verb, quantitative and qualitative metrics, focus, and timeframe, ensuring to include a specific number or percentage.")

    @field_validator('quantitative_metric')
    @classmethod
    def check_quantitative_metric(cls, value):
        # Check if the value is numerical or includes a percentage; this is a simple check and may need more sophisticated validation depending on requirements.
        if not any(char.isdigit() for char in value):
            raise ValueError("Quantitative metric must include a numeric value or percentage.")
        return value

List of goals

# list of simple goals

class SimpleGoals(BaseModel):
    """Given a context, extract and infer a list of goals"""

    goals: list[SimpleGoal]

# n length list of simple goals

class SimpleGoals(BaseModel):
    """Given a context, extract and infer a {min_length} list of goals"""

    goals: conlist(SimpleGoal, min_length=5) # type: ignore

# list of complex goals

class ComplexGoals(BaseModel):
    """Given a context, extract and infer a list of goals"""

    goals: list[ComplexGoal]

# n length list of complex goals

class ComplexGoals(BaseModel):
    """Given a context, extract and infer a {min_length} list of goals"""

    goals: conlist(ComplexGoal, min_length=5) # type: ignore