Skip to content

Create Presigned URLs for Evaluation Dataset File Upload

client.Agents.EvaluationDatasets.NewFileUploadPresignedURLs(ctx, body) (*AgentEvaluationDatasetNewFileUploadPresignedURLsResponse, error)
post/v2/gen-ai/evaluation_datasets/file_upload_presigned_urls

To create presigned URLs for evaluation dataset file upload, send a POST request to /v2/gen-ai/evaluation_datasets/file_upload_presigned_urls.

ParametersExpand Collapse
body AgentEvaluationDatasetNewFileUploadPresignedURLsParams
Files param.Field[[]AgentEvaluationDatasetNewFileUploadPresignedURLsParamsFile]optional

A list of files to generate presigned URLs for.

FileName stringoptional

Local filename

FileSize stringoptional

The size of the file in bytes.

formatint64
ReturnsExpand Collapse
type AgentEvaluationDatasetNewFileUploadPresignedURLsResponse struct{…}

Response with pre-signed urls to upload files.

RequestID stringoptional

The ID generated for the request for Presigned URLs.

Uploads []AgentEvaluationDatasetNewFileUploadPresignedURLsResponseUploadoptional

A list of generated presigned URLs and object keys, one per file.

ExpiresAt Timeoptional

The time the url expires at.

formatdate-time
ObjectKey stringoptional

The unique object key to store the file as.

OriginalFileName stringoptional

The original file name.

PresignedURL stringoptional

The actual presigned URL the client can use to upload the file directly.

Create Presigned URLs for Evaluation Dataset File Upload
package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/-go"
  "github.com/stainless-sdks/-go/option"
)

func main() {
  client := gradient.NewClient(
    option.WithAccessToken("My Access Token"),
  )
  response, err := client.Agents.EvaluationDatasets.NewFileUploadPresignedURLs(context.TODO(), gradient.AgentEvaluationDatasetNewFileUploadPresignedURLsParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.RequestID)
}
{
  "request_id": "123e4567-e89b-12d3-a456-426614174000",
  "uploads": [
    {
      "expires_at": "2023-01-01T00:00:00Z",
      "object_key": "example string",
      "original_file_name": "example name",
      "presigned_url": "example string"
    }
  ]
}
Returns Examples
{
  "request_id": "123e4567-e89b-12d3-a456-426614174000",
  "uploads": [
    {
      "expires_at": "2023-01-01T00:00:00Z",
      "object_key": "example string",
      "original_file_name": "example name",
      "presigned_url": "example string"
    }
  ]
}