pdd-cli 0.0.24__py3-none-any.whl → 0.0.25__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pdd-cli might be problematic. Click here for more details.
- pdd/__init__.py +7 -1
- pdd/bug_main.py +5 -1
- pdd/bug_to_unit_test.py +16 -5
- pdd/change.py +2 -1
- pdd/change_main.py +407 -189
- pdd/cli.py +853 -301
- pdd/code_generator.py +2 -1
- pdd/conflicts_in_prompts.py +2 -1
- pdd/construct_paths.py +377 -222
- pdd/context_generator.py +2 -1
- pdd/continue_generation.py +3 -2
- pdd/crash_main.py +55 -20
- pdd/detect_change.py +2 -1
- pdd/fix_code_loop.py +465 -160
- pdd/fix_code_module_errors.py +7 -4
- pdd/fix_error_loop.py +9 -9
- pdd/fix_errors_from_unit_tests.py +207 -365
- pdd/fix_main.py +31 -4
- pdd/fix_verification_errors.py +60 -34
- pdd/fix_verification_errors_loop.py +842 -768
- pdd/fix_verification_main.py +412 -0
- pdd/generate_output_paths.py +427 -189
- pdd/generate_test.py +3 -2
- pdd/increase_tests.py +2 -2
- pdd/llm_invoke.py +14 -3
- pdd/preprocess.py +3 -3
- pdd/process_csv_change.py +466 -154
- pdd/prompts/extract_prompt_update_LLM.prompt +11 -5
- pdd/prompts/extract_unit_code_fix_LLM.prompt +2 -2
- pdd/prompts/fix_code_module_errors_LLM.prompt +29 -0
- pdd/prompts/fix_errors_from_unit_tests_LLM.prompt +5 -5
- pdd/prompts/generate_test_LLM.prompt +9 -3
- pdd/prompts/update_prompt_LLM.prompt +3 -3
- pdd/split.py +6 -5
- pdd/split_main.py +13 -4
- pdd/trace_main.py +7 -0
- pdd/xml_tagger.py +2 -1
- {pdd_cli-0.0.24.dist-info → pdd_cli-0.0.25.dist-info}/METADATA +4 -4
- {pdd_cli-0.0.24.dist-info → pdd_cli-0.0.25.dist-info}/RECORD +43 -42
- {pdd_cli-0.0.24.dist-info → pdd_cli-0.0.25.dist-info}/WHEEL +1 -1
- {pdd_cli-0.0.24.dist-info → pdd_cli-0.0.25.dist-info}/entry_points.txt +0 -0
- {pdd_cli-0.0.24.dist-info → pdd_cli-0.0.25.dist-info}/licenses/LICENSE +0 -0
- {pdd_cli-0.0.24.dist-info → pdd_cli-0.0.25.dist-info}/top_level.txt +0 -0
pdd/__init__.py
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
__version__ = "0.0.
|
|
1
|
+
__version__ = "0.0.25"
|
|
2
|
+
|
|
3
|
+
# Strength parameter used for LLM extraction across the codebase
|
|
4
|
+
# Used in postprocessing, XML tagging, code generation, and other extraction operations. The module should have a large context window and be affordable.
|
|
5
|
+
EXTRACTION_STRENGTH = 0.97
|
|
6
|
+
|
|
7
|
+
DEFAULT_STRENGTH = 0.8
|
pdd/bug_main.py
CHANGED
|
@@ -44,13 +44,17 @@ def bug_main(
|
|
|
44
44
|
"output": output,
|
|
45
45
|
"language": language
|
|
46
46
|
}
|
|
47
|
-
input_strings, output_file_paths,
|
|
47
|
+
input_strings, output_file_paths, detected_language = construct_paths(
|
|
48
48
|
input_file_paths=input_file_paths,
|
|
49
49
|
force=ctx.obj.get('force', False),
|
|
50
50
|
quiet=ctx.obj.get('quiet', False),
|
|
51
51
|
command="bug",
|
|
52
52
|
command_options=command_options
|
|
53
53
|
)
|
|
54
|
+
|
|
55
|
+
# Use the language detected by construct_paths if none was explicitly provided
|
|
56
|
+
if language is None:
|
|
57
|
+
language = detected_language
|
|
54
58
|
|
|
55
59
|
# Load input files
|
|
56
60
|
prompt_content = input_strings["prompt_file"]
|
pdd/bug_to_unit_test.py
CHANGED
|
@@ -2,6 +2,7 @@ from typing import Tuple, Optional
|
|
|
2
2
|
from rich import print
|
|
3
3
|
from rich.markdown import Markdown
|
|
4
4
|
from rich.console import Console
|
|
5
|
+
from . import EXTRACTION_STRENGTH, DEFAULT_STRENGTH
|
|
5
6
|
from .load_prompt_template import load_prompt_template
|
|
6
7
|
from .llm_invoke import llm_invoke
|
|
7
8
|
from .unfinished_prompt import unfinished_prompt
|
|
@@ -17,7 +18,7 @@ def bug_to_unit_test(
|
|
|
17
18
|
prompt_used_to_generate_the_code: str,
|
|
18
19
|
code_under_test: str,
|
|
19
20
|
program_used_to_run_code_under_test: str,
|
|
20
|
-
strength: float =
|
|
21
|
+
strength: float = DEFAULT_STRENGTH,
|
|
21
22
|
temperature: float = 0.0,
|
|
22
23
|
language: str = "python"
|
|
23
24
|
) -> Tuple[str, float, str]:
|
|
@@ -30,7 +31,7 @@ def bug_to_unit_test(
|
|
|
30
31
|
prompt_used_to_generate_the_code (str): Original prompt used to generate the code
|
|
31
32
|
code_under_test (str): Code to be tested
|
|
32
33
|
program_used_to_run_code_under_test (str): Program used to run the code
|
|
33
|
-
strength (float, optional): Strength of the LLM model. Must be between 0 and 1. Defaults to
|
|
34
|
+
strength (float, optional): Strength of the LLM model. Must be between 0 and 1. Defaults to DEFAULT_STRENGTH.
|
|
34
35
|
temperature (float, optional): Temperature of the LLM model. Defaults to 0.0.
|
|
35
36
|
language (str, optional): Programming language. Defaults to "python".
|
|
36
37
|
|
|
@@ -43,6 +44,11 @@ def bug_to_unit_test(
|
|
|
43
44
|
# Validate strength parameter
|
|
44
45
|
if not 0 <= strength <= 1:
|
|
45
46
|
raise ValueError("Strength parameter must be between 0 and 1")
|
|
47
|
+
|
|
48
|
+
# Ensure language parameter is not None or empty
|
|
49
|
+
if not language or not isinstance(language, str):
|
|
50
|
+
language = "python" # Default fallback
|
|
51
|
+
console.print("[yellow]Warning: Invalid language parameter, defaulting to 'python'[/yellow]")
|
|
46
52
|
|
|
47
53
|
total_cost = 0.0
|
|
48
54
|
final_model_name = ""
|
|
@@ -62,7 +68,7 @@ def bug_to_unit_test(
|
|
|
62
68
|
"desired_output": desired_output,
|
|
63
69
|
"code_under_test": code_under_test,
|
|
64
70
|
"program_used_to_run_code_under_test": program_used_to_run_code_under_test,
|
|
65
|
-
"language": language
|
|
71
|
+
"language": language if language and isinstance(language, str) else "python"
|
|
66
72
|
}
|
|
67
73
|
|
|
68
74
|
console.print("[bold blue]Generating unit test...[/bold blue]")
|
|
@@ -85,7 +91,7 @@ def bug_to_unit_test(
|
|
|
85
91
|
|
|
86
92
|
reasoning, is_finished, unfinished_cost, unfinished_model = unfinished_prompt(
|
|
87
93
|
prompt_text=last_600_chars,
|
|
88
|
-
strength=
|
|
94
|
+
strength=strength,
|
|
89
95
|
temperature=temperature,
|
|
90
96
|
verbose=False
|
|
91
97
|
)
|
|
@@ -108,10 +114,15 @@ def bug_to_unit_test(
|
|
|
108
114
|
result = response['result']
|
|
109
115
|
|
|
110
116
|
# Post-process the result
|
|
117
|
+
# Double-check language is valid before passing to postprocess
|
|
118
|
+
if not language or not isinstance(language, str):
|
|
119
|
+
language = "python" # Ensure language is valid
|
|
120
|
+
console.print("[yellow]Warning: Language value became invalid during processing, defaulting to 'python'[/yellow]")
|
|
121
|
+
|
|
111
122
|
final_code, postprocess_cost, postprocess_model = postprocess(
|
|
112
123
|
result,
|
|
113
124
|
language,
|
|
114
|
-
strength=
|
|
125
|
+
strength=EXTRACTION_STRENGTH,
|
|
115
126
|
temperature=temperature,
|
|
116
127
|
verbose=True
|
|
117
128
|
)
|
pdd/change.py
CHANGED
|
@@ -6,6 +6,7 @@ from pydantic import BaseModel, Field
|
|
|
6
6
|
from .preprocess import preprocess
|
|
7
7
|
from .load_prompt_template import load_prompt_template
|
|
8
8
|
from .llm_invoke import llm_invoke
|
|
9
|
+
from . import EXTRACTION_STRENGTH
|
|
9
10
|
|
|
10
11
|
console = Console()
|
|
11
12
|
|
|
@@ -86,7 +87,7 @@ def change(
|
|
|
86
87
|
extract_response = llm_invoke(
|
|
87
88
|
prompt=extract_prompt,
|
|
88
89
|
input_json={"llm_output": change_response["result"]},
|
|
89
|
-
strength=
|
|
90
|
+
strength=EXTRACTION_STRENGTH, # Fixed strength for extraction
|
|
90
91
|
temperature=temperature,
|
|
91
92
|
verbose=verbose,
|
|
92
93
|
output_pydantic=ExtractedPrompt
|