@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
1717<!-- x-release-please-start-version -->
1818
1919``` ruby
20- gem " stagehand" , " ~> 0.2 .0"
20+ gem " stagehand" , " ~> 0.3 .0"
2121```
2222
2323<!-- x-release-please-end -->
@@ -36,7 +36,7 @@ stagehand = Stagehand::Client.new(
3636
3737response = stagehand.sessions.act(" 00000000-your-session-id-000000000000" , input: " click the first link on the page" )
3838
39- puts (response.actions )
39+ puts (response.data )
4040```
4141
4242### Handling errors
@@ -45,10 +45,7 @@ When the library is unable to connect to the API, or if the API returns a non-su
4545
4646``` ruby
4747begin
48- session = stagehand.sessions.start(
49- browserbase_api_key: " your Browserbase API key" ,
50- browserbase_project_id: " your Browserbase Project ID"
51- )
48+ session = stagehand.sessions.start(model_name: " openai/gpt-5-nano" )
5249rescue Stagehand ::Errors ::APIConnectionError => e
5350 puts (" The server could not be reached" )
5451 puts (e.cause) # an underlying Exception, likely raised within `net/http`
@@ -91,11 +88,7 @@ stagehand = Stagehand::Client.new(
9188)
9289
9390# Or, configure per-request:
94- stagehand.sessions.start(
95- browserbase_api_key: " your Browserbase API key" ,
96- browserbase_project_id: " your Browserbase Project ID" ,
97- request_options: {max_retries: 5 }
98- )
91+ stagehand.sessions.start(model_name: " openai/gpt-5-nano" , request_options: {max_retries: 5 })
9992```
10093
10194### Timeouts
@@ -109,11 +102,7 @@ stagehand = Stagehand::Client.new(
109102)
110103
111104# Or, configure per-request:
112- stagehand.sessions.start(
113- browserbase_api_key: " your Browserbase API key" ,
114- browserbase_project_id: " your Browserbase Project ID" ,
115- request_options: {timeout: 5 }
116- )
105+ stagehand.sessions.start(model_name: " openai/gpt-5-nano" , request_options: {timeout: 5 })
117106```
118107
119108On timeout, ` Stagehand::Errors::APITimeoutError ` is raised.
@@ -145,8 +134,7 @@ Note: the `extra_` parameters of the same name overrides the documented paramete
145134``` ruby
146135response =
147136 stagehand.sessions.start(
148- browserbase_api_key: " your Browserbase API key" ,
149- browserbase_project_id: " your Browserbase Project ID" ,
137+ model_name: " openai/gpt-5-nano" ,
150138 request_options: {
151139 extra_query: {my_query_parameter: value},
152140 extra_body: {my_body_parameter: value},
@@ -211,25 +199,25 @@ stagehand.sessions.act("00000000-your-session-id-000000000000", **params)
211199Since this library does not depend on ` sorbet-runtime ` , it cannot provide [ ` T::Enum ` ] ( https://sorbet.org/docs/tenum ) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime:
212200
213201``` ruby
214- # :true
215- puts (Stagehand ::SessionActParams ::XStreamResponse :: TRUE )
202+ # :typescript
203+ puts (Stagehand ::SessionActParams ::XLanguage :: TYPESCRIPT )
216204
217- # Revealed type: `T.all(Stagehand::SessionActParams::XStreamResponse , Symbol)`
218- T .reveal_type(Stagehand ::SessionActParams ::XStreamResponse :: TRUE )
205+ # Revealed type: `T.all(Stagehand::SessionActParams::XLanguage , Symbol)`
206+ T .reveal_type(Stagehand ::SessionActParams ::XLanguage :: TYPESCRIPT )
219207```
220208
221209Enum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:
222210
223211``` ruby
224212# Using the enum constants preserves the tagged type information:
225213stagehand.sessions.act(
226- x_stream_response : Stagehand ::SessionActParams ::XStreamResponse :: TRUE ,
214+ x_language : Stagehand ::SessionActParams ::XLanguage :: TYPESCRIPT ,
227215 # …
228216)
229217
230218# Literal values are also permissible:
231219stagehand.sessions.act(
232- x_stream_response : :true ,
220+ x_language : :typescript ,
233221 # …
234222)
235223```
0 commit comments