блоки 2 и 3 доработки интерфейса системы тестирования
This commit is contained in:
@@ -51,8 +51,13 @@ def chat_completion_text_content(
|
||||
user: str,
|
||||
temperature: float = 0.25,
|
||||
timeout: int = 120,
|
||||
as_json: bool = True,
|
||||
) -> str:
|
||||
"""Возвращает `assistant.message.content` (строку)."""
|
||||
"""Возвращает `assistant.message.content` (строку).
|
||||
|
||||
`as_json=True` (по умолчанию) включает `response_format: json_object`. Для свободного
|
||||
текста (например, объяснения к вопросу) передайте `as_json=False`.
|
||||
"""
|
||||
body: dict = {
|
||||
'model': cfg.model,
|
||||
'messages': [
|
||||
@@ -61,7 +66,7 @@ def chat_completion_text_content(
|
||||
],
|
||||
'temperature': temperature,
|
||||
}
|
||||
if (os.environ.get('LLM_NO_JSON') or '').strip() != '1':
|
||||
if as_json and (os.environ.get('LLM_NO_JSON') or '').strip() != '1':
|
||||
body['response_format'] = {'type': 'json_object'}
|
||||
|
||||
req = urllib.request.Request(
|
||||
|
||||
Reference in New Issue
Block a user