gptdiff 0.1.6__tar.gz → 0.1.8__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: gptdiff
3
- Version: 0.1.6
3
+ Version: 0.1.8
4
4
  Summary: A tool to generate and apply git diffs using LLMs
5
5
  Author: 255labs
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -10,7 +10,7 @@ Description-Content-Type: text/markdown
10
10
  License-File: LICENSE.txt
11
11
  Requires-Dist: openai>=1.0.0
12
12
  Requires-Dist: tiktoken>=0.5.0
13
- Requires-Dist: ai_agent_toolbox>=0.1.9
13
+ Requires-Dist: ai_agent_toolbox>=0.1.11
14
14
  Provides-Extra: test
15
15
  Requires-Dist: pytest; extra == "test"
16
16
  Requires-Dist: pytest-mock; extra == "test"
@@ -165,7 +165,7 @@ def load_prepend_file(file):
165
165
  return f.read()
166
166
 
167
167
  # Function to call GPT-4 API and calculate the cost
168
- def call_gpt4_api(system_prompt, user_prompt, files_content, model, temperature=0.7, max_tokens=2500, api_key=None, base_url=None):
168
+ def call_llm_for_diff(system_prompt, user_prompt, files_content, model, temperature=0.7, max_tokens=30000, api_key=None, base_url=None):
169
169
  enc = tiktoken.get_encoding("o200k_base")
170
170
  start_time = time.time()
171
171
 
@@ -243,7 +243,7 @@ def generate_diff(environment, goal, model=None, temperature=0.7, max_tokens=320
243
243
  prepend = ""
244
244
 
245
245
  system_prompt = prepend+f"Output a git diff into a <diff> block."
246
- _, diff_text, _, _, _, _ = call_gpt4_api(
246
+ _, diff_text, _, _, _, _ = call_llm_for_diff(
247
247
  system_prompt,
248
248
  goal,
249
249
  environment,
@@ -337,6 +337,7 @@ def parse_arguments():
337
337
  help='Call the GPT-4 API. Writes the full prompt to prompt.txt if not specified.')
338
338
  parser.add_argument('files', nargs='*', default=[], help='Specify additional files or directories to include.')
339
339
  parser.add_argument('--temperature', type=float, default=0.7, help='Temperature parameter for model creativity (0.0 to 2.0)')
340
+ parser.add_argument('--max_tokens', type=int, default=30000, help='Temperature parameter for model creativity (0.0 to 2.0)')
340
341
  parser.add_argument('--model', type=str, default=None, help='Model to use for the API call.')
341
342
 
342
343
  parser.add_argument('--nowarn', action='store_true', help='Disable large token warning')
@@ -589,10 +590,11 @@ def main():
589
590
  if confirmation != 'y':
590
591
  print("Request canceled")
591
592
  sys.exit(0)
592
- full_text, diff_text, prompt_tokens, completion_tokens, total_tokens, cost = call_gpt4_api(system_prompt, user_prompt, files_content, args.model,
593
+ full_text, diff_text, prompt_tokens, completion_tokens, total_tokens, cost = call_llm_for_diff(system_prompt, user_prompt, files_content, args.model,
593
594
  temperature=args.temperature,
594
595
  api_key=os.getenv('GPTDIFF_LLM_API_KEY'),
595
- base_url=os.getenv('GPTDIFF_LLM_BASE_URL', "https://nano-gpt.com/api/v1/")
596
+ base_url=os.getenv('GPTDIFF_LLM_BASE_URL', "https://nano-gpt.com/api/v1/"),
597
+ max_tokens=args.max_tokens
596
598
  )
597
599
 
598
600
  if(diff_text.strip() == ""):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: gptdiff
3
- Version: 0.1.6
3
+ Version: 0.1.8
4
4
  Summary: A tool to generate and apply git diffs using LLMs
5
5
  Author: 255labs
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -10,7 +10,7 @@ Description-Content-Type: text/markdown
10
10
  License-File: LICENSE.txt
11
11
  Requires-Dist: openai>=1.0.0
12
12
  Requires-Dist: tiktoken>=0.5.0
13
- Requires-Dist: ai_agent_toolbox>=0.1.9
13
+ Requires-Dist: ai_agent_toolbox>=0.1.11
14
14
  Provides-Extra: test
15
15
  Requires-Dist: pytest; extra == "test"
16
16
  Requires-Dist: pytest-mock; extra == "test"
@@ -1,6 +1,6 @@
1
1
  openai>=1.0.0
2
2
  tiktoken>=0.5.0
3
- ai_agent_toolbox>=0.1.9
3
+ ai_agent_toolbox>=0.1.11
4
4
 
5
5
  [docs]
6
6
  mkdocs
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='gptdiff',
5
- version='0.1.6',
5
+ version='0.1.8',
6
6
  description='A tool to generate and apply git diffs using LLMs',
7
7
  author='255labs',
8
8
  packages=find_packages(), # Use find_packages() to automatically discover packages
@@ -12,7 +12,7 @@ setup(
12
12
  install_requires=[
13
13
  'openai>=1.0.0',
14
14
  'tiktoken>=0.5.0',
15
- 'ai_agent_toolbox>=0.1.9'
15
+ 'ai_agent_toolbox>=0.1.11'
16
16
  ],
17
17
  extras_require={
18
18
  'test': ['pytest', 'pytest-mock'],
File without changes
File without changes
File without changes
File without changes