Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace Azure.AI.OpenAI
{
[CodeGenSuppress("global::Azure.Core.IUtf8JsonSerializable.Write", typeof(Utf8JsonWriter))]
[CodeGenSuppress("ToRequestContent")]
public partial class AzureCognitiveSearchChatExtensionConfiguration : IUtf8JsonSerializable
{
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
Expand All @@ -17,17 +18,18 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
writer.WritePropertyName("type"u8);
writer.WriteStringValue(Type.ToString());

Comment thread
joseharriaga marked this conversation as resolved.
// Custom code note: everything *except* type goes into 'parameters'
// CUSTOM CODE NOTE: Everything *except* 'type' goes into 'parameters'
writer.WriteStartObject("parameters"u8);
Comment thread
joseharriaga marked this conversation as resolved.

writer.WritePropertyName("endpoint"u8);
writer.WriteStringValue(SearchEndpoint.AbsoluteUri);
writer.WriteString("key"u8, SearchKey);
writer.WritePropertyName("key"u8);
writer.WriteStringValue(SearchKey);
writer.WritePropertyName("indexName"u8);
writer.WriteStringValue(IndexName);
if (Optional.IsDefined(FieldMappingOptions))
{
writer.WritePropertyName("fieldMappings"u8);
writer.WritePropertyName("fieldsMapping"u8);
writer.WriteObjectValue(FieldMappingOptions);
}
if (Optional.IsDefined(DocumentCount))
Expand Down Expand Up @@ -57,10 +59,13 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
}
if (Optional.IsDefined(EmbeddingKey))
{
writer.WriteString("embeddingKey"u8, EmbeddingKey);
writer.WritePropertyName("embeddingKey"u8);
writer.WriteStringValue(EmbeddingKey);
}
// CUSTOM CODE NOTE: end of induced 'parameters' first, then the parent object

// CUSTOM CODE NOTE: End of induced 'parameters' first, then the parent object
writer.WriteEndObject();

writer.WriteEndObject();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,6 @@ public override AzureChatExtensionType Type
public Uri SearchEndpoint { get; set; }
/// <summary> The name of the index to use as available in the referenced Azure Cognitive Search resource. </summary>
public string IndexName { get; set; }
/// <summary> Customized field mapping behavior to use when interacting with the search index. </summary>
public AzureCognitiveSearchIndexFieldMappingOptions FieldMappingOptions { get; set; }
/// <summary> The configured top number of documents to feature for the configured query. </summary>
public int? DocumentCount { get; set; }
/// <summary> The query type to use with Azure Cognitive Search. </summary>
public AzureCognitiveSearchQueryType? QueryType { get; set; }
/// <summary> Whether queries should be restricted to use of indexed data. </summary>
public bool? ShouldRestrictResultScope { get; set; }
/// <summary> The additional semantic configuration for the query. </summary>
public string SemanticConfiguration { get; set; }
/// <summary> When using embeddings for search, specifies the resource URL from which embeddings should be retrieved. </summary>
public Uri EmbeddingEndpoint { get; set; }

/// <summary> The API key to use with the specified Azure Cognitive Search endpoint. </summary>
private string SearchKey { get; set; }
Expand All @@ -51,8 +39,14 @@ public override AzureChatExtensionType Type
/// </summary>
public AzureCognitiveSearchChatExtensionConfiguration()
{
// CUSTOM CODE NOTE: Empty constructors are added to options classes to facilitate property-only use; this
// may be reconsidered for required payload constituents in the future.
}

// CUSTOM CODE NOTE: Users must set the search key using the SetSearchKey method, so we make the constructor
// that receives it as a parameter to be internal and instead expose a public constructor
// without it.

/// <summary> Initializes a new instance of AzureCognitiveSearchChatExtensionConfiguration. </summary>
/// <param name="type">
/// The type label to use when configuring Azure OpenAI chat extensions. This should typically not be changed from its
Expand All @@ -71,6 +65,27 @@ public AzureCognitiveSearchChatExtensionConfiguration(AzureChatExtensionType typ
IndexName = indexName;
}

/// <summary> Initializes a new instance of AzureCognitiveSearchChatExtensionConfiguration. </summary>
/// <param name="type">
/// The type label to use when configuring Azure OpenAI chat extensions. This should typically not be changed from its
/// default value for Azure Cognitive Search.
/// </param>
/// <param name="searchEndpoint"> The absolute endpoint path for the Azure Cognitive Search resource to use. </param>
/// <param name="searchKey"> The API admin key to use with the specified Azure Cognitive Search endpoint. </param>
/// <param name="indexName"> The name of the index to use as available in the referenced Azure Cognitive Search resource. </param>
/// <exception cref="ArgumentNullException"> <paramref name="searchEndpoint"/>, <paramref name="searchKey"/> or <paramref name="indexName"/> is null. </exception>
internal AzureCognitiveSearchChatExtensionConfiguration(AzureChatExtensionType type, Uri searchEndpoint, string searchKey, string indexName)
Comment thread
joseharriaga marked this conversation as resolved.
{
Argument.AssertNotNull(searchEndpoint, nameof(searchEndpoint));
Argument.AssertNotNull(searchKey, nameof(searchKey));
Argument.AssertNotNull(indexName, nameof(indexName));

Type = type;
SearchEndpoint = searchEndpoint;
SearchKey = searchKey;
IndexName = indexName;
}

/// <summary>
/// Sets the API key to use with the specified Azure Cognitive Search endpoint.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,52 +10,6 @@ namespace Azure.AI.OpenAI
{
public partial class AzureCognitiveSearchIndexFieldMappingOptions : IUtf8JsonSerializable
{
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
{
writer.WriteStartObject();
if (Optional.IsDefined(TitleFieldName))
{
writer.WritePropertyName("titleField"u8);
writer.WriteStringValue(TitleFieldName);
}
if (Optional.IsDefined(UrlFieldName))
{
writer.WritePropertyName("urlField"u8);
writer.WriteStringValue(UrlFieldName);
}
if (Optional.IsDefined(FilepathFieldName))
{
writer.WritePropertyName("filepathField"u8);
writer.WriteStringValue(FilepathFieldName);
}
if (Optional.IsCollectionDefined(ContentFieldNames))
{
writer.WritePropertyName("contentFieldNames"u8);
writer.WriteStartArray();
foreach (var item in ContentFieldNames)
{
writer.WriteStringValue(item);
}
writer.WriteEndArray();
}
if (Optional.IsDefined(ContentFieldSeparator))
{
writer.WritePropertyName("contentFieldSeparator"u8);
writer.WriteStringValue(ContentFieldSeparator);
}
if (Optional.IsCollectionDefined(VectorFieldNames))
{
writer.WritePropertyName("vectorFields"u8);
writer.WriteStartArray();
foreach (var item in VectorFieldNames)
{
writer.WriteStringValue(item);
}
writer.WriteEndArray();
}
writer.WriteEndObject();
}

/// <summary> Convert into a Utf8JsonRequestContent. </summary>
internal virtual RequestContent ToRequestContent()
{
Expand Down
14 changes: 0 additions & 14 deletions sdk/openai/Azure.AI.OpenAI/src/Custom/ImageSize.cs

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading