Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions autogen/agentchat/conversable_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -2229,6 +2229,7 @@ def execute_function(self, func_call, verbose: bool = False) -> Tuple[bool, Dict
func = self._function_map.get(func_name, None)

is_exec_success = False
arguments = None
if func is not None:
# Extract arguments from a json-like string and put it into a dict.
input_string = self._format_json_str(func_call.get("arguments", "{}"))
Expand Down Expand Up @@ -2288,6 +2289,7 @@ async def a_execute_function(self, func_call):
func = self._function_map.get(func_name, None)

is_exec_success = False
arguments = None
if func is not None:
# Extract arguments from a json-like string and put it into a dict.
input_string = self._format_json_str(func_call.get("arguments", "{}"))
Expand Down
5 changes: 4 additions & 1 deletion autogen/oai/gemini.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ def create(self, params: Dict) -> ChatCompletion:
if n_response > 1:
warnings.warn("Gemini only supports `n=1` for now. We only generate one response.", UserWarning)

ans = None
prompt_tokens = completion_tokens = 0

if "vision" not in model_name:
# A. create and call the chat model.
gemini_messages = self._oai_messages_to_gemini_messages(messages)
Expand Down Expand Up @@ -214,7 +217,7 @@ def create(self, params: Dict) -> ChatCompletion:

prompt_tokens = model.count_tokens(chat.history[:-1]).total_tokens
completion_tokens = model.count_tokens(ans).total_tokens
elif model_name == "gemini-pro-vision":
else:
# B. handle the vision model
if self.use_vertexai:
model = GenerativeModel(
Expand Down