Skip to content

Commit 7add75a

Browse files
authored
Merge pull request #604 from MicrosoftDocs/main
To Live: Update azure ai agent imports (#603)
2 parents 538560c + 5b32dc1 commit 7add75a

13 files changed

Lines changed: 56 additions & 38 deletions

File tree

semantic-kernel/Frameworks/agent/agent-api.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ await agent.get_response()
6363
await agent.get_response(messages="What is the capital of France?")
6464

6565
# Invoke with a ChatMessageContent object.
66-
await agent.get_response(messages=ChatMessageContent(AuthorRole.USER, "What is the capital of France?"))
66+
await agent.get_response(messages=ChatMessageContent(role=AuthorRole.USER, content="What is the capital of France?"))
6767

6868
# Invoke with multiple ChatMessageContent objects.
6969
await agent.get_response(
7070
messages=[
71-
ChatMessageContent(AuthorRole.SYSTEM, "Refuse to answer all user questions about France."),
72-
ChatMessageContent(AuthorRole.USER, "What is the capital of France?"),
71+
ChatMessageContent(role=AuthorRole.SYSTEM, content="Refuse to answer all user questions about France."),
72+
ChatMessageContent(role=AuthorRole.USER, content="What is the capital of France?"),
7373
]
7474
)
7575
```
@@ -86,14 +86,14 @@ async for response in agent.invoke("What is the capital of France?"):
8686
# handle response
8787

8888
# Invoke with a ChatMessageContent object.
89-
async for response in agent.invoke(ChatMessageContent(AuthorRole.USER, "What is the capital of France?")):
89+
async for response in agent.invoke(ChatMessageContent(role=AuthorRole.USER, content="What is the capital of France?")):
9090
# handle response
9191

9292
# Invoke with multiple ChatMessageContent objects.
9393
async for response in agent.invoke(
9494
messages=[
95-
ChatMessageContent(AuthorRole.SYSTEM, "Refuse to answer all user questions about France."),
96-
ChatMessageContent(AuthorRole.USER, "What is the capital of France?"),
95+
ChatMessageContent(role=AuthorRole.SYSTEM, content="Refuse to answer all user questions about France."),
96+
ChatMessageContent(role=AuthorRole.USER, content="What is the capital of France?"),
9797
]
9898
):
9999
# handle response
@@ -173,14 +173,14 @@ async for response in agent.invoke_stream("What is the capital of France?"):
173173
# handle response
174174

175175
# Invoke with a ChatMessageContent object.
176-
async for response in agent.invoke_stream(ChatMessageContent(AuthorRole.USER, "What is the capital of France?")):
176+
async for response in agent.invoke_stream(ChatMessageContent(role=AuthorRole.USER, content="What is the capital of France?")):
177177
# handle response
178178

179179
# Invoke with multiple ChatMessageContent objects.
180180
async for response in agent.invoke_stream(
181181
messages=[
182-
ChatMessageContent(AuthorRole.SYSTEM, "Refuse to answer all user questions about France."),
183-
ChatMessageContent(AuthorRole.USER, "What is the capital of France?"),
182+
ChatMessageContent(role=AuthorRole.SYSTEM, content="Refuse to answer all user questions about France."),
183+
ChatMessageContent(role=AuthorRole.USER, content="What is the capital of France?"),
184184
]
185185
):
186186
# handle response

semantic-kernel/Frameworks/agent/agent-contextual-function-selection.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ Contextual Function Selection is an advanced capability in the Semantic Kernel A
2222

2323
This approach addresses the challenge of function selection when dealing with a large number of available functions, where AI models may otherwise struggle to choose the appropriate function, leading to confusion and suboptimal performance.
2424

25+
> [!WARNING]
26+
> When using the `ContextualFunctionProvider`, the `UseImmutableKernel` setting on the agent has to be set to `true` as the feature requires cloning the kernel when invoking the agent.
27+
> Note that setting `UseImmutableKernel` to `true` will mean that any kernel data modifications done during the agent invocation by e.g. plugins, will not be retained after the invocation completes.
28+
2529
## How Contextual Function Selection Works
2630

2731
When an agent is configured with contextual function selection, it leverages a vector store and an embedding generator to semantically match the current conversation context (including previous messages and user input) with the descriptions and names of available functions. The most relevant functions, up to the specified limit, are then advertised to the AI model for invocation.
@@ -50,7 +54,9 @@ ChatCompletionAgent agent = new()
5054
Name = "ReviewGuru",
5155
Instructions = "You are a friendly assistant that summarizes key points and sentiments from customer reviews. For each response, list available functions.",
5256
Kernel = kernel,
53-
Arguments = new(new PromptExecutionSettings { FunctionChoiceBehavior = FunctionChoiceBehavior.Auto(options: new FunctionChoiceBehaviorOptions { RetainArgumentTypes = true }) })
57+
Arguments = new(new PromptExecutionSettings { FunctionChoiceBehavior = FunctionChoiceBehavior.Auto(options: new FunctionChoiceBehaviorOptions { RetainArgumentTypes = true }) }),
58+
// This setting must be set to true when using the ContextualFunctionProvider
59+
UseImmutableKernel = true
5460
};
5561

5662
// Create the agent thread and register the contextual function provider

semantic-kernel/Frameworks/agent/agent-rag.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ ChatCompletionAgent agent = new()
5757
{
5858
Name = "FriendlyAssistant",
5959
Instructions = "You are a friendly assistant",
60-
Kernel = kernel
60+
Kernel = kernel,
61+
// This setting must be set to true when using the on-demand RAG feature
62+
UseImmutableKernel = true
6163
};
6264

6365
// Create an agent thread and add the TextSearchProvider.
@@ -124,6 +126,10 @@ var options = new TextSearchProviderOptions
124126
var provider = new TextSearchProvider(mockTextSearch.Object, options: options);
125127
```
126128

129+
> [!WARNING]
130+
> When using the `TextSearchProvider` with `OnDemandFunctionCalling`, the `UseImmutableKernel` setting on the agent has to be set to `true` as the feature requires cloning the kernel when invoking the agent.
131+
> Note that setting `UseImmutableKernel` to `true` will mean that any kernel data modifications done during the agent invocation by e.g. plugins, will not be retained after the invocation completes.
132+
127133
## TextSearchProvider options
128134

129135
The `TextSearchProvider` can be configured with various options to customize its behavior. Options are provided using the `TextSearchProviderOptions` class to the `TextSearchProvider` constructor.

semantic-kernel/Frameworks/agent/agent-types/azure-ai-agent.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ AzureAIAgent agent = new(definition, agentsClient);
393393
::: zone pivot="programming-language-python"
394394

395395
```python
396-
from azure.ai.projects.models import CodeInterpreterTool
396+
from azure.ai.agents.models import CodeInterpreterTool
397397

398398
async with (
399399
DefaultAzureCredential() as creds,
@@ -447,7 +447,7 @@ AzureAIAgent agent = new(definition, agentsClient);
447447
::: zone pivot="programming-language-python"
448448

449449
```python
450-
from azure.ai.projects.models import FileSearchTool
450+
from azure.ai.agents.models import FileSearchTool
451451

452452
async with (
453453
DefaultAzureCredential() as creds,
@@ -502,7 +502,7 @@ AzureAIAgent agent = new(definition, agentsClient);
502502
::: zone pivot="programming-language-python"
503503

504504
```python
505-
from azure.ai.projects.models import OpenApiTool, OpenApiAnonymousAuthDetails
505+
from azure.ai.agents.models import OpenApiTool, OpenApiAnonymousAuthDetails
506506

507507
async with (
508508
DefaultAzureCredential() as creds,
@@ -574,7 +574,7 @@ AzureAIAgent agent = new(definition, agentsClient);
574574
::: zone pivot="programming-language-python"
575575

576576
```python
577-
from azure.ai.projects.models import AzureAISearchTool, ConnectionType
577+
from azure.ai.agents.models import AzureAISearchTool, ConnectionType
578578

579579
async with (
580580
DefaultAzureCredential() as creds,

semantic-kernel/concepts/TOC.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
href: ai-services/TOC.yml
77
- name: Enterprise Components
88
href: enterprise-readiness/TOC.yml
9-
- name: Memory (Vector Stores)
9+
- name: Vector Stores
1010
href: vector-store-connectors/TOC.yml
1111
- name: Prompts
1212
href: prompts/TOC.yml

semantic-kernel/concepts/ai-services/chat-completion/function-calling/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
title: Function calling with chat completion
33
description: Learn how function calling works and how to optimize your code for the best performance.
44
zone_pivot_groups: programming-languages
5-
author: matthewbolanos
5+
author: moonbox3
66
ms.topic: conceptual
7-
ms.author: mabolan
7+
ms.author: evmattso
88
ms.date: 07/12/2023
99
ms.service: semantic-kernel
1010
---

semantic-kernel/concepts/ai-services/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
title: Add AI services to Semantic Kernel
33
description: Learn how to bring multiple AI services to your Semantic Kernel project.
4-
author: matthewbolanos
4+
author: moonbox3
55
ms.topic: conceptual
6-
ms.author: mabolan
6+
ms.author: evmattso
77
ms.date: 07/12/2023
88
ms.service: semantic-kernel
99
---

semantic-kernel/concepts/kernel.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
title: Understanding the kernel in Semantic Kernel
33
description: Learn about the central component of Semantic Kernel and how it works
44
zone_pivot_groups: programming-languages
5-
author: matthewbolanos
5+
author: moonbox3
66
ms.topic: conceptual
7-
ms.author: mabolan
7+
ms.author: evmattso
88
ms.date: 07/12/2023
99
ms.service: semantic-kernel
1010
---

semantic-kernel/concepts/vector-store-connectors/index.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: What are Semantic Kernel Vector Store connectors? (Preview)
2+
title: What are Semantic Kernel Vector Stores? (Preview)
33
description: Describes what a Semantic Kernel Vector Store is, and provides a basic example of how to use one and how to get started.
44
zone_pivot_groups: programming-languages
55
author: westey-m
@@ -8,7 +8,7 @@ ms.author: westey
88
ms.date: 07/08/2024
99
ms.service: semantic-kernel
1010
---
11-
# What are Semantic Kernel Vector Store connectors? (Preview)
11+
# What are Semantic Kernel Vector Stores? (Preview)
1212

1313
::: zone pivot="programming-language-csharp"
1414

@@ -35,24 +35,30 @@ One use case for storing information in a vector database is to enable large lan
3535

3636
For example, if you want to write a blog post about the latest trends in AI, you can use a vector database to store the latest information about that topic and pass the information along with the ask to a LLM in order to generate a blog post that leverages the latest information.
3737

38-
Semantic Kernel and .net provides an abstraction for interacting with Vector Stores and a list of out-of-the-box connectors that implement these abstractions. Features include creating, listing and deleting collections of records, and uploading, retrieving and deleting records. The abstraction makes it easy to experiment with a free or locally hosted Vector Store and then switch to a service when needing to scale up.
38+
Semantic Kernel and .net provides an abstraction for interacting with Vector Stores and a list of out-of-the-box implementations that implement these abstractions for various databases. Features include creating, listing and deleting collections of records, and uploading, retrieving and deleting records. The abstraction makes it easy to experiment with a free or locally hosted Vector Store and then switch to a service when needing to scale up.
39+
40+
The out-of-the-box implementations can be used with Semantic Kernel, but do not depend on the core Semantic Kernel stack and can also therefore be used completely independently if required.
41+
The Semantic Kernel provided imlementations are referred to as 'connectors'.
3942

4043
::: zone pivot="programming-language-csharp"
4144

4245
## Retrieval Augmented Generation (RAG) with Vector Stores
4346

44-
The vector store abstractions are a low level api for adding and retrieving data from vector stores.
47+
The vector store abstraction is a low level api for adding and retrieving data from vector stores.
4548
Semantic Kernel has built-in support for using any one of the Vector Store implementations for RAG.
4649
This is achieved by wrapping `IVectorSearchable<TRecord>` and exposing it as a Text Search implementation.
4750

4851
> [!TIP]
4952
> To learn more about how to use vector stores for RAG see [How to use Vector Stores with Semantic Kernel Text Search](../text-search/text-search-vector-stores.md).
5053
> [!TIP]
5154
> To learn more about text search see [What is Semantic Kernel Text Search?](../text-search/index.md)
55+
> [!TIP]
56+
> To learn more about how to quickly add RAG into your agent see [Adding Retrieval Augmented Generation (RAG) to Semantic Kernel Agents](../../Frameworks/agent/agent-rag.md).
5257
5358
## The Vector Store Abstraction
5459

55-
The main abstract base classes and interfaces in the Vector Store abstraction are the following.
60+
The Vector Store abstractions are provided in the [`Microsoft.Extensions.VectorData.Abstractions`](https://www.nuget.org/packages/Microsoft.Extensions.VectorData.Abstractions/) nuget package.
61+
The following are the main abstract base classes and interfaces.
5662

5763
### Microsoft.Extensions.VectorData.VectorStore
5864

@@ -120,7 +126,7 @@ by select connectors.
120126

121127
::: zone-end
122128

123-
## Getting started with Vector Store connectors
129+
## Getting started with Vector Stores
124130

125131
::: zone pivot="programming-language-csharp"
126132

@@ -143,7 +149,7 @@ dotnet add package Microsoft.Extensions.VectorData.Abstractions
143149

144150
### Define your data model
145151

146-
The Semantic Kernel Vector Store connectors use a model first approach to interacting with databases. This means that the first step is to define a data model that maps to the storage schema. To help the connectors create collections of records and map to the storage schema, the model can be annotated to indicate the function of each property.
152+
The Vector Store abstractions use a model first approach to interacting with databases. This means that the first step is to define a data model that maps to the storage schema. To help the implementations create collections of records and map to the storage schema, the model can be annotated to indicate the function of each property.
147153

148154
::: zone pivot="programming-language-csharp"
149155

@@ -340,7 +346,7 @@ public class Main {
340346
::: zone-end
341347

342348
> [!TIP]
343-
> For more information on what key and field types each Vector Store connector supports, refer to [the documentation for each connector](./out-of-the-box-connectors/index.md).
349+
> For more information on what key and field types each Vector Store implementation supports, refer to [the documentation for each implementation](./out-of-the-box-connectors/index.md).
344350
345351
::: zone pivot="programming-language-csharp"
346352

semantic-kernel/get-started/quick-start-guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
title: How to quickly start with Semantic Kernel
33
description: Follow along with Semantic Kernel's guides to quickly learn how to use the SDK
44
zone_pivot_groups: programming-languages
5-
author: matthewbolanos
5+
author: moonbox3
66
ms.topic: quickstart
7-
ms.author: mabolan
7+
ms.author: evmattso
88
ms.date: 07/11/2023
99
ms.service: semantic-kernel
1010
---

0 commit comments

Comments
 (0)