gptdiff 0.1.6__tar.gz → 0.1.7__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {gptdiff-0.1.6 → gptdiff-0.1.7}/PKG-INFO +1 -1
- {gptdiff-0.1.6 → gptdiff-0.1.7}/gptdiff/gptdiff.py +6 -4
- {gptdiff-0.1.6 → gptdiff-0.1.7}/gptdiff.egg-info/PKG-INFO +1 -1
- {gptdiff-0.1.6 → gptdiff-0.1.7}/setup.py +1 -1
- {gptdiff-0.1.6 → gptdiff-0.1.7}/LICENSE.txt +0 -0
- {gptdiff-0.1.6 → gptdiff-0.1.7}/README.md +0 -0
- {gptdiff-0.1.6 → gptdiff-0.1.7}/gptdiff/__init__.py +0 -0
- {gptdiff-0.1.6 → gptdiff-0.1.7}/gptdiff.egg-info/SOURCES.txt +0 -0
- {gptdiff-0.1.6 → gptdiff-0.1.7}/gptdiff.egg-info/dependency_links.txt +0 -0
- {gptdiff-0.1.6 → gptdiff-0.1.7}/gptdiff.egg-info/entry_points.txt +0 -0
- {gptdiff-0.1.6 → gptdiff-0.1.7}/gptdiff.egg-info/requires.txt +0 -0
- {gptdiff-0.1.6 → gptdiff-0.1.7}/gptdiff.egg-info/top_level.txt +0 -0
- {gptdiff-0.1.6 → gptdiff-0.1.7}/setup.cfg +0 -0
- {gptdiff-0.1.6 → gptdiff-0.1.7}/tests/test_smartapply.py +0 -0
@@ -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
|
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, _, _, _, _ =
|
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 =
|
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() == ""):
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
2
2
|
|
3
3
|
setup(
|
4
4
|
name='gptdiff',
|
5
|
-
version='0.1.
|
5
|
+
version='0.1.7',
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|