Skip to content

Commit

Permalink
fix unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreymeetkai committed Aug 8, 2024
1 parent 403293c commit fe924b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions functionary/prompt_template/llama31_prompt_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,10 @@ def parse_assistant_response(

def initialize_fsm_gen_state(
self,
tool_choice: str | Tool,
tool_choice: Union[str, Tool],
curr_text: str,
curr_tokens: List[int] | None,
add_code_interpreter: bool | None,
curr_tokens: Optional[List[int]],
add_code_interpreter: Optional[bool],
) -> Dict:
func_name = None
# To force a text response ("tool_choice"="none")
Expand Down Expand Up @@ -305,10 +305,10 @@ def stream_delta_text(
self,
gen_state: Dict,
delta_text: str,
finish_reason: str | None,
finish_reason: Optional[str],
tools_or_functions: List[Dict],
tool_choice: Any,
) -> Tuple[Dict | List[Dict] | None]:
) -> Tuple[Dict, Optional[Union[Dict, List[Dict]]]]:
if finish_reason is not None: # handle if finish
if gen_state["stage"] in ["parameter", "code-interpreter"]:
finish_reason = "tool_calls"
Expand Down
10 changes: 5 additions & 5 deletions functionary/prompt_template/prompt_template_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,10 @@ def get_chat_template_jinja(self) -> str:

def initialize_fsm_gen_state(
self,
tool_choice: str | Tool,
tool_choice: Union[str, Tool],
curr_text: str,
curr_tokens: List[int] | None,
add_code_interpreter: bool | None,
curr_tokens: Optional[List[int]],
add_code_interpreter: Optional[bool],
) -> Dict:
add_all_recipient = False
func_name = None
Expand Down Expand Up @@ -336,10 +336,10 @@ def stream_delta_text(
self,
gen_state: Dict,
delta_text: str,
finish_reason: str | None,
finish_reason: Optional[str],
tools_or_functions: List[Dict],
tool_choice: Any,
) -> Tuple[Dict | List[Dict] | None]:
) -> Tuple[Dict, Optional[Union[Dict, List[Dict]]]]:
if finish_reason is not None: # handle if finish
if gen_state["func_name"] is not None and gen_state["func_name"] != "all":
finish_reason = "tool_calls"
Expand Down

0 comments on commit fe924b9

Please sign in to comment.