Skip to content

P2.4: Generate Structured & Scored Outputs #30

@Virgo-Alpha

Description

@Virgo-Alpha

This ticket focuses on transforming the agent's final output from a simple block of text into a rich, structured, and more actionable format. Instead of just a text memo, the system will generate a full JSON object that can be easily rendered into a dashboard. This includes creating a scoring mechanism to provide at-a-glance insights into a potential investment.

Implementation Tips

  • Pydantic Schemas: This is the core of the implementation. The JsonFormattingAgent will be given a Pydantic output_schema that defines the exact structure of the final report. This is the most reliable way to enforce a consistent JSON output from the LLM.
  • Dashboard Summary: In your Django models (e.g., ScanJob), create a new JSONField called summary_data. After the full report is generated, a small utility function can parse it to extract key metrics (e.g., employee count, funding amount) and save them to this summary field for quick loading on a dashboard.
  • Scoring Mechanism: Develop a simple scoring algorithm. This can be a Python function that takes the final JSON report as input. It can assign points based on certain criteria (e.g., +5 points if founders have previous exits, -10 points if financial analysis shows high burn rate). The final score can be saved to a new score field on the ScanJob model.
  • Final Report Display: Create a new template and view that can take the final JSON object and render it as a clean, easy-to-read web page or dashboard, with different sections for each key in the JSON.

Acceptance Criteria (Checklist)

  • A Pydantic model defining the full structure of the final report exists.
  • The JsonFormattingAgent is configured to use this model as its output_schema.
  • The final output from the agent workflow is a valid JSON object matching the schema.
  • A simple scoring function is created and calculates a score based on the JSON report.
  • The final score and a summary of key metrics are saved to the ScanJob database record.

Unit Tests

  • Scoring Function Test: Write unit tests for your scoring algorithm. Feed it mock JSON reports with different data points and assert that it calculates the expected score for each case.
  • Model Tests: Test that the summary_data and score fields on the ScanJob model can be saved and retrieved correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions