Skip to content

Commit

Permalink
Multiple tools calls in a raw.
Browse files Browse the repository at this point in the history
  • Loading branch information
solovieff committed Aug 2, 2024
1 parent 97a8380 commit eebc59b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions kibernikto/interactors/openai_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ async def process_tool_calls(self, choice: Choice, original_request_text: str, s
if not choice.message.tool_calls:
raise ValueError("No tools provided!")
message_dict = None
tool_call_messages = []
for tool_call in choice.message.tool_calls:
fn_name = tool_call.function.name
function_impl = self._get_tool_implementation(fn_name)
Expand All @@ -269,8 +270,8 @@ async def process_tool_calls(self, choice: Choice, original_request_text: str, s
additional_params=additional_params)
message_dict = dict(content=f"{original_request_text}", role=OpenAIRoles.user.value)
prompt.append(message_dict)
tool_call_messages = ai_tools.get_tool_call_serving_messages(tool_call, tool_call_result,
xml=self.xml_tools)
tool_call_messages += ai_tools.get_tool_call_serving_messages(tool_call, tool_call_result,
xml=self.xml_tools)

choice, usage = await self._run_for_messages(full_prompt=prompt + tool_call_messages)
response_message: ChatCompletionMessage = choice.message
Expand Down
1 change: 0 additions & 1 deletion kibernikto/telegram/telegram_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def __init__(self, aiogram_chat: Chat, aiogram_user: User = None):
self.aiogram_user = aiogram_user



class TelegramBot(OpenAIExecutor):
def __init__(self, config: OpenAiExecutorConfig, master_id, username, key=NOT_GIVEN,
chat_info: KiberniktoChatInfo = None):
Expand Down

0 comments on commit eebc59b

Please sign in to comment.