UriContent Constructors
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.
Overloads
| Name | Description |
|---|---|
| UriContent(String, String) |
Initializes a new instance of the UriContent class. |
| UriContent(Uri, String) |
Initializes a new instance of the UriContent class. |
UriContent(String, String)
- Source:
- UriContent.cs
Initializes a new instance of the UriContent class.
public UriContent(string uri, string? mediaType = default);
new Microsoft.Extensions.AI.UriContent : string * string -> Microsoft.Extensions.AI.UriContent
Public Sub New (uri As String, Optional mediaType As String = Nothing)
Parameters
- uri
- String
The URI to the represented content.
- mediaType
- String
The media type (also known as MIME type) represented by the content. If not provided, it will be inferred from the file extension of the URI. If it cannot be inferred, "application/octet-stream" is used.
Exceptions
uri is an invalid URL.
uri is null.
mediaType is an invalid media type.
uri is an invalid URL.
Remarks
A media type must be specified, so that consumers know what to do with the content. If an exact media type is not known, but the category (e.g. image) is known, a wildcard may be used (e.g. "image/*").
Applies to
UriContent(Uri, String)
- Source:
- UriContent.cs
Initializes a new instance of the UriContent class.
[System.Text.Json.Serialization.JsonConstructor]
public UriContent(Uri uri, string? mediaType = default);
[<System.Text.Json.Serialization.JsonConstructor>]
new Microsoft.Extensions.AI.UriContent : Uri * string -> Microsoft.Extensions.AI.UriContent
Public Sub New (uri As Uri, Optional mediaType As String = Nothing)
Parameters
- uri
- Uri
The URI to the represented content.
- mediaType
- String
The media type (also known as MIME type) represented by the content. If not provided, it will be inferred from the file extension of the URI. If it cannot be inferred, "application/octet-stream" is used.
- Attributes
Exceptions
uri is null.
mediaType is an invalid media type.
Remarks
A media type must be specified, so that consumers know what to do with the content. If an exact media type is not known, but the category (e.g. image) is known, a wildcard may be used (e.g. "image/*").