Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions batchata/core/job_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class JobResult:
raw_response: Optional[str] = None # Raw text response (None for failed jobs)
parsed_response: Optional[Union[BaseModel, Dict]] = None # Structured output or error dict
citations: Optional[List[Citation]] = None # Extracted citations
citation_mappings: Optional[Dict[str, List[Citation]]] = None # Field -> citations mapping
citation_mappings: Optional[Dict[str, List[Citation]]] = None # Field -> citation mappings with confidence
input_tokens: int = 0
output_tokens: int = 0
cost_usd: float = 0.0
Expand Down Expand Up @@ -62,11 +62,13 @@ def to_dict(self) -> Dict[str, Any]:
if self.citation_mappings:
citation_mappings = {
field: [{
'text': c.text,
'source': c.source,
'page': c.page,
'metadata': c.metadata
} for c in citations]
'text': citation.text,
'source': citation.source,
'page': citation.page,
'metadata': citation.metadata,
'confidence': citation.confidence,
'match_reason': citation.match_reason
} for citation in citations]
for field, citations in self.citation_mappings.items()
}

Expand All @@ -78,7 +80,9 @@ def to_dict(self) -> Dict[str, Any]:
'text': c.text,
'source': c.source,
'page': c.page,
'metadata': c.metadata
'metadata': c.metadata,
'confidence': c.confidence,
'match_reason': c.match_reason
} for c in self.citations] if self.citations else None,
"citation_mappings": citation_mappings,
"input_tokens": self.input_tokens,
Expand Down
Loading
Loading