mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 18:25:00 +00:00
added autocomplete for model names
This commit is contained in:
parent
8e9a00006b
commit
665b9044c8
1 changed files with 9 additions and 0 deletions
|
@ -5,6 +5,7 @@ import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import git
|
import git
|
||||||
|
import litellm
|
||||||
import openai
|
import openai
|
||||||
from prompt_toolkit.completion import Completion
|
from prompt_toolkit.completion import Completion
|
||||||
|
|
||||||
|
@ -14,6 +15,8 @@ from aider.utils import is_image_file
|
||||||
|
|
||||||
from .dump import dump # noqa: F401
|
from .dump import dump # noqa: F401
|
||||||
|
|
||||||
|
litellm.suppress_debug_info = True
|
||||||
|
|
||||||
|
|
||||||
class SwitchModel(Exception):
|
class SwitchModel(Exception):
|
||||||
def __init__(self, model):
|
def __init__(self, model):
|
||||||
|
@ -41,6 +44,12 @@ class Commands:
|
||||||
models.sanity_check_models(self.io, model)
|
models.sanity_check_models(self.io, model)
|
||||||
raise SwitchModel(model)
|
raise SwitchModel(model)
|
||||||
|
|
||||||
|
def completions_model(self, partial):
|
||||||
|
models = litellm.model_cost.keys()
|
||||||
|
for model in models:
|
||||||
|
if partial.lower() in model.lower():
|
||||||
|
yield Completion(model, start_position=-len(partial))
|
||||||
|
|
||||||
def cmd_models(self, args):
|
def cmd_models(self, args):
|
||||||
"Search the list of available models"
|
"Search the list of available models"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue