mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 22:34:59 +00:00
move to gpt-3.5-turbo-1106
This commit is contained in:
parent
6ebc142377
commit
fb07b784f6
8 changed files with 27 additions and 23 deletions
|
@ -53,10 +53,10 @@ class Coder:
|
|||
@classmethod
|
||||
def create(
|
||||
self,
|
||||
client,
|
||||
main_model=None,
|
||||
edit_format=None,
|
||||
io=None,
|
||||
client=None,
|
||||
skip_model_availabily_check=False,
|
||||
**kwargs,
|
||||
):
|
||||
|
@ -67,12 +67,13 @@ class Coder:
|
|||
|
||||
if not skip_model_availabily_check and not main_model.always_available:
|
||||
if not check_model_availability(io, client, main_model):
|
||||
fallback_model = models.GPT35_1106
|
||||
if main_model != models.GPT4:
|
||||
io.tool_error(
|
||||
f"API key does not support {main_model.name}, falling back to"
|
||||
f" {models.GPT35_16k.name}"
|
||||
f" {fallback_model.name}"
|
||||
)
|
||||
main_model = models.GPT35_16k
|
||||
main_model = fallback_model
|
||||
|
||||
if edit_format is None:
|
||||
edit_format = main_model.edit_format
|
||||
|
@ -163,7 +164,9 @@ class Coder:
|
|||
|
||||
if use_git:
|
||||
try:
|
||||
self.repo = GitRepo(self.io, fnames, git_dname, aider_ignore_file)
|
||||
self.repo = GitRepo(
|
||||
self.io, fnames, git_dname, aider_ignore_file, client=self.client
|
||||
)
|
||||
self.root = self.repo.root
|
||||
except FileNotFoundError:
|
||||
self.repo = None
|
||||
|
@ -950,7 +953,8 @@ class Coder:
|
|||
|
||||
def check_model_availability(io, client, main_model):
|
||||
available_models = client.models.list()
|
||||
model_ids = sorted(model.id for model in available_models["data"])
|
||||
dump(available_models)
|
||||
model_ids = sorted(model.id for model in available_models)
|
||||
if main_model.name in model_ids:
|
||||
return True
|
||||
|
||||
|
|
|
@ -157,12 +157,13 @@ def main(argv=None, input=None, output=None, force_git_root=None):
|
|||
default=False,
|
||||
help="Override to skip model availability check (default: False)",
|
||||
)
|
||||
default_3_model = models.GPT35_1106
|
||||
core_group.add_argument(
|
||||
"-3",
|
||||
action="store_const",
|
||||
dest="model",
|
||||
const=models.GPT35_16k.name,
|
||||
help=f"Use {models.GPT35_16k.name} model for the main chat (gpt-4 is better)",
|
||||
const=default_3_model.name,
|
||||
help=f"Use {default_3_model.name} model for the main chat (gpt-4 is better)",
|
||||
)
|
||||
core_group.add_argument(
|
||||
"--voice-language",
|
||||
|
@ -509,11 +510,11 @@ def main(argv=None, input=None, output=None, force_git_root=None):
|
|||
|
||||
try:
|
||||
coder = Coder.create(
|
||||
client,
|
||||
main_model,
|
||||
args.edit_format,
|
||||
io,
|
||||
args.skip_model_availability_check,
|
||||
main_model=main_model,
|
||||
edit_format=args.edit_format,
|
||||
io=io,
|
||||
skip_model_availabily_check=args.skip_model_availability_check,
|
||||
client=client,
|
||||
##
|
||||
fnames=fnames,
|
||||
git_dname=git_dname,
|
||||
|
|
|
@ -4,6 +4,7 @@ from .openrouter import OpenRouterModel
|
|||
|
||||
GPT4 = Model.create("gpt-4")
|
||||
GPT35 = Model.create("gpt-3.5-turbo")
|
||||
GPT35_1106 = Model.create("gpt-3.5-turbo-1106")
|
||||
GPT35_16k = Model.create("gpt-3.5-turbo-16k")
|
||||
|
||||
__all__ = [
|
||||
|
|
|
@ -33,11 +33,11 @@ class Model:
|
|||
|
||||
@staticmethod
|
||||
def weak_model():
|
||||
return Model.create("gpt-3.5-turbo")
|
||||
return Model.create("gpt-3.5-turbo-1106")
|
||||
|
||||
@staticmethod
|
||||
def commit_message_models():
|
||||
return [Model.create("gpt-3.5-turbo"), Model.create("gpt-3.5-turbo-16k")]
|
||||
return [Model.weak_model()]
|
||||
|
||||
def token_count(self, messages):
|
||||
if not self.tokenizer:
|
||||
|
|
|
@ -55,6 +55,7 @@ class OpenAIModel(Model):
|
|||
if self.is_gpt35():
|
||||
self.edit_format = "whole"
|
||||
self.always_available = True
|
||||
self.send_undo_reply = False
|
||||
|
||||
if self.name == "gpt-3.5-turbo-1106":
|
||||
self.prompt_price = 0.001
|
||||
|
|
|
@ -7,12 +7,8 @@ cached_model_details = None
|
|||
|
||||
class OpenRouterModel(Model):
|
||||
def __init__(self, client, name):
|
||||
if name == "gpt-4":
|
||||
name = "openai/gpt-4"
|
||||
elif name == "gpt-3.5-turbo":
|
||||
name = "openai/gpt-3.5-turbo"
|
||||
elif name == "gpt-3.5-turbo-16k":
|
||||
name = "openai/gpt-3.5-turbo-16k"
|
||||
if name.startswith("gpt-4") or name.startswith("gpt-3.5-turbo"):
|
||||
name = "openai/" + name
|
||||
|
||||
self.name = name
|
||||
self.edit_format = edit_format_for_model(name)
|
||||
|
|
|
@ -110,9 +110,7 @@ class GitRepo:
|
|||
raise OpenAIClientNotProvided
|
||||
|
||||
if len(diffs) >= 4 * 1024 * 4:
|
||||
self.io.tool_error(
|
||||
f"Diff is too large for {models.GPT35.name} to generate a commit message."
|
||||
)
|
||||
self.io.tool_error("Diff is too large to generate a commit message.")
|
||||
return
|
||||
|
||||
diffs = "# Diffs:\n" + diffs
|
||||
|
|
|
@ -12,6 +12,9 @@ class TestModels(unittest.TestCase):
|
|||
model = Model.create("gpt-3.5-turbo-16k")
|
||||
self.assertEqual(model.max_context_tokens, 16 * 1024)
|
||||
|
||||
model = Model.create("gpt-3.5-turbo-1106")
|
||||
self.assertEqual(model.max_context_tokens, 16 * 1024)
|
||||
|
||||
model = Model.create("gpt-4")
|
||||
self.assertEqual(model.max_context_tokens, 8 * 1024)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue