@@ -406,6 +406,7 @@ async def _search_dataset(
406406 try :
407407 search_result = await dataset_instance .search (ctx , query , search_params )
408408 except Exception as e :
409+ logger .exception (f"Dataset search failed: { e } " )
409410 raise HTTPException (
410411 status_code = 500 , detail = f"Dataset search failed: { str (e )} "
411412 ) from e
@@ -451,12 +452,16 @@ async def _chat_with_model(
451452 endpoint .model_id , endpoint .tenant_id
452453 )
453454 if not model :
455+ logger .error (
456+ f"Model not found: model_id={ endpoint .model_id } , tenant_id={ endpoint .tenant_id } "
457+ )
454458 raise HTTPException (status_code = 500 , detail = "Model not found" )
455459
456460 # Get model type
457461 try :
458462 model_type_cls = self .model_registry .get_model_type (model .dtype )
459463 except KeyError :
464+ logger .exception (f"Model type '{ model .dtype } ' not registered" )
460465 raise HTTPException (
461466 status_code = 500 , detail = f"Model type '{ model .dtype } ' not registered"
462467 ) from None
@@ -500,6 +505,7 @@ async def _chat_with_model(
500505 # Chat with the model
501506 chat_result = await model_instance .chat (ctx , messages , chat_params )
502507 except Exception as e :
508+ logger .exception (f"Model chat failed: { e } " )
503509 raise HTTPException (
504510 status_code = 500 , detail = f"Model chat failed: { str (e )} "
505511 ) from e
@@ -508,6 +514,11 @@ async def _chat_with_model(
508514 # For simplicity, take the last message
509515 last_message = chat_result .messages [- 1 ] if chat_result .messages else None
510516 if not last_message :
517+ logger .error (
518+ "Model returned no messages: "
519+ f"model_id={ endpoint .model_id } , "
520+ f"chat_result_id={ chat_result .id } "
521+ )
511522 raise HTTPException (status_code = 500 , detail = "Model returned no messages" )
512523
513524 return SummaryResponse (
@@ -550,6 +561,7 @@ async def publish_endpoint(
550561 HTTPException: If endpoint not found or marketplace repository not configured
551562 """
552563 if not self .marketplace_repository :
564+ logger .error ("Marketplace publishing is not configured" )
553565 raise HTTPException (
554566 status_code = 500 ,
555567 detail = "Marketplace publishing is not configured" ,
@@ -607,6 +619,7 @@ async def unpublish_endpoint(
607619 ) -> list [UnpublishResult ]:
608620 """Unpublish an endpoint from all its marketplaces."""
609621 if not self .marketplace_repository :
622+ logger .error ("Marketplace unpublishing is not configured" )
610623 raise HTTPException (
611624 status_code = 500 ,
612625 detail = "Marketplace publishing is not configured" ,
@@ -683,7 +696,7 @@ async def _unpublish_endpoint(
683696 error = e .message ,
684697 )
685698 except Exception as e :
686- logger .error (
699+ logger .exception (
687700 f"Failed to unpublish endpoint { endpoint .slug } from { marketplace .name } : { str (e )} "
688701 )
689702 return UnpublishResult (
@@ -798,6 +811,7 @@ async def check_slug_availability(
798811
799812 # Check marketplace availability
800813 if not self .marketplace_repository :
814+ logger .error ("Marketplace checking is not configured" )
801815 raise HTTPException (
802816 status_code = 500 ,
803817 detail = "Marketplace checking is not configured" ,
@@ -1017,7 +1031,7 @@ async def sync_endpoints_to_marketplaces(
10171031 f"Failed to sync to marketplace { marketplace_id } : { e .message } "
10181032 )
10191033 except Exception as e :
1020- logger .error (
1034+ logger .exception (
10211035 f"Unexpected error syncing to marketplace { marketplace_id } : { e } "
10221036 )
10231037
0 commit comments