Skip to content

Commit

Permalink
update docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
micpst committed Aug 26, 2024
1 parent 9a8b63e commit e0e9da8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/dbally/iql_generator/iql_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def failed(self) -> bool:

class IQLGenerator:
"""
Program that orchestrates all IQL operations for the given question.
Orchestrates all IQL operations for the given question.
"""

def __init__(
Expand Down Expand Up @@ -127,7 +127,7 @@ async def __call__(

class IQLOperationGenerator(Generic[IQLQueryT]):
"""
Program that generates IQL queries for the given question.
Generates IQL queries for the given question.
"""

def __init__(
Expand Down Expand Up @@ -199,7 +199,7 @@ async def __call__(

class IQLQuestionAssessor:
"""
Program that assesses whether a question requires applying IQL operation or not.
Assesses whether a question requires applying IQL operation or not.
"""

def __init__(self, prompt: PromptTemplate[DecisionPromptFormat]) -> None:
Expand Down Expand Up @@ -251,7 +251,7 @@ async def __call__(

class IQLQueryGenerator(Generic[IQLQueryT]):
"""
Program that generates IQL queries for the given question.
Generates IQL queries for the given question.
"""

ERROR_MESSAGE = "Unfortunately, generated IQL is not valid. Please try again, \
Expand Down
4 changes: 2 additions & 2 deletions src/dbally/iql_generator/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ def __init__(
Args:
question: Question to be asked.
methods: List of filters exposed by the view.
methods: List of methods exposed by the view.
examples: List of examples to be injected into the conversation.
aggregations: List of aggregations exposed by the view.
"""
super().__init__(examples)
self.question = question
self.methods = "\n".join([str(condition) for condition in methods]) if methods else []
self.methods = "\n".join(str(method) for method in methods)


FILTERING_DECISION_TEMPLATE = PromptTemplate[DecisionPromptFormat](
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/test_iql_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ async def test_iql_prompt_format_default() -> None:
{
"role": "system",
"content": "You have access to an API that lets you query a database:\n"
"\n[]\n"
"\n\n"
"Suggest which one(s) to call and how they should be joined with logic operators (AND, OR, NOT).\n"
"Remember! Don't give any comments, just the function calls.\n"
"The output will look like this:\n"
'filter1("arg1") AND (NOT filter2(120) OR filter3(True))\n'
"DO NOT INCLUDE arguments names in your response. Only the values.\n"
"You MUST use only these methods:\n"
"\n[]\n"
"\n\n"
"It is VERY IMPORTANT not to use methods other than those listed above."
"""If you DON'T KNOW HOW TO ANSWER DON'T SAY anything other than `UNSUPPORTED QUERY`"""
"This is CRUCIAL, otherwise the system will crash. ",
Expand All @@ -44,14 +44,14 @@ async def test_iql_prompt_format_few_shots_injected() -> None:
{
"role": "system",
"content": "You have access to an API that lets you query a database:\n"
"\n[]\n"
"\n\n"
"Suggest which one(s) to call and how they should be joined with logic operators (AND, OR, NOT).\n"
"Remember! Don't give any comments, just the function calls.\n"
"The output will look like this:\n"
'filter1("arg1") AND (NOT filter2(120) OR filter3(True))\n'
"DO NOT INCLUDE arguments names in your response. Only the values.\n"
"You MUST use only these methods:\n"
"\n[]\n"
"\n\n"
"It is VERY IMPORTANT not to use methods other than those listed above."
"""If you DON'T KNOW HOW TO ANSWER DON'T SAY anything other than `UNSUPPORTED QUERY`"""
"This is CRUCIAL, otherwise the system will crash. ",
Expand Down

0 comments on commit e0e9da8

Please sign in to comment.