mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Fix pre commit 4
This commit is contained in:
@@ -390,36 +390,36 @@ class _OutputItemTracker:
|
||||
if self._active_type != "text":
|
||||
yield from self._close()
|
||||
yield from self._open_message()
|
||||
assert self._text_content is not None # noqa: S101
|
||||
self._accumulated.append(content.text)
|
||||
yield self._text_content.emit_delta(content.text)
|
||||
if self._text_content is not None:
|
||||
yield self._text_content.emit_delta(content.text)
|
||||
|
||||
elif content.type == "text_reasoning" and content.text is not None:
|
||||
if self._active_type != "text_reasoning":
|
||||
yield from self._close()
|
||||
yield from self._open_reasoning()
|
||||
assert self._summary_part is not None # noqa: S101
|
||||
self._accumulated.append(content.text)
|
||||
yield self._summary_part.emit_text_delta(content.text)
|
||||
if self._summary_part is not None:
|
||||
yield self._summary_part.emit_text_delta(content.text)
|
||||
|
||||
elif content.type == "function_call" and content.call_id is not None:
|
||||
if self._active_type != "function_call" or self._active_id != content.call_id:
|
||||
yield from self._close()
|
||||
yield from self._open_function_call(content)
|
||||
assert self._fc_builder is not None # noqa: S101
|
||||
args_str = _arguments_to_str(content.arguments)
|
||||
self._accumulated.append(args_str)
|
||||
yield self._fc_builder.emit_arguments_delta(args_str)
|
||||
if self._fc_builder is not None:
|
||||
yield self._fc_builder.emit_arguments_delta(args_str)
|
||||
|
||||
elif content.type == "mcp_server_tool_call" and content.tool_name:
|
||||
key = f"{content.server_name or 'default'}::{content.tool_name}"
|
||||
if self._active_type != "mcp_server_tool_call" or self._active_id != key:
|
||||
yield from self._close()
|
||||
yield from self._open_mcp_call(content)
|
||||
assert self._mcp_builder is not None # noqa: S101
|
||||
args_str = _arguments_to_str(content.arguments)
|
||||
self._accumulated.append(args_str)
|
||||
yield self._mcp_builder.emit_arguments_delta(args_str)
|
||||
if self._mcp_builder is not None:
|
||||
yield self._mcp_builder.emit_arguments_delta(args_str)
|
||||
|
||||
else:
|
||||
yield from self._close()
|
||||
|
||||
@@ -347,28 +347,29 @@ setup_observability(
|
||||
```
|
||||
|
||||
**After (Current):**
|
||||
|
||||
```python
|
||||
# For Microsoft Foundry projects
|
||||
from agent_framework.foundry import FoundryChatClient
|
||||
from azure.identity import AzureCliCredential
|
||||
|
||||
client = FoundryChatClient(
|
||||
project_endpoint="https://your-project.services.ai.azure.com",
|
||||
model="gpt-4o",
|
||||
credential=AzureCliCredential(),
|
||||
)
|
||||
await client.configure_azure_monitor(enable_live_metrics=True)
|
||||
|
||||
# For non-Azure AI projects
|
||||
from azure.monitor.opentelemetry import configure_azure_monitor
|
||||
from agent_framework.observability import create_resource, enable_instrumentation
|
||||
|
||||
configure_azure_monitor(
|
||||
connection_string="InstrumentationKey=...",
|
||||
resource=create_resource(),
|
||||
enable_live_metrics=True,
|
||||
)
|
||||
enable_instrumentation()
|
||||
async def main():
|
||||
# For Microsoft Foundry projects
|
||||
from agent_framework.foundry import FoundryChatClient
|
||||
from azure.identity import AzureCliCredential
|
||||
client = FoundryChatClient(
|
||||
project_endpoint="https://your-project.services.ai.azure.com",
|
||||
model="gpt-4o",
|
||||
credential=AzureCliCredential(),
|
||||
)
|
||||
await client.configure_azure_monitor(enable_live_metrics=True)
|
||||
|
||||
# For non-Azure AI projects
|
||||
from azure.monitor.opentelemetry import configure_azure_monitor
|
||||
from agent_framework.observability import create_resource, enable_instrumentation
|
||||
|
||||
configure_azure_monitor(
|
||||
connection_string="InstrumentationKey=...",
|
||||
resource=create_resource(),
|
||||
enable_live_metrics=True,
|
||||
)
|
||||
enable_instrumentation()
|
||||
```
|
||||
|
||||
### Console Output
|
||||
|
||||
Reference in New Issue
Block a user