Skip to content
Draft
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
34 changes: 10 additions & 24 deletions .dotnet/OpenAI.sln
Original file line number Diff line number Diff line change
@@ -1,37 +1,19 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29709.97
# Visual Studio Version 17
VisualStudioVersion = 17.9.34902.65
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAI", "src\OpenAI.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenAI", "src\OpenAI.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAI.Tests", "tests\OpenAI.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenAI.Tests", "tests\OpenAI.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.ClientModel", "..\..\azure-sdk-for-net\sdk\core\System.ClientModel\src\System.ClientModel.csproj", "{174AF64C-C129-454D-BFE7-0D05018EC531}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU
{8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU
{A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU
{FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU
{85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU
{28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU
{28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -40,6 +22,10 @@ Global
{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU
{174AF64C-C129-454D-BFE7-0D05018EC531}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{174AF64C-C129-454D-BFE7-0D05018EC531}.Debug|Any CPU.Build.0 = Debug|Any CPU
{174AF64C-C129-454D-BFE7-0D05018EC531}.Release|Any CPU.ActiveCfg = Release|Any CPU
{174AF64C-C129-454D-BFE7-0D05018EC531}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
5 changes: 5 additions & 0 deletions .dotnet/src/Custom/Assistants/Assistant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@ public partial class Assistant
/// </summary>
[CodeGenMember("TopP")]
public float? NucleusSamplingFactor { get; }

public override string ToString()
{
return Id;
}
}
64 changes: 40 additions & 24 deletions .dotnet/src/Custom/Assistants/AssistantClient.Convenience.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,14 @@ public virtual ClientResult<ThreadMessage> CreateMessage(
/// timestamp.
/// </param>
/// <returns> A collection of messages that can be enumerated using <c>await foreach</c>. </returns>
public virtual AsyncPageableCollection<ThreadMessage> GetMessagesAsync(
public virtual AsyncPageableResult<ThreadMessage> GetMessagesAsync(
AssistantThread thread,
int? pageSize = null,
ListOrder? resultOrder = default)
{
Argument.AssertNotNull(thread, nameof(thread));

return GetMessagesAsync(thread.Id, resultOrder);
return GetMessagesAsync(thread.Id, pageSize, resultOrder);
}

/// <summary>
Expand All @@ -148,13 +149,16 @@ public virtual AsyncPageableCollection<ThreadMessage> GetMessagesAsync(
/// timestamp.
/// </param>
/// <returns> A collection of messages that can be enumerated using <c>foreach</c>. </returns>
public virtual PageableCollection<ThreadMessage> GetMessages(
AssistantThread thread,
ListOrder? resultOrder = default)
public virtual PageableResult<ThreadMessage> GetMessages(
AssistantThread thread,
ListOrder? resultOrder = null,
string itemsAfter = default,
string itemsBefore = default,
int? pageSize = null)
{
Argument.AssertNotNull(thread, nameof(thread));

return GetMessages(thread.Id, resultOrder);
return GetMessages(thread.Id, resultOrder, itemsAfter, itemsBefore, pageSize);
}

/// <summary>
Expand Down Expand Up @@ -236,7 +240,7 @@ public virtual ClientResult<ThreadRun> CreateRun(AssistantThread thread, Assista
/// <param name="thread"> The thread that the run should evaluate. </param>
/// <param name="assistant"> The assistant that should be used when evaluating the thread. </param>
/// <param name="options"> Additional options for the run. </param>
public virtual AsyncResultCollection<StreamingUpdate> CreateRunStreamingAsync(
public virtual AsyncCollectionResult<StreamingUpdate> CreateRunStreamingAsync(
AssistantThread thread,
Assistant assistant,
RunCreationOptions options = null)
Expand All @@ -249,7 +253,7 @@ public virtual AsyncResultCollection<StreamingUpdate> CreateRunStreamingAsync(
/// <param name="thread"> The thread that the run should evaluate. </param>
/// <param name="assistant"> The assistant that should be used when evaluating the thread. </param>
/// <param name="options"> Additional options for the run. </param>
public virtual ResultCollection<StreamingUpdate> CreateRunStreaming(
public virtual CollectionResult<StreamingUpdate> CreateRunStreaming(
AssistantThread thread,
Assistant assistant,
RunCreationOptions options = null)
Expand Down Expand Up @@ -287,7 +291,7 @@ public virtual ClientResult<ThreadRun> CreateThreadAndRun(
/// <param name="assistant"> The assistant that the new run should use. </param>
/// <param name="threadOptions"> Options for the new thread that will be created. </param>
/// <param name="runOptions"> Additional options to apply to the run that will begin. </param>
public virtual AsyncResultCollection<StreamingUpdate> CreateThreadAndRunStreamingAsync(
public virtual AsyncCollectionResult<StreamingUpdate> CreateThreadAndRunStreamingAsync(
Assistant assistant,
ThreadCreationOptions threadOptions = null,
RunCreationOptions runOptions = null)
Expand All @@ -299,7 +303,7 @@ public virtual AsyncResultCollection<StreamingUpdate> CreateThreadAndRunStreamin
/// <param name="assistant"> The assistant that the new run should use. </param>
/// <param name="threadOptions"> Options for the new thread that will be created. </param>
/// <param name="runOptions"> Additional options to apply to the run that will begin. </param>
public virtual ResultCollection<StreamingUpdate> CreateThreadAndRunStreaming(
public virtual CollectionResult<StreamingUpdate> CreateThreadAndRunStreaming(
Assistant assistant,
ThreadCreationOptions threadOptions = null,
RunCreationOptions runOptions = null)
Expand All @@ -314,13 +318,16 @@ public virtual ResultCollection<StreamingUpdate> CreateThreadAndRunStreaming(
/// timestamp.
/// </param>
/// <returns> A collection of runs that can be enumerated using <c>await foreach</c>. </returns>
public virtual AsyncPageableCollection<ThreadRun> GetRunsAsync(
public virtual AsyncPageableResult<ThreadRun> GetRunsAsync(
AssistantThread thread,
ListOrder? resultOrder = default)
ListOrder? resultOrder = null,
string itemsAfter = default,
string itemsBefore = default,
int? pageSize = null)
{
Argument.AssertNotNull(thread, nameof(thread));

return GetRunsAsync(thread.Id, resultOrder);
return GetRunsAsync(thread.Id, resultOrder, itemsAfter, itemsBefore, pageSize);
}

/// <summary>
Expand All @@ -332,13 +339,16 @@ public virtual AsyncPageableCollection<ThreadRun> GetRunsAsync(
/// timestamp.
/// </param>
/// <returns> A collection of runs that can be enumerated using <c>foreach</c>. </returns>
public virtual PageableCollection<ThreadRun> GetRuns(
public virtual PageableResult<ThreadRun> GetRuns(
AssistantThread thread,
ListOrder? resultOrder = default)
ListOrder? resultOrder = null,
string itemsAfter = default,
string itemsBefore = default,
int? pageSize = null)
{
Argument.AssertNotNull(thread, nameof(thread));

return GetRuns(thread.Id, resultOrder);
return GetRuns(thread.Id, resultOrder, itemsAfter, itemsBefore, pageSize);
}

/// <summary>
Expand Down Expand Up @@ -390,7 +400,7 @@ public virtual ClientResult<ThreadRun> SubmitToolOutputsToRun(
/// <param name="toolOutputs">
/// The tool outputs, corresponding to <see cref="InternalRequiredToolCall"/> instances from the run.
/// </param>
public virtual AsyncResultCollection<StreamingUpdate> SubmitToolOutputsToRunStreamingAsync(
public virtual AsyncCollectionResult<StreamingUpdate> SubmitToolOutputsToRunStreamingAsync(
ThreadRun run,
IEnumerable<ToolOutput> toolOutputs)
=> SubmitToolOutputsToRunStreamingAsync(run?.ThreadId, run?.Id, toolOutputs);
Expand All @@ -402,7 +412,7 @@ public virtual AsyncResultCollection<StreamingUpdate> SubmitToolOutputsToRunStre
/// <param name="toolOutputs">
/// The tool outputs, corresponding to <see cref="InternalRequiredToolCall"/> instances from the run.
/// </param>
public virtual ResultCollection<StreamingUpdate> SubmitToolOutputsToRunStreaming(
public virtual CollectionResult<StreamingUpdate> SubmitToolOutputsToRunStreaming(
ThreadRun run,
IEnumerable<ToolOutput> toolOutputs)
=> SubmitToolOutputsToRunStreaming(run?.ThreadId, run?.Id, toolOutputs);
Expand Down Expand Up @@ -432,13 +442,16 @@ public virtual ClientResult<ThreadRun> CancelRun(ThreadRun run)
/// timestamp.
/// </param>
/// <returns> A collection of run steps that can be enumerated using <c>await foreach</c>. </returns>
public virtual PageableCollection<RunStep> GetRunSteps(
public virtual PageableResult<RunStep> GetRunSteps(
ThreadRun run,
ListOrder? resultOrder = default)
ListOrder? resultOrder = null,
string itemsAfter = default,
string itemsBefore = default,
int? pageSize = null)
{
Argument.AssertNotNull(run, nameof(run));

return GetRunSteps(run.ThreadId, run.Id, resultOrder);
return GetRunSteps(run.ThreadId, run.Id, resultOrder, itemsAfter, itemsBefore, pageSize);
}

/// <summary>
Expand All @@ -450,12 +463,15 @@ public virtual PageableCollection<RunStep> GetRunSteps(
/// timestamp.
/// </param>
/// <returns> A collection of run steps that can be enumerated using <c>foreach</c>. </returns>
public virtual AsyncPageableCollection<RunStep> GetRunStepsAsync(
public virtual AsyncPageableResult<RunStep> GetRunStepsAsync(
ThreadRun run,
ListOrder? resultOrder = default)
ListOrder? resultOrder = null,
string itemsAfter = default,
string itemsBefore = default,
int? pageSize = null)
{
Argument.AssertNotNull(run, nameof(run));

return GetRunStepsAsync(run.ThreadId, run.Id, resultOrder);
return GetRunStepsAsync(run.ThreadId, run.Id, resultOrder, itemsAfter, itemsBefore, pageSize);
}
}
Loading