Skip to content

Commit 703d1f2

Browse files
committed
removed deprecated text completion and edit endpoint and types
1 parent 8a56aa2 commit 703d1f2

6 files changed

Lines changed: 1 addition & 197 deletions

File tree

Runtime/DataTypes.cs

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -161,63 +161,7 @@ public struct CreateAudioResponse: IResponse
161161
public string Text { get; set; }
162162
}
163163
#endregion
164-
165-
#region Completions API Data Types
166-
public sealed class CreateCompletionRequest
167-
{
168-
public string Model { get; set; }
169-
public string Prompt { get; set; } = "<|endoftext|>";
170-
public string Suffix { get; set; }
171-
public int? MaxTokens { get; set; } = 16;
172-
public float? Temperature { get; set; } = 1;
173-
public float? TopP { get; set; } = 1;
174-
public int N { get; set; } = 1;
175-
public bool Stream { get; set; } = false;
176-
public int? Logpropbs { get; set; }
177-
public bool? Echo { get; set; } = false;
178-
public string Stop { get; set; }
179-
public float? PresencePenalty { get; set; } = 0;
180-
public float? FrequencyPenalty { get; set; } = 0;
181-
public int? BestOf { get; set; } = 1;
182-
public Dictionary<string, string> LogitBias { get; set; }
183-
public string User { get; set; }
184-
}
185-
186-
public struct CreateCompletionResponse: IResponse
187-
{
188-
public ApiError Error { get; set; }
189-
public string Warning { get; set; }
190-
public string Id { get; set; }
191-
public string Object { get; set; }
192-
public long Created { get; set; }
193-
public string Model { get; set; }
194-
public List<Choice> Choices { get; set; }
195-
public Usage Usage { get; set; }
196-
}
197-
#endregion
198-
199-
#region Edits API Data Types
200-
public sealed class CreateEditRequest
201-
{
202-
public string Model { get; set; }
203-
public string Input { get; set; } = "";
204-
public string Instruction { get; set; }
205-
public float? Temperature { get; set; } = 1;
206-
public float? TopP { get; set; } = 1;
207-
public int? N { get; set; } = 1;
208-
}
209164

210-
public struct CreateEditResponse: IResponse
211-
{
212-
public ApiError Error { get; set; }
213-
public string Warning { get; set; }
214-
public string Object { get; set; }
215-
public long Created { get; set; }
216-
public List<Choice> Choices { get; set; }
217-
public Usage Usage { get; set; }
218-
}
219-
#endregion
220-
221165
#region Images API Data Types
222166
public class CreateImageRequestBase
223167
{

Runtime/OpenAIApi.cs

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -216,35 +216,7 @@ public async Task<OpenAIModel> RetrieveModel(string id)
216216
var path = $"{BASE_PATH}/models/{id}";
217217
return await DispatchRequest<OpenAIModelResponse>(path, UnityWebRequest.kHttpVerbGET);
218218
}
219-
220-
/// <summary>
221-
/// Creates a completion for the provided prompt and parameters.
222-
/// </summary>
223-
/// <param name="request">See <see cref="CreateCompletionRequest"/></param>
224-
/// <returns>See <see cref="CreateCompletionResponse"/></returns>
225-
public async Task<CreateCompletionResponse> CreateCompletion(CreateCompletionRequest request)
226-
{
227-
var path = $"{BASE_PATH}/completions";
228-
var payload = CreatePayload(request);
229-
return await DispatchRequest<CreateCompletionResponse>(path, UnityWebRequest.kHttpVerbPOST, payload);
230-
}
231-
232-
/// <summary>
233-
/// Creates a chat completion request as in ChatGPT.
234-
/// </summary>
235-
/// <param name="request">See <see cref="CreateChatCompletionRequest"/></param>
236-
/// <param name="onResponse">Callback function that will be called when stream response is updated.</param>
237-
/// <param name="onComplete">Callback function that will be called when stream response is completed.</param>
238-
/// <param name="token">Cancellation token to cancel the request.</param>
239-
public void CreateCompletionAsync(CreateCompletionRequest request, Action<List<CreateCompletionResponse>> onResponse, Action onComplete, CancellationTokenSource token)
240-
{
241-
request.Stream = true;
242-
var path = $"{BASE_PATH}/completions";
243-
var payload = CreatePayload(request);
244-
245-
DispatchRequest(path, UnityWebRequest.kHttpVerbPOST, onResponse, onComplete, token, payload);
246-
}
247-
219+
248220
/// <summary>
249221
/// Creates a chat completion request as in ChatGPT.
250222
/// </summary>
@@ -274,18 +246,6 @@ public void CreateChatCompletionAsync(CreateChatCompletionRequest request, Actio
274246
DispatchRequest(path, UnityWebRequest.kHttpVerbPOST, onResponse, onComplete, token, payload);
275247
}
276248

277-
/// <summary>
278-
/// Creates a new edit for the provided input, instruction, and parameters.
279-
/// </summary>
280-
/// <param name="request">See <see cref="CreateEditRequest"/></param>
281-
/// <returns>See <see cref="CreateEditResponse"/></returns>
282-
public async Task<CreateEditResponse> CreateEdit(CreateEditRequest request)
283-
{
284-
var path = $"{BASE_PATH}/edits";
285-
var payload = CreatePayload(request);
286-
return await DispatchRequest<CreateEditResponse>(path, UnityWebRequest.kHttpVerbPOST, payload);
287-
}
288-
289249
/// <summary>
290250
/// Creates an image given a prompt.
291251
/// </summary>

Tests/CompletionsApiTests.cs

Lines changed: 0 additions & 55 deletions
This file was deleted.

Tests/CompletionsApiTests.cs.meta

Lines changed: 0 additions & 11 deletions
This file was deleted.

Tests/EditsApiTests.cs

Lines changed: 0 additions & 23 deletions
This file was deleted.

Tests/EditsApiTests.cs.meta

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)