agent-framework-foundry 1.8.2__tar.gz → 1.10.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {agent_framework_foundry-1.8.2 → agent_framework_foundry-1.10.2}/PKG-INFO +28 -4
- {agent_framework_foundry-1.8.2 → agent_framework_foundry-1.10.2}/README.md +24 -0
- {agent_framework_foundry-1.8.2 → agent_framework_foundry-1.10.2}/agent_framework_foundry/_agent.py +56 -23
- {agent_framework_foundry-1.8.2 → agent_framework_foundry-1.10.2}/agent_framework_foundry/_chat_client.py +16 -16
- {agent_framework_foundry-1.8.2 → agent_framework_foundry-1.10.2}/agent_framework_foundry/_embedding_client.py +5 -5
- {agent_framework_foundry-1.8.2 → agent_framework_foundry-1.10.2}/agent_framework_foundry/_foundry_evals.py +14 -12
- {agent_framework_foundry-1.8.2 → agent_framework_foundry-1.10.2}/agent_framework_foundry/_memory_provider.py +2 -2
- {agent_framework_foundry-1.8.2 → agent_framework_foundry-1.10.2}/agent_framework_foundry/_to_prompt_agent.py +2 -2
- {agent_framework_foundry-1.8.2 → agent_framework_foundry-1.10.2}/pyproject.toml +4 -4
- {agent_framework_foundry-1.8.2 → agent_framework_foundry-1.10.2}/LICENSE +0 -0
- {agent_framework_foundry-1.8.2 → agent_framework_foundry-1.10.2}/agent_framework_foundry/__init__.py +0 -0
- {agent_framework_foundry-1.8.2 → agent_framework_foundry-1.10.2}/agent_framework_foundry/_oauth_helpers.py +0 -0
- {agent_framework_foundry-1.8.2 → agent_framework_foundry-1.10.2}/agent_framework_foundry/_tools.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agent-framework-foundry
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.10.2
|
|
4
4
|
Summary: Microsoft Foundry integrations for Microsoft Agent Framework.
|
|
5
5
|
Author-email: Microsoft <af-support@microsoft.com>
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -16,11 +16,11 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.14
|
|
17
17
|
Classifier: Typing :: Typed
|
|
18
18
|
License-File: LICENSE
|
|
19
|
-
Requires-Dist: agent-framework-core>=1.
|
|
20
|
-
Requires-Dist: agent-framework-openai>=1.
|
|
19
|
+
Requires-Dist: agent-framework-core>=1.11.0,<2
|
|
20
|
+
Requires-Dist: agent-framework-openai>=1.10.0,<2
|
|
21
21
|
Requires-Dist: aiohttp>=3.9,<4
|
|
22
22
|
Requires-Dist: azure-ai-inference>=1.0.0b9,<1.0.0b10
|
|
23
|
-
Requires-Dist: azure-ai-projects>=2.2.0,<
|
|
23
|
+
Requires-Dist: azure-ai-projects>=2.2.0,<2.4.0
|
|
24
24
|
Project-URL: homepage, https://aka.ms/agent-framework
|
|
25
25
|
Project-URL: issues, https://github.com/microsoft/agent-framework/issues
|
|
26
26
|
Project-URL: release_notes, https://github.com/microsoft/agent-framework/releases?q=tag%3Apython-1&expanded=true
|
|
@@ -134,6 +134,30 @@ Generally available factories: `get_code_interpreter_tool`,
|
|
|
134
134
|
| `get_browser_automation_tool(connection_id)` | `BrowserAutomationPreviewTool` |
|
|
135
135
|
| `get_bing_custom_search_tool(connection_id, instance_name, ...)` | `BingCustomSearchPreviewTool` |
|
|
136
136
|
| `get_a2a_tool(base_url=..., project_connection_id=..., ...)` | `A2APreviewTool` |
|
|
137
|
+
|
|
138
|
+
## Creating Foundry conversation sessions
|
|
139
|
+
|
|
140
|
+
`FoundryAgent.create_conversation()` creates a server-side Foundry
|
|
141
|
+
project conversation and returns an `AgentSession` that can be passed to
|
|
142
|
+
`agent.run(...)` without reaching into the raw OpenAI client.
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
from agent_framework.foundry import FoundryAgent
|
|
146
|
+
|
|
147
|
+
agent = FoundryAgent(
|
|
148
|
+
project_endpoint=project_endpoint,
|
|
149
|
+
agent_name="travel-agent",
|
|
150
|
+
credential=credential,
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
session = await agent.create_conversation()
|
|
154
|
+
response = await agent.run("Help me plan a trip to Seattle.", session=session)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
This is separate from hosted-agent `isolation_key` sessions: the created
|
|
158
|
+
conversation ID is stored on `AgentSession.service_session_id`, while the local
|
|
159
|
+
`session_id` remains available for application/session storage.
|
|
160
|
+
|
|
137
161
|
## Publishing an agent as a Foundry prompt agent
|
|
138
162
|
|
|
139
163
|
> **Experimental — `ExperimentalFeature.TO_PROMPT_AGENT`.** `to_prompt_agent`
|
|
@@ -106,6 +106,30 @@ Generally available factories: `get_code_interpreter_tool`,
|
|
|
106
106
|
| `get_browser_automation_tool(connection_id)` | `BrowserAutomationPreviewTool` |
|
|
107
107
|
| `get_bing_custom_search_tool(connection_id, instance_name, ...)` | `BingCustomSearchPreviewTool` |
|
|
108
108
|
| `get_a2a_tool(base_url=..., project_connection_id=..., ...)` | `A2APreviewTool` |
|
|
109
|
+
|
|
110
|
+
## Creating Foundry conversation sessions
|
|
111
|
+
|
|
112
|
+
`FoundryAgent.create_conversation()` creates a server-side Foundry
|
|
113
|
+
project conversation and returns an `AgentSession` that can be passed to
|
|
114
|
+
`agent.run(...)` without reaching into the raw OpenAI client.
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
from agent_framework.foundry import FoundryAgent
|
|
118
|
+
|
|
119
|
+
agent = FoundryAgent(
|
|
120
|
+
project_endpoint=project_endpoint,
|
|
121
|
+
agent_name="travel-agent",
|
|
122
|
+
credential=credential,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
session = await agent.create_conversation()
|
|
126
|
+
response = await agent.run("Help me plan a trip to Seattle.", session=session)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
This is separate from hosted-agent `isolation_key` sessions: the created
|
|
130
|
+
conversation ID is stored on `AgentSession.service_session_id`, while the local
|
|
131
|
+
`session_id` remains available for application/session storage.
|
|
132
|
+
|
|
109
133
|
## Publishing an agent as a Foundry prompt agent
|
|
110
134
|
|
|
111
135
|
> **Experimental — `ExperimentalFeature.TO_PROMPT_AGENT`.** `to_prompt_agent`
|
{agent_framework_foundry-1.8.2 → agent_framework_foundry-1.10.2}/agent_framework_foundry/_agent.py
RENAMED
|
@@ -41,17 +41,17 @@ from agent_framework_foundry._oauth_helpers import try_parse_oauth_consent_event
|
|
|
41
41
|
from ._tools import _sanitize_foundry_response_tool # pyright: ignore[reportPrivateUsage]
|
|
42
42
|
|
|
43
43
|
if sys.version_info >= (3, 13):
|
|
44
|
-
from typing import TypeVar #
|
|
44
|
+
from typing import TypeVar # pragma: no cover
|
|
45
45
|
else:
|
|
46
|
-
from typing_extensions import TypeVar #
|
|
46
|
+
from typing_extensions import TypeVar # pragma: no cover
|
|
47
47
|
if sys.version_info >= (3, 12):
|
|
48
|
-
from typing import override #
|
|
48
|
+
from typing import override # pragma: no cover
|
|
49
49
|
else:
|
|
50
|
-
from typing_extensions import override #
|
|
50
|
+
from typing_extensions import override # pragma: no cover
|
|
51
51
|
if sys.version_info >= (3, 11):
|
|
52
|
-
from typing import TypedDict #
|
|
52
|
+
from typing import TypedDict # pragma: no cover
|
|
53
53
|
else:
|
|
54
|
-
from typing_extensions import TypedDict #
|
|
54
|
+
from typing_extensions import TypedDict # pragma: no cover
|
|
55
55
|
|
|
56
56
|
if TYPE_CHECKING:
|
|
57
57
|
from agent_framework import (
|
|
@@ -94,7 +94,7 @@ class FoundryAgentOptions(OpenAIChatOptions, total=False):
|
|
|
94
94
|
Keyword Args:
|
|
95
95
|
extra_body: Additional request body values sent to the Responses API.
|
|
96
96
|
isolation_key: Isolation key used when lazily creating a hosted-agent
|
|
97
|
-
session through
|
|
97
|
+
session through the project's agent operations.
|
|
98
98
|
"""
|
|
99
99
|
|
|
100
100
|
extra_body: dict[str, Any]
|
|
@@ -145,7 +145,7 @@ def _build_agent_reference(agent_name: str, agent_version: str | None) -> dict[s
|
|
|
145
145
|
return ref
|
|
146
146
|
|
|
147
147
|
|
|
148
|
-
class RawFoundryAgentChatClient(
|
|
148
|
+
class RawFoundryAgentChatClient(
|
|
149
149
|
RawOpenAIChatClient[FoundryAgentOptionsT],
|
|
150
150
|
Generic[FoundryAgentOptionsT],
|
|
151
151
|
):
|
|
@@ -375,13 +375,24 @@ class RawFoundryAgentChatClient( # type: ignore[misc]
|
|
|
375
375
|
|
|
376
376
|
run_options.pop("isolation_key", None)
|
|
377
377
|
|
|
378
|
-
# Strip
|
|
379
|
-
# agent
|
|
380
|
-
#
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
378
|
+
# Strip tool fields from the request body. This client always targets a pre-provisioned
|
|
379
|
+
# Foundry agent (agent_name is required), and the service rejects requests that carry both
|
|
380
|
+
# an agent reference and tool declarations with HTTP 400 "Not allowed when agent is
|
|
381
|
+
# specified." (issue #5130). The agent already owns its tool schema server-side; any
|
|
382
|
+
# FunctionTools passed here are used only for client-side dispatch by the function
|
|
383
|
+
# invocation layer. This must run on both the non-preview path (agent injected via
|
|
384
|
+
# ``agent_reference`` in extra_body) and the preview path (agent injected via the OpenAI
|
|
385
|
+
# client kwarg ``agent_name``) — both specify an agent, so neither may send tools.
|
|
386
|
+
stripped_tools = run_options.pop("tools", None)
|
|
387
|
+
run_options.pop("tool_choice", None)
|
|
388
|
+
run_options.pop("parallel_tool_calls", None)
|
|
389
|
+
if stripped_tools:
|
|
390
|
+
logger.warning(
|
|
391
|
+
"Foundry agent '%s' was provided tools, but tool declarations cannot be sent when an "
|
|
392
|
+
"agent is specified; they are omitted from the request and used only for client-side "
|
|
393
|
+
"function dispatch. Define tool schemas on the Foundry agent definition in the service.",
|
|
394
|
+
self.agent_name,
|
|
395
|
+
)
|
|
385
396
|
|
|
386
397
|
return run_options
|
|
387
398
|
|
|
@@ -481,9 +492,7 @@ class RawFoundryAgentChatClient( # type: ignore[misc]
|
|
|
481
492
|
return self.agent_version
|
|
482
493
|
if not self.allow_preview:
|
|
483
494
|
return None
|
|
484
|
-
agent_details = await cast(Any, self.project_client.beta.agents).get(
|
|
485
|
-
agent_name=self.agent_name
|
|
486
|
-
)
|
|
495
|
+
agent_details = await cast(Any, self.project_client.beta.agents).get(agent_name=self.agent_name)
|
|
487
496
|
versions_object = getattr(agent_details, "versions", None)
|
|
488
497
|
if not isinstance(versions_object, Mapping):
|
|
489
498
|
raise TypeError("Foundry agent details did not include a versions mapping.")
|
|
@@ -501,7 +510,7 @@ class RawFoundryAgentChatClient( # type: ignore[misc]
|
|
|
501
510
|
await self.project_client.close()
|
|
502
511
|
|
|
503
512
|
|
|
504
|
-
class _FoundryAgentChatClient(
|
|
513
|
+
class _FoundryAgentChatClient(
|
|
505
514
|
FunctionInvocationLayer[FoundryAgentOptionsT],
|
|
506
515
|
ChatMiddlewareLayer[FoundryAgentOptionsT],
|
|
507
516
|
ChatTelemetryLayer[FoundryAgentOptionsT],
|
|
@@ -591,7 +600,7 @@ class _FoundryAgentChatClient( # type: ignore[misc]
|
|
|
591
600
|
)
|
|
592
601
|
|
|
593
602
|
|
|
594
|
-
class RawFoundryAgent(
|
|
603
|
+
class RawFoundryAgent(
|
|
595
604
|
RawAgent[FoundryAgentOptionsT],
|
|
596
605
|
):
|
|
597
606
|
"""Raw Microsoft Foundry Agent without agent-level middleware or telemetry.
|
|
@@ -710,7 +719,7 @@ class RawFoundryAgent( # type: ignore[misc]
|
|
|
710
719
|
id=id,
|
|
711
720
|
name=name or agent_name,
|
|
712
721
|
description=description,
|
|
713
|
-
tools=tools,
|
|
722
|
+
tools=tools,
|
|
714
723
|
default_options=cast(FoundryAgentOptionsT | None, default_options),
|
|
715
724
|
context_providers=context_providers,
|
|
716
725
|
middleware=middleware,
|
|
@@ -747,15 +756,39 @@ class RawFoundryAgent( # type: ignore[misc]
|
|
|
747
756
|
if version := await self.client.get_agent_version():
|
|
748
757
|
from azure.ai.projects.models import VersionRefIndicator
|
|
749
758
|
|
|
750
|
-
create_session_kwargs["version_indicator"] = VersionRefIndicator(agent_version=version)
|
|
759
|
+
create_session_kwargs["version_indicator"] = VersionRefIndicator(agent_version=version)
|
|
760
|
+
|
|
761
|
+
session_agents = cast(Any, self.client.project_client.agents)
|
|
762
|
+
create_session = getattr(session_agents, "create_session", None)
|
|
763
|
+
if create_session is None:
|
|
764
|
+
session_agents = cast(Any, self.client.project_client.beta.agents)
|
|
765
|
+
create_session = session_agents.create_session
|
|
751
766
|
|
|
752
|
-
service_session = await
|
|
767
|
+
service_session = await create_session(**create_session_kwargs)
|
|
753
768
|
agent_session_id = getattr(service_session, "agent_session_id", None)
|
|
754
769
|
if not isinstance(agent_session_id, str) or not agent_session_id:
|
|
755
770
|
raise ValueError("Hosted Foundry session creation did not return a non-empty agent_session_id.")
|
|
756
771
|
|
|
757
772
|
return agent_session_id
|
|
758
773
|
|
|
774
|
+
async def create_conversation(self, *, session_id: str | None = None) -> AgentSession:
|
|
775
|
+
"""Create a project-level Foundry conversation session.
|
|
776
|
+
|
|
777
|
+
This creates a server-side conversation through the Foundry project's OpenAI
|
|
778
|
+
client and returns an ``AgentSession`` configured to continue that
|
|
779
|
+
conversation.
|
|
780
|
+
|
|
781
|
+
Keyword Args:
|
|
782
|
+
session_id: Optional local session ID (generated if not provided).
|
|
783
|
+
|
|
784
|
+
Returns:
|
|
785
|
+
A new ``AgentSession`` whose ``service_session_id`` is the created
|
|
786
|
+
Foundry conversation ID.
|
|
787
|
+
"""
|
|
788
|
+
client = cast(RawFoundryAgentChatClient, self.client)
|
|
789
|
+
conversation = await client.project_client.get_openai_client().conversations.create()
|
|
790
|
+
return self.get_session(service_session_id=conversation.id, session_id=session_id)
|
|
791
|
+
|
|
759
792
|
@override
|
|
760
793
|
async def _prepare_run_context(
|
|
761
794
|
self,
|
|
@@ -59,17 +59,17 @@ from agent_framework_foundry._oauth_helpers import try_parse_oauth_consent_event
|
|
|
59
59
|
from ._tools import _sanitize_foundry_response_tool # pyright: ignore[reportPrivateUsage]
|
|
60
60
|
|
|
61
61
|
if sys.version_info >= (3, 13):
|
|
62
|
-
from typing import TypeVar #
|
|
62
|
+
from typing import TypeVar # pragma: no cover
|
|
63
63
|
else:
|
|
64
|
-
from typing_extensions import TypeVar #
|
|
64
|
+
from typing_extensions import TypeVar # pragma: no cover
|
|
65
65
|
if sys.version_info >= (3, 12):
|
|
66
|
-
from typing import override #
|
|
66
|
+
from typing import override # pragma: no cover
|
|
67
67
|
else:
|
|
68
|
-
from typing_extensions import override #
|
|
68
|
+
from typing_extensions import override # pragma: no cover
|
|
69
69
|
if sys.version_info >= (3, 11):
|
|
70
|
-
from typing import TypedDict #
|
|
70
|
+
from typing import TypedDict # pragma: no cover
|
|
71
71
|
else:
|
|
72
|
-
from typing_extensions import TypedDict #
|
|
72
|
+
from typing_extensions import TypedDict # pragma: no cover
|
|
73
73
|
|
|
74
74
|
if TYPE_CHECKING:
|
|
75
75
|
from agent_framework import ChatAndFunctionMiddlewareTypes, ToolTypes
|
|
@@ -131,7 +131,7 @@ FoundryChatOptionsT = TypeVar(
|
|
|
131
131
|
FoundryChatOptions = OpenAIChatOptions
|
|
132
132
|
|
|
133
133
|
|
|
134
|
-
class RawFoundryChatClient(
|
|
134
|
+
class RawFoundryChatClient(
|
|
135
135
|
RawOpenAIChatClient[FoundryChatOptionsT],
|
|
136
136
|
Generic[FoundryChatOptionsT],
|
|
137
137
|
):
|
|
@@ -149,8 +149,8 @@ class RawFoundryChatClient( # type: ignore[misc]
|
|
|
149
149
|
for a fully-featured client with middleware, telemetry, and function invocation.
|
|
150
150
|
"""
|
|
151
151
|
|
|
152
|
-
OTEL_PROVIDER_NAME: ClassVar[str] = "azure.ai.foundry"
|
|
153
|
-
SUPPORTS_RICH_FUNCTION_OUTPUT: ClassVar[bool] = False
|
|
152
|
+
OTEL_PROVIDER_NAME: ClassVar[str] = "azure.ai.foundry"
|
|
153
|
+
SUPPORTS_RICH_FUNCTION_OUTPUT: ClassVar[bool] = False
|
|
154
154
|
|
|
155
155
|
def __init__(
|
|
156
156
|
self,
|
|
@@ -219,7 +219,7 @@ class RawFoundryChatClient( # type: ignore[misc]
|
|
|
219
219
|
raise ValueError("Azure credential is required when using project_endpoint without a project_client.")
|
|
220
220
|
project_client_kwargs: dict[str, Any] = {
|
|
221
221
|
"endpoint": project_endpoint,
|
|
222
|
-
"credential": credential,
|
|
222
|
+
"credential": credential,
|
|
223
223
|
"user_agent": get_user_agent(),
|
|
224
224
|
}
|
|
225
225
|
if allow_preview is not None:
|
|
@@ -394,7 +394,7 @@ class RawFoundryChatClient( # type: ignore[misc]
|
|
|
394
394
|
)
|
|
395
395
|
|
|
396
396
|
@staticmethod
|
|
397
|
-
def get_web_search_tool(
|
|
397
|
+
def get_web_search_tool(
|
|
398
398
|
*,
|
|
399
399
|
user_location: dict[str, str] | None = None,
|
|
400
400
|
search_context_size: Literal["low", "medium", "high"] | None = None,
|
|
@@ -581,7 +581,7 @@ class RawFoundryChatClient( # type: ignore[misc]
|
|
|
581
581
|
)
|
|
582
582
|
|
|
583
583
|
@staticmethod
|
|
584
|
-
def get_image_generation_tool(
|
|
584
|
+
def get_image_generation_tool(
|
|
585
585
|
*,
|
|
586
586
|
model: Literal["gpt-image-1"] | str | None = None,
|
|
587
587
|
size: Literal["1024x1024", "1024x1536", "1536x1024", "auto"] | None = None,
|
|
@@ -609,8 +609,8 @@ class RawFoundryChatClient( # type: ignore[misc]
|
|
|
609
609
|
Returns:
|
|
610
610
|
An ImageGenTool ready to pass to an Agent.
|
|
611
611
|
"""
|
|
612
|
-
return ImageGenTool(
|
|
613
|
-
model=model,
|
|
612
|
+
return ImageGenTool(
|
|
613
|
+
model=model,
|
|
614
614
|
size=size,
|
|
615
615
|
output_format=output_format,
|
|
616
616
|
quality=quality,
|
|
@@ -897,7 +897,7 @@ class RawFoundryChatClient( # type: ignore[misc]
|
|
|
897
897
|
# endregion
|
|
898
898
|
|
|
899
899
|
|
|
900
|
-
class FoundryChatClient(
|
|
900
|
+
class FoundryChatClient(
|
|
901
901
|
FunctionInvocationLayer[FoundryChatOptionsT],
|
|
902
902
|
ChatMiddlewareLayer[FoundryChatOptionsT],
|
|
903
903
|
ChatTelemetryLayer[FoundryChatOptionsT],
|
|
@@ -952,7 +952,7 @@ class FoundryChatClient( # type: ignore[misc]
|
|
|
952
952
|
)
|
|
953
953
|
"""
|
|
954
954
|
|
|
955
|
-
OTEL_PROVIDER_NAME: ClassVar[str] = "azure.ai.foundry"
|
|
955
|
+
OTEL_PROVIDER_NAME: ClassVar[str] = "azure.ai.foundry"
|
|
956
956
|
|
|
957
957
|
def __init__(
|
|
958
958
|
self,
|
|
@@ -23,9 +23,9 @@ from azure.ai.inference.models import ImageEmbeddingInput
|
|
|
23
23
|
from azure.core.credentials import AzureKeyCredential
|
|
24
24
|
|
|
25
25
|
if sys.version_info >= (3, 13):
|
|
26
|
-
from typing import TypeVar #
|
|
26
|
+
from typing import TypeVar # pragma: no cover
|
|
27
27
|
else:
|
|
28
|
-
from typing_extensions import TypeVar #
|
|
28
|
+
from typing_extensions import TypeVar # pragma: no cover
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
logger = logging.getLogger("agent_framework.foundry")
|
|
@@ -205,7 +205,7 @@ class RawFoundryEmbeddingClient(
|
|
|
205
205
|
ValueError: If model is not provided or an unsupported content type is encountered.
|
|
206
206
|
"""
|
|
207
207
|
if not values:
|
|
208
|
-
return GeneratedEmbeddings([], options=options)
|
|
208
|
+
return GeneratedEmbeddings([], options=options)
|
|
209
209
|
|
|
210
210
|
opts: dict[str, Any] = dict(options) if options else {}
|
|
211
211
|
|
|
@@ -307,7 +307,7 @@ class RawFoundryEmbeddingClient(
|
|
|
307
307
|
[embedding for embedding in embeddings if embedding is not None],
|
|
308
308
|
options=options,
|
|
309
309
|
usage=usage_details,
|
|
310
|
-
)
|
|
310
|
+
)
|
|
311
311
|
|
|
312
312
|
|
|
313
313
|
class FoundryEmbeddingClient(
|
|
@@ -363,7 +363,7 @@ class FoundryEmbeddingClient(
|
|
|
363
363
|
result = await client.get_embeddings(["hello", image])
|
|
364
364
|
"""
|
|
365
365
|
|
|
366
|
-
OTEL_PROVIDER_NAME: ClassVar[str] = "azure.ai.inference"
|
|
366
|
+
OTEL_PROVIDER_NAME: ClassVar[str] = "azure.ai.inference"
|
|
367
367
|
|
|
368
368
|
def __init__(
|
|
369
369
|
self,
|
|
@@ -541,6 +541,8 @@ def _extract_rubric_scores(sample: Any) -> list[RubricScore] | None:
|
|
|
541
541
|
if props_dict is not None and props_dict is not properties:
|
|
542
542
|
containers.append(props_dict)
|
|
543
543
|
containers.append(sample_any)
|
|
544
|
+
else:
|
|
545
|
+
containers.append(sample)
|
|
544
546
|
|
|
545
547
|
for container in containers:
|
|
546
548
|
for key in _RUBRIC_DIMENSION_KEYS:
|
|
@@ -692,8 +694,8 @@ async def _evaluate_via_responses_impl(
|
|
|
692
694
|
"""
|
|
693
695
|
eval_obj = await client.evals.create(
|
|
694
696
|
name=eval_name,
|
|
695
|
-
data_source_config={"type": "azure_ai_source", "scenario": "responses"}, # type: ignore[arg-type]
|
|
696
|
-
testing_criteria=_build_testing_criteria(evaluators, model), # type: ignore[arg-type]
|
|
697
|
+
data_source_config={"type": "azure_ai_source", "scenario": "responses"}, # type: ignore[arg-type]
|
|
698
|
+
testing_criteria=_build_testing_criteria(evaluators, model), # type: ignore[arg-type]
|
|
697
699
|
)
|
|
698
700
|
|
|
699
701
|
data_source = {
|
|
@@ -711,7 +713,7 @@ async def _evaluate_via_responses_impl(
|
|
|
711
713
|
run = await client.evals.runs.create(
|
|
712
714
|
eval_id=eval_obj.id,
|
|
713
715
|
name=f"{eval_name} Run",
|
|
714
|
-
data_source=data_source, # type: ignore[arg-type]
|
|
716
|
+
data_source=data_source, # type: ignore[arg-type]
|
|
715
717
|
)
|
|
716
718
|
|
|
717
719
|
return await _poll_eval_run(client, eval_obj.id, run.id, poll_interval, timeout, provider=provider)
|
|
@@ -926,14 +928,14 @@ class FoundryEvals:
|
|
|
926
928
|
|
|
927
929
|
eval_obj = await self._client.evals.create(
|
|
928
930
|
name=eval_name,
|
|
929
|
-
data_source_config={
|
|
931
|
+
data_source_config={
|
|
930
932
|
"type": "custom",
|
|
931
933
|
"item_schema": _build_item_schema(
|
|
932
934
|
has_context=has_context, has_ground_truth=has_ground_truth, has_tools=has_tools
|
|
933
935
|
),
|
|
934
936
|
"include_sample_schema": True,
|
|
935
937
|
},
|
|
936
|
-
testing_criteria=_build_testing_criteria( # type: ignore[arg-type]
|
|
938
|
+
testing_criteria=_build_testing_criteria( # type: ignore[arg-type]
|
|
937
939
|
evaluators,
|
|
938
940
|
self._model,
|
|
939
941
|
include_data_mapping=True,
|
|
@@ -952,7 +954,7 @@ class FoundryEvals:
|
|
|
952
954
|
run = await self._client.evals.runs.create(
|
|
953
955
|
eval_id=eval_obj.id,
|
|
954
956
|
name=f"{eval_name} Run",
|
|
955
|
-
data_source=data_source, # type: ignore[arg-type]
|
|
957
|
+
data_source=data_source, # type: ignore[arg-type]
|
|
956
958
|
)
|
|
957
959
|
|
|
958
960
|
return await _poll_eval_run(
|
|
@@ -1048,14 +1050,14 @@ async def evaluate_traces(
|
|
|
1048
1050
|
|
|
1049
1051
|
eval_obj = await oai_client.evals.create(
|
|
1050
1052
|
name=eval_name,
|
|
1051
|
-
data_source_config={"type": "azure_ai_source", "scenario": "traces"}, # type: ignore[arg-type]
|
|
1052
|
-
testing_criteria=_build_testing_criteria(resolved_evaluators, model), # type: ignore[arg-type]
|
|
1053
|
+
data_source_config={"type": "azure_ai_source", "scenario": "traces"}, # type: ignore[arg-type]
|
|
1054
|
+
testing_criteria=_build_testing_criteria(resolved_evaluators, model), # type: ignore[arg-type]
|
|
1053
1055
|
)
|
|
1054
1056
|
|
|
1055
1057
|
run = await oai_client.evals.runs.create(
|
|
1056
1058
|
eval_id=eval_obj.id,
|
|
1057
1059
|
name=f"{eval_name} Run",
|
|
1058
|
-
data_source=trace_source, # type: ignore[arg-type]
|
|
1060
|
+
data_source=trace_source, # type: ignore[arg-type]
|
|
1059
1061
|
)
|
|
1060
1062
|
|
|
1061
1063
|
return await _poll_eval_run(oai_client, eval_obj.id, run.id, poll_interval, timeout)
|
|
@@ -1111,11 +1113,11 @@ async def evaluate_foundry_target(
|
|
|
1111
1113
|
|
|
1112
1114
|
eval_obj = await oai_client.evals.create(
|
|
1113
1115
|
name=eval_name,
|
|
1114
|
-
data_source_config={ # type: ignore[arg-type]
|
|
1116
|
+
data_source_config={ # type: ignore[arg-type]
|
|
1115
1117
|
"type": "azure_ai_source",
|
|
1116
1118
|
"scenario": "target_completions",
|
|
1117
1119
|
},
|
|
1118
|
-
testing_criteria=_build_testing_criteria(resolved_evaluators, model), # type: ignore[arg-type]
|
|
1120
|
+
testing_criteria=_build_testing_criteria(resolved_evaluators, model), # type: ignore[arg-type]
|
|
1119
1121
|
)
|
|
1120
1122
|
|
|
1121
1123
|
data_source: dict[str, Any] = {
|
|
@@ -1130,7 +1132,7 @@ async def evaluate_foundry_target(
|
|
|
1130
1132
|
run = await oai_client.evals.runs.create(
|
|
1131
1133
|
eval_id=eval_obj.id,
|
|
1132
1134
|
name=f"{eval_name} Run",
|
|
1133
|
-
data_source=data_source, # type: ignore[arg-type]
|
|
1135
|
+
data_source=data_source, # type: ignore[arg-type]
|
|
1134
1136
|
)
|
|
1135
1137
|
|
|
1136
1138
|
return await _poll_eval_run(oai_client, eval_obj.id, run.id, poll_interval, timeout)
|
|
@@ -49,7 +49,7 @@ class FoundryProjectSettings(TypedDict, total=False):
|
|
|
49
49
|
class FoundryMemoryProvider(ContextProvider):
|
|
50
50
|
"""Foundry Memory context provider using the new ContextProvider hooks pattern.
|
|
51
51
|
|
|
52
|
-
Integrates
|
|
52
|
+
Integrates Microsoft Foundry Memory Store for persistent semantic memory,
|
|
53
53
|
searching and storing memories via the Azure AI Projects SDK.
|
|
54
54
|
|
|
55
55
|
Args:
|
|
@@ -118,7 +118,7 @@ class FoundryMemoryProvider(ContextProvider):
|
|
|
118
118
|
raise ValueError("Azure credential is required when project_client is not provided.")
|
|
119
119
|
project_client_kwargs: dict[str, Any] = {
|
|
120
120
|
"endpoint": resolved_endpoint,
|
|
121
|
-
"credential": credential,
|
|
121
|
+
"credential": credential,
|
|
122
122
|
"user_agent": get_user_agent(),
|
|
123
123
|
}
|
|
124
124
|
if allow_preview is not None:
|
|
@@ -168,7 +168,7 @@ def _prepare_prompt_agent_options(
|
|
|
168
168
|
ToolChoiceAllowed,
|
|
169
169
|
ToolChoiceFunction,
|
|
170
170
|
)
|
|
171
|
-
from openai.lib._parsing._responses import (
|
|
171
|
+
from openai.lib._parsing._responses import (
|
|
172
172
|
type_to_text_format_param,
|
|
173
173
|
)
|
|
174
174
|
from pydantic import BaseModel
|
|
@@ -320,4 +320,4 @@ def _validate_mapping_tool(tool_item: Mapping[str, Any]) -> Tool:
|
|
|
320
320
|
# ``_deserialize`` is the SDK's discriminator-aware entry point. It is marked
|
|
321
321
|
# protected by convention but is the standard way to rehydrate polymorphic
|
|
322
322
|
# azure-sdk-for-python models from a raw mapping.
|
|
323
|
-
return cast("Tool", ProjectsTool._deserialize(dict(tool_item), [])) # type: ignore[no-untyped-call]
|
|
323
|
+
return cast("Tool", ProjectsTool._deserialize(dict(tool_item), [])) # type: ignore[no-untyped-call]
|
|
@@ -4,7 +4,7 @@ description = "Microsoft Foundry integrations for Microsoft Agent Framework."
|
|
|
4
4
|
authors = [{ name = "Microsoft", email = "af-support@microsoft.com"}]
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.10.2"
|
|
8
8
|
license-files = ["LICENSE"]
|
|
9
9
|
urls.homepage = "https://aka.ms/agent-framework"
|
|
10
10
|
urls.source = "https://github.com/microsoft/agent-framework/tree/main/python"
|
|
@@ -23,11 +23,11 @@ classifiers = [
|
|
|
23
23
|
"Typing :: Typed",
|
|
24
24
|
]
|
|
25
25
|
dependencies = [
|
|
26
|
-
"agent-framework-core>=1.
|
|
27
|
-
"agent-framework-openai>=1.
|
|
26
|
+
"agent-framework-core>=1.11.0,<2",
|
|
27
|
+
"agent-framework-openai>=1.10.0,<2",
|
|
28
28
|
"aiohttp>=3.9,<4",
|
|
29
29
|
"azure-ai-inference>=1.0.0b9,<1.0.0b10",
|
|
30
|
-
"azure-ai-projects>=2.2.0,<
|
|
30
|
+
"azure-ai-projects>=2.2.0,<2.4.0",
|
|
31
31
|
]
|
|
32
32
|
|
|
33
33
|
[tool.uv]
|
|
File without changes
|
{agent_framework_foundry-1.8.2 → agent_framework_foundry-1.10.2}/agent_framework_foundry/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{agent_framework_foundry-1.8.2 → agent_framework_foundry-1.10.2}/agent_framework_foundry/_tools.py
RENAMED
|
File without changes
|