DAMJ هي أداة لإنشاء مطالبات شاملة لنماذج اللغة من خلال الجمع بين ملفات المشروع وتطبيق خيارات المعالجة المخصصة.
تم تصميم damj لمساعدة المطورين على إنشاء مطالبات فعالة لنماذج اللغة الكبيرة (LLMS) مثل 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. انظر ملف الترخيص للحصول على التفاصيل.
بازل ماثر ([email protected])
المساهمات مرحب بها! يرجى تورك المستودع وفتح طلب سحب مع تغييراتك.