Skip to content

Commit dd6aa13

Browse files
authored
Add derive types for ResponseMessageAnnotation (#649)
* Add derive types for ResponseMessageAnnotation
1 parent efabd97 commit dd6aa13

22 files changed

+297
-218
lines changed

api/OpenAI.net8.0.cs

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4716,6 +4716,26 @@ public class ComputerTool : ResponseTool, IJsonModel<ComputerTool>, IPersistable
47164716
public override readonly string ToString();
47174717
}
47184718
[Experimental("OPENAI001")]
4719+
public class FileCitationMessageAnnotation : ResponseMessageAnnotation, IJsonModel<FileCitationMessageAnnotation>, IPersistableModel<FileCitationMessageAnnotation> {
4720+
public FileCitationMessageAnnotation(string fileId, int index);
4721+
public string FileId { get; set; }
4722+
public int Index { get; set; }
4723+
protected override ResponseMessageAnnotation JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
4724+
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
4725+
protected override ResponseMessageAnnotation PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
4726+
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
4727+
}
4728+
[Experimental("OPENAI001")]
4729+
public class FilePathMessageAnnotation : ResponseMessageAnnotation, IJsonModel<FilePathMessageAnnotation>, IPersistableModel<FilePathMessageAnnotation> {
4730+
public FilePathMessageAnnotation(string fileId, int index);
4731+
public string FileId { get; set; }
4732+
public int Index { get; set; }
4733+
protected override ResponseMessageAnnotation JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
4734+
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
4735+
protected override ResponseMessageAnnotation PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
4736+
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
4737+
}
4738+
[Experimental("OPENAI001")]
47194739
public class FileSearchCallResponseItem : ResponseItem, IJsonModel<FileSearchCallResponseItem>, IPersistableModel<FileSearchCallResponseItem> {
47204740
public FileSearchCallResponseItem(IEnumerable<string> queries);
47214741
public IList<string> Queries { get; }
@@ -5196,15 +5216,7 @@ public class ResponseItemCollectionOptions : IJsonModel<ResponseItemCollectionOp
51965216
}
51975217
[Experimental("OPENAI001")]
51985218
public class ResponseMessageAnnotation : IJsonModel<ResponseMessageAnnotation>, IPersistableModel<ResponseMessageAnnotation> {
5199-
public string FileCitationFileId { get; }
5200-
public int? FileCitationIndex { get; }
5201-
public string FilePathFileId { get; }
5202-
public int? FilePathIndex { get; }
52035219
public ResponseMessageAnnotationKind Kind { get; }
5204-
public int? UriCitationEndIndex { get; }
5205-
public int? UriCitationStartIndex { get; }
5206-
public string UriCitationTitle { get; }
5207-
public Uri UriCitationUri { get; }
52085220
protected virtual ResponseMessageAnnotation JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
52095221
protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
52105222
protected virtual ResponseMessageAnnotation PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
@@ -5622,6 +5634,18 @@ public class StreamingResponseWebSearchCallSearchingUpdate : StreamingResponseUp
56225634
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
56235635
}
56245636
[Experimental("OPENAI001")]
5637+
public class UriCitationMessageAnnotation : ResponseMessageAnnotation, IJsonModel<UriCitationMessageAnnotation>, IPersistableModel<UriCitationMessageAnnotation> {
5638+
public UriCitationMessageAnnotation(Uri uri, int startIndex, int endIndex, string title);
5639+
public int EndIndex { get; set; }
5640+
public int StartIndex { get; set; }
5641+
public string Title { get; set; }
5642+
public Uri Uri { get; set; }
5643+
protected override ResponseMessageAnnotation JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
5644+
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
5645+
protected override ResponseMessageAnnotation PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
5646+
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
5647+
}
5648+
[Experimental("OPENAI001")]
56255649
public class WebSearchCallResponseItem : ResponseItem, IJsonModel<WebSearchCallResponseItem>, IPersistableModel<WebSearchCallResponseItem> {
56265650
public WebSearchCallResponseItem();
56275651
public WebSearchCallStatus? Status { get; }

api/OpenAI.netstandard2.0.cs

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4141,6 +4141,24 @@ public class ComputerTool : ResponseTool, IJsonModel<ComputerTool>, IPersistable
41414141
public static bool operator !=(ComputerToolEnvironment left, ComputerToolEnvironment right);
41424142
public override readonly string ToString();
41434143
}
4144+
public class FileCitationMessageAnnotation : ResponseMessageAnnotation, IJsonModel<FileCitationMessageAnnotation>, IPersistableModel<FileCitationMessageAnnotation> {
4145+
public FileCitationMessageAnnotation(string fileId, int index);
4146+
public string FileId { get; set; }
4147+
public int Index { get; set; }
4148+
protected override ResponseMessageAnnotation JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
4149+
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
4150+
protected override ResponseMessageAnnotation PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
4151+
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
4152+
}
4153+
public class FilePathMessageAnnotation : ResponseMessageAnnotation, IJsonModel<FilePathMessageAnnotation>, IPersistableModel<FilePathMessageAnnotation> {
4154+
public FilePathMessageAnnotation(string fileId, int index);
4155+
public string FileId { get; set; }
4156+
public int Index { get; set; }
4157+
protected override ResponseMessageAnnotation JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
4158+
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
4159+
protected override ResponseMessageAnnotation PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
4160+
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
4161+
}
41444162
public class FileSearchCallResponseItem : ResponseItem, IJsonModel<FileSearchCallResponseItem>, IPersistableModel<FileSearchCallResponseItem> {
41454163
public FileSearchCallResponseItem(IEnumerable<string> queries);
41464164
public IList<string> Queries { get; }
@@ -4583,15 +4601,7 @@ public class ResponseItemCollectionOptions : IJsonModel<ResponseItemCollectionOp
45834601
public override readonly string ToString();
45844602
}
45854603
public class ResponseMessageAnnotation : IJsonModel<ResponseMessageAnnotation>, IPersistableModel<ResponseMessageAnnotation> {
4586-
public string FileCitationFileId { get; }
4587-
public int? FileCitationIndex { get; }
4588-
public string FilePathFileId { get; }
4589-
public int? FilePathIndex { get; }
45904604
public ResponseMessageAnnotationKind Kind { get; }
4591-
public int? UriCitationEndIndex { get; }
4592-
public int? UriCitationStartIndex { get; }
4593-
public string UriCitationTitle { get; }
4594-
public Uri UriCitationUri { get; }
45954605
protected virtual ResponseMessageAnnotation JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
45964606
protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
45974607
protected virtual ResponseMessageAnnotation PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
@@ -4966,6 +4976,17 @@ public class StreamingResponseWebSearchCallSearchingUpdate : StreamingResponseUp
49664976
protected override StreamingResponseUpdate PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
49674977
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
49684978
}
4979+
public class UriCitationMessageAnnotation : ResponseMessageAnnotation, IJsonModel<UriCitationMessageAnnotation>, IPersistableModel<UriCitationMessageAnnotation> {
4980+
public UriCitationMessageAnnotation(Uri uri, int startIndex, int endIndex, string title);
4981+
public int EndIndex { get; set; }
4982+
public int StartIndex { get; set; }
4983+
public string Title { get; set; }
4984+
public Uri Uri { get; set; }
4985+
protected override ResponseMessageAnnotation JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
4986+
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
4987+
protected override ResponseMessageAnnotation PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
4988+
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
4989+
}
49694990
public class WebSearchCallResponseItem : ResponseItem, IJsonModel<WebSearchCallResponseItem>, IPersistableModel<WebSearchCallResponseItem> {
49704991
public WebSearchCallResponseItem();
49714992
public WebSearchCallStatus? Status { get; }
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace OpenAI.Responses;
2+
3+
// CUSTOM:
4+
// - Renamed.
5+
[CodeGenType("AnnotationFileCitation")]
6+
public partial class FileCitationMessageAnnotation
7+
{
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace OpenAI.Responses;
2+
3+
// CUSTOM:
4+
// - Renamed.
5+
[CodeGenType("AnnotationFilePath")]
6+
public partial class FilePathMessageAnnotation
7+
{
8+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace OpenAI.Responses;
2+
3+
// CUSTOM:
4+
// - Added Experimental attribute.
5+
// - Renamed.
6+
[CodeGenType("Annotation")]
7+
[CodeGenVisibility(nameof(Kind), CodeGenVisibility.Public)]
8+
public partial class ResponseMessageAnnotation
9+
{
10+
}

src/Custom/Responses/ResponseMessageAnnotationKind.cs renamed to src/Custom/Responses/Annotations/ResponseMessageAnnotationKind.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ public enum ResponseMessageAnnotationKind
1717
FilePath,
1818

1919
ContainerFileCitation
20-
}
20+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
3+
namespace OpenAI.Responses;
4+
5+
// CUSTOM:
6+
// - Renamed.
7+
[CodeGenType("AnnotationUrlCitation")]
8+
public partial class UriCitationMessageAnnotation
9+
{
10+
[CodeGenMember("Url")]
11+
public Uri Uri { get; set; }
12+
}

src/Custom/Responses/Internal/GeneratorStubs.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
namespace OpenAI.Responses;
22

3-
[CodeGenType("AnnotationFileCitation")] internal partial class InternalAnnotationFileCitation {}
4-
[CodeGenType("AnnotationFilePath")] internal partial class InternalAnnotationFilePath {}
5-
[CodeGenType("AnnotationUrlCitation")] internal partial class InternalAnnotationUrlCitation {}
63
[CodeGenType("ComparisonFilter")] internal partial class InternalComparisonFilter {}
74
[CodeGenType("ComparisonFilterEquals")] internal partial class InternalComparisonFilterEquals {}
85
[CodeGenType("ComparisonFilterGreaterThan")] internal partial class InternalComparisonFilterGreaterThan {}

src/Custom/Responses/ResponseMessageAnnotation.cs

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/Generated/Models/OpenAIContext.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@ namespace OpenAI
9696
[ModelReaderWriterBuildable(typeof(EmbeddingGenerationOptions))]
9797
[ModelReaderWriterBuildable(typeof(EmbeddingTokenUsage))]
9898
[ModelReaderWriterBuildable(typeof(FileChunkingStrategy))]
99+
[ModelReaderWriterBuildable(typeof(FileCitationMessageAnnotation))]
99100
[ModelReaderWriterBuildable(typeof(FileDeletionResult))]
100101
[ModelReaderWriterBuildable(typeof(FileFromStoreRemovalResult))]
102+
[ModelReaderWriterBuildable(typeof(FilePathMessageAnnotation))]
101103
[ModelReaderWriterBuildable(typeof(FileSearchCallResponseItem))]
102104
[ModelReaderWriterBuildable(typeof(FileSearchCallResult))]
103105
[ModelReaderWriterBuildable(typeof(FileSearchRankingOptions))]
@@ -147,9 +149,6 @@ namespace OpenAI
147149
[ModelReaderWriterBuildable(typeof(InputNoiseReductionOptions))]
148150
[ModelReaderWriterBuildable(typeof(InputTranscriptionOptions))]
149151
[ModelReaderWriterBuildable(typeof(InternalAddUploadPartRequest))]
150-
[ModelReaderWriterBuildable(typeof(InternalAnnotationFileCitation))]
151-
[ModelReaderWriterBuildable(typeof(InternalAnnotationFilePath))]
152-
[ModelReaderWriterBuildable(typeof(InternalAnnotationUrlCitation))]
153152
[ModelReaderWriterBuildable(typeof(InternalAssistantsNamedToolChoiceFunction))]
154153
[ModelReaderWriterBuildable(typeof(InternalAssistantToolsFileSearchFileSearch))]
155154
[ModelReaderWriterBuildable(typeof(InternalAssistantToolsFileSearchTypeOnly))]
@@ -785,6 +784,7 @@ namespace OpenAI
785784
[ModelReaderWriterBuildable(typeof(UnknownRunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsObject))]
786785
[ModelReaderWriterBuildable(typeof(UnknownRunStepDetailsToolCallsObjectToolCallsObject))]
787786
[ModelReaderWriterBuildable(typeof(UnknownRunStepObjectStepDetails))]
787+
[ModelReaderWriterBuildable(typeof(UriCitationMessageAnnotation))]
788788
[ModelReaderWriterBuildable(typeof(UserChatMessage))]
789789
[ModelReaderWriterBuildable(typeof(ValidateGraderRequest))]
790790
[ModelReaderWriterBuildable(typeof(ValidateGraderResponse))]

0 commit comments

Comments
 (0)