Skip to content

Commit aad5100

Browse files
committed
test: Updated replicate.json.
1 parent dd676ab commit aad5100

File tree

132 files changed

+3311
-3622
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+3311
-3622
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- ollama.yaml
3939
- openai.yaml
4040
- petstore.yaml
41-
- replicate.yaml
41+
- replicate.json
4242
- special-cases.yaml
4343
- together.yaml
4444
- heygen.yaml

AutoSDK.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "specs", "specs", "{7E829AE4
4040
specs\ai21.json = specs\ai21.json
4141
specs\huggingface.yaml = specs\huggingface.yaml
4242
specs\cohere.yaml = specs\cohere.yaml
43-
specs\replicate.yaml = specs\replicate.yaml
4443
specs\together.yaml = specs\together.yaml
4544
specs\assemblyai.yaml = specs\assemblyai.yaml
4645
specs\mystic.yaml = specs\mystic.yaml
@@ -56,6 +55,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "specs", "specs", "{7E829AE4
5655
specs\langsmith.json = specs\langsmith.json
5756
specs\jina.json = specs\jina.json
5857
specs\recraft.yaml = specs\recraft.yaml
58+
specs\replicate.json = specs\replicate.json
5959
EndProjectSection
6060
EndProject
6161
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoSDK.IntegrationTests.Cli", "src\tests\AutoSDK.IntegrationTests.Cli\AutoSDK.IntegrationTests.Cli.csproj", "{41F1B4D8-5F6F-40FB-A1C2-A5E6A4B62AA7}"

specs/replicate.json

Lines changed: 1392 additions & 0 deletions
Large diffs are not rendered by default.

specs/replicate.yaml

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

src/tests/AutoSDK.IntegrationTests.Cli/CliTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class CliTests
1212
[DataRow("ollama.yaml")]
1313
[DataRow("openai.yaml")]
1414
[DataRow("petstore.yaml")]
15-
[DataRow("replicate.yaml")]
15+
[DataRow("replicate.json")]
1616
[DataRow("huggingface.yaml")]
1717
[DataRow("ai21.json")]
1818
[DataRow("cohere.yaml")]

src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreateDeployments.g.verified.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ partial void ProcessCreateDeploymentsResponseContent(
2929
/// ```console<br/>
3030
/// curl -s \<br/>
3131
/// -X POST \<br/>
32-
/// -H "Authorization: Bearer &lt;paste-your-token-here&gt;" \<br/>
32+
/// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \<br/>
3333
/// -H "Content-Type: application/json" \<br/>
3434
/// -d '{<br/>
3535
/// "name": "my-app-image-generator",<br/>
@@ -204,7 +204,7 @@ partial void ProcessCreateDeploymentsResponseContent(
204204
/// ```console<br/>
205205
/// curl -s \<br/>
206206
/// -X POST \<br/>
207-
/// -H "Authorization: Bearer &lt;paste-your-token-here&gt;" \<br/>
207+
/// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \<br/>
208208
/// -H "Content-Type: application/json" \<br/>
209209
/// -d '{<br/>
210210
/// "name": "my-app-image-generator",<br/>

src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreateModels.g.verified.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ partial void ProcessCreateModelsResponse(
2323
/// Example cURL request:<br/>
2424
/// ```console<br/>
2525
/// curl -s -X POST \<br/>
26-
/// -H "Authorization: Bearer &lt;paste-your-token-here&gt;" \<br/>
26+
/// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \<br/>
2727
/// -H 'Content-Type: application/json' \<br/>
2828
/// -d '{"owner": "alice", "name": "my-model", "description": "An example model", "visibility": "public", "hardware": "cpu"}' \<br/>
2929
/// https://api.replicate.com/v1/models<br/>
@@ -136,7 +136,7 @@ partial void ProcessCreateModelsResponse(
136136
/// Example cURL request:<br/>
137137
/// ```console<br/>
138138
/// curl -s -X POST \<br/>
139-
/// -H "Authorization: Bearer &lt;paste-your-token-here&gt;" \<br/>
139+
/// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \<br/>
140140
/// -H 'Content-Type: application/json' \<br/>
141141
/// -d '{"owner": "alice", "name": "my-model", "description": "An example model", "visibility": "public", "hardware": "cpu"}' \<br/>
142142
/// https://api.replicate.com/v1/models<br/>

src/tests/AutoSDK.SnapshotTests/Snapshots/Replicate/NewtonsoftJson/_#G.Api.CreatePredictions.g.verified.cs

Lines changed: 29 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -8,64 +8,40 @@ public partial class Api
88
{
99
partial void PrepareCreatePredictionsArguments(
1010
global::System.Net.Http.HttpClient httpClient,
11+
ref string? prefer,
1112
global::G.VersionPredictionRequest request);
1213
partial void PrepareCreatePredictionsRequest(
1314
global::System.Net.Http.HttpClient httpClient,
1415
global::System.Net.Http.HttpRequestMessage httpRequestMessage,
16+
string? prefer,
1517
global::G.VersionPredictionRequest request);
1618
partial void ProcessCreatePredictionsResponse(
1719
global::System.Net.Http.HttpClient httpClient,
1820
global::System.Net.Http.HttpResponseMessage httpResponseMessage);
1921

2022
/// <summary>
2123
/// Create a prediction<br/>
22-
/// Start a new prediction for the model version and inputs you provide.<br/>
23-
/// Example request body:<br/>
24-
/// ```json<br/>
25-
/// {<br/>
26-
/// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",<br/>
27-
/// "input": {<br/>
28-
/// "text": "Alice"<br/>
29-
/// }<br/>
30-
/// }<br/>
31-
/// ```<br/>
24+
/// Create a prediction for the model version and inputs you provide.<br/>
3225
/// Example cURL request:<br/>
3326
/// ```console<br/>
34-
/// curl -s -X POST \<br/>
27+
/// curl -s -X POST -H 'Prefer: wait' \<br/>
3528
/// -d '{"version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa", "input": {"text": "Alice"}}' \<br/>
36-
/// -H "Authorization: Bearer &lt;paste-your-token-here&gt;" \<br/>
29+
/// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \<br/>
3730
/// -H 'Content-Type: application/json' \<br/>
3831
/// https://api.replicate.com/v1/predictions<br/>
3932
/// ```<br/>
40-
/// The response will be the prediction object:<br/>
41-
/// ```json<br/>
42-
/// {<br/>
43-
/// "id": "gm3qorzdhgbfurvjtvhg6dckhu",<br/>
44-
/// "model": "replicate/hello-world",<br/>
45-
/// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",<br/>
46-
/// "input": {<br/>
47-
/// "text": "Alice"<br/>
48-
/// },<br/>
49-
/// "output": null,<br/>
50-
/// "logs": "",<br/>
51-
/// "error": null,<br/>
52-
/// "status": "starting",<br/>
53-
/// "created_at": "2023-09-08T16:19:34.765994657Z",<br/>
54-
/// "urls": {<br/>
55-
/// "cancel": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel",<br/>
56-
/// "get": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu"<br/>
57-
/// }<br/>
58-
/// }<br/>
59-
/// ```<br/>
60-
/// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.<br/>
61-
/// Input and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.<br/>
62-
/// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it.
33+
/// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.<br/>
34+
/// For a complete overview of the `predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases.
6335
/// </summary>
36+
/// <param name="prefer">
37+
/// Example: wait=5
38+
/// </param>
6439
/// <param name="request"></param>
6540
/// <param name="cancellationToken">The token to cancel the operation with</param>
6641
/// <exception cref="global::G.ApiException"></exception>
6742
public async global::System.Threading.Tasks.Task CreatePredictionsAsync(
6843
global::G.VersionPredictionRequest request,
44+
string? prefer = default,
6945
global::System.Threading.CancellationToken cancellationToken = default)
7046
{
7147
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -74,6 +50,7 @@ partial void ProcessCreatePredictionsResponse(
7450
client: HttpClient);
7551
PrepareCreatePredictionsArguments(
7652
httpClient: HttpClient,
53+
prefer: ref prefer,
7754
request: request);
7855

7956
var __pathBuilder = new PathBuilder(
@@ -99,6 +76,12 @@ partial void ProcessCreatePredictionsResponse(
9976
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
10077
}
10178
}
79+
80+
if (prefer != default)
81+
{
82+
__httpRequest.Headers.TryAddWithoutValidation("Prefer", prefer.ToString());
83+
}
84+
10285
var __httpRequestContentBody = request.ToJson(JsonSerializerOptions);
10386
var __httpRequestContent = new global::System.Net.Http.StringContent(
10487
content: __httpRequestContentBody,
@@ -112,6 +95,7 @@ partial void ProcessCreatePredictionsResponse(
11295
PrepareCreatePredictionsRequest(
11396
httpClient: HttpClient,
11497
httpRequestMessage: __httpRequest,
98+
prefer: prefer,
11599
request: request);
116100

117101
using var __response = await HttpClient.SendAsync(
@@ -146,48 +130,21 @@ partial void ProcessCreatePredictionsResponse(
146130

147131
/// <summary>
148132
/// Create a prediction<br/>
149-
/// Start a new prediction for the model version and inputs you provide.<br/>
150-
/// Example request body:<br/>
151-
/// ```json<br/>
152-
/// {<br/>
153-
/// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",<br/>
154-
/// "input": {<br/>
155-
/// "text": "Alice"<br/>
156-
/// }<br/>
157-
/// }<br/>
158-
/// ```<br/>
133+
/// Create a prediction for the model version and inputs you provide.<br/>
159134
/// Example cURL request:<br/>
160135
/// ```console<br/>
161-
/// curl -s -X POST \<br/>
136+
/// curl -s -X POST -H 'Prefer: wait' \<br/>
162137
/// -d '{"version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa", "input": {"text": "Alice"}}' \<br/>
163-
/// -H "Authorization: Bearer &lt;paste-your-token-here&gt;" \<br/>
138+
/// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \<br/>
164139
/// -H 'Content-Type: application/json' \<br/>
165140
/// https://api.replicate.com/v1/predictions<br/>
166141
/// ```<br/>
167-
/// The response will be the prediction object:<br/>
168-
/// ```json<br/>
169-
/// {<br/>
170-
/// "id": "gm3qorzdhgbfurvjtvhg6dckhu",<br/>
171-
/// "model": "replicate/hello-world",<br/>
172-
/// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",<br/>
173-
/// "input": {<br/>
174-
/// "text": "Alice"<br/>
175-
/// },<br/>
176-
/// "output": null,<br/>
177-
/// "logs": "",<br/>
178-
/// "error": null,<br/>
179-
/// "status": "starting",<br/>
180-
/// "created_at": "2023-09-08T16:19:34.765994657Z",<br/>
181-
/// "urls": {<br/>
182-
/// "cancel": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel",<br/>
183-
/// "get": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu"<br/>
184-
/// }<br/>
185-
/// }<br/>
186-
/// ```<br/>
187-
/// As models can take several seconds or more to run, the output will not be available immediately. To get the final result of the prediction you should either provide a `webhook` HTTPS URL for us to call when the results are ready, or poll the [get a prediction](#predictions.get) endpoint until it has finished.<br/>
188-
/// Input and output (including any files) will be automatically deleted after an hour, so you must save a copy of any files in the output if you'd like to continue using them.<br/>
189-
/// Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it.
142+
/// The request will wait up to 60 seconds for the model to run. If this time is exceeded the prediction will be returned in a `"starting"` state and need to be retrieved using the `predictions.get` endpiont.<br/>
143+
/// For a complete overview of the `predictions.create` API check out our documentation on [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) which covers a variety of use cases.
190144
/// </summary>
145+
/// <param name="prefer">
146+
/// Example: wait=5
147+
/// </param>
191148
/// <param name="input">
192149
/// The model's input as a JSON object. The input schema depends on what model you are running. To see the available inputs, click the "API" tab on the model you are running or [get the model version](#models.versions.get) and look at its `openapi_schema` property. For example, [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as an input.<br/>
193150
/// Files should be passed as HTTP URLs or data URLs.<br/>
@@ -235,6 +192,7 @@ partial void ProcessCreatePredictionsResponse(
235192
public async global::System.Threading.Tasks.Task CreatePredictionsAsync(
236193
object input,
237194
string version,
195+
string? prefer = default,
238196
bool? stream = default,
239197
string? webhook = default,
240198
global::System.Collections.Generic.IList<global::G.VersionPredictionRequestWebhookEventsFilterItem>? webhookEventsFilter = default,
@@ -250,6 +208,7 @@ partial void ProcessCreatePredictionsResponse(
250208
};
251209

252210
await CreatePredictionsAsync(
211+
prefer: prefer,
253212
request: __request,
254213
cancellationToken: cancellationToken).ConfigureAwait(false);
255214
}

0 commit comments

Comments
 (0)