Class: Stagehand::Models::SessionExtractParams::Options

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/stagehand/models/session_extract_params.rb

Defined Under Namespace

Modules: Model

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(ignore_selectors: nil, model: nil, screenshot: nil, selector: nil, timeout: nil) ⇒ Object

Some parameter documentations has been truncated, see Stagehand::Models::SessionExtractParams::Options for more details.

Parameters:



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
# File 'lib/stagehand/models/session_extract_params.rb', line 62

class Options < Stagehand::Internal::Type::BaseModel
  # @!attribute ignore_selectors
  #   Selectors for elements and subtrees that should be excluded from extraction
  #
  #   @return [Array<String>, nil]
  optional :ignore_selectors, Stagehand::Internal::Type::ArrayOf[String], api_name: :ignoreSelectors

  # @!attribute model
  #   Model configuration object or model name string (e.g., 'openai/gpt-5-nano')
  #
  #   @return [Stagehand::Models::SessionExtractParams::Options::Model::VertexModelConfigObject, Stagehand::Models::SessionExtractParams::Options::Model::GenericModelConfigObject, String, nil]
  optional :model, union: -> { Stagehand::SessionExtractParams::Options::Model }

  # @!attribute screenshot
  #   When true, include a screenshot of the current viewport in the extraction LLM
  #   call. Defaults to false.
  #
  #   @return [Boolean, nil]
  optional :screenshot, Stagehand::Internal::Type::Boolean

  # @!attribute selector
  #   CSS selector to scope extraction to a specific element
  #
  #   @return [String, nil]
  optional :selector, String

  # @!attribute timeout
  #   Timeout in ms for the extraction
  #
  #   @return [Float, nil]
  optional :timeout, Float

  # @!method initialize(ignore_selectors: nil, model: nil, screenshot: nil, selector: nil, timeout: nil)
  #   Some parameter documentations has been truncated, see
  #   {Stagehand::Models::SessionExtractParams::Options} for more details.
  #
  #   @param ignore_selectors [Array<String>] Selectors for elements and subtrees that should be excluded from extraction
  #
  #   @param model [Stagehand::Models::SessionExtractParams::Options::Model::VertexModelConfigObject, Stagehand::Models::SessionExtractParams::Options::Model::GenericModelConfigObject, String] Model configuration object or model name string (e.g., 'openai/gpt-5-nano')
  #
  #   @param screenshot [Boolean] When true, include a screenshot of the current viewport in the extraction LLM ca
  #
  #   @param selector [String] CSS selector to scope extraction to a specific element
  #
  #   @param timeout [Float] Timeout in ms for the extraction

  # Model configuration object or model name string (e.g., 'openai/gpt-5-nano')
  #
  # @see Stagehand::Models::SessionExtractParams::Options#model
  module Model
    extend Stagehand::Internal::Type::Union

    variant -> { Stagehand::SessionExtractParams::Options::Model::VertexModelConfigObject }

    variant -> { Stagehand::SessionExtractParams::Options::Model::GenericModelConfigObject }

    variant String

    class VertexModelConfigObject < Stagehand::Internal::Type::BaseModel
      # @!attribute auth
      #   Vertex provider authentication configuration
      #
      #   @return [Stagehand::Models::SessionExtractParams::Options::Model::VertexModelConfigObject::Auth]
      required :auth, -> { Stagehand::SessionExtractParams::Options::Model::VertexModelConfigObject::Auth }

      # @!attribute model_name
      #   Model name string with provider prefix (e.g., 'openai/gpt-5-nano')
      #
      #   @return [String]
      required :model_name, String, api_name: :modelName

      # @!attribute provider
      #   Vertex AI model provider
      #
      #   @return [Symbol, :vertex]
      required :provider, const: :vertex

      # @!attribute provider_options
      #   Vertex provider-specific model configuration
      #
      #   @return [Stagehand::Models::SessionExtractParams::Options::Model::VertexModelConfigObject::ProviderOptions]
      required :provider_options,
               -> {
                 Stagehand::SessionExtractParams::Options::Model::VertexModelConfigObject::ProviderOptions
               },
               api_name: :providerOptions

      # @!attribute api_key
      #   API key for the model provider
      #
      #   @return [String, nil]
      optional :api_key, String, api_name: :apiKey

      # @!attribute base_url
      #   Base URL for the model provider
      #
      #   @return [String, nil]
      optional :base_url, String, api_name: :baseURL

      # @!attribute headers
      #   Custom headers sent with every request to the model provider
      #
      #   @return [Hash{Symbol=>String}, nil]
      optional :headers, Stagehand::Internal::Type::HashOf[String]

      # @!method initialize(auth:, model_name:, provider_options:, api_key: nil, base_url: nil, headers: nil, provider: :vertex)
      #   @param auth [Stagehand::Models::SessionExtractParams::Options::Model::VertexModelConfigObject::Auth] Vertex provider authentication configuration
      #
      #   @param model_name [String] Model name string with provider prefix (e.g., 'openai/gpt-5-nano')
      #
      #   @param provider_options [Stagehand::Models::SessionExtractParams::Options::Model::VertexModelConfigObject::ProviderOptions] Vertex provider-specific model configuration
      #
      #   @param api_key [String] API key for the model provider
      #
      #   @param base_url [String] Base URL for the model provider
      #
      #   @param headers [Hash{Symbol=>String}] Custom headers sent with every request to the model provider
      #
      #   @param provider [Symbol, :vertex] Vertex AI model provider

      # @see Stagehand::Models::SessionExtractParams::Options::Model::VertexModelConfigObject#auth
      class Auth < Stagehand::Internal::Type::BaseModel
        # @!attribute credentials
        #   Google Cloud service account credentials
        #
        #   @return [Stagehand::Models::SessionExtractParams::Options::Model::VertexModelConfigObject::Auth::Credentials]
        required :credentials,
                 -> { Stagehand::SessionExtractParams::Options::Model::VertexModelConfigObject::Auth::Credentials }

        # @!attribute type
        #   Use inline Google Cloud service account credentials for provider authentication
        #
        #   @return [Symbol, :googleServiceAccount]
        required :type, const: :googleServiceAccount

        # @!attribute project_id
        #   Google Cloud project ID used by google-auth-library
        #
        #   @return [String, nil]
        optional :project_id, String, api_name: :projectId

        # @!attribute scopes
        #   Google auth scopes for the desired API request
        #
        #   @return [String, Array<String>, nil]
        optional :scopes,
                 union: -> { Stagehand::SessionExtractParams::Options::Model::VertexModelConfigObject::Auth::Scopes }

        # @!attribute universe_domain
        #   Google Cloud universe domain
        #
        #   @return [String, nil]
        optional :universe_domain, String, api_name: :universeDomain

        # @!method initialize(credentials:, project_id: nil, scopes: nil, universe_domain: nil, type: :googleServiceAccount)
        #   Vertex provider authentication configuration
        #
        #   @param credentials [Stagehand::Models::SessionExtractParams::Options::Model::VertexModelConfigObject::Auth::Credentials] Google Cloud service account credentials
        #
        #   @param project_id [String] Google Cloud project ID used by google-auth-library
        #
        #   @param scopes [String, Array<String>] Google auth scopes for the desired API request
        #
        #   @param universe_domain [String] Google Cloud universe domain
        #
        #   @param type [Symbol, :googleServiceAccount] Use inline Google Cloud service account credentials for provider authentication

        # @see Stagehand::Models::SessionExtractParams::Options::Model::VertexModelConfigObject::Auth#credentials
        class Credentials < Stagehand::Internal::Type::BaseModel
          # @!attribute client_email
          #
          #   @return [String]
          required :client_email, String

          # @!attribute private_key
          #
          #   @return [String]
          required :private_key, String

          # @!attribute auth_provider_x509_cert_url
          #
          #   @return [String, nil]
          optional :auth_provider_x509_cert_url, String

          # @!attribute auth_uri
          #
          #   @return [String, nil]
          optional :auth_uri, String

          # @!attribute client_id
          #
          #   @return [String, nil]
          optional :client_id, String

          # @!attribute client_x509_cert_url
          #
          #   @return [String, nil]
          optional :client_x509_cert_url, String

          # @!attribute private_key_id
          #
          #   @return [String, nil]
          optional :private_key_id, String

          # @!attribute project_id
          #
          #   @return [String, nil]
          optional :project_id, String

          # @!attribute token_uri
          #
          #   @return [String, nil]
          optional :token_uri, String

          # @!attribute type
          #
          #   @return [Symbol, Stagehand::Models::SessionExtractParams::Options::Model::VertexModelConfigObject::Auth::Credentials::Type, nil]
          optional :type,
                   enum: -> { Stagehand::SessionExtractParams::Options::Model::VertexModelConfigObject::Auth::Credentials::Type }

          # @!attribute universe_domain
          #
          #   @return [String, nil]
          optional :universe_domain, String

          # @!method initialize(client_email:, private_key:, auth_provider_x509_cert_url: nil, auth_uri: nil, client_id: nil, client_x509_cert_url: nil, private_key_id: nil, project_id: nil, token_uri: nil, type: nil, universe_domain: nil)
          #   Google Cloud service account credentials
          #
          #   @param client_email [String]
          #   @param private_key [String]
          #   @param auth_provider_x509_cert_url [String]
          #   @param auth_uri [String]
          #   @param client_id [String]
          #   @param client_x509_cert_url [String]
          #   @param private_key_id [String]
          #   @param project_id [String]
          #   @param token_uri [String]
          #   @param type [Symbol, Stagehand::Models::SessionExtractParams::Options::Model::VertexModelConfigObject::Auth::Credentials::Type]
          #   @param universe_domain [String]

          # @see Stagehand::Models::SessionExtractParams::Options::Model::VertexModelConfigObject::Auth::Credentials#type
          module Type
            extend Stagehand::Internal::Type::Enum

            SERVICE_ACCOUNT = :service_account

            # @!method self.values
            #   @return [Array<Symbol>]
          end
        end

        # Google auth scopes for the desired API request
        #
        # @see Stagehand::Models::SessionExtractParams::Options::Model::VertexModelConfigObject::Auth#scopes
        module Scopes
          extend Stagehand::Internal::Type::Union

          variant String

          variant -> { Stagehand::Models::SessionExtractParams::Options::Model::VertexModelConfigObject::Auth::Scopes::StringArray }

          # @!method self.variants
          #   @return [Array(String, Array<String>)]

          # @type [Stagehand::Internal::Type::Converter]
          StringArray = Stagehand::Internal::Type::ArrayOf[String]
        end
      end

      # @see Stagehand::Models::SessionExtractParams::Options::Model::VertexModelConfigObject#provider_options
      class ProviderOptions < Stagehand::Internal::Type::BaseModel
        # @!attribute vertex
        #   Vertex AI provider-specific settings
        #
        #   @return [Stagehand::Models::SessionExtractParams::Options::Model::VertexModelConfigObject::ProviderOptions::Vertex]
        required :vertex,
                 -> { Stagehand::SessionExtractParams::Options::Model::VertexModelConfigObject::ProviderOptions::Vertex }

        # @!method initialize(vertex:)
        #   Vertex provider-specific model configuration
        #
        #   @param vertex [Stagehand::Models::SessionExtractParams::Options::Model::VertexModelConfigObject::ProviderOptions::Vertex] Vertex AI provider-specific settings

        # @see Stagehand::Models::SessionExtractParams::Options::Model::VertexModelConfigObject::ProviderOptions#vertex
        class Vertex < Stagehand::Internal::Type::BaseModel
          # @!attribute location
          #   Google Cloud location for Vertex AI models
          #
          #   @return [String]
          required :location, String

          # @!attribute project
          #   Google Cloud project ID for Vertex AI models
          #
          #   @return [String]
          required :project, String

          # @!attribute base_url
          #   Base URL for the Vertex AI provider
          #
          #   @return [String, nil]
          optional :base_url, String, api_name: :baseURL

          # @!attribute headers
          #   Custom headers sent with every request to the Vertex AI provider
          #
          #   @return [Hash{Symbol=>String}, nil]
          optional :headers, Stagehand::Internal::Type::HashOf[String]

          # @!method initialize(location:, project:, base_url: nil, headers: nil)
          #   Vertex AI provider-specific settings
          #
          #   @param location [String] Google Cloud location for Vertex AI models
          #
          #   @param project [String] Google Cloud project ID for Vertex AI models
          #
          #   @param base_url [String] Base URL for the Vertex AI provider
          #
          #   @param headers [Hash{Symbol=>String}] Custom headers sent with every request to the Vertex AI provider
        end
      end
    end

    class GenericModelConfigObject < Stagehand::Internal::Type::BaseModel
      # @!attribute model_name
      #   Model name string with provider prefix (e.g., 'openai/gpt-5-nano')
      #
      #   @return [String]
      required :model_name, String, api_name: :modelName

      # @!attribute api_key
      #   API key for the model provider
      #
      #   @return [String, nil]
      optional :api_key, String, api_name: :apiKey

      # @!attribute base_url
      #   Base URL for the model provider
      #
      #   @return [String, nil]
      optional :base_url, String, api_name: :baseURL

      # @!attribute headers
      #   Custom headers sent with every request to the model provider
      #
      #   @return [Hash{Symbol=>String}, nil]
      optional :headers, Stagehand::Internal::Type::HashOf[String]

      # @!attribute provider
      #   AI provider for the model (or provide a baseURL endpoint instead)
      #
      #   @return [Symbol, Stagehand::Models::SessionExtractParams::Options::Model::GenericModelConfigObject::Provider, nil]
      optional :provider,
               enum: -> { Stagehand::SessionExtractParams::Options::Model::GenericModelConfigObject::Provider }

      # @!method initialize(model_name:, api_key: nil, base_url: nil, headers: nil, provider: nil)
      #   @param model_name [String] Model name string with provider prefix (e.g., 'openai/gpt-5-nano')
      #
      #   @param api_key [String] API key for the model provider
      #
      #   @param base_url [String] Base URL for the model provider
      #
      #   @param headers [Hash{Symbol=>String}] Custom headers sent with every request to the model provider
      #
      #   @param provider [Symbol, Stagehand::Models::SessionExtractParams::Options::Model::GenericModelConfigObject::Provider] AI provider for the model (or provide a baseURL endpoint instead)

      # AI provider for the model (or provide a baseURL endpoint instead)
      #
      # @see Stagehand::Models::SessionExtractParams::Options::Model::GenericModelConfigObject#provider
      module Provider
        extend Stagehand::Internal::Type::Enum

        OPENAI = :openai
        ANTHROPIC = :anthropic
        GOOGLE = :google
        MICROSOFT = :microsoft
        BEDROCK = :bedrock

        # @!method self.values
        #   @return [Array<Symbol>]
      end
    end

    # @!method self.variants
    #   @return [Array(Stagehand::Models::SessionExtractParams::Options::Model::VertexModelConfigObject, Stagehand::Models::SessionExtractParams::Options::Model::GenericModelConfigObject, String)]
  end
end

Instance Attribute Details

#ignore_selectorsArray<String>?

Selectors for elements and subtrees that should be excluded from extraction

Returns:

  • (Array<String>, nil)


67
# File 'lib/stagehand/models/session_extract_params.rb', line 67

optional :ignore_selectors, Stagehand::Internal::Type::ArrayOf[String], api_name: :ignoreSelectors

#modelStagehand::Models::SessionExtractParams::Options::Model::VertexModelConfigObject, ...

Model configuration object or model name string (e.g., ‘openai/gpt-5-nano’)



73
# File 'lib/stagehand/models/session_extract_params.rb', line 73

optional :model, union: -> { Stagehand::SessionExtractParams::Options::Model }

#screenshotBoolean?

When true, include a screenshot of the current viewport in the extraction LLM call. Defaults to false.

Returns:

  • (Boolean, nil)


80
# File 'lib/stagehand/models/session_extract_params.rb', line 80

optional :screenshot, Stagehand::Internal::Type::Boolean

#selectorString?

CSS selector to scope extraction to a specific element

Returns:

  • (String, nil)


86
# File 'lib/stagehand/models/session_extract_params.rb', line 86

optional :selector, String

#timeoutFloat?

Timeout in ms for the extraction

Returns:

  • (Float, nil)


92
# File 'lib/stagehand/models/session_extract_params.rb', line 92

optional :timeout, Float