From 3cd5066dd67614ed11c0941fa436ce06672e29e4 Mon Sep 17 00:00:00 2001 From: Jake Koenig Date: Fri, 16 Feb 2024 12:02:53 -0800 Subject: [PATCH 1/2] Use a different model to guess pip and respond If we finetune a model it will learn to always respond in python surrounded with backticks so it won't be able to produce pip packages well. We need to have a different model. --- src/rawdog/config.py | 2 ++ src/rawdog/llm_client.py | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/rawdog/config.py b/src/rawdog/config.py index dbbc4bb..e9e7b92 100644 --- a/src/rawdog/config.py +++ b/src/rawdog/config.py @@ -10,6 +10,7 @@ "llm_api_key": None, "llm_base_url": None, "llm_model": "gpt-4-turbo-preview", + "pip_model": None "llm_custom_provider": None, "llm_temperature": 1.0, "retries": 2, @@ -21,6 +22,7 @@ setting_descriptions = { "retries": "If the script fails, retry this many times before giving up.", "leash": "Print the script before executing and prompt for confirmation.", + "pip_model": "The model to use to get package name from import name.", } diff --git a/src/rawdog/llm_client.py b/src/rawdog/llm_client.py index e6c3404..20cbc6b 100644 --- a/src/rawdog/llm_client.py +++ b/src/rawdog/llm_client.py @@ -46,7 +46,14 @@ def add_message(self, role: str, content: str): def get_python_package(self, import_name: str): base_url = self.config.get("llm_base_url") - model = self.config.get("llm_model") + model = self.config.get("pip_model") + llm_model = self.config.get("llm_model") + if model is None: + if "ft:" in llm_model or "rawdog" in llm_model or "abante" in llm_model: + model = "gpt-3.5-turbo" + else: + model = llm_model + custom_llm_provider = self.config.get("llm_custom_provider") messages = [ From 4818ef2034fbae111f2a6b973ac9293622bbb119 Mon Sep 17 00:00:00 2001 From: Jake Koenig Date: Fri, 16 Feb 2024 12:19:54 -0800 Subject: [PATCH 2/2] black fix --- src/rawdog/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rawdog/config.py b/src/rawdog/config.py index e9e7b92..301bb55 100644 --- a/src/rawdog/config.py +++ b/src/rawdog/config.py @@ -10,7 +10,7 @@ "llm_api_key": None, "llm_base_url": None, "llm_model": "gpt-4-turbo-preview", - "pip_model": None + "pip_model": None, "llm_custom_provider": None, "llm_temperature": 1.0, "retries": 2,