-
Notifications
You must be signed in to change notification settings - Fork 363
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move defaults and typings to constants
- Loading branch information
Showing
33 changed files
with
141 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,65 @@ | ||
# -*- coding: utf-8 -*- | ||
""" Some constants used in the project""" | ||
from numbers import Number | ||
from enum import IntEnum | ||
|
||
PACKAGE_NAME = "agentscope" | ||
MSG_TOKEN = f"<{PACKAGE_NAME}_msg>" | ||
|
||
|
||
# default values | ||
|
||
# for file manager | ||
_DEFAULT_DIR = "./runs" | ||
_DEFAULT_LOG_LEVEL = "INFO" | ||
_DEFAULT_SUBDIR_CODE = "code" | ||
_DEFAULT_SUBDIR_FILE = "file" | ||
_DEFAULT_SUBDIR_INVOKE = "invoke" | ||
_DEFAULT_IMAGE_NAME = "image_{}_{}.png" | ||
# for model wrapper | ||
_DEFAULT_MAX_RETRIES = 3 | ||
_DEFAULT_MESSAGES_KEY = "inputs" | ||
_DEFAULT_RETRY_INTERVAL = 1 | ||
# 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: | ||
""" | ||
|
||
# typing | ||
Embedding = list[Number] | ||
|
||
|
||
# enums | ||
class ResponseFormat(IntEnum): | ||
"""Enum for model response format.""" | ||
|
||
NONE = 0 | ||
JSON = 1 | ||
|
||
|
||
class ServiceExecStatus(IntEnum): | ||
"""Enum for service execution status.""" | ||
|
||
SUCCESS = 1 | ||
ERROR = -1 | ||
|
||
|
||
class PromptType(IntEnum): | ||
"""Enum for prompt types.""" | ||
|
||
STRING = 0 | ||
LIST = 1 | ||
|
||
|
||
class ShrinkPolicy(IntEnum): | ||
"""Enum for shrink strategies when the prompt is too long.""" | ||
|
||
TRUNCATE = 0 | ||
SUMMARIZE = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.