pdd-cli 0.0.38__py3-none-any.whl → 0.0.40__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.

Files changed (50) hide show
  1. pdd/__init__.py +5 -4
  2. pdd/auto_deps_main.py +14 -7
  3. pdd/auto_include.py +147 -98
  4. pdd/auto_update.py +24 -11
  5. pdd/bug_main.py +5 -2
  6. pdd/bug_to_unit_test.py +9 -2
  7. pdd/change.py +32 -22
  8. pdd/change_main.py +14 -10
  9. pdd/cli.py +11 -1
  10. pdd/cmd_test_main.py +7 -3
  11. pdd/code_generator.py +7 -1
  12. pdd/code_generator_main.py +9 -3
  13. pdd/conflicts_in_prompts.py +7 -2
  14. pdd/conflicts_main.py +6 -2
  15. pdd/context_generator.py +20 -3
  16. pdd/context_generator_main.py +2 -0
  17. pdd/continue_generation.py +8 -2
  18. pdd/crash_main.py +51 -31
  19. pdd/detect_change.py +8 -4
  20. pdd/detect_change_main.py +3 -0
  21. pdd/fix_code_loop.py +7 -2
  22. pdd/fix_code_module_errors.py +5 -2
  23. pdd/fix_error_loop.py +6 -2
  24. pdd/fix_errors_from_unit_tests.py +11 -6
  25. pdd/fix_main.py +4 -0
  26. pdd/fix_verification_errors.py +8 -3
  27. pdd/fix_verification_errors_loop.py +9 -3
  28. pdd/fix_verification_main.py +37 -31
  29. pdd/generate_test.py +10 -4
  30. pdd/get_extension.py +23 -9
  31. pdd/git_update.py +5 -3
  32. pdd/increase_tests.py +5 -2
  33. pdd/insert_includes.py +8 -2
  34. pdd/preprocess_main.py +10 -3
  35. pdd/process_csv_change.py +8 -2
  36. pdd/split.py +15 -7
  37. pdd/split_main.py +2 -0
  38. pdd/summarize_directory.py +4 -0
  39. pdd/trace.py +9 -5
  40. pdd/trace_main.py +5 -4
  41. pdd/unfinished_prompt.py +6 -1
  42. pdd/update_main.py +6 -3
  43. pdd/update_prompt.py +8 -4
  44. pdd/xml_tagger.py +10 -5
  45. {pdd_cli-0.0.38.dist-info → pdd_cli-0.0.40.dist-info}/METADATA +4 -4
  46. {pdd_cli-0.0.38.dist-info → pdd_cli-0.0.40.dist-info}/RECORD +50 -50
  47. {pdd_cli-0.0.38.dist-info → pdd_cli-0.0.40.dist-info}/WHEEL +0 -0
  48. {pdd_cli-0.0.38.dist-info → pdd_cli-0.0.40.dist-info}/entry_points.txt +0 -0
  49. {pdd_cli-0.0.38.dist-info → pdd_cli-0.0.40.dist-info}/licenses/LICENSE +0 -0
  50. {pdd_cli-0.0.38.dist-info → pdd_cli-0.0.40.dist-info}/top_level.txt +0 -0
pdd/get_extension.py CHANGED
@@ -1,10 +1,23 @@
1
- # To implement the `get_extension` function as described, we will follow the steps outlined in your request. We'll use the `pandas` library to read the CSV file, and we'll handle the environment variable for the file path. Here's how you can implement this function:
1
+ """Module to retrieve file extensions for programming languages."""
2
2
 
3
- # ```python
4
3
  import os
5
4
  import pandas as pd
6
5
 
7
- def get_extension(language):
6
+ def get_extension(language: str) -> str:
7
+ """
8
+ Retrieves the file extension for a given programming language.
9
+
10
+ Args:
11
+ language: The name of the programming language.
12
+
13
+ Returns:
14
+ The file extension (e.g., ".py") or an empty string if not found
15
+ or if the extension is invalid.
16
+
17
+ Raises:
18
+ ValueError: If the PDD_PATH environment variable is not set.
19
+ FileNotFoundError: If the language_format.csv file is not found.
20
+ """
8
21
  # Step 1: Load the environment variable PDD_PATH
9
22
  pdd_path = os.getenv('PDD_PATH')
10
23
  if not pdd_path:
@@ -18,24 +31,25 @@ def get_extension(language):
18
31
 
19
32
  # Step 3: Load the CSV file and look up the file extension
20
33
  try:
21
- df = pd.read_csv(csv_file_path)
22
- except FileNotFoundError:
23
- raise FileNotFoundError(f"The file {csv_file_path} does not exist.")
34
+ dataframe = pd.read_csv(csv_file_path)
35
+ except FileNotFoundError as exc:
36
+ raise FileNotFoundError(
37
+ f"The file {csv_file_path} does not exist."
38
+ ) from exc
24
39
 
25
40
  # Check if the language exists in the DataFrame
26
- row = df[df['language'].str.lower() == language_lower]
41
+ row = dataframe[dataframe['language'].str.lower() == language_lower]
27
42
 
28
43
  # Step 4: Return the file extension or an empty string if not found
29
44
  if not row.empty:
30
45
  extension = row['extension'].values[0]
31
46
  return extension if isinstance(extension, str) and extension else ''
32
-
47
+
33
48
  return ''
34
49
 
35
50
  # Example usage:
36
51
  # Assuming the environment variable PDD_PATH is set correctly
37
52
  # print(get_extension('Python')) # Output: .py
38
- # ```
39
53
 
40
54
  # ### Explanation of the Code:
41
55
  # 1. **Environment Variable**: We use `os.getenv` to retrieve the `PDD_PATH` environment variable. If it's not set, we raise a `ValueError`.
pdd/git_update.py CHANGED
@@ -5,7 +5,7 @@ from rich.console import Console
5
5
  from rich.panel import Panel
6
6
  from .update_prompt import update_prompt
7
7
  import git
8
-
8
+ from . import DEFAULT_TIME
9
9
  console = Console()
10
10
 
11
11
  def git_update(
@@ -13,7 +13,8 @@ def git_update(
13
13
  modified_code_file: str,
14
14
  strength: float,
15
15
  temperature: float,
16
- verbose: bool = False
16
+ verbose: bool = False,
17
+ time: float = DEFAULT_TIME
17
18
  ) -> Tuple[Optional[str], float, str]:
18
19
  """
19
20
  Read in modified code, restore the prior checked-in version from GitHub,
@@ -61,7 +62,8 @@ def git_update(
61
62
  modified_code=modified_code,
62
63
  strength=strength,
63
64
  temperature=temperature,
64
- verbose=verbose
65
+ verbose=verbose,
66
+ time=time
65
67
  )
66
68
 
67
69
  # Write back the modified code
pdd/increase_tests.py CHANGED
@@ -1,6 +1,6 @@
1
- from typing import Tuple
1
+ from typing import Tuple, Optional
2
2
  from rich.console import Console
3
- from . import EXTRACTION_STRENGTH
3
+ from . import EXTRACTION_STRENGTH, DEFAULT_TIME
4
4
  from .load_prompt_template import load_prompt_template
5
5
  from .llm_invoke import llm_invoke
6
6
  from .postprocess import postprocess
@@ -13,6 +13,7 @@ def increase_tests(
13
13
  language: str = "python",
14
14
  strength: float = 0.5,
15
15
  temperature: float = 0.0,
16
+ time: Optional[float] = DEFAULT_TIME,
16
17
  verbose: bool = False
17
18
  ) -> Tuple[str, float, str]:
18
19
  """
@@ -26,6 +27,7 @@ def increase_tests(
26
27
  language (str, optional): Programming language. Defaults to "python".
27
28
  strength (float, optional): LLM model strength. Defaults to 0.5.
28
29
  temperature (float, optional): LLM model temperature. Defaults to 0.0.
30
+ time (Optional[float]): Time allocation for the LLM. Defaults to DEFAULT_TIME.
29
31
  verbose (bool, optional): Verbose output flag. Defaults to False.
30
32
 
31
33
  Returns:
@@ -73,6 +75,7 @@ def increase_tests(
73
75
  input_json=input_json,
74
76
  strength=strength,
75
77
  temperature=temperature,
78
+ time=time,
76
79
  verbose=verbose
77
80
  )
78
81
 
pdd/insert_includes.py CHANGED
@@ -7,6 +7,7 @@ from .llm_invoke import llm_invoke
7
7
  from .load_prompt_template import load_prompt_template
8
8
  from .auto_include import auto_include
9
9
  from .preprocess import preprocess
10
+ from . import DEFAULT_TIME, DEFAULT_STRENGTH
10
11
 
11
12
  class InsertIncludesOutput(BaseModel):
12
13
  output_prompt: str = Field(description="The prompt with dependencies inserted")
@@ -15,8 +16,9 @@ def insert_includes(
15
16
  input_prompt: str,
16
17
  directory_path: str,
17
18
  csv_filename: str,
18
- strength: float,
19
- temperature: float,
19
+ strength: float = DEFAULT_STRENGTH,
20
+ temperature: float = 0.0,
21
+ time: float = DEFAULT_TIME,
20
22
  verbose: bool = False
21
23
  ) -> Tuple[str, str, float, str]:
22
24
  """
@@ -28,6 +30,7 @@ def insert_includes(
28
30
  csv_filename (str): Name of the CSV file containing dependencies
29
31
  strength (float): Strength parameter for the LLM model
30
32
  temperature (float): Temperature parameter for the LLM model
33
+ time (float): Time budget for the LLM model
31
34
  verbose (bool, optional): Whether to print detailed information. Defaults to False.
32
35
 
33
36
  Returns:
@@ -74,6 +77,7 @@ def insert_includes(
74
77
  csv_file=csv_content,
75
78
  strength=strength,
76
79
  temperature=temperature,
80
+ time=time,
77
81
  verbose=verbose
78
82
  )
79
83
 
@@ -90,6 +94,7 @@ def insert_includes(
90
94
  },
91
95
  strength=strength,
92
96
  temperature=temperature,
97
+ time=time,
93
98
  verbose=verbose,
94
99
  output_pydantic=InsertIncludesOutput
95
100
  )
@@ -135,6 +140,7 @@ def main():
135
140
  csv_filename=csv_filename,
136
141
  strength=strength,
137
142
  temperature=temperature,
143
+ time=0.25,
138
144
  verbose=True
139
145
  )
140
146
 
pdd/preprocess_main.py CHANGED
@@ -7,7 +7,7 @@ from rich import print as rprint
7
7
  from .construct_paths import construct_paths
8
8
  from .preprocess import preprocess
9
9
  from .xml_tagger import xml_tagger
10
-
10
+ from . import DEFAULT_TIME, DEFAULT_STRENGTH
11
11
  def preprocess_main(
12
12
  ctx: click.Context, prompt_file: str, output: Optional[str], xml: bool, recursive: bool, double: bool, exclude: list
13
13
  ) -> Tuple[str, float, str]:
@@ -40,10 +40,17 @@ def preprocess_main(
40
40
 
41
41
  if xml:
42
42
  # Use xml_tagger to add XML delimiters
43
- strength = ctx.obj.get("strength", 0.5)
43
+ strength = ctx.obj.get("strength", DEFAULT_STRENGTH)
44
44
  temperature = ctx.obj.get("temperature", 0.0)
45
45
  verbose = ctx.obj.get("verbose", False)
46
- xml_tagged, total_cost, model_name = xml_tagger(prompt, strength, temperature, verbose)
46
+ time = ctx.obj.get("time", DEFAULT_TIME)
47
+ xml_tagged, total_cost, model_name = xml_tagger(
48
+ prompt,
49
+ strength,
50
+ temperature,
51
+ verbose,
52
+ time=time
53
+ )
47
54
  processed_prompt = xml_tagged
48
55
  else:
49
56
  # Preprocess the prompt
pdd/process_csv_change.py CHANGED
@@ -10,6 +10,7 @@ from .get_extension import get_extension
10
10
  # Assuming EXTRACTION_STRENGTH and DEFAULT_STRENGTH might be needed later,
11
11
  # or just acknowledging their existence as per the prompt.
12
12
  # from .. import EXTRACTION_STRENGTH, DEFAULT_STRENGTH
13
+ from . import DEFAULT_TIME # Added DEFAULT_TIME
13
14
 
14
15
  # No changes needed in the code_under_test based on these specific errors.
15
16
 
@@ -69,7 +70,8 @@ def process_csv_change(
69
70
  code_directory: str,
70
71
  language: str, # Default language if not specified in prompt filename
71
72
  extension: str, # Default extension (unused if language suffix found)
72
- budget: float
73
+ budget: float,
74
+ time: float = DEFAULT_TIME # Added time parameter
73
75
  ) -> Tuple[bool, List[Dict[str, str]], float, Optional[str]]:
74
76
  """
75
77
  Reads a CSV file, processes each row to modify associated code files using an LLM,
@@ -86,6 +88,7 @@ def process_csv_change(
86
88
  extension: Default file extension (including '.') if language cannot be inferred.
87
89
  Note: This is less likely to be used if `get_extension` covers the default language.
88
90
  budget: Maximum allowed cost for all LLM operations. Must be non-negative.
91
+ time: Time budget for each LLM operation.
89
92
 
90
93
  Returns:
91
94
  A tuple containing:
@@ -296,7 +299,10 @@ def process_csv_change(
296
299
  input_code=input_code,
297
300
  change_prompt=change_instructions,
298
301
  strength=strength,
299
- temperature=temperature
302
+ temperature=temperature,
303
+ time=time, # Pass time
304
+ budget=budget - total_cost, # Pass per-row budget
305
+ quiet=True # Suppress individual change prints for CSV mode
300
306
  )
301
307
  console.print(f" [dim]Change cost:[/dim] ${cost:.6f}")
302
308
  console.print(f" [dim]Model used:[/dim] {current_model_name}")
pdd/split.py CHANGED
@@ -1,11 +1,12 @@
1
- from typing import Tuple
1
+ from typing import Tuple, Optional
2
2
  from rich import print as rprint
3
3
  from rich.markdown import Markdown
4
4
  from pydantic import BaseModel, Field
5
5
  from .load_prompt_template import load_prompt_template
6
6
  from .preprocess import preprocess
7
7
  from .llm_invoke import llm_invoke
8
- from . import EXTRACTION_STRENGTH
8
+
9
+ from . import EXTRACTION_STRENGTH, DEFAULT_STRENGTH, DEFAULT_TEMPERATURE, DEFAULT_TIME
9
10
 
10
11
  class PromptSplit(BaseModel):
11
12
  extracted_functionality: str = Field(description="The extracted functionality as a sub-module prompt")
@@ -15,10 +16,11 @@ def split(
15
16
  input_prompt: str,
16
17
  input_code: str,
17
18
  example_code: str,
18
- strength: float,
19
- temperature: float,
19
+ strength: float = DEFAULT_STRENGTH,
20
+ temperature: float = DEFAULT_TEMPERATURE,
21
+ time: Optional[float] = DEFAULT_TIME,
20
22
  verbose: bool = False
21
- ) -> Tuple[str, str, float, str]:
23
+ ) -> Tuple[Tuple[str, str], float, str]:
22
24
  """
23
25
  Split a prompt into extracted functionality and remaining prompt.
24
26
 
@@ -28,14 +30,18 @@ def split(
28
30
  example_code (str): Example code showing usage.
29
31
  strength (float): LLM strength parameter (0-1).
30
32
  temperature (float): LLM temperature parameter (0-1).
33
+ time (Optional[float]): Time allocation for the LLM.
31
34
  verbose (bool): Whether to print detailed information.
32
35
 
33
36
  Returns:
34
- Tuple[str, str, float, str]: (extracted_functionality, remaining_prompt, model_name, total_cost)
37
+ Tuple[Tuple[str, str], float, str]:
38
+ ((extracted_functionality, remaining_prompt), total_cost, model_name)
35
39
  where model_name is the name of the model used (returned as the second to last tuple element)
36
40
  and total_cost is the aggregated cost from all LLM invocations.
37
41
  """
38
42
  total_cost = 0.0
43
+ model_name = ""
44
+
39
45
 
40
46
  # Input validation
41
47
  if not all([input_prompt, input_code, example_code]):
@@ -79,6 +85,7 @@ def split(
79
85
  },
80
86
  strength=strength,
81
87
  temperature=temperature,
88
+ time=time,
82
89
  verbose=verbose
83
90
  )
84
91
  total_cost += split_response["cost"]
@@ -95,7 +102,8 @@ def split(
95
102
  strength=EXTRACTION_STRENGTH, # Fixed strength for extraction
96
103
  temperature=temperature,
97
104
  output_pydantic=PromptSplit,
98
- verbose=verbose
105
+ verbose=verbose,
106
+ time=time # Pass time to the second llm_invoke call
99
107
  )
100
108
  total_cost += extract_response["cost"]
101
109
 
pdd/split_main.py CHANGED
@@ -59,6 +59,7 @@ def split_main(
59
59
  # Get parameters from context
60
60
  strength = ctx.obj.get('strength', 0.5)
61
61
  temperature = ctx.obj.get('temperature', 0)
62
+ time = ctx.obj.get('time')
62
63
 
63
64
  # Call the split function with the standardized return pattern (result_data, cost, model_name)
64
65
  result_tuple, total_cost, model_name = split(
@@ -67,6 +68,7 @@ def split_main(
67
68
  example_code=input_strings["example_code"],
68
69
  strength=strength,
69
70
  temperature=temperature,
71
+ time=time,
70
72
  verbose=not ctx.obj.get('quiet', False)
71
73
  )
72
74
 
@@ -11,6 +11,7 @@ from rich.progress import track
11
11
 
12
12
  from .load_prompt_template import load_prompt_template
13
13
  from .llm_invoke import llm_invoke
14
+ from . import DEFAULT_TIME
14
15
 
15
16
  class FileSummary(BaseModel):
16
17
  file_summary: str = Field(description="The summary of the file")
@@ -80,6 +81,7 @@ def summarize_directory(
80
81
  strength: float,
81
82
  temperature: float,
82
83
  verbose: bool,
84
+ time: float = DEFAULT_TIME,
83
85
  csv_file: Optional[str] = None
84
86
  ) -> Tuple[str, float, str]:
85
87
  """
@@ -90,6 +92,7 @@ def summarize_directory(
90
92
  strength (float): Between 0 and 1 that is the strength of the LLM model to use.
91
93
  temperature (float): Controls the randomness of the LLM's output.
92
94
  verbose (bool): Whether to print out the details of the function.
95
+ time (float): Time budget for LLM calls.
93
96
  csv_file (Optional[str]): Current CSV file contents if it already exists.
94
97
 
95
98
  Returns:
@@ -184,6 +187,7 @@ def summarize_directory(
184
187
  input_json=input_params,
185
188
  strength=strength,
186
189
  temperature=temperature,
190
+ time=time,
187
191
  verbose=verbose,
188
192
  output_pydantic=FileSummary
189
193
  )
pdd/trace.py CHANGED
@@ -6,7 +6,7 @@ import difflib
6
6
  from .load_prompt_template import load_prompt_template
7
7
  from .preprocess import preprocess
8
8
  from .llm_invoke import llm_invoke
9
-
9
+ from . import DEFAULT_TIME, DEFAULT_STRENGTH
10
10
  console = Console()
11
11
 
12
12
  class PromptLineOutput(BaseModel):
@@ -16,9 +16,10 @@ def trace(
16
16
  code_file: str,
17
17
  code_line: int,
18
18
  prompt_file: str,
19
- strength: float = 0.5,
19
+ strength: float = DEFAULT_STRENGTH,
20
20
  temperature: float = 0,
21
- verbose: bool = False
21
+ verbose: bool = False,
22
+ time: float = DEFAULT_TIME
22
23
  ) -> Tuple[Optional[int], float, str]:
23
24
  """
24
25
  Trace a line of code back to its corresponding line in the prompt file.
@@ -30,6 +31,7 @@ def trace(
30
31
  strength (float, optional): Model strength. Defaults to 0.5
31
32
  temperature (float, optional): Model temperature. Defaults to 0
32
33
  verbose (bool, optional): Whether to print detailed information. Defaults to False
34
+ time (float, optional): Time parameter for LLM calls. Defaults to 0.25
33
35
 
34
36
  Returns:
35
37
  Tuple[Optional[int], float, str]: (prompt line number, total cost, model name)
@@ -67,7 +69,8 @@ def trace(
67
69
  },
68
70
  strength=strength,
69
71
  temperature=temperature,
70
- verbose=verbose
72
+ verbose=verbose,
73
+ time=time
71
74
  )
72
75
 
73
76
  total_cost += trace_response['cost']
@@ -89,7 +92,8 @@ def trace(
89
92
  strength=strength,
90
93
  temperature=temperature,
91
94
  verbose=verbose,
92
- output_pydantic=PromptLineOutput
95
+ output_pydantic=PromptLineOutput,
96
+ time=time
93
97
  )
94
98
 
95
99
  total_cost += extract_response['cost']
pdd/trace_main.py CHANGED
@@ -5,7 +5,7 @@ import os
5
5
  import logging
6
6
  from .construct_paths import construct_paths
7
7
  from .trace import trace
8
-
8
+ from . import DEFAULT_TIME, DEFAULT_STRENGTH
9
9
  logging.basicConfig(level=logging.WARNING)
10
10
  logger = logging.getLogger(__name__)
11
11
 
@@ -49,11 +49,12 @@ def trace_main(ctx: click.Context, prompt_file: str, code_file: str, code_line:
49
49
  logger.debug("Input files loaded")
50
50
 
51
51
  # Perform trace analysis
52
- strength = ctx.obj.get('strength', 0.5)
52
+ strength = ctx.obj.get('strength', DEFAULT_STRENGTH)
53
53
  temperature = ctx.obj.get('temperature', 0.0)
54
+ time = ctx.obj.get('time', DEFAULT_TIME)
54
55
  try:
55
56
  prompt_line, total_cost, model_name = trace(
56
- code_content, code_line, prompt_content, strength, temperature
57
+ code_content, code_line, prompt_content, strength, temperature, time=time
57
58
  )
58
59
  logger.debug(f"Trace analysis completed: prompt_line={prompt_line}, total_cost={total_cost}, model_name={model_name}")
59
60
 
@@ -90,7 +91,7 @@ def trace_main(ctx: click.Context, prompt_file: str, code_file: str, code_line:
90
91
  logger.debug(f"Results saved to {output_path}")
91
92
  except IOError as e:
92
93
  if not quiet:
93
- rprint(f"[bold red]An unexpected error occurred: {e}[/bold red]")
94
+ rprint(f"[bold red]Error saving trace results: {e}[/bold red]")
94
95
  logger.error(f"IOError while saving results: {e}")
95
96
  ctx.exit(1)
96
97
 
pdd/unfinished_prompt.py CHANGED
@@ -3,6 +3,7 @@ from pydantic import BaseModel, Field
3
3
  from rich import print as rprint
4
4
  from .load_prompt_template import load_prompt_template
5
5
  from .llm_invoke import llm_invoke
6
+ from . import DEFAULT_STRENGTH, DEFAULT_TIME
6
7
 
7
8
  class PromptAnalysis(BaseModel):
8
9
  reasoning: str = Field(description="Structured reasoning for the completeness assessment")
@@ -10,8 +11,9 @@ class PromptAnalysis(BaseModel):
10
11
 
11
12
  def unfinished_prompt(
12
13
  prompt_text: str,
13
- strength: float = 0.5,
14
+ strength: float = DEFAULT_STRENGTH,
14
15
  temperature: float = 0,
16
+ time: float = DEFAULT_TIME,
15
17
  verbose: bool = False
16
18
  ) -> Tuple[str, bool, float, str]:
17
19
  """
@@ -21,6 +23,7 @@ def unfinished_prompt(
21
23
  prompt_text (str): The prompt text to analyze
22
24
  strength (float, optional): Strength of the LLM model. Defaults to 0.5.
23
25
  temperature (float, optional): Temperature of the LLM model. Defaults to 0.
26
+ time (float, optional): Time budget for LLM calls. Defaults to DEFAULT_TIME.
24
27
  verbose (bool, optional): Whether to print detailed information. Defaults to False.
25
28
 
26
29
  Returns:
@@ -70,6 +73,7 @@ def unfinished_prompt(
70
73
  input_json=input_json,
71
74
  strength=strength,
72
75
  temperature=temperature,
76
+ time=time,
73
77
  verbose=verbose,
74
78
  output_pydantic=PromptAnalysis
75
79
  )
@@ -103,6 +107,7 @@ if __name__ == "__main__":
103
107
  try:
104
108
  reasoning, is_finished, cost, model = unfinished_prompt(
105
109
  prompt_text=sample_prompt,
110
+ time=DEFAULT_TIME,
106
111
  verbose=True
107
112
  )
108
113
  rprint("\n[blue]Results:[/blue]")
pdd/update_main.py CHANGED
@@ -6,7 +6,7 @@ from rich import print as rprint
6
6
  from .construct_paths import construct_paths
7
7
  from .update_prompt import update_prompt
8
8
  from .git_update import git_update
9
-
9
+ from . import DEFAULT_TIME
10
10
  def update_main(
11
11
  ctx: click.Context,
12
12
  input_prompt_file: str,
@@ -49,6 +49,7 @@ def update_main(
49
49
  input_prompt = input_strings["input_prompt_file"]
50
50
  modified_code = input_strings["modified_code_file"]
51
51
  input_code = input_strings.get("input_code_file")
52
+ time = ctx.obj.get('time', DEFAULT_TIME)
52
53
 
53
54
  # Update prompt using appropriate method
54
55
  if git:
@@ -59,7 +60,8 @@ def update_main(
59
60
  modified_code_file=modified_code_file,
60
61
  strength=ctx.obj.get("strength", 0.5),
61
62
  temperature=ctx.obj.get("temperature", 0),
62
- verbose=ctx.obj.get("verbose", False)
63
+ verbose=ctx.obj.get("verbose", False),
64
+ time=time
63
65
  )
64
66
  else:
65
67
  if input_code is None:
@@ -70,7 +72,8 @@ def update_main(
70
72
  modified_code=modified_code,
71
73
  strength=ctx.obj.get("strength", 0.5),
72
74
  temperature=ctx.obj.get("temperature", 0),
73
- verbose=ctx.obj.get("verbose", False)
75
+ verbose=ctx.obj.get("verbose", False),
76
+ time=time
74
77
  )
75
78
 
76
79
  # Save the modified prompt
pdd/update_prompt.py CHANGED
@@ -5,7 +5,7 @@ from pydantic import BaseModel, Field
5
5
  from .load_prompt_template import load_prompt_template
6
6
  from .preprocess import preprocess
7
7
  from .llm_invoke import llm_invoke
8
-
8
+ from . import DEFAULT_TIME
9
9
  class PromptUpdate(BaseModel):
10
10
  modified_prompt: str = Field(description="The updated prompt that will generate the modified code")
11
11
 
@@ -15,7 +15,8 @@ def update_prompt(
15
15
  modified_code: str,
16
16
  strength: float,
17
17
  temperature: float,
18
- verbose: bool = False
18
+ verbose: bool = False,
19
+ time: float = DEFAULT_TIME
19
20
  ) -> Tuple[str, float, str]:
20
21
  """
21
22
  Update a prompt based on the original and modified code.
@@ -27,6 +28,7 @@ def update_prompt(
27
28
  strength (float): The strength parameter for the LLM model (0-1)
28
29
  temperature (float): The temperature parameter for the LLM model (0-1)
29
30
  verbose (bool, optional): Whether to print detailed output. Defaults to False.
31
+ time (float, optional): The time parameter for the LLM model. Defaults to 0.25.
30
32
 
31
33
  Returns:
32
34
  Tuple[str, float, str]: (modified_prompt, total_cost, model_name)
@@ -68,7 +70,8 @@ def update_prompt(
68
70
  },
69
71
  strength=strength,
70
72
  temperature=temperature,
71
- verbose=verbose
73
+ verbose=verbose,
74
+ time=time
72
75
  )
73
76
 
74
77
  if not first_response or not isinstance(first_response, dict) or 'result' not in first_response:
@@ -84,7 +87,8 @@ def update_prompt(
84
87
  strength=0.5,
85
88
  temperature=temperature,
86
89
  output_pydantic=PromptUpdate,
87
- verbose=verbose
90
+ verbose=verbose,
91
+ time=time
88
92
  )
89
93
 
90
94
  if not second_response or not isinstance(second_response, dict) or 'result' not in second_response:
pdd/xml_tagger.py CHANGED
@@ -5,7 +5,7 @@ from pydantic import BaseModel, Field
5
5
  from .load_prompt_template import load_prompt_template
6
6
  from .llm_invoke import llm_invoke
7
7
  from . import EXTRACTION_STRENGTH
8
-
8
+ from . import DEFAULT_TIME
9
9
  class XMLOutput(BaseModel):
10
10
  xml_tagged: str = Field(description="The XML-tagged version of the prompt")
11
11
 
@@ -13,7 +13,8 @@ def xml_tagger(
13
13
  raw_prompt: str,
14
14
  strength: float,
15
15
  temperature: float,
16
- verbose: bool = False
16
+ verbose: bool = False,
17
+ time: float = DEFAULT_TIME
17
18
  ) -> Tuple[str, float, str]:
18
19
  """
19
20
  Enhance a given LLM prompt by adding XML tags to improve its structure and readability.
@@ -23,6 +24,7 @@ def xml_tagger(
23
24
  strength (float): The strength parameter for the LLM model (0-1)
24
25
  temperature (float): The temperature parameter for the LLM model (0-1)
25
26
  verbose (bool): Whether to print detailed information
27
+ time (float): The time allocation for the LLM calls
26
28
 
27
29
  Returns:
28
30
  Tuple[str, float, str]: (xml_tagged, total_cost, model_name)
@@ -55,7 +57,8 @@ def xml_tagger(
55
57
  input_json={"raw_prompt": raw_prompt},
56
58
  strength=strength,
57
59
  temperature=temperature,
58
- verbose=verbose
60
+ verbose=verbose,
61
+ time=time
59
62
  )
60
63
 
61
64
  xml_generated_analysis = conversion_response.get('result', '')
@@ -76,7 +79,8 @@ def xml_tagger(
76
79
  strength=EXTRACTION_STRENGTH, # Fixed strength for extraction
77
80
  temperature=temperature,
78
81
  verbose=verbose,
79
- output_pydantic=XMLOutput
82
+ output_pydantic=XMLOutput,
83
+ time=time
80
84
  )
81
85
 
82
86
  result: XMLOutput = extraction_response.get('result')
@@ -109,7 +113,8 @@ def main():
109
113
  raw_prompt=sample_prompt,
110
114
  strength=0.7,
111
115
  temperature=0.8,
112
- verbose=True
116
+ verbose=True,
117
+ time=0.5
113
118
  )
114
119
 
115
120
  rprint("[blue]XML Tagging Complete[/blue]")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pdd-cli
3
- Version: 0.0.38
3
+ Version: 0.0.40
4
4
  Summary: PDD (Prompt-Driven Development) Command Line Interface
5
5
  Author: Greg Tanaka
6
6
  Author-email: glt@alumni.caltech.edu
@@ -35,18 +35,18 @@ Requires-Dist: litellm
35
35
  Requires-Dist: rich==14.0.0
36
36
  Requires-Dist: semver==3.0.2
37
37
  Requires-Dist: setuptools
38
+ Requires-Dist: pytest
38
39
  Requires-Dist: boto3==1.35.99
39
40
  Requires-Dist: python-Levenshtein
40
41
  Provides-Extra: dev
41
42
  Requires-Dist: commitizen; extra == "dev"
42
- Requires-Dist: pytest; extra == "dev"
43
43
  Requires-Dist: pytest-cov; extra == "dev"
44
44
  Requires-Dist: pytest-mock; extra == "dev"
45
45
  Requires-Dist: pytest-asyncio; extra == "dev"
46
46
  Requires-Dist: z3-solver; extra == "dev"
47
47
  Dynamic: license-file
48
48
 
49
- .. image:: https://img.shields.io/badge/pdd--cli-v0.0.38-blue
49
+ .. image:: https://img.shields.io/badge/pdd--cli-v0.0.40-blue
50
50
  :alt: PDD-CLI Version
51
51
 
52
52
  .. image:: https://img.shields.io/badge/Discord-join%20chat-7289DA.svg?logo=discord&logoColor=white&link=https://discord.gg/Yp4RTh8bG7
@@ -134,7 +134,7 @@ After installation, verify:
134
134
 
135
135
  pdd --version
136
136
 
137
- You'll see the current PDD version (e.g., 0.0.38).
137
+ You'll see the current PDD version (e.g., 0.0.40).
138
138
 
139
139
  Advanced Installation Tips
140
140
  --------------------------