mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: Web search file search tools (#395)
* Add web and file search tools * add tests * PR comments * Add tools support for chat and assistants clients * fix code checks * add tests for assistants client * Add samples * fix fn descriptions * Add openai responses model id to environment variables --------- Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
This commit is contained in:
co-authored by
Dmytro Struk
parent
ed86baa6cb
commit
0410f51777
@@ -141,7 +141,7 @@ def _tool_call_non_streaming(
|
||||
# Failsafe: give up on tools, ask model for plain answer
|
||||
chat_options.tool_choice = "none"
|
||||
self._prepare_tool_choice(chat_options=chat_options) # type: ignore[reportPrivateUsage]
|
||||
response = await func(self, messages=messages, chat_options=chat_options)
|
||||
response = await func(self, messages=messages, chat_options=chat_options, **kwargs)
|
||||
if fcc_messages:
|
||||
for msg in reversed(fcc_messages):
|
||||
response.messages.insert(0, msg)
|
||||
@@ -167,7 +167,7 @@ def _tool_call_streaming(
|
||||
for attempt_idx in range(getattr(self, "__maximum_iterations_per_request", 10)):
|
||||
function_call_returned = False
|
||||
all_messages: list[ChatResponseUpdate] = []
|
||||
async for update in func(self, messages=messages, chat_options=chat_options):
|
||||
async for update in func(self, messages=messages, chat_options=chat_options, **kwargs):
|
||||
if update.contents and any(isinstance(item, FunctionCallContent) for item in update.contents):
|
||||
all_messages.append(update)
|
||||
function_call_returned = True
|
||||
|
||||
Reference in New Issue
Block a user