Skip to content

Commit

Permalink
Exposed get_relevant_procedures_string
Browse files Browse the repository at this point in the history
  • Loading branch information
KillianLucas committed Oct 12, 2023
1 parent 27ddc8d commit 8081961
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
5 changes: 5 additions & 0 deletions interpreter/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import appdirs
import os
from datetime import datetime
from ..rag.get_relevant_procedures_string import get_relevant_procedures_string
import json
from ..utils.check_for_update import check_for_update
from ..utils.display_markdown_message import display_markdown_message
Expand Down Expand Up @@ -145,5 +146,9 @@ def reset(self):
code_interpreter.terminate()
self._code_interpreters = {}

# These functions are worth exposing to developers
# I wish we could just dynamically expose all of our functions to devs...
def generate_system_message(self):
return generate_system_message(self)
def get_relevant_procedures_string(self):
return get_relevant_procedures_string(self)
3 changes: 1 addition & 2 deletions interpreter/core/generate_system_message.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from ..utils.get_user_info_string import get_user_info_string
from ..rag.get_relevant_procedures_string import get_relevant_procedures_string


def generate_system_message(interpreter):
Expand All @@ -22,7 +21,7 @@ def generate_system_message(interpreter):

system_message += "\n" + get_user_info_string()
try:
system_message += "\n" + get_relevant_procedures_string(interpreter)
system_message += "\n" + interpreter.get_relevant_procedures_string(interpreter)
except:
# In case some folks can't install the embedding model (I'm not sure if this ever happens)
pass
Expand Down
4 changes: 4 additions & 0 deletions interpreter/rag/get_relevant_procedures_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ def get_relevant_procedures_string(interpreter):

# Open Procedures is an open-source database of tiny, up-to-date coding tutorials.
# We can query it semantically and append relevant tutorials/procedures to our system message

# If download_open_procedures is True and interpreter.procedures is None,
# We download the bank of procedures:

if interpreter.procedures is None and interpreter.download_open_procedures and not interpreter.local:
# Let's get Open Procedures from Github
url = "https://raw.githubusercontent.com/KillianLucas/open-procedures/main/procedures_db.json"
Expand Down
8 changes: 4 additions & 4 deletions interpreter/terminal_interface/validate_llm_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,18 @@ def validate_llm_settings(interpreter):
To use `GPT-4` (recommended) please provide an OpenAI API key.
To use `Code-Llama` (free but less capable) press `enter`.
To use `Mistral-7B` (free but less capable) press `enter`.
---
""")

response = input("OpenAI API key: ")

if response == "":
# User pressed `enter`, requesting Code-Llama
display_markdown_message("""> Switching to `Code-Llama`...
# User pressed `enter`, requesting Mistral-7B
display_markdown_message("""> Switching to `Mistral-7B`...
**Tip:** Run `interpreter --local` to automatically use `Code-Llama`.
**Tip:** Run `interpreter --local` to automatically use `Mistral-7B`.
---""")
time.sleep(1.5)
Expand Down

0 comments on commit 8081961

Please sign in to comment.