exa-py 1.13.0__py3-none-any.whl → 1.13.2__py3-none-any.whl

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.

Potentially problematic release.


This version of exa-py might be problematic. Click here for more details.

exa_py/websets/types.py CHANGED
@@ -1,20 +1,34 @@
1
+ # generated by datamodel-codegen:
2
+ # filename: schema.json
3
+ # timestamp: 2025-05-30T02:51:12+00:00
4
+
1
5
  from __future__ import annotations
2
6
 
3
7
  from datetime import datetime
4
8
  from enum import Enum
5
9
  from typing import Any, Dict, List, Literal, Optional, Union
6
10
 
7
- from pydantic import AnyUrl, Field, confloat, constr
11
+ from pydantic import AnyUrl, Field, PositiveInt, confloat, constr
8
12
  from .core.base import ExaBaseModel
9
13
 
10
-
11
- class CanceledReason(Enum):
14
+ class StreamBehaviorSearchConfig(ExaBaseModel):
15
+ query: constr(min_length=2, max_length=10000)
16
+ criteria: List[SearchCriterion] = Field(..., max_items=5)
17
+ entity: Union[
18
+ WebsetCompanyEntity,
19
+ WebsetPersonEntity,
20
+ WebsetArticleEntity,
21
+ WebsetResearchPaperEntity,
22
+ WebsetCustomEntity,
23
+ ] = Field(..., title='WebsetEntity')
24
+ count: PositiveInt
12
25
  """
13
- The reason the search was canceled
26
+ The maximum number of results to find
27
+ """
28
+ behavior: Optional[WebsetSearchBehavior] = 'append'
29
+ """
30
+ The behaviour of the Search when it is added to a Webset.
14
31
  """
15
-
16
- webset_deleted = 'webset_deleted'
17
- webset_canceled = 'webset_canceled'
18
32
 
19
33
 
20
34
  class CreateCriterionParameters(ExaBaseModel):
@@ -45,6 +59,24 @@ class CreateEnrichmentParameters(ExaBaseModel):
45
59
  """
46
60
 
47
61
 
62
+ class CreateStreamParameters(ExaBaseModel):
63
+ webset_id: str = Field(..., alias='websetId')
64
+ """
65
+ The id of the Webset
66
+ """
67
+ cadence: StreamCadence
68
+ """
69
+ How often the stream will run
70
+ """
71
+ behavior: Union[StreamBehaviorSearch, StreamBehaviorRefresh] = Field(
72
+ ..., discriminator='type'
73
+ )
74
+ """
75
+ Behavior to perform when stream runs
76
+ """
77
+ metadata: Optional[Dict[str, Any]] = None
78
+
79
+
48
80
  class CreateWebhookParameters(ExaBaseModel):
49
81
  events: List[EventType] = Field(..., max_items=12, min_items=1)
50
82
  """
@@ -61,11 +93,11 @@ class CreateWebhookParameters(ExaBaseModel):
61
93
 
62
94
 
63
95
  class CreateWebsetParameters(ExaBaseModel):
64
- search: Search
96
+ search: CreateWebsetParametersSearch
65
97
  """
66
98
  Create initial search for the Webset.
67
99
  """
68
- enrichments: Optional[List[CreateEnrichmentParameters]] = Field(None, max_items=10)
100
+ enrichments: Optional[List[CreateEnrichmentParameters]] = None
69
101
  """
70
102
  Add Enrichments for the Webset.
71
103
  """
@@ -82,7 +114,7 @@ class CreateWebsetParameters(ExaBaseModel):
82
114
 
83
115
 
84
116
  class CreateWebsetSearchParameters(ExaBaseModel):
85
- count: confloat(ge=1.0)
117
+ count: PositiveInt
86
118
  """
87
119
  Number of Items the Search will attempt to find.
88
120
 
@@ -121,13 +153,12 @@ class CreateWebsetSearchParameters(ExaBaseModel):
121
153
 
122
154
  It's not required to provide your own criteria, we automatically detect the criteria from all the information provided in the query.
123
155
  """
124
- behaviour: Optional[WebsetSearchBehaviour] = Field(
125
- 'override', title='WebsetSearchBehaviour'
126
- )
156
+ behavior: Optional[WebsetSearchBehavior] = 'override'
127
157
  """
128
- The behaviour of the Search when it is added to a Webset.
158
+ The behavior of the Search when it is added to a Webset.
129
159
 
130
- - `override`: the search will reuse the existing Items found in the Webset and evaluate them against the new criteria. Any Items that don't match the new criteria will be discarded.
160
+ - `override`: the search will replace the existing Items found in the Webset and evaluate them against the new criteria. Any Items that don't match the new criteria will be discarded.
161
+ - `append`: the search will add the new Items found to the existing Webset. Any Items that don't match the new criteria will be discarded.
131
162
  """
132
163
  metadata: Optional[Dict[str, Any]] = None
133
164
  """
@@ -135,7 +166,7 @@ class CreateWebsetSearchParameters(ExaBaseModel):
135
166
  """
136
167
 
137
168
 
138
- class Criterion(ExaBaseModel):
169
+ class WebsetSearchCriterion(ExaBaseModel):
139
170
  description: constr(min_length=1)
140
171
  """
141
172
  The description of the criterion
@@ -146,6 +177,10 @@ class Criterion(ExaBaseModel):
146
177
  """
147
178
 
148
179
 
180
+ class SearchCriterion(ExaBaseModel):
181
+ description: constr(min_length=2)
182
+
183
+
149
184
  class EnrichmentResult(ExaBaseModel):
150
185
  object: Literal['enrichment_result']
151
186
  format: WebsetEnrichmentFormat
@@ -167,6 +202,14 @@ class EnrichmentResult(ExaBaseModel):
167
202
  """
168
203
 
169
204
 
205
+ class StreamRefreshBehaviorEnrichmentsConfigEnrichments(ExaBaseModel):
206
+ """
207
+ Only refresh specific enrichments
208
+ """
209
+
210
+ ids: Optional[List[str]] = None
211
+
212
+
170
213
  class EventType(Enum):
171
214
  webset_created = 'webset.created'
172
215
  webset_deleted = 'webset.deleted'
@@ -181,8 +224,6 @@ class EventType(Enum):
181
224
  webset_item_created = 'webset.item.created'
182
225
  webset_item_enriched = 'webset.item.enriched'
183
226
 
184
-
185
-
186
227
  class Format(Enum):
187
228
  """
188
229
  Format of the enrichment response.
@@ -220,7 +261,37 @@ class ListEventsResponse(ExaBaseModel):
220
261
  """
221
262
  Whether there are more results to paginate through
222
263
  """
223
- next_cursor: Optional[str] = Field(..., alias='nextCursor')
264
+ next_cursor: Optional[str] = Field(None, alias='nextCursor')
265
+ """
266
+ The cursor to paginate through the next set of results
267
+ """
268
+
269
+
270
+ class ListStreamRunsResponse(ExaBaseModel):
271
+ data: List[StreamRun]
272
+ """
273
+ The list of stream runs
274
+ """
275
+ has_more: bool = Field(..., alias='hasMore')
276
+ """
277
+ Whether there are more results to paginate through
278
+ """
279
+ next_cursor: Optional[str] = Field(None, alias='nextCursor')
280
+ """
281
+ The cursor to paginate through the next set of results
282
+ """
283
+
284
+
285
+ class ListStreamsResponse(ExaBaseModel):
286
+ data: List[Stream]
287
+ """
288
+ The list of streams
289
+ """
290
+ has_more: bool = Field(..., alias='hasMore')
291
+ """
292
+ Whether there are more results to paginate through
293
+ """
294
+ next_cursor: Optional[str] = Field(None, alias='nextCursor')
224
295
  """
225
296
  The cursor to paginate through the next set of results
226
297
  """
@@ -235,7 +306,7 @@ class ListWebhookAttemptsResponse(ExaBaseModel):
235
306
  """
236
307
  Whether there are more results to paginate through
237
308
  """
238
- next_cursor: Optional[str] = Field(..., alias='nextCursor')
309
+ next_cursor: Optional[str] = Field(None, alias='nextCursor')
239
310
  """
240
311
  The cursor to paginate through the next set of results
241
312
  """
@@ -250,7 +321,7 @@ class ListWebhooksResponse(ExaBaseModel):
250
321
  """
251
322
  Whether there are more results to paginate through
252
323
  """
253
- next_cursor: Optional[str] = Field(..., alias='nextCursor')
324
+ next_cursor: Optional[str] = Field(None, alias='nextCursor')
254
325
  """
255
326
  The cursor to paginate through the next set of results
256
327
  """
@@ -265,7 +336,7 @@ class ListWebsetItemResponse(ExaBaseModel):
265
336
  """
266
337
  Whether there are more Items to paginate through
267
338
  """
268
- next_cursor: Optional[str] = Field(..., alias='nextCursor')
339
+ next_cursor: Optional[str] = Field(None, alias='nextCursor')
269
340
  """
270
341
  The cursor to paginate through the next set of Items
271
342
  """
@@ -280,19 +351,17 @@ class ListWebsetsResponse(ExaBaseModel):
280
351
  """
281
352
  Whether there are more results to paginate through
282
353
  """
283
- next_cursor: Optional[str] = Field(..., alias='nextCursor')
354
+ next_cursor: Optional[str] = Field(None, alias='nextCursor')
284
355
  """
285
356
  The cursor to paginate through the next set of results
286
357
  """
287
358
 
288
-
289
359
  class Option(ExaBaseModel):
290
360
  label: str
291
361
  """
292
362
  The label of the option
293
363
  """
294
364
 
295
-
296
365
  class Progress(ExaBaseModel):
297
366
  """
298
367
  The progress of the search
@@ -333,7 +402,7 @@ class Satisfied(Enum):
333
402
  unclear = 'unclear'
334
403
 
335
404
 
336
- class Search(ExaBaseModel):
405
+ class CreateWebsetParametersSearch(ExaBaseModel):
337
406
  """
338
407
  Create initial search for the Webset.
339
408
  """
@@ -351,7 +420,7 @@ class Search(ExaBaseModel):
351
420
 
352
421
  Any URL provided will be crawled and used as context for the search.
353
422
  """
354
- count: Optional[confloat(ge=1.0)] = 10
423
+ count: Optional[PositiveInt] = 10
355
424
  """
356
425
  Number of Items the Webset will attempt to find.
357
426
 
@@ -365,7 +434,7 @@ class Search(ExaBaseModel):
365
434
  WebsetResearchPaperEntity,
366
435
  WebsetCustomEntity,
367
436
  ]
368
- ] = Field(None, discriminator='type')
437
+ ] = None
369
438
  """
370
439
  Entity the Webset will return results for.
371
440
 
@@ -387,6 +456,174 @@ class Source(Enum):
387
456
  """
388
457
 
389
458
  search = 'search'
459
+ import_ = 'import'
460
+
461
+
462
+ class StreamRunStatus(Enum):
463
+ """
464
+ The status of the Stream Run
465
+ """
466
+
467
+ created = 'created'
468
+ running = 'running'
469
+ completed = 'completed'
470
+ canceled = 'canceled'
471
+
472
+
473
+ class StreamStatus(Enum):
474
+ """
475
+ The status of the Stream
476
+ """
477
+
478
+ open = 'open'
479
+ closed = 'closed'
480
+
481
+
482
+ class Stream(ExaBaseModel):
483
+ id: str
484
+ """
485
+ The unique identifier for the Stream
486
+ """
487
+ object: str = 'stream'
488
+ """
489
+ The type of object
490
+ """
491
+ status: StreamStatus
492
+ """
493
+ The status of the Stream
494
+ """
495
+ webset_id: str = Field(..., alias='websetId')
496
+ """
497
+ The id of the Webset the Stream belongs to
498
+ """
499
+ cadence: StreamCadence
500
+ """
501
+ How often the stream will run
502
+ """
503
+ behavior: Union[StreamBehaviorSearch, StreamBehaviorRefresh] = Field(
504
+ ..., discriminator='type'
505
+ )
506
+ """
507
+ Behavior to perform when stream runs
508
+ """
509
+ last_run: Optional[StreamRun] = Field(None, alias='lastRun', title='StreamRun')
510
+ """
511
+ The last run of the stream
512
+ """
513
+ next_run_at: Optional[datetime] = Field(None, alias='nextRunAt')
514
+ """
515
+ When the next run will occur
516
+ """
517
+ metadata: Dict[str, constr(max_length=1000)]
518
+ """
519
+ Set of key-value pairs you want to associate with this object.
520
+ """
521
+ created_at: datetime = Field(..., alias='createdAt')
522
+ """
523
+ When the stream was created
524
+ """
525
+ updated_at: datetime = Field(..., alias='updatedAt')
526
+ """
527
+ When the stream was last updated
528
+ """
529
+
530
+
531
+ class StreamBehaviorRefresh(ExaBaseModel):
532
+ type: Literal['refresh']
533
+ config: Union[
534
+ StreamRefreshBehaviorEnrichmentsConfig, StreamRefreshBehaviorContentsConfig
535
+ ] = Field(..., discriminator='target')
536
+ """
537
+ Specify the target of the refresh
538
+ """
539
+
540
+
541
+ class StreamBehaviorSearch(ExaBaseModel):
542
+ type: Literal['search']
543
+ config: StreamBehaviorSearchConfig
544
+
545
+
546
+ class StreamCadence(ExaBaseModel):
547
+ cron: str
548
+ """
549
+ Cron expression for stream cadence (must be a valid Unix cron with 5 fields). The schedule must trigger at most once per day.
550
+ """
551
+ timezone: Optional[str] = 'Etc/UTC'
552
+ """
553
+ IANA timezone (e.g., "America/New_York")
554
+ """
555
+
556
+
557
+ class StreamRefreshBehaviorContentsConfig(ExaBaseModel):
558
+ target: Literal['contents']
559
+
560
+
561
+ class StreamRefreshBehaviorEnrichmentsConfig(ExaBaseModel):
562
+ target: Literal['enrichments']
563
+ enrichments: Optional[StreamRefreshBehaviorEnrichmentsConfigEnrichments] = None
564
+ """
565
+ Only refresh specific enrichments
566
+ """
567
+
568
+
569
+ class StreamRun(ExaBaseModel):
570
+ id: str
571
+ """
572
+ The unique identifier for the Stream Run
573
+ """
574
+ object: str = 'stream_run'
575
+ """
576
+ The type of object
577
+ """
578
+ status: StreamRunStatus
579
+ """
580
+ The status of the Stream Run
581
+ """
582
+ stream_id: str = Field(..., alias='streamId')
583
+ """
584
+ The stream that the run is associated with
585
+ """
586
+ type: Type
587
+ """
588
+ The type of the Stream Run
589
+ """
590
+ completed_at: Optional[datetime] = Field(None, alias='completedAt')
591
+ """
592
+ When the run completed
593
+ """
594
+ failed_at: Optional[datetime] = Field(None, alias='failedAt')
595
+ """
596
+ When the run failed
597
+ """
598
+ canceled_at: Optional[datetime] = Field(None, alias='canceledAt')
599
+ """
600
+ When the run was canceled
601
+ """
602
+ created_at: datetime = Field(..., alias='createdAt')
603
+ """
604
+ When the run was created
605
+ """
606
+ updated_at: datetime = Field(..., alias='updatedAt')
607
+ """
608
+ When the run was last updated
609
+ """
610
+
611
+
612
+ class Type(Enum):
613
+ """
614
+ The type of the Stream Run
615
+ """
616
+
617
+ search = 'search'
618
+ refresh = 'refresh'
619
+
620
+
621
+ class UpdateStream(ExaBaseModel):
622
+ status: Optional[StreamStatus] = None
623
+ """
624
+ The status of the stream.
625
+ """
626
+ metadata: Optional[Dict[str, str]] = None
390
627
 
391
628
 
392
629
  class UpdateWebhookParameters(ExaBaseModel):
@@ -477,7 +714,7 @@ class WebhookAttempt(ExaBaseModel):
477
714
  """
478
715
  The headers of the response
479
716
  """
480
- response_body: str = Field(..., alias='responseBody')
717
+ response_body: Optional[str] = Field(None, alias='responseBody')
481
718
  """
482
719
  The body of the response
483
720
  """
@@ -514,7 +751,7 @@ class Webset(ExaBaseModel):
514
751
  """
515
752
  The status of the webset
516
753
  """
517
- external_id: Optional[str] = Field(..., alias='externalId')
754
+ external_id: Optional[str] = Field(None, alias='externalId')
518
755
  """
519
756
  The external identifier for the webset
520
757
  """
@@ -526,6 +763,10 @@ class Webset(ExaBaseModel):
526
763
  """
527
764
  The Enrichments to apply to the Webset Items.
528
765
  """
766
+ streams: List[Stream]
767
+ """
768
+ The Streams for the Webset.
769
+ """
529
770
  metadata: Optional[Dict[str, Any]] = {}
530
771
  """
531
772
  Set of key-value pairs you want to associate with this object.
@@ -615,7 +856,7 @@ class WebsetEnrichment(ExaBaseModel):
615
856
  The format of the enrichment response.
616
857
  """
617
858
  options: Optional[List[WebsetEnrichmentOption]] = Field(
618
- ..., title='WebsetEnrichmentOptions'
859
+ None, title='WebsetEnrichmentOptions'
619
860
  )
620
861
  """
621
862
  When the format is options, the different options for the enrichment agent to choose from.
@@ -747,7 +988,7 @@ class WebsetItemArticlePropertiesFields(ExaBaseModel):
747
988
  """
748
989
  The author(s) of the article
749
990
  """
750
- published_at: Optional[str] = Field(..., alias='publishedAt')
991
+ published_at: Optional[str] = Field(None, alias='publishedAt')
751
992
  """
752
993
  The date and time the article was published
753
994
  """
@@ -793,7 +1034,7 @@ class WebsetItemCompanyPropertiesFields(ExaBaseModel):
793
1034
  """
794
1035
  A short description of the company
795
1036
  """
796
- logo_url: Optional[AnyUrl] = Field(..., alias='logoUrl')
1037
+ logo_url: Optional[AnyUrl] = Field(None, alias='logoUrl')
797
1038
  """
798
1039
  The logo URL of the company
799
1040
  """
@@ -837,12 +1078,11 @@ class WebsetItemCustomPropertiesFields(ExaBaseModel):
837
1078
  """
838
1079
  The author(s) of the website
839
1080
  """
840
- published_at: Optional[str] = Field(..., alias='publishedAt')
1081
+ published_at: Optional[str] = Field(None, alias='publishedAt')
841
1082
  """
842
1083
  The date and time the website was published
843
1084
  """
844
1085
 
845
-
846
1086
  class WebsetItemEnrichedEvent(ExaBaseModel):
847
1087
  id: str
848
1088
  """
@@ -870,9 +1110,9 @@ class WebsetItemEvaluation(ExaBaseModel):
870
1110
  """
871
1111
  The satisfaction of the criterion
872
1112
  """
873
- references: List[Reference] = []
1113
+ references: Optional[List[Reference]] = []
874
1114
  """
875
- The references used to generate the result. `null` if the evaluation is not yet completed.
1115
+ The references used to generate the result.
876
1116
  """
877
1117
 
878
1118
 
@@ -904,7 +1144,7 @@ class WebsetItemPersonPropertiesFields(ExaBaseModel):
904
1144
  """
905
1145
  The current work position of the person
906
1146
  """
907
- picture_url: Optional[AnyUrl] = Field(..., alias='pictureUrl')
1147
+ picture_url: Optional[AnyUrl] = Field(None, alias='pictureUrl')
908
1148
  """
909
1149
  The image URL of the person
910
1150
  """
@@ -934,7 +1174,7 @@ class WebsetItemResearchPaperPropertiesFields(ExaBaseModel):
934
1174
  """
935
1175
  The author(s) of the research paper
936
1176
  """
937
- published_at: Optional[str] = Field(..., alias='publishedAt')
1177
+ published_at: Optional[str] = Field(None, alias='publishedAt')
938
1178
  """
939
1179
  The date and time the research paper was published
940
1180
  """
@@ -976,26 +1216,33 @@ class WebsetSearch(ExaBaseModel):
976
1216
  """
977
1217
  The query used to create the search.
978
1218
  """
979
- entity: Union[
1219
+ entity: Optional[Union[
980
1220
  WebsetCompanyEntity,
981
1221
  WebsetPersonEntity,
982
1222
  WebsetArticleEntity,
983
1223
  WebsetResearchPaperEntity,
984
1224
  WebsetCustomEntity,
985
- ]
1225
+ ]] = None
986
1226
  """
987
1227
  The entity the search will return results for.
988
1228
 
989
1229
  When no entity is provided during creation, we will automatically select the best entity based on the query.
990
1230
  """
991
- criteria: List[Criterion]
1231
+ criteria: List[WebsetSearchCriterion]
992
1232
  """
993
1233
  The criteria the search will use to evaluate the results. If not provided, we will automatically generate them for you.
994
1234
  """
995
- count: confloat(ge=1.0)
1235
+ count: PositiveInt
996
1236
  """
997
1237
  The number of results the search will attempt to find. The actual number of results may be less than this number depending on the search complexity.
998
1238
  """
1239
+ behavior: Optional[WebsetSearchBehavior] = 'override'
1240
+ """
1241
+ The behavior of the search when it is added to a Webset.
1242
+
1243
+ - `override`: the search will replace the existing Items found in the Webset and evaluate them against the new criteria. Any Items that don't match the new criteria will be discarded.
1244
+ - `append`: the search will add the new Items found to the existing Webset. Any Items that don't match the new criteria will be discarded.
1245
+ """
999
1246
  progress: Progress
1000
1247
  """
1001
1248
  The progress of the search
@@ -1004,11 +1251,11 @@ class WebsetSearch(ExaBaseModel):
1004
1251
  """
1005
1252
  Set of key-value pairs you want to associate with this object.
1006
1253
  """
1007
- canceled_at: Optional[datetime] = Field(..., alias='canceledAt')
1254
+ canceled_at: Optional[datetime] = Field(None, alias='canceledAt')
1008
1255
  """
1009
1256
  The date and time the search was canceled
1010
1257
  """
1011
- canceled_reason: Optional[CanceledReason] = Field(..., alias='canceledReason')
1258
+ canceled_reason: Optional[WebsetSearchCanceledReason] = Field(None, alias='canceledReason')
1012
1259
  """
1013
1260
  The reason the search was canceled
1014
1261
  """
@@ -1022,14 +1269,15 @@ class WebsetSearch(ExaBaseModel):
1022
1269
  """
1023
1270
 
1024
1271
 
1025
- class WebsetSearchBehaviour(Enum):
1272
+ class WebsetSearchBehavior(Enum):
1026
1273
  """
1027
- The behaviour of the Search when it is added to a Webset.
1274
+ The behavior of the Search when it is added to a Webset.
1028
1275
 
1029
- - `override`: the search will reuse the existing Items found in the Webset and evaluate them against the new criteria. Any Items that don't match the new criteria will be discarded.
1276
+ - `override`: the search will replace the existing Items found in the Webset and evaluate them against the new criteria. Any Items that don't match the new criteria will be discarded.
1277
+ - `append`: the search will add the new Items found to the existing Webset. Any Items that don't match the new criteria will be discarded.
1030
1278
  """
1031
-
1032
1279
  override = 'override'
1280
+ append = 'append'
1033
1281
 
1034
1282
 
1035
1283
  class WebsetSearchCanceledEvent(ExaBaseModel):
@@ -1046,6 +1294,11 @@ class WebsetSearchCanceledEvent(ExaBaseModel):
1046
1294
  """
1047
1295
 
1048
1296
 
1297
+ class WebsetSearchCanceledReason(Enum):
1298
+ webset_deleted = 'webset_deleted'
1299
+ webset_canceled = 'webset_canceled'
1300
+
1301
+
1049
1302
  class WebsetSearchCompletedEvent(ExaBaseModel):
1050
1303
  id: str
1051
1304
  """