Skip to content

Commit

Permalink
examples_as_sys_msg for sonnet gets 100% compliance on exercism eval
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-gauthier committed Jun 24, 2024
1 parent 3015495 commit 42fbe28
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 0 additions & 2 deletions aider/coders/editblock_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ def hello():
Include just the changing lines, and a few surrounding lines if needed for uniqueness.
Do not include long runs of unchanging lines in *SEARCH/REPLACE* blocks.
Include *ALL* the code being searched and replaced!
Only create *SEARCH/REPLACE* blocks for files that the user has added to the chat!
To move code within a file, use 2 *SEARCH/REPLACE* blocks: 1 to delete it from its current location, 1 to insert it in the new location.
Expand Down
20 changes: 13 additions & 7 deletions aider/models.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import difflib
import json
import yaml
import math
import os
import sys
from dataclasses import dataclass, fields
from typing import Optional

import yaml
from PIL import Image

from aider import urls
Expand Down Expand Up @@ -184,18 +184,21 @@ class ModelSettings:
"diff",
weak_model_name="claude-3-haiku-20240307",
use_repo_map=True,
examples_as_sys_msg=True,
),
ModelSettings(
"anthropic/claude-3-5-sonnet-20240620",
"diff",
weak_model_name="claude-3-haiku-20240307",
use_repo_map=True,
examples_as_sys_msg=True,
),
ModelSettings(
"openrouter/anthropic/claude-3.5-sonnet",
"diff",
weak_model_name="openrouter/anthropic/claude-3-haiku-20240307",
use_repo_map=True,
examples_as_sys_msg=True,
),
# Vertex AI Claude models
ModelSettings(
Expand Down Expand Up @@ -471,21 +474,24 @@ def validate_environment(self):
return validate_variables(["GROQ_API_KEY"])

return res



def register_models(model_settings_fnames):
files_loaded = []
for model_settings_fname in model_settings_fnames:
if not os.path.exists(model_settings_fname):
continue

try:
with open(model_settings_fname, "r") as model_settings_file:
model_settings_list = yaml.safe_load(model_settings_file)

for model_settings_dict in model_settings_list:
model_settings = ModelSettings(**model_settings_dict)
existing_model_settings = next((ms for ms in MODEL_SETTINGS if ms.name == model_settings.name), None)

existing_model_settings = next(
(ms for ms in MODEL_SETTINGS if ms.name == model_settings.name), None
)

if existing_model_settings:
MODEL_SETTINGS.remove(existing_model_settings)
MODEL_SETTINGS.append(model_settings)
Expand All @@ -501,14 +507,14 @@ def register_litellm_models(model_fnames):
for model_fname in model_fnames:
if not os.path.exists(model_fname):
continue

try:
with open(model_fname, "r") as model_def_file:
model_def = json.load(model_def_file)
litellm.register_model(model_def)
except Exception as e:
raise Exception(f"Error loading model definition from {model_fname}: {e}")

files_loaded.append(model_fname)

return files_loaded
Expand Down

0 comments on commit 42fbe28

Please sign in to comment.