Skip to content

Commit

Permalink
Fix a style-change bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mahaloz committed Sep 16, 2024
1 parent 1071c2a commit f56f773
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dailalib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "3.7.0"
__version__ = "3.7.1"

from .api import AIAPI, LiteLLMAIAPI
from libbs.api import DecompilerInterface
Expand Down
8 changes: 6 additions & 2 deletions dailalib/api/litellm/litellm_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(
api_key: Optional[str] = None,
model: str = DEFAULT_MODEL,
prompts: Optional[list] = None,
fit_to_tokens: bool = True,
fit_to_tokens: bool = False,
**kwargs
):
super().__init__(**kwargs)
Expand Down Expand Up @@ -165,7 +165,11 @@ def ask_prompt_style(self, *args, **kwargs):
style_choices,
title="DAILA"
)
if p_style != prompt_style and p_style is not None:
if p_style != prompt_style and p_style:
if p_style not in ALL_STYLES:
self._dec_interface.error(f"Prompt style {p_style} is not supported.")
return

self.prompt_style = p_style
self._dec_interface.info(f"Prompt style set to {p_style}")

Expand Down
1 change: 1 addition & 0 deletions dailalib/api/litellm/prompts/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def _query_model(ai_api=self.ai_api, function=function, dec_text=dec_text, **_kw
#ai_api.info(f"Response received from AI: {response}")
default_response = {} if self._json_response else ""
if not response:
ai_api.warning(f"Response received from AI was empty! AI failed to answer.")
return default_response

# changes response type to a dict
Expand Down

0 comments on commit f56f773

Please sign in to comment.