Skip to content

Commit

Permalink
Merge pull request #648 from betalgo/628-azure-openai-upload-file-wit…
Browse files Browse the repository at this point in the history
…h-purpose-set-to-batch

Azure DataPlane Endpoints are updated
  • Loading branch information
kayhantolga authored Oct 8, 2024
2 parents 7704d04 + 23b2dcf commit f5b196e
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions OpenAI.SDK/EndpointProviders/AzureOpenAiEndpointProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ public AzureOpenAiEndpointProvider(string apiVersion, string deploymentId)
private string Prefix => $"{ApiPrefix}/{DeploymentsPrefix}/{WebUtility.UrlEncode(_deploymentId)}";
private string AzureVersionQueryString => $"?api-version={_apiVersion}";
private string AssistantPrefix => $"{ApiPrefix}/";
private string DataPlanePrefix => $"{ApiPrefix}/";

public string ModelRetrieve(string model)
{
return $"{Prefix}/models/{model}{AzureVersionQueryString}";
return $"{DataPlanePrefix}/models/{model}{AzureVersionQueryString}";
}

public string FileDelete(string fileId)
{
return $"{Prefix}/files/{fileId}{AzureVersionQueryString}";
return $"{DataPlanePrefix}/files/{fileId}{AzureVersionQueryString}";
}

public string CompletionCreate()
Expand All @@ -43,7 +44,7 @@ public string EditCreate()

public string ModelsList()
{
return $"{Prefix}/models{AzureVersionQueryString}";
return $"{DataPlanePrefix}/models{AzureVersionQueryString}";
}

public string FilesList()
Expand All @@ -58,12 +59,12 @@ public string FilesUpload()

public string FileRetrieve(string fileId)
{
return $"{Prefix}/files/{fileId}{AzureVersionQueryString}";
return $"{DataPlanePrefix}/files/{fileId}{AzureVersionQueryString}";
}

public string FileRetrieveContent(string fileId)
{
return $"{Prefix}/files/{fileId}/content{AzureVersionQueryString}";
return $"{DataPlanePrefix}/files/{fileId}/content{AzureVersionQueryString}";
}

public string FineTuneCreate()
Expand Down Expand Up @@ -93,17 +94,17 @@ public string FineTuneListEvents(string fineTuneId)

public string FineTuneDelete(string fineTuneId)
{
return $"{Prefix}/models/{fineTuneId}{AzureVersionQueryString}";
return $"{DataPlanePrefix}/fine_tuning/jobs/{fineTuneId}{AzureVersionQueryString}";
}

public string FineTuningJobCreate()
{
return $"{Prefix}/fine_tuning/jobs{AzureVersionQueryString}";
return $"{DataPlanePrefix}/fine_tuning/jobs{AzureVersionQueryString}";
}

public string FineTuningJobList(FineTuningJobListRequest? fineTuningJobListRequest)
{
var url = $"{Prefix}/fine_tuning/jobs";
var url = $"{DataPlanePrefix}/fine_tuning/jobs";
if (fineTuningJobListRequest != null)
{
var queryParams = new List<string>();
Expand All @@ -121,22 +122,22 @@ public string FineTuningJobList(FineTuningJobListRequest? fineTuningJobListReque

public string FineTuningJobRetrieve(string fineTuningJobId)
{
return $"{Prefix}/fine_tuning/jobs/{fineTuningJobId}{AzureVersionQueryString}";
return $"{DataPlanePrefix}/fine_tuning/jobs/{fineTuningJobId}{AzureVersionQueryString}";
}

public string FineTuningJobCancel(string fineTuningJobId)
{
return $"{Prefix}/fine_tuning/jobs/{fineTuningJobId}/cancel{AzureVersionQueryString}";
return $"{DataPlanePrefix}/fine_tuning/jobs/{fineTuningJobId}/cancel{AzureVersionQueryString}";
}

public string FineTuningJobListEvents(string fineTuningJobId)
{
return $"{Prefix}/fine_tuning/jobs/{fineTuningJobId}/events{AzureVersionQueryString}";
return $"{DataPlanePrefix}/fine_tuning/jobs/{fineTuningJobId}/events{AzureVersionQueryString}";
}

public string ModelsDelete(string modelId)
{
return $"{Prefix}/models/{modelId}{AzureVersionQueryString}";
return $"{DataPlanePrefix}/models/{modelId}{AzureVersionQueryString}";
}

public string EmbeddingCreate()
Expand Down Expand Up @@ -451,26 +452,26 @@ public string VectorStoreFileBatchList(string vectorStoreId, string batchId, Pag

public string BatchCreate()
{
return $"{Prefix}/batches{AzureVersionQueryString}";
return $"{DataPlanePrefix}/batches{AzureVersionQueryString}";
}

public string BatchRetrieve(string batchId)
{
return $"{Prefix}/batches/{batchId}{AzureVersionQueryString}";
return $"{DataPlanePrefix}/batches/{batchId}{AzureVersionQueryString}";
}

public string BatchCancel(string batchId)
{
return $"{Prefix}/batches/{batchId}/cancel{AzureVersionQueryString}";
return $"{DataPlanePrefix}/batches/{batchId}/cancel{AzureVersionQueryString}";
}

public string FineTuningJobList()
{
return $"{Prefix}/fine_tuning/jobs{AzureVersionQueryString}";
return $"{DataPlanePrefix}/fine_tuning/jobs{AzureVersionQueryString}";
}

private string Files()
{
return $"{Prefix}/files{AzureVersionQueryString}";
return $"{DataPlanePrefix}/files{AzureVersionQueryString}";
}
}

0 comments on commit f5b196e

Please sign in to comment.