redcodegen 0.0.2__tar.gz → 0.0.3__tar.gz

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 redcodegen might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: redcodegen
3
- Version: 0.0.2
3
+ Version: 0.0.3
4
4
  Summary: Add your description here
5
5
  Requires-Dist: click>=8.0.0
6
6
  Requires-Dist: cwe2>=3.0.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "redcodegen"
3
- version = "0.0.2"
3
+ version = "0.0.3"
4
4
  description = "Add your description here"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -11,7 +11,7 @@ CWE_TOP_25 = [
11
11
  798, 190, 400, 306
12
12
  ]
13
13
 
14
- def create_lm(model_name="openai/gpt-4o-mini", api_key=None):
14
+ def create_lm(model_name="openai/gpt-4o-mini", temperature=0.8, api_key=None):
15
15
  """Create a DSPy language model instance.
16
16
 
17
17
  Args:
@@ -23,7 +23,12 @@ def create_lm(model_name="openai/gpt-4o-mini", api_key=None):
23
23
  """
24
24
  if api_key is None:
25
25
  api_key = os.environ.get("OPENAI_API_KEY")
26
- return dspy.LM(model_name, api_key=api_key)
26
+ return dspy.LM(
27
+ model_name,
28
+ api_key=api_key,
29
+ temperature=temperature,
30
+ max_tokens=16000
31
+ )
27
32
 
28
33
  SCENARIO_EXAMPLES = [
29
34
  dspy.Example(
@@ -0,0 +1,2 @@
1
+
2
+ m
@@ -155,7 +155,13 @@ def append_to_jsonl(record: Dict[str, Any], output_path: Path):
155
155
  default=None,
156
156
  help='API key (defaults to OPENAI_API_KEY env var)'
157
157
  )
158
- def main(cwes, use_top_25, min_samples, output, model, api_key):
158
+ @click.option(
159
+ '--temperature',
160
+ default=0.8,
161
+ type=float,
162
+ help='Temperature for code generation (default: 0.8)'
163
+ )
164
+ def main(cwes, use_top_25, min_samples, output, model, api_key, temperature):
159
165
  """Generate and evaluate vulnerable code samples for specified CWEs.
160
166
 
161
167
  Examples:
@@ -166,7 +172,7 @@ def main(cwes, use_top_25, min_samples, output, model, api_key):
166
172
  python -m redcodegen --use-top-25 --model openai/gpt-4o # switch model
167
173
  """
168
174
  # Configure DSPy with specified model
169
- lm = create_lm(model_name=model, api_key=api_key)
175
+ lm = create_lm(model_name=model, temperature=temperature, api_key=api_key)
170
176
  dspy.configure(lm=lm)
171
177
  logger.info(f"Configured model: {model}")
172
178
 
@@ -1,17 +0,0 @@
1
- import dspy
2
- import jsonlines
3
- from cwe2.database import Database
4
-
5
- from redcodegen.constants import LM
6
-
7
- dspy.configure(lm=LM)
8
-
9
-
10
- db = Database()
11
- entry = db.get(502)
12
-
13
- print(entry.name)
14
- print(entry.extended_description)
15
-
16
-
17
-
File without changes