-
Notifications
You must be signed in to change notification settings - Fork 347
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 types to constants (#9)
* move defaults and typing to constants * move defaults to constants * update operator name in docstring * fix typing issues in pipeline packages * refactor pipeline
- Loading branch information
Showing
40 changed files
with
314 additions
and
257 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
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,54 @@ | ||
# -*- 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 execute python | ||
_DEFAULT_PYPI_MIRROR = "http://mirrors.aliyun.com/pypi/simple/" | ||
_DEFAULT_TRUSTED_HOST = "mirrors.aliyun.com" | ||
# 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 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
Oops, something went wrong.