Skip to content

Commit 057e54b

Browse files
authored
Refactor Assistants for better organization (#158)
* No API and no behavior changes. * Prefixes the names of a few internal models with "Internal" for consistency. * Moves the internal pagination classes for Assistants and VectorStores into a sub-folder called "Internal/Pagination". * Bumps the timeout of Assistant tests slightly to improve reliability.
1 parent 7b31b63 commit 057e54b

File tree

86 files changed

+799
-765
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+799
-765
lines changed

src/Custom/Assistants/Internal/GeneratorStubs.Internal.cs

Lines changed: 17 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -11,55 +11,55 @@ internal partial class InternalSubmitToolOutputsRunRequest { }
1111
internal readonly partial struct InternalCreateAssistantRequestModel { }
1212

1313
[CodeGenModel("MessageContentTextObjectAnnotation")]
14-
internal partial class MessageContentTextObjectAnnotation { }
14+
internal partial class InternalMessageContentTextObjectAnnotation { }
1515

1616
[CodeGenModel("MessageContentTextAnnotationsFileCitationObject")]
17-
internal partial class MessageContentTextAnnotationsFileCitationObject { }
17+
internal partial class InternalMessageContentTextAnnotationsFileCitationObject { }
1818

1919
[CodeGenModel("MessageContentTextAnnotationsFilePathObject")]
20-
internal partial class MessageContentTextAnnotationsFilePathObject { }
20+
internal partial class InternalMessageContentTextAnnotationsFilePathObject { }
2121

2222
[CodeGenModel("MessageDeltaContentImageFileObjectImageFile")]
23-
internal partial class MessageDeltaContentImageFileObjectImageFile
23+
internal partial class InternalMessageDeltaContentImageFileObjectImageFile
2424
{
2525
[CodeGenMember("Detail")]
2626
internal string Detail { get; set; }
2727
}
2828

2929
[CodeGenModel("MessageDeltaContentImageUrlObjectImageUrl")]
30-
internal partial class MessageDeltaContentImageUrlObjectImageUrl
30+
internal partial class InternalMessageDeltaContentImageUrlObjectImageUrl
3131
{
3232
[CodeGenMember("Detail")]
3333
internal string Detail { get; }
3434
}
3535

3636
[CodeGenModel("MessageDeltaContentImageFileObject")]
37-
internal partial class MessageDeltaContentImageFileObject { }
37+
internal partial class InternalMessageDeltaContentImageFileObject { }
3838

3939
[CodeGenModel("MessageDeltaContentImageUrlObject")]
40-
internal partial class MessageDeltaContentImageUrlObject { }
40+
internal partial class InternalMessageDeltaContentImageUrlObject { }
4141

4242
[CodeGenModel("MessageDeltaObjectDelta")]
43-
internal partial class MessageDeltaObjectDelta
43+
internal partial class InternalMessageDeltaObjectDelta
4444
{
4545
[CodeGenMember("Role")]
4646
internal MessageRole Role { get; }
4747
}
4848

4949
[CodeGenModel("MessageDeltaContentTextObject")]
50-
internal partial class MessageDeltaContentTextObject { }
50+
internal partial class InternalMessageDeltaContentTextObject { }
5151

5252
[CodeGenModel("MessageDeltaContentTextObjectText")]
53-
internal partial class MessageDeltaContentTextObjectText { }
53+
internal partial class InternalMessageDeltaContentTextObjectText { }
5454

5555
[CodeGenModel("MessageDeltaContentTextAnnotationsFileCitationObject")]
56-
internal partial class MessageDeltaContentTextAnnotationsFileCitationObject { }
56+
internal partial class InternalMessageDeltaContentTextAnnotationsFileCitationObject { }
5757

5858
[CodeGenModel("MessageDeltaTextContentAnnotation")]
59-
internal partial class MessageDeltaTextContentAnnotation { }
59+
internal partial class InternalMessageDeltaTextContentAnnotation { }
6060

6161
[CodeGenModel("MessageDeltaContentTextAnnotationsFileCitationObjectFileCitation")]
62-
internal partial class MessageDeltaContentTextAnnotationsFileCitationObjectFileCitation { }
62+
internal partial class InternalMessageDeltaContentTextAnnotationsFileCitationObjectFileCitation { }
6363

6464
[CodeGenModel("RunStepDeltaObject")]
6565
internal partial class InternalRunStepDelta { private readonly object Object; }
@@ -68,22 +68,13 @@ internal partial class InternalRunStepDelta { private readonly object Object; }
6868
internal partial class InternalRunStepDeltaObjectDelta { }
6969

7070
[CodeGenModel("MessageDeltaContentTextAnnotationsFilePathObject")]
71-
internal partial class MessageDeltaContentTextAnnotationsFilePathObject { }
71+
internal partial class InternalMessageDeltaContentTextAnnotationsFilePathObject { }
7272

7373
[CodeGenModel("MessageDeltaContentTextAnnotationsFilePathObjectFilePath")]
74-
internal partial class MessageDeltaContentTextAnnotationsFilePathObjectFilePath { }
75-
76-
[CodeGenModel("UnknownMessageDeltaContent")]
77-
internal partial class UnknownMessageDeltaContent { }
78-
79-
[CodeGenModel("UnknownAssistantToolDefinition")]
80-
internal partial class UnknownAssistantToolDefinition { }
81-
82-
[CodeGenModel("UnknownRunStepDeltaStepDetailsToolCallsObjectToolCallsObject")]
83-
internal partial class UnknownRunStepDeltaStepDetailsToolCallsObjectToolCallsObject { }
74+
internal partial class InternalMessageDeltaContentTextAnnotationsFilePathObjectFilePath { }
8475

8576
[CodeGenModel("MessageDeltaContent")]
86-
internal partial class MessageDeltaContent { }
77+
internal partial class InternalMessageDeltaContent { }
8778

8879
[CodeGenModel("DeleteAssistantResponse")]
8980
internal partial class InternalDeleteAssistantResponse { }
@@ -127,25 +118,7 @@ internal partial class InternalMessageContentItemFileObjectImageFile
127118
}
128119

129120
[CodeGenModel("MessageContentTextObjectText")]
130-
internal partial class MessageContentTextObjectText { }
131-
132-
[CodeGenModel("UnknownMessageContentTextObjectAnnotation")]
133-
internal partial class UnknownMessageContentTextObjectAnnotation { }
134-
135-
[CodeGenModel("UnknownMessageDeltaTextContentAnnotation")]
136-
internal partial class UnknownMessageDeltaTextContentAnnotation { }
137-
138-
[CodeGenModel("UnknownRunStepDetails")]
139-
internal partial class UnknownRunStepDetails { }
140-
141-
[CodeGenModel("UnknownRunStepObjectStepDetails")]
142-
internal partial class UnknownRunStepObjectStepDetails { }
143-
144-
[CodeGenModel("UnknownRunStepDetailsToolCallsObjectToolCallsObject")]
145-
internal partial class UnknownRunStepDetailsToolCallsObjectToolCallsObject { }
146-
147-
[CodeGenModel("UnknownRunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsObject")]
148-
internal partial class UnknownRunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsObject { }
121+
internal partial class InternalMessageContentTextObjectText { }
149122

150123
[CodeGenModel("RunStepDetailsMessageCreationObjectMessageCreation")]
151124
internal partial class InternalRunStepDetailsMessageCreationObjectMessageCreation { }
@@ -256,12 +229,6 @@ internal partial class InternalRunStepDeltaStepDetailsToolCallsCodeOutputImageOb
256229
[CodeGenModel("RunStepDeltaStepDetails")]
257230
internal partial class InternalRunStepDeltaStepDetails { }
258231

259-
[CodeGenModel("UnknownRunStepDeltaStepDetailsToolCallsCodeObjectCodeInterpreterOutputsObject")]
260-
internal partial class UnknownRunStepDeltaStepDetailsToolCallsCodeObjectCodeInterpreterOutputsObject { }
261-
262-
[CodeGenModel("UnknownRunStepDeltaStepDetails")]
263-
internal partial class UnknownRunStepDeltaStepDetails { }
264-
265232
[CodeGenModel("RunStepDeltaStepDetailsToolCallsFunctionObjectFunction")]
266233
internal partial class InternalRunStepDeltaStepDetailsToolCallsFunctionObjectFunction { }
267234

src/Custom/Assistants/Internal/InternalResponseMessageTextContent.Serialization.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ protected override void WriteCore(Utf8JsonWriter writer, ModelReaderWriterOption
2121
writer.WritePropertyName("type"u8);
2222
writer.WriteStringValue(_type);
2323
writer.WritePropertyName("text"u8);
24-
writer.WriteObjectValue<MessageContentTextObjectText>(_text, options);
24+
writer.WriteObjectValue<InternalMessageContentTextObjectText>(_text, options);
2525
writer.WriteSerializedAdditionalRawData(SerializedAdditionalRawData, options);
2626
writer.WriteEndObject();
2727
}

src/Custom/Assistants/Internal/InternalResponseMessageTextContent.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace OpenAI.Assistants;
88
[CodeGenModel("MessageContentTextObject")]
99
internal partial class InternalResponseMessageTextContent
1010
{
11-
/// <inheritdoc cref="MessageContentTextObjectText.Value"/>
11+
/// <inheritdoc cref="InternalMessageContentTextObjectText.Value"/>
1212
public string InternalText => _text.Value;
1313

1414
public IReadOnlyList<TextAnnotation> InternalAnnotations => _annotations ??= WrapAnnotations();
@@ -17,14 +17,14 @@ internal partial class InternalResponseMessageTextContent
1717
private readonly string _type;
1818

1919
[CodeGenMember("Text")]
20-
private readonly MessageContentTextObjectText _text;
20+
private readonly InternalMessageContentTextObjectText _text;
2121

2222
private IReadOnlyList<TextAnnotation> _annotations;
2323

2424
/// <summary> Initializes a new instance of <see cref="InternalResponseMessageTextContent"/>. </summary>
2525
/// <param name="internalText"></param>
2626
/// <exception cref="ArgumentNullException"> <paramref name="internalText"/> is null. </exception>
27-
internal InternalResponseMessageTextContent(MessageContentTextObjectText internalText)
27+
internal InternalResponseMessageTextContent(InternalMessageContentTextObjectText internalText)
2828
{
2929
Argument.AssertNotNull(internalText, nameof(internalText));
3030

@@ -36,7 +36,7 @@ internal InternalResponseMessageTextContent(MessageContentTextObjectText interna
3636
private IReadOnlyList<TextAnnotation> WrapAnnotations()
3737
{
3838
List<TextAnnotation> annotations = [];
39-
foreach (MessageContentTextObjectAnnotation internalAnnotation in _text?.Annotations ?? [])
39+
foreach (InternalMessageContentTextObjectAnnotation internalAnnotation in _text?.Annotations ?? [])
4040
{
4141
annotations.Add(new(internalAnnotation));
4242
}

0 commit comments

Comments
 (0)