Skip to content

Commit

Permalink
test: Updated replicate.json.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Nov 13, 2024
1 parent dd676ab commit aad5100
Show file tree
Hide file tree
Showing 132 changed files with 3,311 additions and 3,622 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- ollama.yaml
- openai.yaml
- petstore.yaml
- replicate.yaml
- replicate.json
- special-cases.yaml
- together.yaml
- heygen.yaml
Expand Down
2 changes: 1 addition & 1 deletion AutoSDK.sln
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "specs", "specs", "{7E829AE4
specs\ai21.json = specs\ai21.json
specs\huggingface.yaml = specs\huggingface.yaml
specs\cohere.yaml = specs\cohere.yaml
specs\replicate.yaml = specs\replicate.yaml
specs\together.yaml = specs\together.yaml
specs\assemblyai.yaml = specs\assemblyai.yaml
specs\mystic.yaml = specs\mystic.yaml
Expand All @@ -56,6 +55,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "specs", "specs", "{7E829AE4
specs\langsmith.json = specs\langsmith.json
specs\jina.json = specs\jina.json
specs\recraft.yaml = specs\recraft.yaml
specs\replicate.json = specs\replicate.json
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoSDK.IntegrationTests.Cli", "src\tests\AutoSDK.IntegrationTests.Cli\AutoSDK.IntegrationTests.Cli.csproj", "{41F1B4D8-5F6F-40FB-A1C2-A5E6A4B62AA7}"
Expand Down
1,392 changes: 1,392 additions & 0 deletions specs/replicate.json

Large diffs are not rendered by default.

997 changes: 0 additions & 997 deletions specs/replicate.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion src/tests/AutoSDK.IntegrationTests.Cli/CliTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class CliTests
[DataRow("ollama.yaml")]
[DataRow("openai.yaml")]
[DataRow("petstore.yaml")]
[DataRow("replicate.yaml")]
[DataRow("replicate.json")]
[DataRow("huggingface.yaml")]
[DataRow("ai21.json")]
[DataRow("cohere.yaml")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ partial void ProcessCreateDeploymentsResponseContent(
/// ```console<br/>
/// curl -s \<br/>
/// -X POST \<br/>
/// -H "Authorization: Bearer &lt;paste-your-token-here&gt;" \<br/>
/// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \<br/>
/// -H "Content-Type: application/json" \<br/>
/// -d '{<br/>
/// "name": "my-app-image-generator",<br/>
Expand Down Expand Up @@ -204,7 +204,7 @@ partial void ProcessCreateDeploymentsResponseContent(
/// ```console<br/>
/// curl -s \<br/>
/// -X POST \<br/>
/// -H "Authorization: Bearer &lt;paste-your-token-here&gt;" \<br/>
/// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \<br/>
/// -H "Content-Type: application/json" \<br/>
/// -d '{<br/>
/// "name": "my-app-image-generator",<br/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ partial void ProcessCreateModelsResponse(
/// Example cURL request:<br/>
/// ```console<br/>
/// curl -s -X POST \<br/>
/// -H "Authorization: Bearer &lt;paste-your-token-here&gt;" \<br/>
/// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \<br/>
/// -H 'Content-Type: application/json' \<br/>
/// -d '{"owner": "alice", "name": "my-model", "description": "An example model", "visibility": "public", "hardware": "cpu"}' \<br/>
/// https://api.replicate.com/v1/models<br/>
Expand Down Expand Up @@ -136,7 +136,7 @@ partial void ProcessCreateModelsResponse(
/// Example cURL request:<br/>
/// ```console<br/>
/// curl -s -X POST \<br/>
/// -H "Authorization: Bearer &lt;paste-your-token-here&gt;" \<br/>
/// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \<br/>
/// -H 'Content-Type: application/json' \<br/>
/// -d '{"owner": "alice", "name": "my-model", "description": "An example model", "visibility": "public", "hardware": "cpu"}' \<br/>
/// https://api.replicate.com/v1/models<br/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,64 +8,40 @@ public partial class Api
{
partial void PrepareCreatePredictionsArguments(
global::System.Net.Http.HttpClient httpClient,
ref string? prefer,
global::G.VersionPredictionRequest request);
partial void PrepareCreatePredictionsRequest(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpRequestMessage httpRequestMessage,
string? prefer,
global::G.VersionPredictionRequest request);
partial void ProcessCreatePredictionsResponse(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage);

/// <summary>
/// Create a prediction<br/>
/// Start a new prediction for the model version and inputs you provide.<br/>
/// Example request body:<br/>
/// ```json<br/>
/// {<br/>
/// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",<br/>
/// "input": {<br/>
/// "text": "Alice"<br/>
/// }<br/>
/// }<br/>
/// ```<br/>
/// Create a prediction for the model version and inputs you provide.<br/>
/// Example cURL request:<br/>
/// ```console<br/>
/// curl -s -X POST \<br/>
/// curl -s -X POST -H 'Prefer: wait' \<br/>
/// -d '{"version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa", "input": {"text": "Alice"}}' \<br/>
/// -H "Authorization: Bearer &lt;paste-your-token-here&gt;" \<br/>
/// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \<br/>
/// -H 'Content-Type: application/json' \<br/>
/// https://api.replicate.com/v1/predictions<br/>
/// ```<br/>
/// The response will be the prediction object:<br/>
/// ```json<br/>
/// {<br/>
/// "id": "gm3qorzdhgbfurvjtvhg6dckhu",<br/>
/// "model": "replicate/hello-world",<br/>
/// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",<br/>
/// "input": {<br/>
/// "text": "Alice"<br/>
/// },<br/>
/// "output": null,<br/>
/// "logs": "",<br/>
/// "error": null,<br/>
/// "status": "starting",<br/>
/// "created_at": "2023-09-08T16:19:34.765994657Z",<br/>
/// "urls": {<br/>
/// "cancel": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel",<br/>
/// "get": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu"<br/>
/// }<br/>
/// }<br/>
/// ```<br/>
/// 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/>
/// 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/>
/// 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.
/// 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/>
/// 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.
/// </summary>
/// <param name="prefer">
/// Example: wait=5
/// </param>
/// <param name="request"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::G.ApiException"></exception>
public async global::System.Threading.Tasks.Task CreatePredictionsAsync(
global::G.VersionPredictionRequest request,
string? prefer = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand All @@ -74,6 +50,7 @@ partial void ProcessCreatePredictionsResponse(
client: HttpClient);
PrepareCreatePredictionsArguments(
httpClient: HttpClient,
prefer: ref prefer,
request: request);

var __pathBuilder = new PathBuilder(
Expand All @@ -99,6 +76,12 @@ partial void ProcessCreatePredictionsResponse(
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
}
}

if (prefer != default)
{
__httpRequest.Headers.TryAddWithoutValidation("Prefer", prefer.ToString());
}

var __httpRequestContentBody = request.ToJson(JsonSerializerOptions);
var __httpRequestContent = new global::System.Net.Http.StringContent(
content: __httpRequestContentBody,
Expand All @@ -112,6 +95,7 @@ partial void ProcessCreatePredictionsResponse(
PrepareCreatePredictionsRequest(
httpClient: HttpClient,
httpRequestMessage: __httpRequest,
prefer: prefer,
request: request);

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

/// <summary>
/// Create a prediction<br/>
/// Start a new prediction for the model version and inputs you provide.<br/>
/// Example request body:<br/>
/// ```json<br/>
/// {<br/>
/// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",<br/>
/// "input": {<br/>
/// "text": "Alice"<br/>
/// }<br/>
/// }<br/>
/// ```<br/>
/// Create a prediction for the model version and inputs you provide.<br/>
/// Example cURL request:<br/>
/// ```console<br/>
/// curl -s -X POST \<br/>
/// curl -s -X POST -H 'Prefer: wait' \<br/>
/// -d '{"version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa", "input": {"text": "Alice"}}' \<br/>
/// -H "Authorization: Bearer &lt;paste-your-token-here&gt;" \<br/>
/// -H "Authorization: Bearer $REPLICATE_API_TOKEN" \<br/>
/// -H 'Content-Type: application/json' \<br/>
/// https://api.replicate.com/v1/predictions<br/>
/// ```<br/>
/// The response will be the prediction object:<br/>
/// ```json<br/>
/// {<br/>
/// "id": "gm3qorzdhgbfurvjtvhg6dckhu",<br/>
/// "model": "replicate/hello-world",<br/>
/// "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",<br/>
/// "input": {<br/>
/// "text": "Alice"<br/>
/// },<br/>
/// "output": null,<br/>
/// "logs": "",<br/>
/// "error": null,<br/>
/// "status": "starting",<br/>
/// "created_at": "2023-09-08T16:19:34.765994657Z",<br/>
/// "urls": {<br/>
/// "cancel": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel",<br/>
/// "get": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu"<br/>
/// }<br/>
/// }<br/>
/// ```<br/>
/// 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/>
/// 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/>
/// 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.
/// 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/>
/// 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.
/// </summary>
/// <param name="prefer">
/// Example: wait=5
/// </param>
/// <param name="input">
/// 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/>
/// Files should be passed as HTTP URLs or data URLs.<br/>
Expand Down Expand Up @@ -235,6 +192,7 @@ partial void ProcessCreatePredictionsResponse(
public async global::System.Threading.Tasks.Task CreatePredictionsAsync(
object input,
string version,
string? prefer = default,
bool? stream = default,
string? webhook = default,
global::System.Collections.Generic.IList<global::G.VersionPredictionRequestWebhookEventsFilterItem>? webhookEventsFilter = default,
Expand All @@ -250,6 +208,7 @@ partial void ProcessCreatePredictionsResponse(
};

await CreatePredictionsAsync(
prefer: prefer,
request: __request,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
Expand Down
Loading

0 comments on commit aad5100

Please sign in to comment.