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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions codegen/generator/src/OpenAI.Library.Plugin.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<RootNamespace>OpenAI.Microsoft.Generator.CSharp.ClientModel.Plugin</RootNamespace>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.TypeSpec.Generator.ClientModel" Version="1.0.0-alpha.20250915.1" />
<PackageReference Include="Microsoft.TypeSpec.Generator.ClientModel" Version="1.0.0-alpha.20250924.1" />
</ItemGroup>

<!-- Copy output to package dist path for local execution and -->
Expand Down
4 changes: 2 additions & 2 deletions codegen/generator/src/OpenAILibraryVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public class OpenAILibraryVisitor : ScmLibraryVisitor

protected override TypeProvider VisitType(TypeProvider type)
{
if (type is ModelProvider { BaseModelProvider: null } && type.Fields.Count > 0)
var additionalPropertiesField = type.Fields.FirstOrDefault(f => f.Name == AdditionalPropertiesFieldName);
if (type is ModelProvider { BaseModelProvider: null } && additionalPropertiesField != null)
{
// Add an internal AdditionalProperties property to all base models
var additionalPropertiesField = type.Fields.Single(f => f.Name == AdditionalPropertiesFieldName);
var properties = new List<PropertyProvider>(type.Properties)
{
new PropertyProvider($"", MethodSignatureModifiers.Internal,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,12 @@ public class ExperimentalAttributeVisitor : ScmLibraryVisitor

protected override PropertyProvider? VisitProperty(PropertyProvider property)
{
// Skip properties that are already marked as experimental
if (property.Attributes.Any(attr => attr.Type.Equals(typeof(ExperimentalAttribute))))
{
return base.VisitProperty(property);
}

// Skip properties that are not public or are in non-stable classes
if ((!property.Modifiers.HasFlag(MethodSignatureModifiers.Public) &&
!property.Modifiers.HasFlag(MethodSignatureModifiers.Protected)) ||
Expand Down
3 changes: 2 additions & 1 deletion codegen/generator/src/Visitors/PageOrderRemovalVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ private static InputParameter CreateSyntheticPageOrderInputParameter()
discriminatedSubtypes: new Dictionary<string, InputModelType>(),
additionalProperties: null,
modelAsStruct: true,
serializationOptions: new());
serializationOptions: new(),
isDynamicModel: false);
return new InputQueryParameter(
name: "order",
serializedName: "order",
Expand Down
2 changes: 1 addition & 1 deletion codegen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"dependencies": {
"@open-ai/plugin": "file:",
"@azure-tools/typespec-client-generator-core": "0.60.0",
"@typespec/http-client-csharp": "1.0.0-alpha.20250915.1",
"@typespec/http-client-csharp": "1.0.0-alpha.20250924.1",
"@typespec/http": "1.4.0",
"@typespec/openapi": "1.4.0"
},
Expand Down
234 changes: 116 additions & 118 deletions package-lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@ protected virtual Assistant PersistableModelCreateCore(BinaryData data, ModelRea
public static explicit operator Assistant(ClientResult result)
{
using PipelineResponse response = result.GetRawResponse();
using JsonDocument document = JsonDocument.Parse(response.Content);
BinaryData data = response.Content;
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeAssistant(document.RootElement, ModelSerializationExtensions.WireOptions);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ protected virtual AssistantDeletionResult PersistableModelCreateCore(BinaryData
public static explicit operator AssistantDeletionResult(ClientResult result)
{
using PipelineResponse response = result.GetRawResponse();
using JsonDocument document = JsonDocument.Parse(response.Content);
BinaryData data = response.Content;
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeAssistantDeletionResult(document.RootElement, ModelSerializationExtensions.WireOptions);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ protected virtual AssistantThread PersistableModelCreateCore(BinaryData data, Mo
public static explicit operator AssistantThread(ClientResult result)
{
using PipelineResponse response = result.GetRawResponse();
using JsonDocument document = JsonDocument.Parse(response.Content);
BinaryData data = response.Content;
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeAssistantThread(document.RootElement, ModelSerializationExtensions.WireOptions);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace OpenAI.Assistants
{
public partial class CodeInterpreterToolDefinition : IJsonModel<CodeInterpreterToolDefinition>
public partial class CodeInterpreterToolDefinition : ToolDefinition, IJsonModel<CodeInterpreterToolDefinition>
{
void IJsonModel<CodeInterpreterToolDefinition>.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace OpenAI.Assistants
{
public partial class FileSearchToolDefinition : IJsonModel<FileSearchToolDefinition>
public partial class FileSearchToolDefinition : ToolDefinition, IJsonModel<FileSearchToolDefinition>
{
void IJsonModel<FileSearchToolDefinition>.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace OpenAI.Assistants
{
public partial class FunctionToolDefinition : IJsonModel<FunctionToolDefinition>
public partial class FunctionToolDefinition : ToolDefinition, IJsonModel<FunctionToolDefinition>
{
void IJsonModel<FunctionToolDefinition>.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace OpenAI.Assistants
{
internal partial class InternalDotNetAssistantResponseFormatJsonObject : IJsonModel<InternalDotNetAssistantResponseFormatJsonObject>
internal partial class InternalDotNetAssistantResponseFormatJsonObject : AssistantResponseFormat, IJsonModel<InternalDotNetAssistantResponseFormatJsonObject>
{
void IJsonModel<InternalDotNetAssistantResponseFormatJsonObject>.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace OpenAI.Assistants
{
internal partial class InternalDotNetAssistantResponseFormatJsonSchema : IJsonModel<InternalDotNetAssistantResponseFormatJsonSchema>
internal partial class InternalDotNetAssistantResponseFormatJsonSchema : AssistantResponseFormat, IJsonModel<InternalDotNetAssistantResponseFormatJsonSchema>
{
internal InternalDotNetAssistantResponseFormatJsonSchema() : this(InternalResponseFormatType.JsonSchema, null, null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace OpenAI.Assistants
{
internal partial class InternalDotNetAssistantResponseFormatText : IJsonModel<InternalDotNetAssistantResponseFormatText>
internal partial class InternalDotNetAssistantResponseFormatText : AssistantResponseFormat, IJsonModel<InternalDotNetAssistantResponseFormatText>
{
void IJsonModel<InternalDotNetAssistantResponseFormatText>.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ protected virtual InternalListAssistantsResponse PersistableModelCreateCore(Bina
public static explicit operator InternalListAssistantsResponse(ClientResult result)
{
using PipelineResponse response = result.GetRawResponse();
using JsonDocument document = JsonDocument.Parse(response.Content);
BinaryData data = response.Content;
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeInternalListAssistantsResponse(document.RootElement, ModelSerializationExtensions.WireOptions);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ protected virtual InternalListMessagesResponse PersistableModelCreateCore(Binary
public static explicit operator InternalListMessagesResponse(ClientResult result)
{
using PipelineResponse response = result.GetRawResponse();
using JsonDocument document = JsonDocument.Parse(response.Content);
BinaryData data = response.Content;
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeInternalListMessagesResponse(document.RootElement, ModelSerializationExtensions.WireOptions);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ protected virtual InternalListRunStepsResponse PersistableModelCreateCore(Binary
public static explicit operator InternalListRunStepsResponse(ClientResult result)
{
using PipelineResponse response = result.GetRawResponse();
using JsonDocument document = JsonDocument.Parse(response.Content);
BinaryData data = response.Content;
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeInternalListRunStepsResponse(document.RootElement, ModelSerializationExtensions.WireOptions);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ protected virtual InternalListRunsResponse PersistableModelCreateCore(BinaryData
public static explicit operator InternalListRunsResponse(ClientResult result)
{
using PipelineResponse response = result.GetRawResponse();
using JsonDocument document = JsonDocument.Parse(response.Content);
BinaryData data = response.Content;
using JsonDocument document = JsonDocument.Parse(data);
return DeserializeInternalListRunsResponse(document.RootElement, ModelSerializationExtensions.WireOptions);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace OpenAI.Assistants
{
internal partial class InternalMessageContentImageFileObject : IJsonModel<InternalMessageContentImageFileObject>
internal partial class InternalMessageContentImageFileObject : MessageContent, IJsonModel<InternalMessageContentImageFileObject>
{
internal InternalMessageContentImageFileObject() : this(InternalMessageContentType.ImageFile, null, null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace OpenAI.Assistants
{
internal partial class InternalMessageContentImageUrlObject : IJsonModel<InternalMessageContentImageUrlObject>
internal partial class InternalMessageContentImageUrlObject : MessageContent, IJsonModel<InternalMessageContentImageUrlObject>
{
internal InternalMessageContentImageUrlObject() : this(InternalMessageContentType.ImageUrl, null, null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace OpenAI.Assistants
{
internal partial class InternalMessageContentRefusalObject : IJsonModel<InternalMessageContentRefusalObject>
internal partial class InternalMessageContentRefusalObject : MessageContent, IJsonModel<InternalMessageContentRefusalObject>
{
internal InternalMessageContentRefusalObject() : this(InternalMessageContentType.Refusal, null, null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace OpenAI.Assistants
{
internal partial class InternalMessageContentTextAnnotationsFileCitationObject : IJsonModel<InternalMessageContentTextAnnotationsFileCitationObject>
internal partial class InternalMessageContentTextAnnotationsFileCitationObject : InternalMessageContentTextObjectAnnotation, IJsonModel<InternalMessageContentTextAnnotationsFileCitationObject>
{
internal InternalMessageContentTextAnnotationsFileCitationObject() : this(InternalMessageContentTextAnnotationType.FileCitation, null, null, null, default, default)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace OpenAI.Assistants
{
internal partial class InternalMessageContentTextAnnotationsFilePathObject : IJsonModel<InternalMessageContentTextAnnotationsFilePathObject>
internal partial class InternalMessageContentTextAnnotationsFilePathObject : InternalMessageContentTextObjectAnnotation, IJsonModel<InternalMessageContentTextAnnotationsFilePathObject>
{
internal InternalMessageContentTextAnnotationsFilePathObject() : this(InternalMessageContentTextAnnotationType.FilePath, null, null, null, default, default)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace OpenAI.Assistants
{
internal partial class InternalMessageContentTextObject : IJsonModel<InternalMessageContentTextObject>
internal partial class InternalMessageContentTextObject : MessageContent, IJsonModel<InternalMessageContentTextObject>
{
internal InternalMessageContentTextObject() : this(InternalMessageContentType.Text, null, null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace OpenAI.Assistants
{
internal partial class InternalMessageDeltaContentImageFileObject : IJsonModel<InternalMessageDeltaContentImageFileObject>
internal partial class InternalMessageDeltaContentImageFileObject : InternalMessageDeltaContent, IJsonModel<InternalMessageDeltaContentImageFileObject>
{
internal InternalMessageDeltaContentImageFileObject() : this(InternalMessageContentType.ImageFile, null, default, null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace OpenAI.Assistants
{
internal partial class InternalMessageDeltaContentImageUrlObject : IJsonModel<InternalMessageDeltaContentImageUrlObject>
internal partial class InternalMessageDeltaContentImageUrlObject : InternalMessageDeltaContent, IJsonModel<InternalMessageDeltaContentImageUrlObject>
{
internal InternalMessageDeltaContentImageUrlObject() : this(InternalMessageContentType.ImageUrl, null, default, null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace OpenAI.Assistants
{
internal partial class InternalMessageDeltaContentRefusalObject : IJsonModel<InternalMessageDeltaContentRefusalObject>
internal partial class InternalMessageDeltaContentRefusalObject : InternalMessageDeltaContent, IJsonModel<InternalMessageDeltaContentRefusalObject>
{
internal InternalMessageDeltaContentRefusalObject() : this(InternalMessageContentType.Refusal, null, default, null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace OpenAI.Assistants
{
internal partial class InternalMessageDeltaContentTextAnnotationsFileCitationObject : IJsonModel<InternalMessageDeltaContentTextAnnotationsFileCitationObject>
internal partial class InternalMessageDeltaContentTextAnnotationsFileCitationObject : InternalMessageDeltaTextContentAnnotation, IJsonModel<InternalMessageDeltaContentTextAnnotationsFileCitationObject>
{
internal InternalMessageDeltaContentTextAnnotationsFileCitationObject() : this(InternalMessageContentTextAnnotationType.FileCitation, null, default, null, null, default, default)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace OpenAI.Assistants
{
internal partial class InternalMessageDeltaContentTextAnnotationsFilePathObject : IJsonModel<InternalMessageDeltaContentTextAnnotationsFilePathObject>
internal partial class InternalMessageDeltaContentTextAnnotationsFilePathObject : InternalMessageDeltaTextContentAnnotation, IJsonModel<InternalMessageDeltaContentTextAnnotationsFilePathObject>
{
internal InternalMessageDeltaContentTextAnnotationsFilePathObject() : this(InternalMessageContentTextAnnotationType.FilePath, null, default, null, null, default, default)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace OpenAI.Assistants
{
internal partial class InternalMessageDeltaContentTextObject : IJsonModel<InternalMessageDeltaContentTextObject>
internal partial class InternalMessageDeltaContentTextObject : InternalMessageDeltaContent, IJsonModel<InternalMessageDeltaContentTextObject>
{
internal InternalMessageDeltaContentTextObject() : this(InternalMessageContentType.Text, null, default, null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace OpenAI.Assistants
{
internal partial class InternalRequiredFunctionToolCall : IJsonModel<InternalRequiredFunctionToolCall>
internal partial class InternalRequiredFunctionToolCall : InternalRequiredToolCall, IJsonModel<InternalRequiredFunctionToolCall>
{
internal InternalRequiredFunctionToolCall()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace OpenAI.Assistants
{
internal partial class InternalRequiredFunctionToolCall
internal partial class InternalRequiredFunctionToolCall : InternalRequiredToolCall
{
private protected IDictionary<string, BinaryData> _additionalBinaryDataProperties;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace OpenAI.Assistants
{
internal partial class InternalRunStepCodeInterpreterLogOutput : IJsonModel<InternalRunStepCodeInterpreterLogOutput>
internal partial class InternalRunStepCodeInterpreterLogOutput : RunStepCodeInterpreterOutput, IJsonModel<InternalRunStepCodeInterpreterLogOutput>
{
internal InternalRunStepCodeInterpreterLogOutput() : this(InternalRunStepDetailsCodeInterpreterOutputType.Logs, null, null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace OpenAI.Assistants
{
internal partial class InternalRunStepDeltaStepDetailsMessageCreationObject : IJsonModel<InternalRunStepDeltaStepDetailsMessageCreationObject>
internal partial class InternalRunStepDeltaStepDetailsMessageCreationObject : InternalRunStepDeltaStepDetails, IJsonModel<InternalRunStepDeltaStepDetailsMessageCreationObject>
{
void IJsonModel<InternalRunStepDeltaStepDetailsMessageCreationObject>.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace OpenAI.Assistants
{
internal partial class InternalRunStepDeltaStepDetailsToolCallsCodeObject : IJsonModel<InternalRunStepDeltaStepDetailsToolCallsCodeObject>
internal partial class InternalRunStepDeltaStepDetailsToolCallsCodeObject : InternalRunStepDeltaStepDetailsToolCallsObjectToolCallsObject, IJsonModel<InternalRunStepDeltaStepDetailsToolCallsCodeObject>
{
internal InternalRunStepDeltaStepDetailsToolCallsCodeObject() : this(RunStepToolCallKind.CodeInterpreter, null, default, null, null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace OpenAI.Assistants
{
internal partial class InternalRunStepDeltaStepDetailsToolCallsCodeOutputImageObject : IJsonModel<InternalRunStepDeltaStepDetailsToolCallsCodeOutputImageObject>
internal partial class InternalRunStepDeltaStepDetailsToolCallsCodeOutputImageObject : RunStepUpdateCodeInterpreterOutput, IJsonModel<InternalRunStepDeltaStepDetailsToolCallsCodeOutputImageObject>
{
internal InternalRunStepDeltaStepDetailsToolCallsCodeOutputImageObject() : this(InternalRunStepDetailsCodeInterpreterOutputType.Image, null, default, null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace OpenAI.Assistants
{
internal partial class InternalRunStepDeltaStepDetailsToolCallsCodeOutputLogsObject : IJsonModel<InternalRunStepDeltaStepDetailsToolCallsCodeOutputLogsObject>
internal partial class InternalRunStepDeltaStepDetailsToolCallsCodeOutputLogsObject : RunStepUpdateCodeInterpreterOutput, IJsonModel<InternalRunStepDeltaStepDetailsToolCallsCodeOutputLogsObject>
{
internal InternalRunStepDeltaStepDetailsToolCallsCodeOutputLogsObject() : this(InternalRunStepDetailsCodeInterpreterOutputType.Logs, null, default, null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace OpenAI.Assistants
{
internal partial class InternalRunStepDeltaStepDetailsToolCallsFileSearchObject : IJsonModel<InternalRunStepDeltaStepDetailsToolCallsFileSearchObject>
internal partial class InternalRunStepDeltaStepDetailsToolCallsFileSearchObject : InternalRunStepDeltaStepDetailsToolCallsObjectToolCallsObject, IJsonModel<InternalRunStepDeltaStepDetailsToolCallsFileSearchObject>
{
internal InternalRunStepDeltaStepDetailsToolCallsFileSearchObject() : this(RunStepToolCallKind.FileSearch, null, default, null, null)
{
Expand Down
Loading