Skip to content

Commit 66f7b1c

Browse files
committed
Remove prompt over-engineering
1 parent 5b4e4f1 commit 66f7b1c

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

src/llm_change_agent/llm_agent.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
OPENAI_PROVIDER,
1313
)
1414
from llm_change_agent.utils.llm_utils import (
15-
augment_prompt,
1615
execute_agent,
1716
get_anthropic_models,
1817
get_default_model_for_provider,
@@ -99,6 +98,6 @@ def run(self):
9998
"""Run the LLM Change Agent."""
10099
llm_config = self._get_llm_config()
101100
self.llm = llm_factory(llm_config)
102-
response = execute_agent(llm=self.llm, prompt=augment_prompt(self.prompt), external_rag_docs=self.docs)
101+
response = execute_agent(llm=self.llm, prompt=self.prompt, external_rag_docs=self.docs)
103102
pprint(response["output"])
104103
return response["output"]

src/llm_change_agent/utils/llm_utils.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
KGCL_SCHEMA,
3232
OLLAMA_PROVIDER,
3333
ONTOLOGIES_AS_DOC_MAP,
34-
ONTOLOGIES_URL,
35-
# ONTODIFF_DOCS,
3634
OPENAI_KEY,
3735
OPENAI_PROVIDER,
3836
VECTOR_DB_NAME,
@@ -339,30 +337,23 @@ def _chunk_list(lst, chunk_size):
339337
tools = [tool, compress_iri]
340338
template = get_issue_analyzer_template()
341339
react_agent = create_react_agent(llm=llm, tools=tools, prompt=template)
342-
agent_executor = AgentExecutor(agent=react_agent, tools=tools, handle_parsing_errors=True, verbose=True)
340+
agent_executor = AgentExecutor(
341+
agent=react_agent,
342+
tools=tools,
343+
handle_parsing_errors=True,
344+
verbose=True,
345+
return_intermediate_steps=True,
346+
)
343347
logger.info("Agent executor created successfully.")
344-
345348
return agent_executor.invoke(
346349
{
347350
"input": prompt,
348351
"grammar": grammar["lark"],
349352
"explanation": grammar["explanation"],
350-
"ontology_urls": ONTOLOGIES_URL,
351353
}
352354
)
353355

354356

355-
def augment_prompt(prompt: str):
356-
"""Augment the prompt with additional information."""
357-
return f"""
358-
Give me all relevant KGCL commands based on this request: \n\n
359-
+ {prompt} +
360-
\n\n
361-
Return as a python list object which will be passed to another tool.
362-
Each element of the list should be enlosed in double quotes.
363-
"""
364-
365-
366357
def extract_commands(command):
367358
"""Extract the command from the list."""
368359
# Remove markdown markers

0 commit comments

Comments
 (0)