Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AI] [Projects] Add fabric skill to Agents SDK #38570

Open
wants to merge 158 commits into
base: feature/azure-ai-projects-b2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
158 commits
Select commit Hold shift + click to select a range
e119c2d
First version of client with endpoint operations
dargilco Sep 25, 2024
5edce71
Make Endpoints sample work
dargilco Sep 25, 2024
7f17e49
Create EndpointProperties class. Implement client.endpoints.get_default
dargilco Sep 26, 2024
f41ae25
Support AzureAIClient.from_connection_string()
dargilco Sep 26, 2024
ee2aad6
Make default input argument for .endpoints.get
dargilco Sep 26, 2024
1619243
Re-emit from latest TypeSpec. First attempt to support 3 different en…
dargilco Oct 3, 2024
5b9ecad
Fix construction of the three endpoints
dargilco Oct 3, 2024
8d33253
Re-emit from TypeSpec. Rename host_name to endpoint
dargilco Oct 3, 2024
4640714
Bug fix
dargilco Oct 3, 2024
9fdbccb
Add methods ai_client.inference.get_chat_completions_client() and ai_…
dargilco Oct 4, 2024
a719078
Merge remote-tracking branch 'origin/main' into dargilco/azure-ai-client
dargilco Oct 4, 2024
b1a9215
Adding sample and changing client name (#37724)
singankit Oct 4, 2024
6b53fc6
Add .inference.get_embeddings_client() method
dargilco Oct 5, 2024
3043ab1
Jhakulin/azure ai client agents (#37748)
jhakulin Oct 7, 2024
dfbcb3c
Merge remote-tracking branch 'origin/main' into dargilco/azure-ai-client
dargilco Oct 7, 2024
f237671
Create seperate inference samples
dargilco Oct 8, 2024
367f88b
Move SASTokenCredential into .models
dargilco Oct 8, 2024
7bcf705
Add more agents samples (#37777)
jhakulin Oct 8, 2024
ae5a0af
Update _patch.py (#37760)
singankit Oct 8, 2024
b540375
Online Evaluation changes (#37794)
singankit Oct 8, 2024
72cadc3
Patch constructor for async AzureAIClient (#37804)
dargilco Oct 9, 2024
8805675
Merge remote-tracking branch 'origin/main' into dargilco/azure-ai-client
dargilco Oct 9, 2024
8935a4d
Users/singankit/evaluation add data mapping (#37824)
singankit Oct 9, 2024
c4d3540
Fix .inference.get_azure_openai_client() for the async AzureAIClient …
dargilco Oct 10, 2024
a0d1232
Merge remote-tracking branch 'origin/main' into dargilco/azure-ai-client
dargilco Oct 10, 2024
37405e0
migrate async, poll functions, and samples from assistant to agent (#…
howieleung Oct 10, 2024
b2fa08e
[AI Client] adapt Sophia's assistant tests to client repo (#37819)
glharper Oct 11, 2024
1eea304
Took out streaming from create_run, create_and_process_run, and submi…
howieleung Oct 11, 2024
e204002
Miscellaneous updates (#37852)
dargilco Oct 11, 2024
d9f5c3a
Jhakulin/azure ai client pylance (#37887)
jhakulin Oct 14, 2024
d8d3a16
Use List instead of Sequence and fixed samples (#37898)
howieleung Oct 15, 2024
3bf1321
Merge remote-tracking branch 'origin/main' into dargilco/azure-ai-client
dargilco Oct 15, 2024
e672df7
fixed warning for aio and get call function tools for stream within t…
howieleung Oct 16, 2024
e231bc5
Evaluation API Review Feedback (#37915)
singankit Oct 16, 2024
a0db3a8
Fixed poll while loop and sample (#37922)
howieleung Oct 16, 2024
5e48c75
Jhakulin/azure ai client agents updates2 (#37937)
jhakulin Oct 16, 2024
ea5cf16
Merge remote-tracking branch 'origin/main' into dargilco/azure-ai-client
dargilco Oct 17, 2024
4b38a6f
create_vector_store_file_batch_and_poll + samples and update aio usin…
howieleung Oct 17, 2024
0b2a410
Clean up on the Optional (#37971)
howieleung Oct 17, 2024
306cb0e
Switch from .endpoints to .connection (re-emit from latest TypeSpec)
dargilco Oct 18, 2024
879ffe8
updates and minor fixes (#37984)
jhakulin Oct 18, 2024
f3aa098
Clean up (#37985)
howieleung Oct 18, 2024
e69d662
Rename connection string environment variables
dargilco Oct 18, 2024
715c96e
updated codeinterpreter attachment sample (#37990)
jhakulin Oct 18, 2024
7fa5125
Filter parameters, returned by SSE event (#37991)
nick863 Oct 18, 2024
ecd9d80
Evaluation data set id change revert (#38007)
singankit Oct 21, 2024
7cc54a7
Updates to .connection operators (#38024)
dargilco Oct 22, 2024
065849b
Users/singankit/ai project utils (#38033)
singankit Oct 22, 2024
325b965
Merge remote-tracking branch 'origin/main' into dargilco/azure-ai-client
dargilco Oct 22, 2024
99e8ecd
First emit of azure-ai-project (_patch.py, samples and test not yet c…
dargilco Oct 22, 2024
6b38bd9
Copy _patch.py, samples, test, update names
dargilco Oct 22, 2024
a8fe986
Fix wrong import
dargilco Oct 22, 2024
78e6894
M hietala/agent tools updates (#38031)
M-Hietala Oct 22, 2024
5eae9e6
add changes to latest typespec and ai-project changes (#38051)
saikmicro Oct 23, 2024
1282a64
Move agents test to agents folder (#38055)
nick863 Oct 23, 2024
4e950c7
Prep for connection tests. (#38060)
dargilco Oct 23, 2024
6e50ef0
Merge remote-tracking branch 'origin/main' into dargilco/azure-ai-client
dargilco Oct 23, 2024
dfbaaf5
Create azure-ai-projects folder
dargilco Oct 23, 2024
0f9dc5c
Add Inference tests (#38069)
dargilco Oct 24, 2024
01eafd6
re-doing the agent toolu updates after package changes (#38078)
M-Hietala Oct 24, 2024
216258c
Add .diagnostics.enable() method to fetch App Insights connection str…
dargilco Oct 26, 2024
46e18c3
Merge remote-tracking branch 'origin/main' into dargilco/azure-ai-client
dargilco Oct 28, 2024
557f406
Users/singankit/evaluation async samples (#38104)
singankit Oct 28, 2024
cdc3ffb
Fix sphinx docstring and cSpell (#38125)
nick863 Oct 28, 2024
f9967f6
Disable evaluation schedule and remove sampling rate (#38161)
saikmicro Oct 29, 2024
f780407
Add tests for Connection operations (#38156)
dargilco Oct 29, 2024
222a07d
update to get file content (#38165)
jhakulin Oct 29, 2024
83dbacf
Jhakulin/parse messages (#38167)
jhakulin Oct 29, 2024
b5744a7
Update README.md (#38173)
howieleung Oct 30, 2024
42a4c8e
update to get file content (#38192)
jhakulin Oct 30, 2024
147e7fa
Enable tracing (#38185)
dargilco Oct 30, 2024
3ed16a7
added validation to tools and tools_resources, added update agent (#3…
howieleung Oct 30, 2024
a395f29
Rename `.diagnostics` to `.telemetry` (#38209)
dargilco Oct 30, 2024
e659c51
Jhakulin/agents get file content async (#38201)
jhakulin Oct 30, 2024
5b4b1b9
Fixed test (#38222)
howieleung Oct 31, 2024
5445d74
Support the new unified models deployed to the AIServices connection
dargilco Oct 31, 2024
9f9b12f
Fixed validation to put AyncFunctionTool into ToolSet and FunctionToo…
howieleung Oct 31, 2024
595ec6d
adding ai agents instrumentor (#38200)
M-Hietala Oct 31, 2024
6c3da41
Jhakulin/user functions updates (#38248)
jhakulin Oct 31, 2024
40f27f1
Connections & Inference test updates to support new unified models
dargilco Nov 1, 2024
a73fd8b
Improve tracing samples and add docs on telemetry.enable (#38257)
lmolkova Nov 1, 2024
59a3228
Jhakulin/user functions optional (#38261)
jhakulin Nov 1, 2024
99b5b9f
adding content recording control to agents instrumentor api (#38268)
M-Hietala Nov 4, 2024
139ca5d
Howie/save file test (#38306)
howieleung Nov 4, 2024
904c9ef
Mypy fixes for instrumentor (#38302)
nick863 Nov 4, 2024
b8ba93e
Fix handling of SAS token and fix mypy (#38312)
nick863 Nov 4, 2024
a1b6f46
Glharper/ai client new tools (#38202)
glharper Nov 4, 2024
e3a2600
Merge remote-tracking branch 'origin/main' into dargilco/azure-ai-client
dargilco Nov 5, 2024
9328ea6
Merge remote-tracking branch 'origin/main' into dargilco/azure-ai-client
dargilco Nov 5, 2024
4cc537c
Use 'Union' insted of '|' to make it run on Pyton 3.8 and up (#38344)
dargilco Nov 5, 2024
3085358
Fix mypy issues and re generate the code. (#38340)
nick863 Nov 6, 2024
8b6e88f
Use DefaultAzureCredential from azure.identity.aio for async samples …
dargilco Nov 6, 2024
eadeb59
Rename AAD to ENTRA_ID (#38363)
dargilco Nov 6, 2024
cab8379
added agents example section in readme and added tags to samples (#38…
howieleung Nov 7, 2024
a4f0b1d
Fix mypy and do not scan examples (#38375)
nick863 Nov 7, 2024
0fe5ad8
Connections APIs throw instead of returning None if a connection name…
dargilco Nov 7, 2024
2c28298
Add code interpreter file attachment sample and link to readme. Add…
howieleung Nov 7, 2024
b27a145
Merge remote-tracking branch 'origin/main' into feature/azure-ai-proj…
dargilco Nov 7, 2024
f867954
Fix broken async .telemetry.enable() method, when you don't pass in "…
dargilco Nov 7, 2024
50f8aa1
Sample for thread with resource and document it in readme (#38393)
howieleung Nov 7, 2024
e8e8677
Users/singankit/evaluation test (#38402)
singankit Nov 7, 2024
4479f12
Update how the inference URL is constructed (#38409)
dargilco Nov 8, 2024
c88ab42
Merge remote-tracking branch 'origin/main' into feature/azure-ai-proj…
dargilco Nov 8, 2024
60ada67
Fix some cspell errors, and link errors (#38420)
dargilco Nov 8, 2024
75a5354
cspell lint --config .vscode/cspell.json --no-summary "sdk/ai/azure-a…
dargilco Nov 8, 2024
267c0f7
Resolved comments from Krista (#38405)
howieleung Nov 8, 2024
db34c99
Add support of Azure asset IDs for the vector store. (#38066)
nick863 Nov 8, 2024
3e48384
Fix PR comment by Krista on async credential in ConnectionProperties …
dargilco Nov 8, 2024
ad6cddf
Black
dargilco Nov 8, 2024
1722934
User/singankit/evaluation spellcheck (#38427)
singankit Nov 8, 2024
f4eb82b
Fix doc string errors
dargilco Nov 8, 2024
c6edff5
Fix typing in samples (#38354)
nick863 Nov 8, 2024
131554f
Run "black" (again)
dargilco Nov 8, 2024
0008861
Fix a few pyright errors, and address a comment in the Python PR (#38…
dargilco Nov 9, 2024
5762680
Merge remote-tracking branch 'origin/main' into feature/azure-ai-proj…
dargilco Nov 11, 2024
9369a5d
Address some of Krista's PR comments (#38444)
dargilco Nov 11, 2024
2a7d1eb
sdk changes for name change for provisioning state and isEnabled onli…
saikmicro Nov 11, 2024
b31889f
azure-ai-projects: configure otel logging in telemetry.enable() helpe…
lmolkova Nov 11, 2024
a204c17
[ai] fix(pylint): Resolve `W1309`, `W0107`, `W0707`, `R1705`, `W0401`…
kdestin Nov 11, 2024
4ae547e
Add readme for get_message, save_file, get_file_content, tracing, Bin…
howieleung Nov 11, 2024
7a1de64
More fixes to mypy (#38446)
nick863 Nov 11, 2024
d920d44
agents telemetry pyright fixes (#38457)
M-Hietala Nov 11, 2024
7a66f7e
Fix pyright for agents. (#38464)
nick863 Nov 12, 2024
a629bfa
fix pip install instruction (#38480)
glharper Nov 12, 2024
80f7311
[ai] fix(pylint): Resolve `C0301`, `C4739`, `C4740`, `C4741`, `C4742`…
kdestin Nov 12, 2024
78d345d
Enable test recordings for tests\inference, tests\telemetry and tests…
dargilco Nov 12, 2024
fc77caa
Update cspell.json
dargilco Nov 12, 2024
90e27d4
Removed enterprise and add installation for tracing (#38483)
howieleung Nov 12, 2024
a06c0cc
Fix mypy errors (#38487)
dargilco Nov 12, 2024
6573482
Merge remote-tracking branch 'origin/main' into feature/azure-ai-proj…
dargilco Nov 12, 2024
4cd7be7
Run black --config ../../../eng/black-pyproject.toml
dargilco Nov 12, 2024
fb046e2
agents tracing pylint fixes (#38496)
M-Hietala Nov 12, 2024
723c59b
Remove premature adding of asserts.json file
dargilco Nov 12, 2024
b0ec1ed
[ai] fix(pylint): Resolving remaining pylint errors (#38500)
kdestin Nov 13, 2024
64fadfe
Disable all agents tests. Push recordings for all other tests to the …
dargilco Nov 13, 2024
6465546
run "black --config ../../../eng/black-pyproject.toml ."
dargilco Nov 13, 2024
b210645
Fix pylint and new mypy issues (#38503)
nick863 Nov 13, 2024
e807234
Merge remote-tracking branch 'origin/main' into feature/azure-ai-proj…
dargilco Nov 13, 2024
bc0c788
Remove async from .telemetry.enable (#38514)
dargilco Nov 13, 2024
fad94f9
Fix pylint
dargilco Nov 13, 2024
f6dc205
Rename `with_credentials` to `include_credentials` per apiview.dev re…
dargilco Nov 13, 2024
4e018c4
Try to fix test issues on Python 3.13. Run black
dargilco Nov 13, 2024
5fe839c
Try again to fix Python 3.13 test failure
dargilco Nov 13, 2024
355e68b
Attempt to fix azure-ai-projects not showing up in the release pipeline
dargilco Nov 13, 2024
83a4fa5
Fix release date in CHANGELOG.md
dargilco Nov 13, 2024
a201c19
Fix CHANGELOG.md
dargilco Nov 13, 2024
2c084bf
README update. Address PR review comment
dargilco Nov 14, 2024
471053c
Update code snippets in pacakge README.md
dargilco Nov 14, 2024
2364c3f
More README.md fixes
dargilco Nov 14, 2024
65f2979
More
dargilco Nov 14, 2024
9e459d9
Update tests README.md
dargilco Nov 14, 2024
b686218
Merge branch 'feature/azure-ai-projects-beta2' of https://github.com/…
dargilco Nov 14, 2024
5ed9727
Merge remote-tracking branch 'origin/main' into feature/azure-ai-proj…
dargilco Nov 14, 2024
42bbb8e
Merge remote-tracking branch 'origin/main' into feature/azure-ai-proj…
dargilco Nov 14, 2024
4a69706
add sharepoint sample, update Azure AI search constructor
glharper Nov 15, 2024
1092c17
update fabric skill with new TypeSpec
glharper Nov 15, 2024
5d1e38c
add fabric tool def and sample
glharper Nov 15, 2024
5661759
Merge branch 'feature/azure-ai-projects-b2' into glharper/agent_tool_…
glharper Nov 15, 2024
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
4 changes: 2 additions & 2 deletions sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class AgentsNamedToolChoiceType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Tool type ``file_search``"""
BING_GROUNDING = "bing_grounding"
"""Tool type ``bing_grounding``"""
MICROSOFT_FABRIC = "microsoft_fabric"
"""Tool type ``microsoft_fabric``"""
MICROSOFT_FABRIC = "fabric_aiskill"
"""Tool type ``fabric_aiskill``"""
SHAREPOINT = "sharepoint_grounding"
"""Tool type ``sharepoint_grounding``"""
AZURE_AI_SEARCH = "azure_ai_search"
Expand Down
46 changes: 23 additions & 23 deletions sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class AgentsNamedToolChoice(_model_base.Model):

:ivar type: the type of tool. If type is ``function``\\ , the function name must be set.
Required. Known values are: "function", "code_interpreter", "file_search", "bing_grounding",
"microsoft_fabric", "sharepoint_grounding", and "azure_ai_search".
"fabric_aiskill", "sharepoint_grounding", and "azure_ai_search".
:vartype type: str or ~azure.ai.projects.models.AgentsNamedToolChoiceType
:ivar function: The name of the function to call.
:vartype function: ~azure.ai.projects.models.FunctionName
Expand All @@ -232,7 +232,7 @@ class AgentsNamedToolChoice(_model_base.Model):
type: Union[str, "_models.AgentsNamedToolChoiceType"] = rest_field()
"""the type of tool. If type is ``function``, the function name must be set. Required. Known
values are: \"function\", \"code_interpreter\", \"file_search\", \"bing_grounding\",
\"microsoft_fabric\", \"sharepoint_grounding\", and \"azure_ai_search\"."""
\"fabric_aiskill\", \"sharepoint_grounding\", and \"azure_ai_search\"."""
function: Optional["_models.FunctionName"] = rest_field()
"""The name of the function to call."""

Expand Down Expand Up @@ -2410,28 +2410,28 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)


class MicrosoftFabricToolDefinition(ToolDefinition, discriminator="microsoft_fabric"):
class MicrosoftFabricToolDefinition(ToolDefinition, discriminator="fabric_aiskill"):
"""The input definition information for a Microsoft Fabric tool as used to configure an agent.


:ivar type: The object type, which is always 'microsoft_fabric'. Required. Default value is
"microsoft_fabric".
:ivar type: The object type, which is always 'fabric_aiskill'. Required. Default value is
"fabric_aiskill".
:vartype type: str
:ivar microsoft_fabric: The list of connections used by the Microsoft Fabric tool. Required.
:vartype microsoft_fabric: ~azure.ai.projects.models.ToolConnectionList
:ivar fabric_aiskill: The list of connections used by the Microsoft Fabric tool. Required.
:vartype fabric_aiskill: ~azure.ai.projects.models.ToolConnectionList
"""

type: Literal["microsoft_fabric"] = rest_discriminator(name="type") # type: ignore
"""The object type, which is always 'microsoft_fabric'. Required. Default value is
\"microsoft_fabric\"."""
microsoft_fabric: "_models.ToolConnectionList" = rest_field()
type: Literal["fabric_aiskill"] = rest_discriminator(name="type") # type: ignore
"""The object type, which is always 'fabric_aiskill'. Required. Default value is
\"fabric_aiskill\"."""
fabric_aiskill: "_models.ToolConnectionList" = rest_field()
"""The list of connections used by the Microsoft Fabric tool. Required."""

@overload
def __init__(
self,
*,
microsoft_fabric: "_models.ToolConnectionList",
fabric_aiskill: "_models.ToolConnectionList",
) -> None: ...

@overload
Expand All @@ -2442,7 +2442,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None:
"""

def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, type="microsoft_fabric", **kwargs)
super().__init__(*args, type="fabric_aiskill", **kwargs)


class OpenAIFile(_model_base.Model):
Expand Down Expand Up @@ -2963,7 +2963,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:


class RequiredToolCall(_model_base.Model):
"""An abstract representation a a tool invocation needed by the model to continue a run.
"""An abstract representation of a tool invocation needed by the model to continue a run.

You probably want to use the sub-classes and not this class directly. Known sub-classes are:
RequiredFunctionToolCall
Expand Down Expand Up @@ -4498,7 +4498,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)


class RunStepMicrosoftFabricToolCall(RunStepToolCall, discriminator="microsoft_fabric"):
class RunStepMicrosoftFabricToolCall(RunStepToolCall, discriminator="fabric_aiskill"):
"""A record of a call to a Microsoft Fabric tool, issued by the model in evaluation of a defined
tool, that represents
executed Microsoft Fabric operations.
Expand All @@ -4507,17 +4507,17 @@ class RunStepMicrosoftFabricToolCall(RunStepToolCall, discriminator="microsoft_f
:ivar id: The ID of the tool call. This ID must be referenced when you submit tool outputs.
Required.
:vartype id: str
:ivar type: The object type, which is always 'microsoft_fabric'. Required. Default value is
"microsoft_fabric".
:ivar type: The object type, which is always 'fabric_aiskill'. Required. Default value is
"fabric_aiskill".
:vartype type: str
:ivar microsoft_fabric: Reserved for future use. Required.
:vartype microsoft_fabric: dict[str, str]
"""

type: Literal["microsoft_fabric"] = rest_discriminator(name="type") # type: ignore
"""The object type, which is always 'microsoft_fabric'. Required. Default value is
\"microsoft_fabric\"."""
microsoft_fabric: Dict[str, str] = rest_field()
type: Literal["fabric_aiskill"] = rest_discriminator(name="type") # type: ignore
"""The object type, which is always 'fabric_aiskill'. Required. Default value is
\"fabric_aiskill\"."""
microsoft_fabric: Dict[str, str] = rest_field(name="fabric_aiskill")
"""Reserved for future use. Required."""

@overload
Expand All @@ -4536,7 +4536,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None:
"""

def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, type="microsoft_fabric", **kwargs)
super().__init__(*args, type="fabric_aiskill", **kwargs)


class RunStepSharepointToolCall(RunStepToolCall, discriminator="sharepoint_grounding"):
Expand Down Expand Up @@ -5198,7 +5198,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:

class ToolConnectionList(_model_base.Model):
"""A set of connection resources currently used by either the ``bing_grounding``\\ ,
``microsoft_fabric``\\ , or ``sharepoint_grounding`` tools.
``fabric_aiskill``\\ , or ``sharepoint_grounding`` tools.

:ivar connection_list: The connections attached to this tool. There can be a maximum of 1
connection
Expand Down
39 changes: 24 additions & 15 deletions sdk/ai/azure-ai-projects/azure/ai/projects/models/_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
MessageTextContent,
MessageTextFileCitationAnnotation,
MessageTextFilePathAnnotation,
MicrosoftFabricToolDefinition,
OpenAIPageableListOfThreadMessage,
RequiredFunctionToolCall,
RunStep,
Expand Down Expand Up @@ -510,25 +511,15 @@ class AzureAISearchTool(Tool):
A tool that searches for information using Azure AI Search.
"""

def __init__(self):
self.index_list = []

def add_index(self, index: str, name: str):
"""
Add an index ID to the list of indices used to search.

:param str index: The index connection id.
:param str name: The index name.
"""
# TODO
self.index_list.append(IndexResource(index_connection_id=index, index_name=name))
def __init__(self, index_connection_id: str, index_name: str):
self.index_list = [IndexResource(index_connection_id=index_connection_id, index_name=index_name)]

@property
def definitions(self) -> List[ToolDefinition]:
"""
Get the Azure AI search tool definitions.

:rtype: List[ToolDefinition]
:return: A list of tool definitions.
"""
return [AzureAISearchToolDefinition()]

Expand All @@ -537,13 +528,16 @@ def resources(self) -> ToolResources:
"""
Get the Azure AI search resources.

:rtype: ToolResources
:return: ToolResources populated with azure_ai_search associated resources.
"""
return ToolResources(azure_ai_search=AzureAISearchResource(index_list=self.index_list))

def execute(self, tool_call: Any) -> Any:
pass
"""
AI Search tool does not execute client-side.
"""

pass

class ConnectionTool(Tool):
"""
Expand Down Expand Up @@ -587,6 +581,20 @@ def definitions(self) -> List[ToolDefinition]:
return [BingGroundingToolDefinition(bing_grounding=ToolConnectionList(connection_list=self.connection_ids))]


class FabricTool(ConnectionTool):
"""
A tool that searches for information using Microsoft Fabric.
"""

@property
def definitions(self) -> List[ToolDefinition]:
"""
Get the Microsoft Fabric tool definitions.

:rtype: List[ToolDefinition]
"""
return [MicrosoftFabricToolDefinition(fabric_aiskill=ToolConnectionList(connection_list=self.connection_ids))]

class SharepointTool(ConnectionTool):
"""
A tool that searches for information using Sharepoint.
Expand Down Expand Up @@ -1432,6 +1440,7 @@ def get_last_text_message_by_sender(self, sender: str) -> Optional[MessageTextCo
"FunctionTool",
"BingGroundingTool",
"SharepointTool",
"FabricTool",
"AzureAISearchTool",
"SASTokenCredential",
"Tool",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
DESCRIPTION:
This sample demonstrates how to use agent operations with the
Azure AI Search tool from the Azure Agents service using a synchronous client.
To learn how to set up an Azure AI Search resource,
visit https://learn.microsoft.com/azure/search/search-get-started-portal

USAGE:
python sample_agents_azure_ai_search.py
Expand Down Expand Up @@ -36,30 +38,18 @@
conn_str=os.environ["PROJECT_CONNECTION_STRING"],
)

# [START create_agent_with_azure_ai_search_tool]
conn_list = project_client.connections.list()
conn_id = ""
for conn in conn_list:
if conn.connection_type == "CognitiveSearch":
conn_id = conn.id
break

print(conn_id)

# Initialize agent AI search tool and add the search index connection id
ai_search = AzureAISearchTool()
ai_search.add_index(conn_id, "sample_index")
ai_search = AzureAISearchTool(index_connection_id="myconnectionid", index_name="myindexname")

# Create agent with AI search tool and process assistant run
with project_client:
agent = project_client.agents.create_agent(
model="gpt-4-1106-preview",
model="gpt-4o",
name="my-assistant",
instructions="You are a helpful assistant",
tools=ai_search.definitions,
headers={"x-ms-enable-preview": "true"},
)
# [END create_agent_with_azure_ai_search_tool]
print(f"Created agent, ID: {agent.id}")

# Create thread for communication
Expand All @@ -70,7 +60,7 @@
message = project_client.agents.create_message(
thread_id=thread.id,
role="user",
content="Hello, send an email with the datetime and weather information in New York?",
content="What inventory is available currently?",
)
print(f"Created message, ID: {message.id}")

Expand Down
80 changes: 80 additions & 0 deletions sdk/ai/azure-ai-projects/samples/agents/sample_agents_fabric.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------

"""
FILE: sample_agents_fabric.py

DESCRIPTION:
This sample demonstrates how to use agent operations with the Microsoft Fabric grounding tool from
the Azure Agents service using a synchronous client.

USAGE:
python sample_agents_fabric.py

Before running the sample:

pip install azure-ai-projects azure-identity

Set this environment variables with your own values:
PROJECT_CONNECTION_STRING - the Azure AI Project connection string, as found in your AI Studio Project.
"""

import os
from azure.ai.projects import AIProjectClient
from azure.identity import DefaultAzureCredential
from azure.ai.projects.models import FabricTool


# Create an Azure AI Client from a connection string, copied from your AI Studio project.
# At the moment, it should be in the format "<HostName>;<AzureSubscriptionId>;<ResourceGroup>;<HubName>"
# Customer needs to login to Azure subscription via Azure CLI and set the environment variables

project_client = AIProjectClient.from_connection_string(
credential=DefaultAzureCredential(),
conn_str=os.environ["PROJECT_CONNECTION_STRING"],
)

conn_id = "your-connection-id"

# Initialize agent fabric tool and add the connection id
fabric = FabricTool(connection_id=conn_id)

# Create agent with the fabric tool and process assistant run
with project_client:
agent = project_client.agents.create_agent(
model="gpt-4o",
name="my-assistant",
instructions="You are a helpful assistant",
tools=fabric.definitions,
headers={"x-ms-enable-preview": "true"},
)
print(f"Created agent, ID: {agent.id}")

# Create thread for communication
thread = project_client.agents.create_thread()
print(f"Created thread, ID: {thread.id}")

# Create message to thread
message = project_client.agents.create_message(
thread_id=thread.id,
role="user",
content="How does wikipedia explain Euler's Identity?",
)
print(f"Created message, ID: {message.id}")

# Create and process agent run in thread with tools
run = project_client.agents.create_and_process_run(thread_id=thread.id, assistant_id=agent.id)
print(f"Run finished with status: {run.status}")

if run.status == "failed":
print(f"Run failed: {run.last_error}")

# Delete the assistant when done
project_client.agents.delete_agent(agent.id)
print("Deleted agent")

# Fetch and log all messages
messages = project_client.agents.list_messages(thread_id=thread.id)
print(f"Messages: {messages}")
Loading
Loading