DAMJ adalah alat untuk membuat permintaan komprehensif untuk model bahasa dengan menggabungkan file proyek dan menerapkan opsi pemrosesan khusus.
damj dirancang untuk membantu pengembang membuat petunjuk yang efektif untuk model bahasa besar (LLM) seperti chatgpt. Dengan menggabungkan file proyek yang berbeda dan menerapkan opsi pemrosesan yang dapat disesuaikan, damj menyederhanakan proses menghasilkan petunjuk yang disesuaikan dengan konteks proyek tertentu.
Anda dapat menginstal rilis terbaru dari 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 )Keluaran:
# 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 juga menyediakan beberapa fungsi utilitas yang dapat digunakan secara mandiri. Utilitas ini mencakup fungsi untuk mendapatkan struktur proyek, mendapatkan konten file, dan banyak lagi.
Fungsi get_project_structure menghasilkan representasi penurunan harga dari struktur direktori, tidak termasuk file dan direktori daftar hitam.
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 ) Fungsi get_file_content mengambil konten file, menerapkan py_options yang ditentukan.
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 )Proyek ini dilisensikan di bawah lisensi perangkat lunak Apache. Lihat file lisensi untuk detailnya.
Basel Mather ([email protected])
Kontribusi dipersilakan! Harap bayar repositori dan buka permintaan tarik dengan perubahan Anda.