forked from 0xWheatyz/SPARC
04f4d36307
Allow users to choose the LLM model on a per-analysis basis. The model field is optional in both single and batch analysis requests, defaulting to the server-configured MODEL env var. The model used is recorded in the analysis result and database. - Add model parameter to LLMAnalyzer.analyze_patent_content and analyze_patent_portfolio - Add model field to CompanyAnalysisResult and API response - Add model field to BatchAnalysisRequest - Add GET /models endpoint listing supported models and the default - Store model in llm_messages metadata for attribution Closes leeworks-agents/SPARC#37 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
40 lines
824 B
Python
40 lines
824 B
Python
from dataclasses import dataclass, field
|
|
from datetime import datetime
|
|
|
|
|
|
@dataclass
|
|
class Patent:
|
|
patent_id: str
|
|
pdf_link: str
|
|
pdf_path: str | None = None
|
|
summary: dict | None = None
|
|
|
|
|
|
@dataclass
|
|
class Patents:
|
|
patents: list[Patent]
|
|
|
|
|
|
@dataclass
|
|
class CompanyAnalysisResult:
|
|
"""Result of analyzing a single company's patent portfolio."""
|
|
|
|
company_name: str
|
|
analysis: str
|
|
patent_count: int
|
|
success: bool
|
|
error: str | None = None
|
|
model: str | None = None
|
|
timestamp: datetime = field(default_factory=datetime.now)
|
|
|
|
|
|
@dataclass
|
|
class BatchAnalysisResult:
|
|
"""Result of batch analyzing multiple companies."""
|
|
|
|
results: list[CompanyAnalysisResult]
|
|
total_companies: int
|
|
successful: int
|
|
failed: int
|
|
timestamp: datetime = field(default_factory=datetime.now)
|