Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
jinyang628 committed May 5, 2024
1 parent aaed04a commit 9cf833c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion app/process/examiner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from app.config import InferenceConfig
from app.control.post.examiner import post_process
from app.exceptions.exception import LogicError
from app.exceptions.exception import InferenceFailure, LogicError
from app.llm.base import LLMBaseModel
from app.llm.model import LLM, LLMType
from app.models.task import Task
Expand Down Expand Up @@ -111,6 +111,9 @@ async def examine(self, topic: str, summary_chunk: str) -> tuple[str, str, str,
except LogicError as e:
log.error(f"Logic error occurred while generating practices off the summary: {e}")
raise e
except InferenceFailure as e:
log.error(f"Inference failure occurred while generating practices off the summary: {e}")
raise e
except Exception as e:
log.error(f"Unexpected error occurred while generating practices off the summary: {e}")
raise e
4 changes: 4 additions & 0 deletions app/scripts/practice.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ async def _generate(
log.error(
f"Logic error occurred while generating practice (attempt {attempt}/{max_attempts}): {e}"
)
except InferenceFailure as e:
log.error(
f"Inference failure occurred while generating practice (attempt {attempt}/{max_attempts}): {e}"
)

if attempt < max_attempts:
log.info(f"Retrying practice generation for topic: {topic}...")
Expand Down
3 changes: 1 addition & 2 deletions app/scripts/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
async def generate_summary(
conversations: Union[dict[str, Any] | list[Conversation]],
attempt: int = 1,
max_attempts: int = 1,
# max_attempts: int = 9,
max_attempts: int = 9,
token_sum: int = 0,
) -> tuple[dict[str, str], int]:
"""Returns the summary in topic-content key-value pairs and the total token sum of the conversation for usage tracking in stomach.
Expand Down

0 comments on commit 9cf833c

Please sign in to comment.