prebuilt.journalism_.modelsΒΆ

Models for the Journalism AI Assistant.

This module defines all Pydantic models used by the journalism assistant for structured outputs, validation, and data handling throughout the fact-checking, analysis, and review workflows.

Examples

>>> from journalism_assistant.models import FactCheckStatement, ArticleSummary
>>> fact_check = FactCheckStatement(
...     statement="The economy grew by 3%",
...     status="confirmed",
...     explanation="Verified by official statistics"
... )

Note

All models use Pydantic v2 with comprehensive field descriptions for documentation and validation.

ClassesΒΆ

ArticleChunk

Chunk of article text for processing.

ArticleSummary

Structured summary of an article.

BiasIndicator

Potential bias indicator in the text.

ComprehensiveReport

Complete journalism analysis report.

ExtractedQuote

Individual quote extracted from an article.

FactCheckResult

Complete fact-checking results for an article.

FactCheckStatement

Individual fact-check result for a single statement.

GrammarBiasReview

Complete grammar and bias review results.

GrammarIssue

Individual grammar or style issue.

JournalismAction

User action request for journalism tasks.

QuoteExtractionResult

Complete quote extraction results.

SearchResult

Web search result for fact-checking.

ToneAnalysis

Analysis of article tone and sentiment.

Module ContentsΒΆ

class prebuilt.journalism_.models.ArticleChunk(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

Chunk of article text for processing.

Represents a portion of the article for processing within token limits.

chunk_idΒΆ

Unique identifier for the chunk

textΒΆ

The actual text content

start_positionΒΆ

Starting character position

end_positionΒΆ

Ending character position

word_countΒΆ

Number of words in chunk

validate_positions() ArticleChunkΒΆ

Ensure end position is after start position.

chunk_id: int = NoneΒΆ
end_position: int = NoneΒΆ
start_position: int = NoneΒΆ
text: str = NoneΒΆ
word_count: int = NoneΒΆ
class prebuilt.journalism_.models.ArticleSummary(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

Structured summary of an article.

Provides a comprehensive summary focusing on key events, people, and statistics.

main_pointsΒΆ

List of main points from the article

key_peopleΒΆ

Important people mentioned

key_statisticsΒΆ

Important numbers and data

word_countΒΆ

Original article word count

summary_textΒΆ

Complete summary in paragraph form

key_people: List[str] = NoneΒΆ
key_statistics: List[str] = NoneΒΆ
main_points: List[str] = NoneΒΆ
summary_text: str = NoneΒΆ
word_count: int = NoneΒΆ
class prebuilt.journalism_.models.BiasIndicator(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

Potential bias indicator in the text.

Represents language or framing that may indicate bias.

bias_typeΒΆ

Type of bias detected

example_textΒΆ

Text showing the bias

explanationΒΆ

Why this indicates bias

severityΒΆ

How severe the bias is

suggestionΒΆ

How to make it more neutral

bias_type: Literal['political', 'cultural', 'gender', 'racial', 'economic', 'confirmation', 'selection', 'framing'] = NoneΒΆ
example_text: str = NoneΒΆ
explanation: str = NoneΒΆ
severity: Literal['subtle', 'moderate', 'strong'] = NoneΒΆ
suggestion: str | None = NoneΒΆ
class prebuilt.journalism_.models.ComprehensiveReport(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

Complete journalism analysis report.

Combines all analysis results into a comprehensive report.

article_titleΒΆ

Title of the analyzed article

analysis_timestampΒΆ

When the analysis was performed

summaryΒΆ

Article summary

fact_check_resultsΒΆ

Fact-checking results

tone_analysisΒΆ

Tone and sentiment analysis

quotesΒΆ

Extracted quotes

grammar_bias_reviewΒΆ

Grammar and bias review

overall_assessmentΒΆ

Overall article assessment

recommendationsΒΆ

Recommendations for the article

to_markdown() strΒΆ

Convert report to markdown format.

Returns:

Formatted markdown report

Return type:

str

analysis_timestamp: datetime.datetime = NoneΒΆ
article_title: str | None = NoneΒΆ
fact_check_results: FactCheckResult | None = NoneΒΆ
grammar_bias_review: GrammarBiasReview | None = NoneΒΆ
overall_assessment: str = NoneΒΆ
quotes: QuoteExtractionResult | None = NoneΒΆ
recommendations: List[str] = NoneΒΆ
summary: ArticleSummary | None = NoneΒΆ
tone_analysis: ToneAnalysis | None = NoneΒΆ
class prebuilt.journalism_.models.ExtractedQuote(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

Individual quote extracted from an article.

Represents a direct quote with attribution and context.

quote_textΒΆ

The exact quoted text

speakerΒΆ

Person who said the quote

contextΒΆ

Context or situation of the quote

positionΒΆ

Position/title of the speaker if mentioned

significanceΒΆ

Why this quote is important

context: str = NoneΒΆ
position: str | None = NoneΒΆ
quote_text: str = NoneΒΆ
significance: str | None = NoneΒΆ
speaker: str = NoneΒΆ
class prebuilt.journalism_.models.FactCheckResult(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

Complete fact-checking results for an article.

Contains all fact-check statements and overall statistics about the verification process.

statementsΒΆ

List of individual fact-check results

total_claimsΒΆ

Total number of claims analyzed

confirmed_countΒΆ

Number of confirmed claims

refuted_countΒΆ

Number of refuted claims

unverifiable_countΒΆ

Number of unverifiable claims

vague_countΒΆ

Number of vague claims

overall_credibilityΒΆ

Overall credibility score

calculate_statistics() FactCheckResultΒΆ

Calculate statistics from statements.

confirmed_count: int = NoneΒΆ
overall_credibility: confloat(ge=0.0, le=1.0) = NoneΒΆ
refuted_count: int = NoneΒΆ
statements: List[FactCheckStatement] = NoneΒΆ
total_claims: int = NoneΒΆ
unverifiable_count: int = NoneΒΆ
vague_count: int = NoneΒΆ
class prebuilt.journalism_.models.FactCheckStatement(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

Individual fact-check result for a single statement.

Represents the verification status of a claim or statement extracted from an article.

statementΒΆ

The original claim being fact-checked

statusΒΆ

Verification status (confirmed/refuted/unverifiable/vague)

explanationΒΆ

Detailed explanation of the verification result

suggested_keywordsΒΆ

Keywords for further research if needed

confidenceΒΆ

Confidence score in the fact-check result

sourcesΒΆ

Supporting sources used for verification

classmethod validate_keywords(v: List[str]) List[str]ΒΆ

Ensure keywords are unique and non-empty.

confidence: confloat(ge=0.0, le=1.0) = NoneΒΆ
explanation: str = NoneΒΆ
sources: List[Dict[str, str]] = NoneΒΆ
statement: str = NoneΒΆ
status: Literal['confirmed', 'refuted', 'unverifiable', 'vague'] = NoneΒΆ
suggested_keywords: List[str] = NoneΒΆ
class prebuilt.journalism_.models.GrammarBiasReview(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

Complete grammar and bias review results.

Comprehensive review covering grammar issues and potential biases.

grammar_issuesΒΆ

List of grammar/style issues found

bias_indicatorsΒΆ

List of potential biases detected

overall_quality_scoreΒΆ

Overall writing quality score

readability_scoreΒΆ

Readability score

bias_scoreΒΆ

Overall bias score

recommendationsΒΆ

General recommendations for improvement

bias_indicators: List[BiasIndicator] = NoneΒΆ
bias_score: confloat(ge=0.0, le=1.0) = NoneΒΆ
grammar_issues: List[GrammarIssue] = NoneΒΆ
overall_quality_score: confloat(ge=0.0, le=1.0) = NoneΒΆ
readability_score: confloat(ge=0.0, le=1.0) = NoneΒΆ
recommendations: List[str] = NoneΒΆ
class prebuilt.journalism_.models.GrammarIssue(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

Individual grammar or style issue.

Represents a specific grammar, spelling, or style problem found in the text.

issue_typeΒΆ

Type of issue found

textΒΆ

The problematic text

suggestionΒΆ

Suggested correction

severityΒΆ

Severity level of the issue

locationΒΆ

Approximate location in the text

issue_type: Literal['grammar', 'spelling', 'punctuation', 'style', 'clarity'] = NoneΒΆ
location: str | None = NoneΒΆ
severity: Literal['minor', 'moderate', 'major'] = NoneΒΆ
suggestion: str = NoneΒΆ
text: str = NoneΒΆ
class prebuilt.journalism_.models.JournalismAction(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

User action request for journalism tasks.

Represents what actions the user wants to perform on the article.

actionsΒΆ

List of requested actions

priorityΒΆ

Priority level for the request

actions: List[Literal['summarization', 'fact-checking', 'tone-analysis', 'quote-extraction', 'grammar-and-bias-review', 'full-report', 'no-action-required', 'invalid']] = NoneΒΆ
priority: Literal['low', 'medium', 'high'] = NoneΒΆ
class prebuilt.journalism_.models.QuoteExtractionResult(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

Complete quote extraction results.

Contains all extracted quotes with metadata about the extraction process.

quotesΒΆ

List of extracted quotes

total_quotesΒΆ

Total number of quotes found

unique_speakersΒΆ

Number of unique speakers

has_attributionΒΆ

Whether all quotes have proper attribution

calculate_quote_stats() QuoteExtractionResultΒΆ

Calculate statistics from quotes.

has_attribution: bool = NoneΒΆ
quotes: List[ExtractedQuote] = NoneΒΆ
total_quotes: int = NoneΒΆ
unique_speakers: int = NoneΒΆ
class prebuilt.journalism_.models.SearchResult(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

Web search result for fact-checking.

Represents a single search result used for verification.

titleΒΆ

Title of the search result

urlΒΆ

URL of the source

snippetΒΆ

Brief excerpt from the page

relevance_scoreΒΆ

How relevant this result is

credibility_scoreΒΆ

Source credibility score

credibility_score: confloat(ge=0.0, le=1.0) | None = NoneΒΆ
relevance_score: confloat(ge=0.0, le=1.0) = NoneΒΆ
snippet: str = NoneΒΆ
title: str = NoneΒΆ
url: str = NoneΒΆ
class prebuilt.journalism_.models.ToneAnalysis(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

Analysis of article tone and sentiment.

Evaluates the overall tone, sentiment, and potential biases present in the article.

overall_toneΒΆ

Primary tone of the article

sentiment_scoreΒΆ

Sentiment score (-1 to 1)

tone_examplesΒΆ

Specific examples supporting the analysis

detected_biasesΒΆ

List of potential biases found

objectivity_scoreΒΆ

Score for journalistic objectivity

detected_biases: List[str] = NoneΒΆ
objectivity_score: confloat(ge=0.0, le=1.0) = NoneΒΆ
overall_tone: Literal['neutral', 'positive', 'negative', 'critical', 'opinionated', 'balanced'] = NoneΒΆ
sentiment_score: confloat(ge=-1.0, le=1.0) = NoneΒΆ
tone_examples: List[Dict[str, str]] = NoneΒΆ