chore(backend): save remaining API and deployment changes

Expose frozen factual review policy, update API descriptions and Swagger settings, and adjust local deployment and embedding connectivity.

Include the requested extraction candidates and review-policy regression coverage. Validation: 31 OCR policy tests passed; staged diff whitespace checks passed.
This commit is contained in:
amirhosein mazaheri
2026-10-10 17:43:17 +03:30
parent a769196bfa
commit 21a0ea076a
18 changed files with 268 additions and 49 deletions
+24 -4
View File
@@ -75,7 +75,13 @@ def search_profile(cutoff, settings=None):
return dict(embedding=cutoff.profile, calibration_id=cutoff.calibration_id,
retrieval_policy=cutoff.retrieval_policy, distance=cutoff.distance)
@router.post('', response_model=LiveSessionResponse, status_code=201)
@router.post(
'',
response_model=LiveSessionResponse,
status_code=201,
summary='Create Realtime Voice Session',
description='Allocate a new bidirectional realtime voice session for an active conversation. Returns stream_path and poll_url.',
)
def create_voice_session(req: CreateLiveSessionRequest, response: Response,
user: Annotated[UserContext, Depends(get_current_user)],
lifecycle: Annotated[LiveLifecycleService, Depends(get_lifecycle_service)],
@@ -111,7 +117,12 @@ def create_voice_session(req: CreateLiveSessionRequest, response: Response,
response.headers['Idempotency-Replayed'] = 'true'
return result
@router.get('/by-request/{client_request_id}', response_model=LiveSessionResponse)
@router.get(
'/by-request/{client_request_id}',
response_model=LiveSessionResponse,
summary='Recover Voice Session by Request ID',
description='Idempotently look up or recover an existing voice session using the client_request_id.',
)
def recover(client_request_id: UUID, user: Annotated[UserContext, Depends(get_current_user)],
lifecycle: Annotated[LiveLifecycleService, Depends(get_lifecycle_service)]):
try:
@@ -119,7 +130,11 @@ def recover(client_request_id: UUID, user: Annotated[UserContext, Depends(get_cu
except ValueError as exc:
raise error(str(exc)) from None
@router.get('/{session_id}')
@router.get(
'/{session_id}',
summary='Poll Voice Session Status',
description='Poll current session lifecycle status, stream connection state, and expiry.',
)
def poll(session_id: UUID, user: Annotated[UserContext, Depends(get_current_user)],
lifecycle: Annotated[LiveLifecycleService, Depends(get_lifecycle_service)]):
try:
@@ -127,7 +142,12 @@ def poll(session_id: UUID, user: Annotated[UserContext, Depends(get_current_user
except ValueError as exc:
raise error(str(exc)) from None
@router.post('/{session_id}/close', response_model=CloseLiveSessionResponse)
@router.post(
'/{session_id}/close',
response_model=CloseLiveSessionResponse,
summary='Close Voice Session',
description='Explicitly close an active voice session and release provider allocations.',
)
def close(session_id: UUID, user: Annotated[UserContext, Depends(get_current_user)],
lifecycle: Annotated[LiveLifecycleService, Depends(get_lifecycle_service)],
_csrf: Annotated[None, Depends(require_csrf)] = None):