exa-js 1.8.16 → 1.8.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -80,15 +80,6 @@ const answerResult = await exa.answer(
80
80
  "What is the population of New York City?"
81
81
  );
82
82
 
83
- // Get answer with citation contents and use the exa-pro model, which passes 2 extra queries to exa to increase coverage of the search space.
84
- const answerWithTextResults = await exa.answer(
85
- "What is the population of New York City?",
86
- {
87
- text: true,
88
- model: "exa-pro",
89
- }
90
- );
91
-
92
83
  // Get an answer with streaming
93
84
  for await (const chunk of exa.streamAnswer(
94
85
  "What is the population of New York City?"
package/dist/index.d.mts CHANGED
@@ -287,6 +287,8 @@ interface components$1 {
287
287
  *
288
288
  * Any URLs provided will be crawled and used as additional context for the search. */
289
289
  query: string;
290
+ /** @description Whether to compute recall metrics for the search */
291
+ recall?: boolean;
290
292
  };
291
293
  };
292
294
  CreateWebsetSearchParameters: {
@@ -327,12 +329,11 @@ interface components$1 {
327
329
  *
328
330
  * Any URLs provided will be crawled and used as additional context for the search. */
329
331
  query: string;
332
+ /** @description Whether to compute recall metrics for the search */
333
+ recall?: boolean;
330
334
  };
331
335
  /** Custom */
332
336
  CustomEntity: {
333
- /** @description When you decide to use a custom entity, this is the description of the entity.
334
- *
335
- * The entity represents what type of results the will return. For example, if you want results to be Job Postings, you might use "Job Postings" as the entity description. */
336
337
  description: string;
337
338
  /**
338
339
  * @default custom
@@ -362,6 +363,11 @@ interface components$1 {
362
363
  }[];
363
364
  /** @description The result of the enrichment. */
364
365
  result: string[] | null;
366
+ /**
367
+ * @description The status of the enrichment result.
368
+ * @enum {string}
369
+ */
370
+ status: EnrichmentResultStatus;
365
371
  };
366
372
  Entity: components$1["schemas"]["CompanyEntity"] | components$1["schemas"]["PersonEntity"] | components$1["schemas"]["ArticleEntity"] | components$1["schemas"]["ResearchPaperEntity"] | components$1["schemas"]["CustomEntity"];
367
373
  /** Event */
@@ -557,6 +563,7 @@ interface components$1 {
557
563
  type: "webset.search.completed";
558
564
  };
559
565
  /** @enum {string} */
566
+ EventType: EventType;
560
567
  GetWebsetResponse: components$1["schemas"]["Webset"] & {
561
568
  /** @description When expand query parameter contains `items`, this will contain the items in the webset */
562
569
  items?: components$1["schemas"]["WebsetItem"][];
@@ -988,387 +995,7 @@ interface components$1 {
988
995
  /** @description The unique identifier for the webset */
989
996
  id: string;
990
997
  /** @description Imports that have been performed on the webset. */
991
- imports?: ({
992
- count: number;
993
- /** Format: date-time */
994
- createdAt: string;
995
- entity?: {
996
- /**
997
- * @default A homepage of a company
998
- * @constant
999
- */
1000
- description: "A homepage of a company";
1001
- /**
1002
- * @default company
1003
- * @constant
1004
- */
1005
- type: "company";
1006
- } | {
1007
- /**
1008
- * @default A LinkedIn profile
1009
- * @constant
1010
- */
1011
- description: "A LinkedIn profile";
1012
- /**
1013
- * @default person
1014
- * @constant
1015
- */
1016
- type: "person";
1017
- } | {
1018
- /**
1019
- * @default A blog post or article
1020
- * @constant
1021
- */
1022
- description: "A blog post or article";
1023
- /**
1024
- * @default article
1025
- * @constant
1026
- */
1027
- type: "article";
1028
- } | {
1029
- /**
1030
- * @default A research paper
1031
- * @constant
1032
- */
1033
- description: "A research paper";
1034
- /**
1035
- * @default research_paper
1036
- * @constant
1037
- */
1038
- type: "research_paper";
1039
- } | {
1040
- /** @description When you decide to use a custom entity, this is the description of the entity.
1041
- *
1042
- * The entity represents what type of results the will return. For example, if you want results to be Job Postings, you might use "Job Postings" as the entity description. */
1043
- description: string;
1044
- /**
1045
- * @default custom
1046
- * @constant
1047
- */
1048
- type: "custom";
1049
- };
1050
- /** @enum {string} */
1051
- format: WebsetImportsFormat;
1052
- id: string;
1053
- metadata?: {
1054
- [key: string]: string;
1055
- };
1056
- /** @enum {string} */
1057
- status: WebsetImportsStatus;
1058
- teamId: string;
1059
- title: string;
1060
- /** Format: date-time */
1061
- updatedAt: string;
1062
- /** @description The URI of the import when format is CSV */
1063
- uri?: string;
1064
- /** @description The ID of the webset when format is WEBSET */
1065
- websetId?: string;
1066
- } | {
1067
- count: number;
1068
- /** Format: date-time */
1069
- createdAt: string;
1070
- entity: {
1071
- /**
1072
- * @default A homepage of a company
1073
- * @constant
1074
- */
1075
- description: "A homepage of a company";
1076
- /**
1077
- * @default company
1078
- * @constant
1079
- */
1080
- type: "company";
1081
- } | {
1082
- /**
1083
- * @default A LinkedIn profile
1084
- * @constant
1085
- */
1086
- description: "A LinkedIn profile";
1087
- /**
1088
- * @default person
1089
- * @constant
1090
- */
1091
- type: "person";
1092
- } | {
1093
- /**
1094
- * @default A blog post or article
1095
- * @constant
1096
- */
1097
- description: "A blog post or article";
1098
- /**
1099
- * @default article
1100
- * @constant
1101
- */
1102
- type: "article";
1103
- } | {
1104
- /**
1105
- * @default A research paper
1106
- * @constant
1107
- */
1108
- description: "A research paper";
1109
- /**
1110
- * @default research_paper
1111
- * @constant
1112
- */
1113
- type: "research_paper";
1114
- } | {
1115
- /** @description When you decide to use a custom entity, this is the description of the entity.
1116
- *
1117
- * The entity represents what type of results the will return. For example, if you want results to be Job Postings, you might use "Job Postings" as the entity description. */
1118
- description: string;
1119
- /**
1120
- * @default custom
1121
- * @constant
1122
- */
1123
- type: "custom";
1124
- };
1125
- /** @enum {string} */
1126
- format: WebsetImportsFormat;
1127
- id: string;
1128
- metadata?: {
1129
- [key: string]: string;
1130
- };
1131
- /** @enum {string} */
1132
- status: WebsetImportsStatus;
1133
- teamId: string;
1134
- title: string;
1135
- /** Format: date-time */
1136
- updatedAt: string;
1137
- /** @description The URI of the import when format is CSV */
1138
- uri?: string;
1139
- /** @description The ID of the webset when format is WEBSET */
1140
- websetId?: string;
1141
- } | {
1142
- count: number;
1143
- /** Format: date-time */
1144
- createdAt: string;
1145
- entity: {
1146
- /**
1147
- * @default A homepage of a company
1148
- * @constant
1149
- */
1150
- description: "A homepage of a company";
1151
- /**
1152
- * @default company
1153
- * @constant
1154
- */
1155
- type: "company";
1156
- } | {
1157
- /**
1158
- * @default A LinkedIn profile
1159
- * @constant
1160
- */
1161
- description: "A LinkedIn profile";
1162
- /**
1163
- * @default person
1164
- * @constant
1165
- */
1166
- type: "person";
1167
- } | {
1168
- /**
1169
- * @default A blog post or article
1170
- * @constant
1171
- */
1172
- description: "A blog post or article";
1173
- /**
1174
- * @default article
1175
- * @constant
1176
- */
1177
- type: "article";
1178
- } | {
1179
- /**
1180
- * @default A research paper
1181
- * @constant
1182
- */
1183
- description: "A research paper";
1184
- /**
1185
- * @default research_paper
1186
- * @constant
1187
- */
1188
- type: "research_paper";
1189
- } | {
1190
- /** @description When you decide to use a custom entity, this is the description of the entity.
1191
- *
1192
- * The entity represents what type of results the will return. For example, if you want results to be Job Postings, you might use "Job Postings" as the entity description. */
1193
- description: string;
1194
- /**
1195
- * @default custom
1196
- * @constant
1197
- */
1198
- type: "custom";
1199
- };
1200
- /** @enum {string} */
1201
- format: WebsetImportsFormat;
1202
- id: string;
1203
- metadata?: {
1204
- [key: string]: string;
1205
- };
1206
- /** @enum {string} */
1207
- status: WebsetImportsStatus;
1208
- teamId: string;
1209
- title: string;
1210
- /** Format: date-time */
1211
- updatedAt: string;
1212
- /** @description The URI of the import when format is CSV */
1213
- uri?: string;
1214
- /** @description The ID of the webset when format is WEBSET */
1215
- websetId?: string;
1216
- } | {
1217
- count: number;
1218
- /** Format: date-time */
1219
- createdAt: string;
1220
- entity: {
1221
- /**
1222
- * @default A homepage of a company
1223
- * @constant
1224
- */
1225
- description: "A homepage of a company";
1226
- /**
1227
- * @default company
1228
- * @constant
1229
- */
1230
- type: "company";
1231
- } | {
1232
- /**
1233
- * @default A LinkedIn profile
1234
- * @constant
1235
- */
1236
- description: "A LinkedIn profile";
1237
- /**
1238
- * @default person
1239
- * @constant
1240
- */
1241
- type: "person";
1242
- } | {
1243
- /**
1244
- * @default A blog post or article
1245
- * @constant
1246
- */
1247
- description: "A blog post or article";
1248
- /**
1249
- * @default article
1250
- * @constant
1251
- */
1252
- type: "article";
1253
- } | {
1254
- /**
1255
- * @default A research paper
1256
- * @constant
1257
- */
1258
- description: "A research paper";
1259
- /**
1260
- * @default research_paper
1261
- * @constant
1262
- */
1263
- type: "research_paper";
1264
- } | {
1265
- /** @description When you decide to use a custom entity, this is the description of the entity.
1266
- *
1267
- * The entity represents what type of results the will return. For example, if you want results to be Job Postings, you might use "Job Postings" as the entity description. */
1268
- description: string;
1269
- /**
1270
- * @default custom
1271
- * @constant
1272
- */
1273
- type: "custom";
1274
- };
1275
- /** Format: date-time */
1276
- failedAt: string;
1277
- failedMessage: string;
1278
- /** @enum {string} */
1279
- failedReason: WebsetImportsFailedReason;
1280
- /** @enum {string} */
1281
- format: WebsetImportsFormat;
1282
- id: string;
1283
- metadata?: {
1284
- [key: string]: string;
1285
- };
1286
- /** @enum {string} */
1287
- status: WebsetImportsStatus;
1288
- teamId: string;
1289
- title: string;
1290
- /** Format: date-time */
1291
- updatedAt: string;
1292
- /** @description The URI of the import when format is CSV */
1293
- uri?: string;
1294
- /** @description The ID of the webset when format is WEBSET */
1295
- websetId?: string;
1296
- } | {
1297
- count: number;
1298
- /** Format: date-time */
1299
- createdAt: string;
1300
- entity: {
1301
- /**
1302
- * @default A homepage of a company
1303
- * @constant
1304
- */
1305
- description: "A homepage of a company";
1306
- /**
1307
- * @default company
1308
- * @constant
1309
- */
1310
- type: "company";
1311
- } | {
1312
- /**
1313
- * @default A LinkedIn profile
1314
- * @constant
1315
- */
1316
- description: "A LinkedIn profile";
1317
- /**
1318
- * @default person
1319
- * @constant
1320
- */
1321
- type: "person";
1322
- } | {
1323
- /**
1324
- * @default A blog post or article
1325
- * @constant
1326
- */
1327
- description: "A blog post or article";
1328
- /**
1329
- * @default article
1330
- * @constant
1331
- */
1332
- type: "article";
1333
- } | {
1334
- /**
1335
- * @default A research paper
1336
- * @constant
1337
- */
1338
- description: "A research paper";
1339
- /**
1340
- * @default research_paper
1341
- * @constant
1342
- */
1343
- type: "research_paper";
1344
- } | {
1345
- /** @description When you decide to use a custom entity, this is the description of the entity.
1346
- *
1347
- * The entity represents what type of results the will return. For example, if you want results to be Job Postings, you might use "Job Postings" as the entity description. */
1348
- description: string;
1349
- /**
1350
- * @default custom
1351
- * @constant
1352
- */
1353
- type: "custom";
1354
- };
1355
- /** @enum {string} */
1356
- format: WebsetImportsFormat;
1357
- id: string;
1358
- metadata?: {
1359
- [key: string]: string;
1360
- };
1361
- /** @enum {string} */
1362
- status: WebsetImportsStatus;
1363
- teamId: string;
1364
- title: string;
1365
- /** Format: date-time */
1366
- updatedAt: string;
1367
- /** @description The URI of the import when format is CSV */
1368
- uri?: string;
1369
- /** @description The ID of the webset when format is WEBSET */
1370
- websetId?: string;
1371
- })[];
998
+ imports: components$1["schemas"]["Import"][];
1372
999
  /**
1373
1000
  * @description Set of key-value pairs you want to associate with this object.
1374
1001
  * @default {}
@@ -1601,6 +1228,13 @@ interface components$1 {
1601
1228
  description: string;
1602
1229
  /** WebsetItemPersonPropertiesFields */
1603
1230
  person: {
1231
+ /** WebsetItemPersonCompanyPropertiesFields */
1232
+ company: {
1233
+ /** @description The location the person is working at the company */
1234
+ location: string | null;
1235
+ /** @description The name of the company */
1236
+ name: string;
1237
+ } | null;
1604
1238
  /** @description The location of the person */
1605
1239
  location: string | null;
1606
1240
  /** @description The name of the person */
@@ -1705,13 +1339,37 @@ interface components$1 {
1705
1339
  object: "webset_search";
1706
1340
  /** @description The progress of the search */
1707
1341
  progress: {
1342
+ /** @description The number of results analyzed so far */
1343
+ analyzed: number;
1708
1344
  /** @description The completion percentage of the search */
1709
1345
  completion: number;
1710
1346
  /** @description The number of results found so far */
1711
1347
  found: number;
1348
+ /** @description The estimated time remaining in seconds, null if unknown */
1349
+ timeLeft: number | null;
1712
1350
  };
1713
1351
  /** @description The query used to create the search. */
1714
1352
  query: string;
1353
+ /** @description Recall metrics for the search, null if not yet computed or requested. */
1354
+ recall: {
1355
+ expected: {
1356
+ bounds: {
1357
+ /** @description The maximum estimated total number of potential matches */
1358
+ max: number;
1359
+ /** @description The minimum estimated total number of potential matches */
1360
+ min: number;
1361
+ };
1362
+ /**
1363
+ * @description The confidence in the estimate
1364
+ * @enum {string}
1365
+ */
1366
+ confidence: WebsetSearchRecallExpectedConfidence;
1367
+ /** @description The estimated total number of potential matches */
1368
+ total: number;
1369
+ };
1370
+ /** @description The reasoning for the estimate */
1371
+ reasoning: string;
1372
+ } | null;
1715
1373
  /**
1716
1374
  * WebsetSearchStatus
1717
1375
  * @description The status of the search
@@ -1822,6 +1480,11 @@ declare enum CreateWebsetSearchParametersExcludeSource {
1822
1480
  import = "import",
1823
1481
  webset = "webset"
1824
1482
  }
1483
+ declare enum EnrichmentResultStatus {
1484
+ pending = "pending",
1485
+ completed = "completed",
1486
+ canceled = "canceled"
1487
+ }
1825
1488
  declare enum EventType {
1826
1489
  webset_created = "webset.created",
1827
1490
  webset_deleted = "webset.deleted",
@@ -1906,23 +1569,6 @@ declare enum WebhookAttemptEventType {
1906
1569
  webset_export_created = "webset.export.created",
1907
1570
  webset_export_completed = "webset.export.completed"
1908
1571
  }
1909
- declare enum WebsetImportsFormat {
1910
- csv = "csv",
1911
- webset = "webset"
1912
- }
1913
- declare enum WebsetImportsFailedReason {
1914
- file_not_uploaded = "file_not_uploaded",
1915
- invalid_format = "invalid_format",
1916
- invalid_file_content = "invalid_file_content",
1917
- missing_identifier = "missing_identifier"
1918
- }
1919
- declare enum WebsetImportsStatus {
1920
- created = "created",
1921
- failed = "failed",
1922
- processing = "processing",
1923
- scheduled = "scheduled",
1924
- completed = "completed"
1925
- }
1926
1572
  declare enum WebsetStatus {
1927
1573
  idle = "idle",
1928
1574
  running = "running",
@@ -1954,6 +1600,11 @@ declare enum WebsetSearchExcludeSource {
1954
1600
  import = "import",
1955
1601
  webset = "webset"
1956
1602
  }
1603
+ declare enum WebsetSearchRecallExpectedConfidence {
1604
+ high = "high",
1605
+ medium = "medium",
1606
+ low = "low"
1607
+ }
1957
1608
  declare enum WebsetSearchStatus {
1958
1609
  created = "created",
1959
1610
  running = "running",
@@ -3255,14 +2906,14 @@ type Status = {
3255
2906
  * @typedef {Object} AnswerOptions
3256
2907
  * @property {boolean} [stream] - Whether to stream the response. Default false.
3257
2908
  * @property {boolean} [text] - Whether to include text in the source results. Default false.
3258
- * @property {"exa" | "exa-pro"} [model] - The model to use for generating the answer. Default "exa".
2909
+ * @property {"exa"} [model] - The model to use for generating the answer. Default "exa".
3259
2910
  * @property {string} [systemPrompt] - A system prompt to guide the LLM's behavior when generating the answer.
3260
2911
  * @property {Object} [outputSchema] - A JSON Schema specification for the structure you expect the output to take
3261
2912
  */
3262
2913
  type AnswerOptions = {
3263
2914
  stream?: boolean;
3264
2915
  text?: boolean;
3265
- model?: "exa" | "exa-pro";
2916
+ model?: "exa";
3266
2917
  systemPrompt?: string;
3267
2918
  outputSchema?: Record<string, unknown>;
3268
2919
  };
@@ -3389,7 +3040,7 @@ declare class Exa {
3389
3040
  * ```ts
3390
3041
  * const answer = await exa.answer("What is quantum computing?", {
3391
3042
  * text: true,
3392
- * model: "exa-pro",
3043
+ * model: "exa",
3393
3044
  * systemPrompt: "Answer in a technical manner suitable for experts."
3394
3045
  * });
3395
3046
  * ```