Damj ist ein Tool zum Erstellen umfassender Eingabeaufforderungen für Sprachmodelle, indem Projektdateien kombiniert und benutzerdefinierte Verarbeitungsoptionen angewendet werden.
damj soll Entwicklern helfen, effektive Eingabeaufforderungen für Großsprachenmodelle (LLMs) wie ChatGPT zu erstellen. Durch Kombination verschiedener Projektdateien und die Anwendung anpassbarer Verarbeitungsoptionen vereinfacht damj den Prozess der Erstellung von Eingabeaufforderungen, die auf bestimmte Projektkontexte zugeschnitten sind.
Sie können die neueste Version von PYPI installieren:
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 )Ausgabe:
# 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 bietet auch mehrere Versorgungsfunktionen, die unabhängig voneinander verwendet werden können. Diese Dienstprogramme enthalten Funktionen, um die Projektstruktur zu erhalten, Dateiinhalte zu erhalten und vieles mehr.
Die Funktion get_project_structure generiert eine Markdown -Darstellung der Verzeichnisstruktur, ausgenommen Dateien und Verzeichnisse auf schwarze Liste.
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 ) Die Funktion get_file_content ruft den Inhalt einer Datei ab und wendet die angegebenen py_options an.
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 )Dieses Projekt ist unter der Apache -Software -Lizenz lizenziert. Weitere Informationen finden Sie in der Lizenzdatei.
Basel Mather ([email protected])
Beiträge sind willkommen! Bitte geben Sie das Repository aus und öffnen Sie eine Pull -Anfrage mit Ihren Änderungen.