AIContextProvider Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides an abstract base class for components that enhance AI context management during agent invocations.
public abstract class AIContextProvider
type AIContextProvider = class
Public MustInherit Class AIContextProvider
- Inheritance
-
AIContextProvider
Remarks
An AI context provider is a component that participates in the agent invocation lifecycle by:
- Listening to changes in conversations
- Providing additional context to AI models or agents before invocation
- Supplying additional function tools for enhanced capabilities
- Processing invocation results for state management or learning
Context providers operate through a two-phase lifecycle: they are called before invocation via InvokingAsync(AIContextProvider+InvokingContext, CancellationToken) to provide context, and optionally called after invocation via InvokedAsync(AIContextProvider+InvokedContext, CancellationToken) to process results.
Constructors
| AIContextProvider() |
Methods
| GetService(Type, Object) |
Asks the AIContextProvider for an object of the specified type |
| GetService<TService>(Object) |
Asks the AIContextProvider for an object of type |
| InvokedAsync(AIContextProvider+InvokedContext, CancellationToken) |
Called immediately after an AI model or agent has been invoked to process the results. |
| InvokingAsync(AIContextProvider+InvokingContext, CancellationToken) |
Called immediately before an AI model or agent is invoked to provide additional context. |
| Serialize(JsonSerializerOptions) |
Serializes the current object's state to a JsonElement using the specified serialization options. |