@@ -2,7 +2,7 @@ import { EvalFunction } from "../../types/evals";
2
2
import { initStagehand } from "../initStagehand" ;
3
3
import { z } from "zod" ;
4
4
5
- export const extract_research_reports : EvalFunction = async ( {
5
+ export const extract_jstor_news : EvalFunction = async ( {
6
6
modelName,
7
7
logger,
8
8
useTextExtract,
@@ -15,22 +15,22 @@ export const extract_research_reports: EvalFunction = async ({
15
15
const { debugUrl, sessionUrl } = initResponse ;
16
16
17
17
await stagehand . init ( ) ;
18
- await stagehand . page . goto (
19
- "http://www.dsbd.gov.za/index.php/research-reports ",
20
- { waitUntil : "load" } ,
21
- ) ;
18
+ await stagehand . page . goto ( "http://jstor-eval.surge.sh" , {
19
+ waitUntil : "load ",
20
+ } ) ;
21
+ await stagehand . page . act ( { action : "close the cookie" } ) ;
22
22
23
23
const result = await stagehand . page . extract ( {
24
- instruction :
25
- "Extract ALL the research report names. Do not extract the names of the PDF attachments." ,
24
+ instruction : "Extract ALL the news report titles and their dates." ,
26
25
schema : z . object ( {
27
26
reports : z . array (
28
27
z . object ( {
29
28
report_name : z
30
29
. string ( )
31
- . describe (
32
- "The name or title of the research report. NOT the name of the PDF attachment." ,
33
- ) ,
30
+ . describe ( "The name or title of the news report." ) ,
31
+ publish_date : z
32
+ . string ( )
33
+ . describe ( "The date the news report was published." ) ,
34
34
} ) ,
35
35
) ,
36
36
} ) ,
@@ -41,15 +41,16 @@ export const extract_research_reports: EvalFunction = async ({
41
41
await stagehand . close ( ) ;
42
42
43
43
const reports = result . reports ;
44
- const expectedLength = 9 ;
44
+ const expectedLength = 10 ;
45
45
46
46
const expectedFirstItem = {
47
- report_name :
48
- "Longitudinal Study on SMMEs and Co-operatives in South Africa and the study on the Eastern SeaBoard ",
47
+ report_name : "JSTOR retires Publisher Sales Service" ,
48
+ publish_date : "December 9, 2024 ",
49
49
} ;
50
50
51
51
const expectedLastItem = {
52
- report_name : "Research Agenda" ,
52
+ report_name : "Path to Open announces 2024 titles" ,
53
+ publish_date : "May 10, 2024" ,
53
54
} ;
54
55
55
56
if ( reports . length !== expectedLength ) {
@@ -76,7 +77,8 @@ export const extract_research_reports: EvalFunction = async ({
76
77
} ;
77
78
}
78
79
const firstItemMatches =
79
- reports [ 0 ] . report_name === expectedFirstItem . report_name ;
80
+ reports [ 0 ] . report_name === expectedFirstItem . report_name &&
81
+ reports [ 0 ] . publish_date === expectedFirstItem . publish_date ;
80
82
81
83
if ( ! firstItemMatches ) {
82
84
logger . error ( {
@@ -103,7 +105,8 @@ export const extract_research_reports: EvalFunction = async ({
103
105
}
104
106
105
107
const lastItemMatches =
106
- reports [ reports . length - 1 ] . report_name === expectedLastItem . report_name ;
108
+ reports [ reports . length - 1 ] . report_name === expectedLastItem . report_name &&
109
+ reports [ reports . length - 1 ] . publish_date === expectedLastItem . publish_date ;
107
110
108
111
if ( ! lastItemMatches ) {
109
112
logger . error ( {
0 commit comments