Skip to content

Commit

Permalink
rm empty lines between tips
Browse files Browse the repository at this point in the history
  • Loading branch information
vyokky committed Mar 19, 2024
1 parent cbffd5a commit ef99b13
Showing 1 changed file with 3 additions and 25 deletions.
28 changes: 3 additions & 25 deletions ufo/prompter/agent_prompter.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ def system_prompt_construction(self, additional_examples=[], tips=[]) -> str:
examples = self.examples_prompt_helper(additional_examples=additional_examples)
tips_prompt = "\n".join(tips)

# Remove empty lines
tips_prompt = '\n'.join(filter(None, tips_prompt.split('\n')))

return self.prompt_template["system"].format(apis=apis, examples=examples, tips=tips_prompt)


Expand Down Expand Up @@ -282,29 +285,4 @@ def api_prompt_helper(self, verbose: int = 1) -> str:
api_prompt = self.retrived_documents_prompt_helper("", "", api_list)

return api_prompt


def tips_prompt_helper(self, verbose: int = 1) -> str:
"""
Construct the prompt for tips.
:param verbose: The verbosity level.
return: The prompt for tips.
"""

# Construct the prompt for tips
tips_list = ["- The action type are limited to {actions}.".format(actions=list(self.api_prompt_template.keys()))]

# Construct the prompt for each tip
for key in self.api_prompt_template.keys():
api = self.api_prompt_template[key]
if verbose > 0:
api_text = "{summary}\n{usage}".format(summary=api["summary"], usage=api["usage"])
else:
api_text = api["summary"]

tips_list.append(api_text)

tips_prompt = self.retrived_documents_prompt_helper("", "", tips_list)

return tips_prompt

0 comments on commit ef99b13

Please sign in to comment.