# -*- coding: utf-8 -*-""" Some constants used in the project"""importosfromnumbersimportNumberfromenumimportIntEnumfrompathlibimportPathPACKAGE_NAME="agentscope"MSG_TOKEN=f"[{PACKAGE_NAME}_msg]"# default values_RUNTIME_TIMESTAMP_FORMAT="%Y-%m-%d %H:%M:%S"_RUNTIME_ID_FORMAT="run_%Y%m%d-%H%M%S_{}"# for file manager_DEFAULT_SAVE_DIR="./runs"_DEFAULT_LOG_LEVEL="INFO"_DEFAULT_SUBDIR_CODE="code"_DEFAULT_SUBDIR_FILE="file"_DEFAULT_SUBDIR_INVOKE="invoke"_DEFAULT_CACHE_DIR=str(Path(os.environ.get("AS_HOME_PATH",str(Path.home()),),)/".cache"/"agentscope",)_DEFAULT_CFG_NAME=".config"_DEFAULT_IMAGE_NAME="image_{}_{}.png"_DEFAULT_SQLITE_DB_NAME="agentscope.db"# for model wrapper_DEFAULT_MAX_RETRIES=3_DEFAULT_MESSAGES_KEY="messages"_DEFAULT_RETRY_INTERVAL=1_DEFAULT_API_BUDGET=None# for monitor_DEFAULT_TABLE_NAME_FOR_CHAT_AND_EMBEDDING="chat_and_embedding_model_monitor"_DEFAULT_TABLE_NAME_FOR_IMAGE="image_model_monitor"# for summarization_DEFAULT_SUMMARIZATION_PROMPT="""TEXT: {}"""_DEFAULT_SYSTEM_PROMPT="""You are a helpful agent to summarize the text.You need to keep all the key information of the text in the summary."""_DEFAULT_TOKEN_LIMIT_PROMPT="""Summarize the text after TEXT in less than {} tokens:"""# typingEmbedding=list[Number]# rpc# set max message size to 32 MB_DEFAULT_RPC_OPTIONS=[("grpc.max_send_message_length",32*1024*1024),("grpc.max_receive_message_length",32*1024*1024),("grpc.max_metadata_size",64*1024),]_DEFAULT_RPC_TIMEOUT=5_DEFAULT_RPC_RETRY_TIMES=10# enums
[docs]classResponseFormat(IntEnum):"""Enum for model response format."""NONE=0JSON=1
[docs]classShrinkPolicy(IntEnum):"""Enum for shrink strategies when the prompt is too long."""TRUNCATE=0SUMMARIZE=1