File tree Expand file tree Collapse file tree 3 files changed +1207
-7
lines changed Expand file tree Collapse file tree 3 files changed +1207
-7
lines changed Original file line number Diff line number Diff line change 6
6
// 2. Run `export LMNR_PROJECT_API_KEY=<your-api-key>`
7
7
// 3. Expose your OPENAI_API_KEY to the environment.
8
8
9
- import { Laminar } from "@lmnr-ai/lmnr" ;
9
+ import { Laminar , getTracer } from "@lmnr-ai/lmnr" ;
10
10
import { Stagehand } from "@/dist" ;
11
+ import { OpenAI } from "openai" ;
11
12
import { z } from "zod" ;
12
13
13
14
Laminar . initialize ( {
14
15
projectApiKey : process . env . LMNR_PROJECT_API_KEY ,
15
- // In some JS bundlers, you may not need to pass instrumentModules; it may
16
- // be enough to initialize Laminar *before* importing Stagehand.
17
16
instrumentModules : {
18
17
stagehand : Stagehand ,
18
+ OpenAI : OpenAI ,
19
19
} ,
20
20
} ) ;
21
21
@@ -25,6 +25,10 @@ async function example() {
25
25
modelName : "gpt-4o-mini" ,
26
26
modelClientOptions : {
27
27
apiKey : process . env . OPENAI_API_KEY ,
28
+ aiSdkTelemetrySettings : {
29
+ isEnabled : true ,
30
+ tracer : getTracer ( ) ,
31
+ } ,
28
32
} ,
29
33
} ) ;
30
34
await stagehand . init ( ) ;
@@ -42,9 +46,9 @@ async function example() {
42
46
43
47
await stagehand . close ( ) ;
44
48
45
- // In one-off scripts like this, it is important to shut down Laminar to make
49
+ // In one-off scripts like this, it is important to flush Laminar to make
46
50
// sure all spans and session data is flushed and sent to the server.
47
- await Laminar . shutdown ( ) ;
51
+ await Laminar . flush ( ) ;
48
52
}
49
53
50
54
( async ( ) => {
Original file line number Diff line number Diff line change 38
38
"@eslint/js" : " ^9.16.0" ,
39
39
"@langchain/core" : " ^0.3.40" ,
40
40
"@langchain/openai" : " ^0.4.4" ,
41
- "@lmnr-ai/lmnr" : " ^0.5 .0" ,
41
+ "@lmnr-ai/lmnr" : " ^0.6 .0" ,
42
42
"@types/adm-zip" : " ^0.5.7" ,
43
43
"@types/cheerio" : " ^0.22.35" ,
44
44
"@types/express" : " ^4.17.21" ,
You can’t perform that action at this time.
0 commit comments