From b12ef138f3f8b575290f35b41542ee9befa488b6 Mon Sep 17 00:00:00 2001 From: Mark Liffiton Date: Wed, 4 Sep 2024 15:33:03 -0500 Subject: [PATCH] Tweak context prompt to avoid 'what language?' when language is the context name. --- src/codehelp/context.py | 6 +++++- src/codehelp/helper.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/codehelp/context.py b/src/codehelp/context.py index 91a0cf8..c7235ca 100644 --- a/src/codehelp/context.py +++ b/src/codehelp/context.py @@ -73,8 +73,12 @@ def _list_fmt(s: str) -> str: def prompt_str(self) -> str: """ Convert this context into a string to be used in an LLM prompt. """ + # if nothing is provided but a name, use just that name by itself + if not self.tools and not self.details and not self.avoid: + return self.name + template = jinja_env_prompt.from_string("""\ -{{ name }} +Context name: {{ name }} {% if tools %} Environment and tools: {{ tools }} {% endif %} diff --git a/src/codehelp/helper.py b/src/codehelp/helper.py index e0da360..213f994 100644 --- a/src/codehelp/helper.py +++ b/src/codehelp/helper.py @@ -310,10 +310,10 @@ def get_topics(llm: LLMConfig, query_id: int) -> list[str]: return [] messages = prompts.make_topics_prompt( - '', # TODO: put this back: query_row['context'], query_row['code'], query_row['error'], query_row['issue'], + '', # TODO: put this back: query_row['context'], responses['main'] )