mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-11 03:38:38 +00:00
feat(lens): add list summaries and an incremental review filter
This commit is contained in:
parent
183d07c73e
commit
a8a5d41644
1 changed files with 19 additions and 0 deletions
|
|
@ -12,6 +12,7 @@ from litellm.proxy.lens.models import (
|
|||
Lens,
|
||||
LensSettings,
|
||||
Review,
|
||||
Sample,
|
||||
Scope,
|
||||
Step,
|
||||
Worker,
|
||||
|
|
@ -198,3 +199,21 @@ def snapshot_finding(lens: Lens, draft: FindingDraft, revision: int, now: dateti
|
|||
}
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def without_attributes(sample: Sample) -> Sample:
|
||||
executions: Final = tuple(e.model_copy(update=MappingProxyType({"metadata": ()})) for e in sample.executions)
|
||||
return sample.model_copy(update=MappingProxyType({"executions": executions}))
|
||||
|
||||
|
||||
def summarized_job(job: Job) -> Job:
|
||||
sample: Final = without_attributes(job.sample) if job.sample else None
|
||||
return job.model_copy(update=MappingProxyType({"reviews": (), "sample": sample}))
|
||||
|
||||
|
||||
def summarized(lens: Lens) -> Lens:
|
||||
return lens.model_copy(update=MappingProxyType({"jobs": tuple(summarized_job(job) for job in lens.jobs)}))
|
||||
|
||||
|
||||
def reviews_after(job: Job, after: datetime | None) -> tuple[Review, ...]:
|
||||
return job.reviews if after is None else tuple(r for r in job.reviews if r.at > after)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue