Remove unecessary literal_eval (#4570)

This commit is contained in:
Silvano Cerza 2023-04-06 13:30:45 +02:00 committed by GitHub
parent e0895f0ac2
commit ee7b25b8cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@ from typing import Optional, List, Union, Tuple, Dict, Iterator, Any
import logging import logging
import os import os
import ast import ast
import json
from abc import ABC from abc import ABC
from uuid import uuid4 from uuid import uuid4
@ -21,7 +22,7 @@ from haystack.schema import Document, MultiLabel
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
PROMPT_TEMPLATE_ALLOWED_FUNCTIONS = ast.literal_eval( PROMPT_TEMPLATE_ALLOWED_FUNCTIONS = json.loads(
os.environ.get(HAYSTACK_PROMPT_TEMPLATE_ALLOWED_FUNCTIONS, '["join", "to_strings", "replace", "enumerate", "str"]') os.environ.get(HAYSTACK_PROMPT_TEMPLATE_ALLOWED_FUNCTIONS, '["join", "to_strings", "replace", "enumerate", "str"]')
) )
PROMPT_TEMPLATE_SPECIAL_CHAR_ALIAS = {"new_line": "\n", "tab": "\t", "double_quote": '"', "carriage_return": "\r"} PROMPT_TEMPLATE_SPECIAL_CHAR_ALIAS = {"new_line": "\n", "tab": "\t", "double_quote": '"', "carriage_return": "\r"}