Skip to content

Commit

Permalink
Revert the removal of the version path parameter v1 from the default …
Browse files Browse the repository at this point in the history
…endpoint URL (#192)
  • Loading branch information
joseharriaga authored Aug 28, 2024
1 parent 5773292 commit 583e9f6
Show file tree
Hide file tree
Showing 29 changed files with 82 additions and 80 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

### Other Changes

- Reverted the removal of the version path parameter "v1" from the default endpoint URL. (commit_hash)

## 2.0.0-beta.10 (2024-08-26)

### Breaking Changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private PipelineMessage CreateGetAssistantsRequest(int? limit, string order, str
request.Method = "GET";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/assistants", false);
uri.AppendPath("/assistants", false);
if (limit != null)
{
uri.AppendQuery("limit", limit.Value, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private PipelineMessage CreateGetMessagesRequest(string threadId, int? limit, st
request.Method = "GET";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/threads/", false);
uri.AppendPath("/threads/", false);
uri.AppendPath(threadId, true);
uri.AppendPath("/messages", false);
if (limit != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private PipelineMessage CreateGetRunStepsRequest(string threadId, string runId,
request.Method = "GET";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/threads/", false);
uri.AppendPath("/threads/", false);
uri.AppendPath(threadId, true);
uri.AppendPath("/runs/", false);
uri.AppendPath(runId, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private PipelineMessage CreateGetRunsRequest(string threadId, int? limit, string
request.Method = "GET";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/threads/", false);
uri.AppendPath("/threads/", false);
uri.AppendPath(threadId, true);
uri.AppendPath("/runs", false);
if (limit != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ internal PipelineMessage CreateGetBatchesRequest(string after, int? limit, Reque
request.Method = "GET";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/batches", false);
uri.AppendPath("/batches", false);
if (after != null)
{
uri.AppendQuery("after", after, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ internal PipelineMessage CreateGetFineTuningJobCheckpointsRequest(string fineTun
request.Method = "GET";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/fine_tuning/jobs/", false);
uri.AppendPath("/fine_tuning/jobs/", false);
uri.AppendPath(fineTuningJobId, true);
uri.AppendPath("/checkpoints", false);
if (after != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ internal PipelineMessage CreateGetFineTuningEventsRequest(string fineTuningJobId
request.Method = "GET";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/fine_tuning/jobs/", false);
uri.AppendPath("/fine_tuning/jobs/", false);
uri.AppendPath(fineTuningJobId, true);
uri.AppendPath("/events", false);
if (after != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ internal PipelineMessage CreateGetFineTuningJobsRequest(string after, int? limit
request.Method = "GET";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/fine_tuning/jobs", false);
uri.AppendPath("/fine_tuning/jobs", false);
if (after != null)
{
uri.AppendQuery("after", after, true);
Expand Down
2 changes: 1 addition & 1 deletion src/Custom/OpenAIClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace OpenAI;
[CodeGenSuppress("GetVectorStoreClientClient")]
public partial class OpenAIClient
{
private const string OpenAIV1Endpoint = "https://api.openai.com";
private const string OpenAIV1Endpoint = "https://api.openai.com/v1";
private const string OpenAIBetaHeaderValue = "assistants=v2";

private static class KnownHeaderNames
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ internal PipelineMessage CreateGetFilesInVectorStoreBatchesRequest(string vector
request.Method = "GET";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/vector_stores/", false);
uri.AppendPath("/vector_stores/", false);
uri.AppendPath(vectorStoreId, true);
uri.AppendPath("/file_batches/", false);
uri.AppendPath(batchId, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ internal PipelineMessage CreateGetVectorStoreFilesRequest(string vectorStoreId,
request.Method = "GET";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/vector_stores/", false);
uri.AppendPath("/vector_stores/", false);
uri.AppendPath(vectorStoreId, true);
uri.AppendPath("/files", false);
if (limit != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ internal PipelineMessage CreateGetVectorStoresRequest(int? limit, string order,
request.Method = "GET";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/vector_stores", false);
uri.AppendPath("/vector_stores", false);
if (limit != null)
{
uri.AppendQuery("limit", limit.Value, true);
Expand Down
10 changes: 5 additions & 5 deletions src/Generated/AssistantClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ internal PipelineMessage CreateCreateAssistantRequest(BinaryContent content, Req
request.Method = "POST";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/assistants", false);
uri.AppendPath("/assistants", false);
request.Uri = uri.ToUri();
request.Headers.Set("Accept", "application/json");
request.Headers.Set("Content-Type", "application/json");
Expand All @@ -49,7 +49,7 @@ internal PipelineMessage CreateGetAssistantsRequest(int? limit, string order, st
request.Method = "GET";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/assistants", false);
uri.AppendPath("/assistants", false);
if (limit != null)
{
uri.AppendQuery("limit", limit.Value, true);
Expand Down Expand Up @@ -80,7 +80,7 @@ internal PipelineMessage CreateGetAssistantRequest(string assistantId, RequestOp
request.Method = "GET";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/assistants/", false);
uri.AppendPath("/assistants/", false);
uri.AppendPath(assistantId, true);
request.Uri = uri.ToUri();
request.Headers.Set("Accept", "application/json");
Expand All @@ -96,7 +96,7 @@ internal PipelineMessage CreateModifyAssistantRequest(string assistantId, Binary
request.Method = "POST";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/assistants/", false);
uri.AppendPath("/assistants/", false);
uri.AppendPath(assistantId, true);
request.Uri = uri.ToUri();
request.Headers.Set("Accept", "application/json");
Expand All @@ -114,7 +114,7 @@ internal PipelineMessage CreateDeleteAssistantRequest(string assistantId, Reques
request.Method = "DELETE";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/assistants/", false);
uri.AppendPath("/assistants/", false);
uri.AppendPath(assistantId, true);
request.Uri = uri.ToUri();
request.Headers.Set("Accept", "application/json");
Expand Down
6 changes: 3 additions & 3 deletions src/Generated/AudioClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ internal PipelineMessage CreateCreateSpeechRequest(BinaryContent content, Reques
request.Method = "POST";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/audio/speech", false);
uri.AppendPath("/audio/speech", false);
request.Uri = uri.ToUri();
request.Headers.Set("Accept", "application/octet-stream");
request.Headers.Set("Content-Type", "application/json");
Expand All @@ -49,7 +49,7 @@ internal PipelineMessage CreateCreateTranscriptionRequest(BinaryContent content,
request.Method = "POST";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/audio/transcriptions", false);
uri.AppendPath("/audio/transcriptions", false);
request.Uri = uri.ToUri();
request.Headers.Set("Accept", "application/json");
request.Headers.Set("Content-Type", contentType);
Expand All @@ -66,7 +66,7 @@ internal PipelineMessage CreateCreateTranslationRequest(BinaryContent content, s
request.Method = "POST";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/audio/translations", false);
uri.AppendPath("/audio/translations", false);
request.Uri = uri.ToUri();
request.Headers.Set("Accept", "application/json");
request.Headers.Set("Content-Type", contentType);
Expand Down
8 changes: 4 additions & 4 deletions src/Generated/BatchClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal PipelineMessage CreateCreateBatchRequest(BinaryContent content, Request
request.Method = "POST";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/batches", false);
uri.AppendPath("/batches", false);
request.Uri = uri.ToUri();
request.Headers.Set("Accept", "application/json");
request.Headers.Set("Content-Type", "application/json");
Expand All @@ -50,7 +50,7 @@ internal PipelineMessage CreateGetBatchesRequest(string after, int? limit, Reque
request.Method = "GET";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/batches", false);
uri.AppendPath("/batches", false);
if (after != null)
{
uri.AppendQuery("after", after, true);
Expand All @@ -73,7 +73,7 @@ internal PipelineMessage CreateRetrieveBatchRequest(string batchId, RequestOptio
request.Method = "GET";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/batches/", false);
uri.AppendPath("/batches/", false);
uri.AppendPath(batchId, true);
request.Uri = uri.ToUri();
request.Headers.Set("Accept", "application/json");
Expand All @@ -89,7 +89,7 @@ internal PipelineMessage CreateCancelBatchRequest(string batchId, RequestOptions
request.Method = "POST";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/batches/", false);
uri.AppendPath("/batches/", false);
uri.AppendPath(batchId, true);
uri.AppendPath("/cancel", false);
request.Uri = uri.ToUri();
Expand Down
2 changes: 1 addition & 1 deletion src/Generated/ChatClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ internal PipelineMessage CreateCreateChatCompletionRequest(BinaryContent content
request.Method = "POST";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/chat/completions", false);
uri.AppendPath("/chat/completions", false);
request.Uri = uri.ToUri();
request.Headers.Set("Accept", "application/json");
request.Headers.Set("Content-Type", "application/json");
Expand Down
2 changes: 1 addition & 1 deletion src/Generated/EmbeddingClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ internal PipelineMessage CreateCreateEmbeddingRequest(BinaryContent content, Req
request.Method = "POST";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/embeddings", false);
uri.AppendPath("/embeddings", false);
request.Uri = uri.ToUri();
request.Headers.Set("Accept", "application/json");
request.Headers.Set("Content-Type", "application/json");
Expand Down
10 changes: 5 additions & 5 deletions src/Generated/FileClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ internal PipelineMessage CreateCreateFileRequest(BinaryContent content, string c
request.Method = "POST";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/files", false);
uri.AppendPath("/files", false);
request.Uri = uri.ToUri();
request.Headers.Set("Accept", "application/json");
request.Headers.Set("Content-Type", contentType);
Expand All @@ -49,7 +49,7 @@ internal PipelineMessage CreateGetFilesRequest(string purpose, RequestOptions op
request.Method = "GET";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/files", false);
uri.AppendPath("/files", false);
if (purpose != null)
{
uri.AppendQuery("purpose", purpose, true);
Expand All @@ -68,7 +68,7 @@ internal PipelineMessage CreateRetrieveFileRequest(string fileId, RequestOptions
request.Method = "GET";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/files/", false);
uri.AppendPath("/files/", false);
uri.AppendPath(fileId, true);
request.Uri = uri.ToUri();
request.Headers.Set("Accept", "application/json");
Expand All @@ -84,7 +84,7 @@ internal PipelineMessage CreateDeleteFileRequest(string fileId, RequestOptions o
request.Method = "DELETE";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/files/", false);
uri.AppendPath("/files/", false);
uri.AppendPath(fileId, true);
request.Uri = uri.ToUri();
request.Headers.Set("Accept", "application/json");
Expand All @@ -100,7 +100,7 @@ internal PipelineMessage CreateDownloadFileRequest(string fileId, RequestOptions
request.Method = "GET";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/files/", false);
uri.AppendPath("/files/", false);
uri.AppendPath(fileId, true);
uri.AppendPath("/content", false);
request.Uri = uri.ToUri();
Expand Down
12 changes: 6 additions & 6 deletions src/Generated/FineTuningClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ internal PipelineMessage CreateCreateFineTuningJobRequest(BinaryContent content,
request.Method = "POST";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/fine_tuning/jobs", false);
uri.AppendPath("/fine_tuning/jobs", false);
request.Uri = uri.ToUri();
request.Headers.Set("Accept", "application/json");
request.Headers.Set("Content-Type", "application/json");
Expand All @@ -49,7 +49,7 @@ internal PipelineMessage CreateGetPaginatedFineTuningJobsRequest(string after, i
request.Method = "GET";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/fine_tuning/jobs", false);
uri.AppendPath("/fine_tuning/jobs", false);
if (after != null)
{
uri.AppendQuery("after", after, true);
Expand All @@ -72,7 +72,7 @@ internal PipelineMessage CreateRetrieveFineTuningJobRequest(string fineTuningJob
request.Method = "GET";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/fine_tuning/jobs/", false);
uri.AppendPath("/fine_tuning/jobs/", false);
uri.AppendPath(fineTuningJobId, true);
request.Uri = uri.ToUri();
request.Headers.Set("Accept", "application/json");
Expand All @@ -88,7 +88,7 @@ internal PipelineMessage CreateCancelFineTuningJobRequest(string fineTuningJobId
request.Method = "POST";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/fine_tuning/jobs/", false);
uri.AppendPath("/fine_tuning/jobs/", false);
uri.AppendPath(fineTuningJobId, true);
uri.AppendPath("/cancel", false);
request.Uri = uri.ToUri();
Expand All @@ -105,7 +105,7 @@ internal PipelineMessage CreateGetFineTuningJobCheckpointsRequest(string fineTun
request.Method = "GET";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/fine_tuning/jobs/", false);
uri.AppendPath("/fine_tuning/jobs/", false);
uri.AppendPath(fineTuningJobId, true);
uri.AppendPath("/checkpoints", false);
if (after != null)
Expand All @@ -130,7 +130,7 @@ internal PipelineMessage CreateGetFineTuningEventsRequest(string fineTuningJobId
request.Method = "GET";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/fine_tuning/jobs/", false);
uri.AppendPath("/fine_tuning/jobs/", false);
uri.AppendPath(fineTuningJobId, true);
uri.AppendPath("/events", false);
if (after != null)
Expand Down
6 changes: 3 additions & 3 deletions src/Generated/ImageClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ internal PipelineMessage CreateCreateImageRequest(BinaryContent content, Request
request.Method = "POST";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/images/generations", false);
uri.AppendPath("/images/generations", false);
request.Uri = uri.ToUri();
request.Headers.Set("Accept", "application/json");
request.Headers.Set("Content-Type", "application/json");
Expand All @@ -49,7 +49,7 @@ internal PipelineMessage CreateCreateImageEditRequest(BinaryContent content, str
request.Method = "POST";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/images/edits", false);
uri.AppendPath("/images/edits", false);
request.Uri = uri.ToUri();
request.Headers.Set("Accept", "application/json");
request.Headers.Set("Content-Type", contentType);
Expand All @@ -66,7 +66,7 @@ internal PipelineMessage CreateCreateImageVariationRequest(BinaryContent content
request.Method = "POST";
var uri = new ClientUriBuilder();
uri.Reset(_endpoint);
uri.AppendPath("/v1/images/variations", false);
uri.AppendPath("/images/variations", false);
request.Uri = uri.ToUri();
request.Headers.Set("Accept", "application/json");
request.Headers.Set("Content-Type", contentType);
Expand Down
Loading

0 comments on commit 583e9f6

Please sign in to comment.