Share via


EvaluationContext.Contents Property

Definition

Gets or sets a list of AIContent objects that include all the information present in this EvaluationContext.

public:
 property System::Collections::Generic::IList<Microsoft::Extensions::AI::AIContent ^> ^ Contents { System::Collections::Generic::IList<Microsoft::Extensions::AI::AIContent ^> ^ get(); void set(System::Collections::Generic::IList<Microsoft::Extensions::AI::AIContent ^> ^ value); };
public System.Collections.Generic.IList<Microsoft.Extensions.AI.AIContent> Contents { get; set; }
member this.Contents : System.Collections.Generic.IList<Microsoft.Extensions.AI.AIContent> with get, set
Public Property Contents As IList(Of AIContent)

Property Value

A list of AIContent objects that include all the information present in this EvaluationContext.

Remarks

This property allows decomposition of the information present in an EvaluationContext into TextContent objects for text, DataContent or UriContent objects for images, and other similar AIContent objects for other modalities such as audio and video in the future.

For simple EvaluationContexts that only contain text, this property can return a TextContent object that includes the contained text.

Derived implementations of EvaluationContext are free to include any additional properties as needed. However, the expectation is that the Contents property will always return a collection of AIContents that represent all the contextual information that is modeled by the EvaluationContext.

This is because an IEvaluator can (optionally) choose to record any EvaluationContexts that it used, in the Context property of each EvaluationMetric that it produces. When EvaluationMetrics are serialized (for example, as part of the result storage and report generation functionality available in the Microsoft.Extensions.AI.Evaluation.Reporting NuGet package), the EvaluationContexts recorded within the Context will also be serialized. However, for each such EvaluationContext, only the information captured within Contents will be serialized. Any information that is (only) present in custom derived properties will not be serialized. Therefore, in order to ensure that the contextual information included as part of an EvaluationContext is stored and reported accurately, it is important to ensure that the Contents property returns a collection of AIContents that represent all the contextual information that is modeled by the EvaluationContext.

Applies to