damj
1.0.0
DAMJ是通過組合項目文件和應用自定義處理選項來創建語言模型的全面提示的工具。
damj旨在幫助開發人員為大型語言模型(LLM)(例如Chatgpt)創建有效的提示。通過組合不同的項目文件並應用可自定義的處理選項, damj簡化了生成針對特定項目上下文的提示的過程。
您可以安裝PYPI的最新版本:
pip install damjgit clone https://github.com/baselhusam/damj.git
cd damj
pip install . import os
from damj import Damj
cwd = os . getcwd ()
damj = Damj ( cwd )
damj . project_info (
project_overview = "This is a sample project." ,
add_project_structure = True ,
)
prompt = damj . create_prompt (
question = "What is the purpose of this project?" ,
)
print ( prompt )輸出:
# Project Overview
This is a sample project.
# Project Structure
| ├── LICENSE
| ├── README.md
| ├── pyproject.toml
| ├── requirements.txt
├── assets/
| ├── background.png
| ├── logo.png
├── damj/
| ├── __init__.py
| ├── damj.py
| ├── utils.py
# Question
What is the purpose of this project?
import os
from damj import Damj
cwd = os . getcwd ()
damj = Damj (
cwd = cwd ,
whitelist_files = [ "*.py" ],
blacklist_files = [ ".venv" , "__pycache__" ],
snippet_marker = "```"
)
damj . project_info (
project_overview = "This is a sample project." ,
add_project_structure = True ,
add_files_content = True ,
py_options = {
"add_imports" : True ,
"add_comments" : True ,
"add_docstrings" : False ,
"ipynb_output" : False
}
)
prompt = damj . create_prompt (
question = "What is the purpose of this project?" ,
copy_to_clipboard = True ,
to_markdown = False
)
print ( prompt )Damj還提供了幾種可以獨立使用的實用程序功能。這些實用程序包括獲取項目結構,獲取文件內容等的功能。
get_project_structure函數生成目錄結構的標記表示形式,不包括黑名單的文件和目錄。
from damj . utils import get_project_structure
# Get the project structure excluding .venv and __pycache__ directories
cwd = os . getcwd ()
blacklist = [ ".venv" , "__pycache__" ]
project_structure = get_project_structure ( cwd , blacklist )
print ( project_structure )get_file_content函數檢索文件的內容,應用指定的py_options 。
from damj . utils import get_file_content
py_options = {
"add_comments" : True ,
"add_imports" : True ,
"add_docstrings" : False ,
"ipynb_output" : False
}
# Get the content of a Python file with the specified options
file_content = get_file_content ( "example.py" , py_options )
print ( file_content )該項目是根據Apache軟件許可證獲得許可的。有關詳細信息,請參見許可證文件。
巴塞爾·馬瑟(Basel Mather)([email protected])
歡迎捐款!請分配存儲庫,並通過更改打開拉動請求。