обновлен процесс обработки данных
This commit is contained in:
@@ -4,6 +4,7 @@ import re
|
||||
from typing import Literal
|
||||
|
||||
from pydantic import Field, field_validator
|
||||
from pydantic_ai.exceptions import UnexpectedModelBehavior
|
||||
from llm.config import ConfigModel
|
||||
from .prompts import render
|
||||
from .language import validate_texts, action_text
|
||||
@@ -63,6 +64,8 @@ async def enrich(episode, config, agent, prompts):
|
||||
except Exception as exc:
|
||||
# API exceptions may contain request headers. Persist the class only.
|
||||
error = {'scenario_id': episode['scenario_id'], 'error_type': type(exc).__name__, 'attempts': attempt + 1}
|
||||
if not isinstance(exc, (ValueError, UnexpectedModelBehavior)) and attempt == config.retries:
|
||||
raise RuntimeError(f'Запрос LLM не выполнен: {type(exc).__name__}. Генерация остановлена.') from None
|
||||
if isinstance(exc, ValueError):
|
||||
prompt = render(prompts.teacher_retry, canonical({'instruction': episode['instruction'], 'scene': teacher_scene,
|
||||
'validation_error': str(exc)[:500]}))
|
||||
|
||||
Reference in New Issue
Block a user