|
18 | 18 | from .pydantic_models import DocumentSummaryResponse |
19 | 19 | from .pydantic_models import ProjectSummaryResponse |
20 | 20 | from .pydantic_models import SummaryItem |
| 21 | +from .sentry_tags import set_sentry_project_tags |
21 | 22 | from .utils import extract_text_from_document |
22 | 23 |
|
23 | 24 | logger = logging.getLogger(__name__) |
@@ -78,6 +79,7 @@ def project_summarize( |
78 | 79 | - If allow_regeneration is False and a summary exists, always return the latest summary |
79 | 80 | without generating a new one, even when the hash changed. |
80 | 81 | """ |
| 82 | + set_sentry_project_tags(project) |
81 | 83 | request = SummaryRequest(text=text, prompt=prompt) |
82 | 84 | latest = self._get_latest_summary(project) |
83 | 85 | text_hash = ProjectSummary.compute_hash(text) |
@@ -185,16 +187,24 @@ def _save_to_cache( |
185 | 187 | logger.info(f"Cached summary for project {project.id}") |
186 | 188 |
|
187 | 189 | def request_vision_dict( |
188 | | - self, documents_dict: dict[str, str], prompt: str | None = None |
| 190 | + self, |
| 191 | + documents_dict: dict[str, str], |
| 192 | + prompt: str | None = None, |
| 193 | + project=None, |
189 | 194 | ) -> DocumentSummaryResponse: |
190 | 195 | """Process documents from dictionary format.""" |
191 | 196 | items = [DocumentInputItem(handle=h, url=u) for h, u in documents_dict.items()] |
192 | | - return self.request_vision(items, prompt) |
| 197 | + return self.request_vision(items, prompt, project=project) |
193 | 198 |
|
194 | 199 | def request_vision( |
195 | | - self, documents: list[DocumentInputItem], prompt: str | None = None |
| 200 | + self, |
| 201 | + documents: list[DocumentInputItem], |
| 202 | + prompt: str | None = None, |
| 203 | + project=None, |
196 | 204 | ) -> DocumentSummaryResponse: |
197 | 205 | """Process documents and images, return combined summaries.""" |
| 206 | + if project is not None: |
| 207 | + set_sentry_project_tags(project) |
198 | 208 | docs, images = self._split_documents(documents) |
199 | 209 |
|
200 | 210 | results = [] |
|
0 commit comments