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ΒΆ
Chunk of article text for processing. |
|
Structured summary of an article. |
|
Potential bias indicator in the text. |
|
Complete journalism analysis report. |
|
Individual quote extracted from an article. |
|
Complete fact-checking results for an article. |
|
Individual fact-check result for a single statement. |
|
Complete grammar and bias review results. |
|
Individual grammar or style issue. |
|
User action request for journalism tasks. |
|
Complete quote extraction results. |
|
Web search result for fact-checking. |
|
Analysis of article tone and sentiment. |
Module ContentsΒΆ
- class prebuilt.journalism_.models.ArticleChunk(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Chunk of article text for processing.
Represents a portion of the article for processing within token limits.
- Parameters:
data (Any)
- 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
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- validate_positions()ΒΆ
Ensure end position is after start position.
- Return type:
- class prebuilt.journalism_.models.ArticleSummary(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Structured summary of an article.
Provides a comprehensive summary focusing on key events, people, and statistics.
- Parameters:
data (Any)
- 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
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- class prebuilt.journalism_.models.BiasIndicator(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Potential bias indicator in the text.
Represents language or framing that may indicate bias.
- Parameters:
data (Any)
- 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
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- class prebuilt.journalism_.models.ComprehensiveReport(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Complete journalism analysis report.
Combines all analysis results into a comprehensive report.
- Parameters:
data (Any)
- 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
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- class prebuilt.journalism_.models.ExtractedQuote(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Individual quote extracted from an article.
Represents a direct quote with attribution and context.
- Parameters:
data (Any)
- 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
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- class prebuilt.journalism_.models.FactCheckResult(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Complete fact-checking results for an article.
Contains all fact-check statements and overall statistics about the verification process.
- Parameters:
data (Any)
- 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
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- calculate_statistics()ΒΆ
Calculate statistics from statements.
- Return type:
- class prebuilt.journalism_.models.FactCheckStatement(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Individual fact-check result for a single statement.
Represents the verification status of a claim or statement extracted from an article.
- Parameters:
data (Any)
- 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
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- class prebuilt.journalism_.models.GrammarBiasReview(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Complete grammar and bias review results.
Comprehensive review covering grammar issues and potential biases.
- Parameters:
data (Any)
- 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
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- class prebuilt.journalism_.models.GrammarIssue(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Individual grammar or style issue.
Represents a specific grammar, spelling, or style problem found in the text.
- Parameters:
data (Any)
- 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
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- class prebuilt.journalism_.models.JournalismAction(/, **data)ΒΆ
Bases:
pydantic.BaseModel
User action request for journalism tasks.
Represents what actions the user wants to perform on the article.
- Parameters:
data (Any)
- actionsΒΆ
List of requested actions
- priorityΒΆ
Priority level for the request
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- class prebuilt.journalism_.models.QuoteExtractionResult(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Complete quote extraction results.
Contains all extracted quotes with metadata about the extraction process.
- Parameters:
data (Any)
- 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
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- calculate_quote_stats()ΒΆ
Calculate statistics from quotes.
- Return type:
- class prebuilt.journalism_.models.SearchResult(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Web search result for fact-checking.
Represents a single search result used for verification.
- Parameters:
data (Any)
- 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
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- class prebuilt.journalism_.models.ToneAnalysis(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Analysis of article tone and sentiment.
Evaluates the overall tone, sentiment, and potential biases present in the article.
- Parameters:
data (Any)
- 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
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.