Skip to content

Commit

Permalink
feat: Updated OpenAPI spec
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Sep 12, 2024
1 parent 4004b73 commit 3ea450d
Show file tree
Hide file tree
Showing 8 changed files with 599 additions and 93 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@

#nullable enable

namespace AI21
{
public partial class Ai21Api
{
partial void PrepareGetMessagesStudioV1AssistantThreadsThreadIdMessagesGetArguments(
global::System.Net.Http.HttpClient httpClient,
ref string threadId);
partial void PrepareGetMessagesStudioV1AssistantThreadsThreadIdMessagesGetRequest(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpRequestMessage httpRequestMessage,
string threadId);
partial void ProcessGetMessagesStudioV1AssistantThreadsThreadIdMessagesGetResponse(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage);

partial void ProcessGetMessagesStudioV1AssistantThreadsThreadIdMessagesGetResponseContent(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage,
ref string content);

/// <summary>
/// Get Messages
/// </summary>
/// <param name="threadId"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::AI21.GetMessagesResponse> GetMessagesStudioV1AssistantThreadsThreadIdMessagesGetAsync(
string threadId,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: _httpClient);
PrepareGetMessagesStudioV1AssistantThreadsThreadIdMessagesGetArguments(
httpClient: _httpClient,
threadId: ref threadId);

using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Get,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/studio/v1/assistant/threads/{threadId}/messages", global::System.UriKind.RelativeOrAbsolute));

PrepareRequest(
client: _httpClient,
request: httpRequest);
PrepareGetMessagesStudioV1AssistantThreadsThreadIdMessagesGetRequest(
httpClient: _httpClient,
httpRequestMessage: httpRequest,
threadId: threadId);

using var response = await _httpClient.SendAsync(
request: httpRequest,
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
cancellationToken: cancellationToken).ConfigureAwait(false);

ProcessResponse(
client: _httpClient,
response: response);
ProcessGetMessagesStudioV1AssistantThreadsThreadIdMessagesGetResponse(
httpClient: _httpClient,
httpResponseMessage: response);

var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

ProcessResponseContent(
client: _httpClient,
response: response,
content: ref __content);
ProcessGetMessagesStudioV1AssistantThreadsThreadIdMessagesGetResponseContent(
httpClient: _httpClient,
httpResponseMessage: response,
content: ref __content);

try
{
response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException ex)
{
throw new global::System.InvalidOperationException(__content, ex);
}

return
global::System.Text.Json.JsonSerializer.Deserialize(__content, global::AI21.SourceGenerationContext.Default.GetMessagesResponse) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@

#nullable enable

namespace AI21
{
public partial class Ai21Api
{
partial void PrepareSubmitToolOutputsStudioV1AssistantThreadsThreadIdRunsRunIdSubmitToolOutputsPostArguments(
global::System.Net.Http.HttpClient httpClient,
ref string threadId,
ref string runId,
global::AI21.SubmitToolOutputsRequest request);
partial void PrepareSubmitToolOutputsStudioV1AssistantThreadsThreadIdRunsRunIdSubmitToolOutputsPostRequest(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpRequestMessage httpRequestMessage,
string threadId,
string runId,
global::AI21.SubmitToolOutputsRequest request);
partial void ProcessSubmitToolOutputsStudioV1AssistantThreadsThreadIdRunsRunIdSubmitToolOutputsPostResponse(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage);

partial void ProcessSubmitToolOutputsStudioV1AssistantThreadsThreadIdRunsRunIdSubmitToolOutputsPostResponseContent(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage,
ref string content);

/// <summary>
/// Submit Tool Outputs
/// </summary>
/// <param name="threadId"></param>
/// <param name="runId"></param>
/// <param name="request"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::AI21.SubmitToolOutputsResponse> SubmitToolOutputsStudioV1AssistantThreadsThreadIdRunsRunIdSubmitToolOutputsPostAsync(
string threadId,
string runId,
global::AI21.SubmitToolOutputsRequest request,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));

PrepareArguments(
client: _httpClient);
PrepareSubmitToolOutputsStudioV1AssistantThreadsThreadIdRunsRunIdSubmitToolOutputsPostArguments(
httpClient: _httpClient,
threadId: ref threadId,
runId: ref runId,
request: request);

using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Post,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/studio/v1/assistant/threads/{threadId}/runs/{runId}/submit_tool_outputs", global::System.UriKind.RelativeOrAbsolute));
var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::AI21.SourceGenerationContext.Default.SubmitToolOutputsRequest);
var __httpRequestContent = new global::System.Net.Http.StringContent(
content: __httpRequestContentBody,
encoding: global::System.Text.Encoding.UTF8,
mediaType: "application/json");
httpRequest.Content = __httpRequestContent;

PrepareRequest(
client: _httpClient,
request: httpRequest);
PrepareSubmitToolOutputsStudioV1AssistantThreadsThreadIdRunsRunIdSubmitToolOutputsPostRequest(
httpClient: _httpClient,
httpRequestMessage: httpRequest,
threadId: threadId,
runId: runId,
request: request);

using var response = await _httpClient.SendAsync(
request: httpRequest,
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
cancellationToken: cancellationToken).ConfigureAwait(false);

ProcessResponse(
client: _httpClient,
response: response);
ProcessSubmitToolOutputsStudioV1AssistantThreadsThreadIdRunsRunIdSubmitToolOutputsPostResponse(
httpClient: _httpClient,
httpResponseMessage: response);

var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

ProcessResponseContent(
client: _httpClient,
response: response,
content: ref __content);
ProcessSubmitToolOutputsStudioV1AssistantThreadsThreadIdRunsRunIdSubmitToolOutputsPostResponseContent(
httpClient: _httpClient,
httpResponseMessage: response,
content: ref __content);

try
{
response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException ex)
{
throw new global::System.InvalidOperationException(__content, ex);
}

return
global::System.Text.Json.JsonSerializer.Deserialize(__content, global::AI21.SourceGenerationContext.Default.SubmitToolOutputsResponse) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
}

/// <summary>
/// Submit Tool Outputs
/// </summary>
/// <param name="threadId"></param>
/// <param name="runId"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::AI21.SubmitToolOutputsResponse> SubmitToolOutputsStudioV1AssistantThreadsThreadIdRunsRunIdSubmitToolOutputsPostAsync(
string threadId,
string runId,
global::System.Threading.CancellationToken cancellationToken = default)
{
var request = new global::AI21.SubmitToolOutputsRequest
{
};

return await SubmitToolOutputsStudioV1AssistantThreadsThreadIdRunsRunIdSubmitToolOutputsPostAsync(
threadId: threadId,
runId: runId,
request: request,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
}
24 changes: 24 additions & 0 deletions src/libs/AI21/Generated/AI21.Models.GetMessagesResponse.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

#nullable enable

namespace AI21
{
/// <summary>
///
/// </summary>
public sealed partial class GetMessagesResponse
{
/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("results")]
[global::System.Text.Json.Serialization.JsonRequired]
public required global::System.Collections.Generic.IList<global::AI21.MessageResponse> Results { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
[global::System.Text.Json.Serialization.JsonExtensionData]
public global::System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary<string, object>();
}
}
83 changes: 83 additions & 0 deletions src/libs/AI21/Generated/AI21.Models.MessageResponse.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@

#nullable enable

namespace AI21
{
/// <summary>
///
/// </summary>
public sealed partial class MessageResponse
{
/// <summary>
/// The role of an individual message.<br/>
/// - `user`: Input provided by the user. Any instructions given here that conflict<br/>
/// with instructions given in the `system` prompt take precedence over the `system`<br/>
/// prompt instructions.<br/>
/// - `assistant`: Response generated by the model.<br/>
/// - `system`: Initial instructions provided to the system to provide general guidance<br/>
/// on the tone and voice of the generated message. An initial system message is<br/>
/// optional but recommended to provide guidance on the tone of the chat. For<br/>
/// example, "You are a helpful chatbot with a background in earth sciences and a<br/>
/// charming French accent."
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("role")]
[global::System.Text.Json.Serialization.JsonRequired]
public required string Role { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("content")]
[global::System.Text.Json.Serialization.JsonRequired]
public required string Content { get; set; }

/// <summary>
/// A unique ID for the request (not the message). Repeated identical requests<br/>
/// get different IDs. However, for a streaming response, the ID will be the same<br/>
/// for all responses in the stream.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("id")]
[global::System.Text.Json.Serialization.JsonRequired]
public required string Id { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("created_at")]
[global::System.Text.Json.Serialization.JsonRequired]
public required global::System.DateTime CreatedAt { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("updated_at")]
[global::System.Text.Json.Serialization.JsonRequired]
public required global::System.DateTime UpdatedAt { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("object")]
[global::System.Text.Json.Serialization.JsonRequired]
public required string Object { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("thread_id")]
[global::System.Text.Json.Serialization.JsonRequired]
public required string ThreadId { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("assistant_id")]
public string? AssistantId { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
[global::System.Text.Json.Serialization.JsonExtensionData]
public global::System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary<string, object>();
}
}
18 changes: 18 additions & 0 deletions src/libs/AI21/Generated/AI21.Models.SubmitToolOutputsRequest.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

#nullable enable

namespace AI21
{
/// <summary>
///
/// </summary>
public sealed partial class SubmitToolOutputsRequest
{

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
[global::System.Text.Json.Serialization.JsonExtensionData]
public global::System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary<string, object>();
}
}
18 changes: 18 additions & 0 deletions src/libs/AI21/Generated/AI21.Models.SubmitToolOutputsResponse.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

#nullable enable

namespace AI21
{
/// <summary>
///
/// </summary>
public sealed partial class SubmitToolOutputsResponse
{

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
[global::System.Text.Json.Serialization.JsonExtensionData]
public global::System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary<string, object>();
}
}
Loading

0 comments on commit 3ea450d

Please sign in to comment.