Skip to content

Conversation

@stefanorosanelli
Copy link
Contributor

@stefanorosanelli stefanorosanelli commented Jul 2, 2025

This PR introduces a new /jobs endpoint to list and filter asynchronous jobs

  • Added JobsFilter, get_jobs, and get_jobs_query for filtering and paginating async jobs in brevia/async_jobs.py.
  • Introduced date_filter in brevia/utilities/dates.py and refactored chat‐history code to use it.
  • Exposed the /jobs listing endpoint in brevia/routers/jobs_router.py and added comprehensive tests in tests/test_async_jobs.py and tests/routers/test_jobs_router.py

@stefanorosanelli stefanorosanelli changed the title Feat/new jobs endpoint Add new /jobs endpoint Jul 2, 2025
@stefanorosanelli stefanorosanelli requested a review from Copilot July 2, 2025 08:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new /jobs endpoint to list and filter asynchronous jobs, adds shared date‐filtering utilities, and expands test coverage for both the jobs API and underlying get_jobs logic.

  • Added JobsFilter, get_jobs, and get_jobs_query for filtering and paginating async jobs in brevia/async_jobs.py.
  • Introduced date_filter in brevia/utilities/dates.py and refactored chat‐history code to use it.
  • Exposed the /jobs listing endpoint in brevia/routers/jobs_router.py and added comprehensive tests in tests/test_async_jobs.py and tests/routers/test_jobs_router.py.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/test_async_jobs.py Added tests for get_jobs covering filters and pagination
tests/routers/test_jobs_router.py Added API tests for the new /jobs endpoint
brevia/utilities/dates.py New date_filter utility for parsing min/max dates
brevia/routers/jobs_router.py Registered /jobs route with dependency and filtering
brevia/chat_history.py Removed duplicate date logic and now uses date_filter
brevia/async_jobs.py Implemented JobsFilter, get_jobs, and query builder
Comments suppressed due to low confidence (2)

brevia/utilities/dates.py:14

  • The docstring line "If None 'min' is i" seems incomplete or contains a typo. Consider rephrasing to: "If no type_str is provided, 'min' is used by default."
            Valid values are 'max' or 'min'. If None 'min' is i

brevia/async_jobs.py:82

  • SQLAlchemy uses the isnot() method rather than is_not(). This line will fail at runtime—change it to AsyncJobsStore.completed.isnot(None).
            AsyncJobsStore.completed.is_not(None)

@stefanorosanelli stefanorosanelli marked this pull request as ready for review July 2, 2025 08:41
@BuonDavide BuonDavide merged commit ba6d4d4 into brevia-ai:main Jul 3, 2025
12 checks passed
@BuonDavide BuonDavide deleted the feat/new-jobs-endpoint branch July 3, 2025 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants