Skip to content

Commit 7cf6f54

Browse files
committed
Add derive types for ResponseMessageAnnotation
1 parent 7c91d8d commit 7cf6f54

18 files changed

+240
-160
lines changed

api/OpenAI.net8.0.cs

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4675,6 +4675,26 @@ public enum ComputerCallStatus {
46754675
public override readonly string ToString();
46764676
}
46774677
[Experimental("OPENAI001")]
4678+
public class FileCitationAnnotation : ResponseMessageAnnotation, IJsonModel<FileCitationAnnotation>, IPersistableModel<FileCitationAnnotation> {
4679+
public FileCitationAnnotation(string fileId, int index);
4680+
public string FileId { get; set; }
4681+
public int Index { get; set; }
4682+
protected override ResponseMessageAnnotation JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
4683+
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
4684+
protected override ResponseMessageAnnotation PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
4685+
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
4686+
}
4687+
[Experimental("OPENAI001")]
4688+
public class FilePathAnnotation : ResponseMessageAnnotation, IJsonModel<FilePathAnnotation>, IPersistableModel<FilePathAnnotation> {
4689+
public FilePathAnnotation(string fileId, int index);
4690+
public string FileId { get; set; }
4691+
public int Index { get; set; }
4692+
protected override ResponseMessageAnnotation JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
4693+
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
4694+
protected override ResponseMessageAnnotation PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
4695+
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
4696+
}
4697+
[Experimental("OPENAI001")]
46784698
public class FileSearchCallResponseItem : ResponseItem, IJsonModel<FileSearchCallResponseItem>, IPersistableModel<FileSearchCallResponseItem> {
46794699
public FileSearchCallResponseItem(IEnumerable<string> queries);
46804700
public IList<string> Queries { get; }
@@ -5129,15 +5149,7 @@ public class ResponseItemCollectionOptions : IJsonModel<ResponseItemCollectionOp
51295149
}
51305150
[Experimental("OPENAI001")]
51315151
public class ResponseMessageAnnotation : IJsonModel<ResponseMessageAnnotation>, IPersistableModel<ResponseMessageAnnotation> {
5132-
public string FileCitationFileId { get; }
5133-
public int? FileCitationIndex { get; }
5134-
public string FilePathFileId { get; }
5135-
public int? FilePathIndex { get; }
51365152
public ResponseMessageAnnotationKind Kind { get; }
5137-
public int? UriCitationEndIndex { get; }
5138-
public int? UriCitationStartIndex { get; }
5139-
public string UriCitationTitle { get; }
5140-
public Uri UriCitationUri { get; }
51415153
protected virtual ResponseMessageAnnotation JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
51425154
protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
51435155
protected virtual ResponseMessageAnnotation PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
@@ -5555,6 +5567,18 @@ public class StreamingResponseWebSearchCallSearchingUpdate : StreamingResponseUp
55555567
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
55565568
}
55575569
[Experimental("OPENAI001")]
5570+
public class UrlCitationAnnotation : ResponseMessageAnnotation, IJsonModel<UrlCitationAnnotation>, IPersistableModel<UrlCitationAnnotation> {
5571+
public UrlCitationAnnotation(Uri url, int startIndex, int endIndex, string title);
5572+
public int EndIndex { get; set; }
5573+
public int StartIndex { get; set; }
5574+
public string Title { get; set; }
5575+
public Uri Url { get; set; }
5576+
protected override ResponseMessageAnnotation JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
5577+
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
5578+
protected override ResponseMessageAnnotation PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
5579+
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
5580+
}
5581+
[Experimental("OPENAI001")]
55585582
public class WebSearchCallResponseItem : ResponseItem, IJsonModel<WebSearchCallResponseItem>, IPersistableModel<WebSearchCallResponseItem> {
55595583
public WebSearchCallResponseItem();
55605584
public WebSearchCallStatus? Status { get; }

api/OpenAI.netstandard2.0.cs

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4116,6 +4116,24 @@ public enum ComputerCallStatus {
41164116
public static bool operator !=(ComputerToolEnvironment left, ComputerToolEnvironment right);
41174117
public override readonly string ToString();
41184118
}
4119+
public class FileCitationAnnotation : ResponseMessageAnnotation, IJsonModel<FileCitationAnnotation>, IPersistableModel<FileCitationAnnotation> {
4120+
public FileCitationAnnotation(string fileId, int index);
4121+
public string FileId { get; set; }
4122+
public int Index { get; set; }
4123+
protected override ResponseMessageAnnotation JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
4124+
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
4125+
protected override ResponseMessageAnnotation PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
4126+
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
4127+
}
4128+
public class FilePathAnnotation : ResponseMessageAnnotation, IJsonModel<FilePathAnnotation>, IPersistableModel<FilePathAnnotation> {
4129+
public FilePathAnnotation(string fileId, int index);
4130+
public string FileId { get; set; }
4131+
public int Index { get; set; }
4132+
protected override ResponseMessageAnnotation JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
4133+
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
4134+
protected override ResponseMessageAnnotation PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
4135+
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
4136+
}
41194137
public class FileSearchCallResponseItem : ResponseItem, IJsonModel<FileSearchCallResponseItem>, IPersistableModel<FileSearchCallResponseItem> {
41204138
public FileSearchCallResponseItem(IEnumerable<string> queries);
41214139
public IList<string> Queries { get; }
@@ -4535,15 +4553,7 @@ public class ResponseItemCollectionOptions : IJsonModel<ResponseItemCollectionOp
45354553
public override readonly string ToString();
45364554
}
45374555
public class ResponseMessageAnnotation : IJsonModel<ResponseMessageAnnotation>, IPersistableModel<ResponseMessageAnnotation> {
4538-
public string FileCitationFileId { get; }
4539-
public int? FileCitationIndex { get; }
4540-
public string FilePathFileId { get; }
4541-
public int? FilePathIndex { get; }
45424556
public ResponseMessageAnnotationKind Kind { get; }
4543-
public int? UriCitationEndIndex { get; }
4544-
public int? UriCitationStartIndex { get; }
4545-
public string UriCitationTitle { get; }
4546-
public Uri UriCitationUri { get; }
45474557
protected virtual ResponseMessageAnnotation JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
45484558
protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
45494559
protected virtual ResponseMessageAnnotation PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
@@ -4918,6 +4928,17 @@ public class StreamingResponseWebSearchCallSearchingUpdate : StreamingResponseUp
49184928
protected override StreamingResponseUpdate PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
49194929
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
49204930
}
4931+
public class UrlCitationAnnotation : ResponseMessageAnnotation, IJsonModel<UrlCitationAnnotation>, IPersistableModel<UrlCitationAnnotation> {
4932+
public UrlCitationAnnotation(Uri url, int startIndex, int endIndex, string title);
4933+
public int EndIndex { get; set; }
4934+
public int StartIndex { get; set; }
4935+
public string Title { get; set; }
4936+
public Uri Url { get; set; }
4937+
protected override ResponseMessageAnnotation JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
4938+
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
4939+
protected override ResponseMessageAnnotation PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
4940+
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
4941+
}
49214942
public class WebSearchCallResponseItem : ResponseItem, IJsonModel<WebSearchCallResponseItem>, IPersistableModel<WebSearchCallResponseItem> {
49224943
public WebSearchCallResponseItem();
49234944
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 FileCitationAnnotation
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 FilePathAnnotation
7+
{
8+
}

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("ApproximateLocation")] internal partial class InternalApproximateLocation {}
74
[CodeGenType("ComparisonFilter")] internal partial class InternalComparisonFilter {}
85
[CodeGenType("ComparisonFilterEquals")] internal partial class InternalComparisonFilterEquals {}

src/Custom/Responses/ResponseMessageAnnotation.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,4 @@ namespace OpenAI.Responses;
1010
[CodeGenVisibility(nameof(Kind), CodeGenVisibility.Public)]
1111
public partial class ResponseMessageAnnotation
1212
{
13-
// CUSTOM: Exposed file citation properties.
14-
public string FileCitationFileId => (this as InternalAnnotationFileCitation)?.FileId;
15-
public int? FileCitationIndex => (this as InternalAnnotationFileCitation)?.Index;
16-
17-
// CUSTOM: Exposed URL citation properties.
18-
public Uri UriCitationUri => (this as InternalAnnotationUrlCitation)?.Url;
19-
public string UriCitationTitle => (this as InternalAnnotationUrlCitation)?.Title;
20-
public int? UriCitationStartIndex => (this as InternalAnnotationUrlCitation)?.StartIndex;
21-
public int? UriCitationEndIndex => (this as InternalAnnotationUrlCitation)?.EndIndex;
22-
23-
// CUSTOM: Exposed file path properties.
24-
public string FilePathFileId => (this as InternalAnnotationFilePath)?.FileId;
25-
public int? FilePathIndex => (this as InternalAnnotationFilePath)?.Index;
2613
}
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("AnnotationUrlCitation")]
6+
public partial class UrlCitationAnnotation
7+
{
8+
}

src/Generated/Models/OpenAIContext.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,10 @@ namespace OpenAI
9595
[ModelReaderWriterBuildable(typeof(EmbeddingGenerationOptions))]
9696
[ModelReaderWriterBuildable(typeof(EmbeddingTokenUsage))]
9797
[ModelReaderWriterBuildable(typeof(FileChunkingStrategy))]
98+
[ModelReaderWriterBuildable(typeof(FileCitationAnnotation))]
9899
[ModelReaderWriterBuildable(typeof(FileDeletionResult))]
99100
[ModelReaderWriterBuildable(typeof(FileFromStoreRemovalResult))]
101+
[ModelReaderWriterBuildable(typeof(FilePathAnnotation))]
100102
[ModelReaderWriterBuildable(typeof(FileSearchCallResponseItem))]
101103
[ModelReaderWriterBuildable(typeof(FileSearchCallResult))]
102104
[ModelReaderWriterBuildable(typeof(FileSearchRankingOptions))]
@@ -144,9 +146,6 @@ namespace OpenAI
144146
[ModelReaderWriterBuildable(typeof(InputNoiseReductionOptions))]
145147
[ModelReaderWriterBuildable(typeof(InputTranscriptionOptions))]
146148
[ModelReaderWriterBuildable(typeof(InternalAddUploadPartRequest))]
147-
[ModelReaderWriterBuildable(typeof(InternalAnnotationFileCitation))]
148-
[ModelReaderWriterBuildable(typeof(InternalAnnotationFilePath))]
149-
[ModelReaderWriterBuildable(typeof(InternalAnnotationUrlCitation))]
150149
[ModelReaderWriterBuildable(typeof(InternalApproximateLocation))]
151150
[ModelReaderWriterBuildable(typeof(InternalAssistantsNamedToolChoiceFunction))]
152151
[ModelReaderWriterBuildable(typeof(InternalAssistantToolsFileSearchFileSearch))]
@@ -790,6 +789,7 @@ namespace OpenAI
790789
[ModelReaderWriterBuildable(typeof(UnknownRunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsObject))]
791790
[ModelReaderWriterBuildable(typeof(UnknownRunStepDetailsToolCallsObjectToolCallsObject))]
792791
[ModelReaderWriterBuildable(typeof(UnknownRunStepObjectStepDetails))]
792+
[ModelReaderWriterBuildable(typeof(UrlCitationAnnotation))]
793793
[ModelReaderWriterBuildable(typeof(UserChatMessage))]
794794
[ModelReaderWriterBuildable(typeof(ValidateGraderRequest))]
795795
[ModelReaderWriterBuildable(typeof(ValidateGraderResponse))]

0 commit comments

Comments
 (0)