Skip to content

Latest commit

 

History

History
57 lines (38 loc) · 2.3 KB

vertexai.singlerequestoptions.md

File metadata and controls

57 lines (38 loc) · 2.3 KB

Project: /docs/reference/js/_project.yaml Book: /docs/reference/_book.yaml page_type: reference

{% comment %} DO NOT EDIT THIS FILE! This is generated by the JS SDK team, and any local changes will be overwritten. Changes should be made in the source code at https://github.com/firebase/firebase-js-sdk {% endcomment %}

SingleRequestOptions interface

Options that can be provided per-request. Extends the base RequestOptions (like timeout and baseUrl) with request-specific controls like cancellation via AbortSignal.

Options specified here will override any default RequestOptions configured on a model (e.g. GenerativeModel).

Signature:

export interface SingleRequestOptions extends RequestOptions 

Extends: RequestOptions

Properties

Property Type Description
signal AbortSignal An AbortSignal instance that allows cancelling ongoing requests (like generateContent or generateImages).If provided, calling abort() on the corresponding AbortController will attempt to cancel the underlying HTTP request. An AbortError will be thrown if cancellation is successful.Note that this will not cancel the request in the backend, so billing will still be applied despite cancellation.

SingleRequestOptions.signal

An AbortSignal instance that allows cancelling ongoing requests (like generateContent or generateImages).

If provided, calling abort() on the corresponding AbortController will attempt to cancel the underlying HTTP request. An AbortError will be thrown if cancellation is successful.

Note that this will not cancel the request in the backend, so billing will still be applied despite cancellation.

Signature:

signal?: AbortSignal;

Example

const controller = new AbortController();
const model = getGenerativeModel({
  // ...
});

// To cancel request:
controller.abort();