exa-py 1.0.15__py3-none-any.whl → 1.0.17__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/api.py
CHANGED
|
@@ -41,9 +41,9 @@ def snake_to_camel(snake_str: str) -> str:
|
|
|
41
41
|
components = snake_str.split("_")
|
|
42
42
|
return components[0] + "".join(x.title() for x in components[1:])
|
|
43
43
|
|
|
44
|
-
|
|
45
44
|
def to_camel_case(data: dict) -> dict:
|
|
46
|
-
"""
|
|
45
|
+
"""
|
|
46
|
+
Convert keys in a dictionary from snake_case to camelCase recursively.
|
|
47
47
|
|
|
48
48
|
Args:
|
|
49
49
|
data (dict): The dictionary with keys in snake_case format.
|
|
@@ -51,8 +51,11 @@ def to_camel_case(data: dict) -> dict:
|
|
|
51
51
|
Returns:
|
|
52
52
|
dict: The dictionary with keys converted to camelCase format.
|
|
53
53
|
"""
|
|
54
|
-
return {
|
|
55
|
-
|
|
54
|
+
return {
|
|
55
|
+
snake_to_camel(k): to_camel_case(v) if isinstance(v, dict) else v
|
|
56
|
+
for k, v in data.items()
|
|
57
|
+
if v is not None
|
|
58
|
+
}
|
|
56
59
|
|
|
57
60
|
def camel_to_snake(camel_str: str) -> str:
|
|
58
61
|
"""Convert camelCase string to snake_case.
|
|
@@ -66,9 +69,9 @@ def camel_to_snake(camel_str: str) -> str:
|
|
|
66
69
|
snake_str = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", camel_str)
|
|
67
70
|
return re.sub("([a-z0-9])([A-Z])", r"\1_\2", snake_str).lower()
|
|
68
71
|
|
|
69
|
-
|
|
70
72
|
def to_snake_case(data: dict) -> dict:
|
|
71
|
-
"""
|
|
73
|
+
"""
|
|
74
|
+
Convert keys in a dictionary from camelCase to snake_case recursively.
|
|
72
75
|
|
|
73
76
|
Args:
|
|
74
77
|
data (dict): The dictionary with keys in camelCase format.
|
|
@@ -76,8 +79,10 @@ def to_snake_case(data: dict) -> dict:
|
|
|
76
79
|
Returns:
|
|
77
80
|
dict: The dictionary with keys converted to snake_case format.
|
|
78
81
|
"""
|
|
79
|
-
return {
|
|
80
|
-
|
|
82
|
+
return {
|
|
83
|
+
camel_to_snake(k): to_snake_case(v) if isinstance(v, dict) else v
|
|
84
|
+
for k, v in data.items()
|
|
85
|
+
}
|
|
81
86
|
|
|
82
87
|
SEARCH_OPTIONS_TYPES = {
|
|
83
88
|
"query": [str], # The query string.
|
|
@@ -94,6 +99,10 @@ SEARCH_OPTIONS_TYPES = {
|
|
|
94
99
|
"end_published_date": [
|
|
95
100
|
str
|
|
96
101
|
], # Results before this publish date; excludes links with no date. ISO 8601 format.
|
|
102
|
+
"include_text": [
|
|
103
|
+
list
|
|
104
|
+
], # list of strings that must be present in webpage text of results. Currently, only one string is supported, up to 5 words.
|
|
105
|
+
"exclude_text": [list], # list of strings that must not be present in webpage text of result. Currently, only one string is supported, up to 5 words.
|
|
97
106
|
"use_autoprompt": [bool], # Convert query to Exa (Higher latency, Default: false).
|
|
98
107
|
"type": [
|
|
99
108
|
str
|
|
@@ -112,6 +121,8 @@ FIND_SIMILAR_OPTIONS_TYPES = {
|
|
|
112
121
|
"end_crawl_date": [str],
|
|
113
122
|
"start_published_date": [str],
|
|
114
123
|
"end_published_date": [str],
|
|
124
|
+
"include_text": [list],
|
|
125
|
+
"exclude_text": [list],
|
|
115
126
|
"exclude_source_domain": [bool],
|
|
116
127
|
"category": [str],
|
|
117
128
|
}
|
|
@@ -424,7 +435,7 @@ class Exa:
|
|
|
424
435
|
self,
|
|
425
436
|
api_key: Optional[str],
|
|
426
437
|
base_url: str = "https://api.exa.ai",
|
|
427
|
-
user_agent: str = "exa-py 1.0.
|
|
438
|
+
user_agent: str = "exa-py 1.0.17",
|
|
428
439
|
):
|
|
429
440
|
"""Initialize the Exa client with the provided API key and optional base URL and user agent.
|
|
430
441
|
|
|
@@ -462,6 +473,8 @@ class Exa:
|
|
|
462
473
|
end_crawl_date: Optional[str] = None,
|
|
463
474
|
start_published_date: Optional[str] = None,
|
|
464
475
|
end_published_date: Optional[str] = None,
|
|
476
|
+
include_text: Optional[List[str]] = None,
|
|
477
|
+
exclude_text: Optional[List[str]] = None,
|
|
465
478
|
use_autoprompt: Optional[bool] = None,
|
|
466
479
|
type: Optional[str] = None,
|
|
467
480
|
category: Optional[str] = None,
|
|
@@ -477,6 +490,8 @@ class Exa:
|
|
|
477
490
|
end_crawl_date (str, optional): Results will only include links crawled before this date.
|
|
478
491
|
start_published_date (str, optional): Results will only include links with a published date after this date.
|
|
479
492
|
end_published_date (str, optional): Results will only include links with a published date before this date.
|
|
493
|
+
include_text (List[str], optional): List of strings that must be present in the webpage text of results. Currently, only one string is supported, up to 5 words.
|
|
494
|
+
exclude_text (List[str], optional): List of strings that must not be present in the webpage text of results. Currently, only one string is supported, up to 5 words.
|
|
480
495
|
use_autoprompt (bool, optional): If true, convert query to a Exa query. Defaults to False.
|
|
481
496
|
type (str, optional): The type of search, 'keyword' or 'neural'. Defaults to "neural".
|
|
482
497
|
category (str, optional): A data category to focus on, with higher comprehensivity and data cleanliness. Currently, the only category is company.
|
|
@@ -504,6 +519,8 @@ class Exa:
|
|
|
504
519
|
end_crawl_date: Optional[str] = None,
|
|
505
520
|
start_published_date: Optional[str] = None,
|
|
506
521
|
end_published_date: Optional[str] = None,
|
|
522
|
+
include_text: Optional[List[str]] = None,
|
|
523
|
+
exclude_text: Optional[List[str]] = None,
|
|
507
524
|
use_autoprompt: Optional[bool] = None,
|
|
508
525
|
type: Optional[str] = None,
|
|
509
526
|
category: Optional[str] = None,
|
|
@@ -523,6 +540,8 @@ class Exa:
|
|
|
523
540
|
end_crawl_date: Optional[str] = None,
|
|
524
541
|
start_published_date: Optional[str] = None,
|
|
525
542
|
end_published_date: Optional[str] = None,
|
|
543
|
+
include_text: Optional[List[str]] = None,
|
|
544
|
+
exclude_text: Optional[List[str]] = None,
|
|
526
545
|
use_autoprompt: Optional[bool] = None,
|
|
527
546
|
type: Optional[str] = None,
|
|
528
547
|
category: Optional[str] = None,
|
|
@@ -542,6 +561,8 @@ class Exa:
|
|
|
542
561
|
end_crawl_date: Optional[str] = None,
|
|
543
562
|
start_published_date: Optional[str] = None,
|
|
544
563
|
end_published_date: Optional[str] = None,
|
|
564
|
+
include_text: Optional[List[str]] = None,
|
|
565
|
+
exclude_text: Optional[List[str]] = None,
|
|
545
566
|
use_autoprompt: Optional[bool] = None,
|
|
546
567
|
type: Optional[str] = None,
|
|
547
568
|
category: Optional[str] = None,
|
|
@@ -562,6 +583,8 @@ class Exa:
|
|
|
562
583
|
end_crawl_date: Optional[str] = None,
|
|
563
584
|
start_published_date: Optional[str] = None,
|
|
564
585
|
end_published_date: Optional[str] = None,
|
|
586
|
+
include_text: Optional[List[str]] = None,
|
|
587
|
+
exclude_text: Optional[List[str]] = None,
|
|
565
588
|
use_autoprompt: Optional[bool] = None,
|
|
566
589
|
type: Optional[str] = None,
|
|
567
590
|
category: Optional[str] = None,
|
|
@@ -581,6 +604,8 @@ class Exa:
|
|
|
581
604
|
end_crawl_date: Optional[str] = None,
|
|
582
605
|
start_published_date: Optional[str] = None,
|
|
583
606
|
end_published_date: Optional[str] = None,
|
|
607
|
+
include_text: Optional[List[str]] = None,
|
|
608
|
+
exclude_text: Optional[List[str]] = None,
|
|
584
609
|
use_autoprompt: Optional[bool] = None,
|
|
585
610
|
type: Optional[str] = None,
|
|
586
611
|
category: Optional[str] = None,
|
|
@@ -601,6 +626,8 @@ class Exa:
|
|
|
601
626
|
end_crawl_date: Optional[str] = None,
|
|
602
627
|
start_published_date: Optional[str] = None,
|
|
603
628
|
end_published_date: Optional[str] = None,
|
|
629
|
+
include_text: Optional[List[str]] = None,
|
|
630
|
+
exclude_text: Optional[List[str]] = None,
|
|
604
631
|
use_autoprompt: Optional[bool] = None,
|
|
605
632
|
type: Optional[str] = None,
|
|
606
633
|
category: Optional[str] = None,
|
|
@@ -621,6 +648,8 @@ class Exa:
|
|
|
621
648
|
end_crawl_date: Optional[str] = None,
|
|
622
649
|
start_published_date: Optional[str] = None,
|
|
623
650
|
end_published_date: Optional[str] = None,
|
|
651
|
+
include_text: Optional[List[str]] = None,
|
|
652
|
+
exclude_text: Optional[List[str]] = None,
|
|
624
653
|
use_autoprompt: Optional[bool] = None,
|
|
625
654
|
type: Optional[str] = None,
|
|
626
655
|
category: Optional[str] = None,
|
|
@@ -642,6 +671,8 @@ class Exa:
|
|
|
642
671
|
end_crawl_date: Optional[str] = None,
|
|
643
672
|
start_published_date: Optional[str] = None,
|
|
644
673
|
end_published_date: Optional[str] = None,
|
|
674
|
+
include_text: Optional[List[str]] = None,
|
|
675
|
+
exclude_text: Optional[List[str]] = None,
|
|
645
676
|
use_autoprompt: Optional[bool] = None,
|
|
646
677
|
type: Optional[str] = None,
|
|
647
678
|
category: Optional[str] = None,
|
|
@@ -769,6 +800,8 @@ class Exa:
|
|
|
769
800
|
end_crawl_date: Optional[str] = None,
|
|
770
801
|
start_published_date: Optional[str] = None,
|
|
771
802
|
end_published_date: Optional[str] = None,
|
|
803
|
+
include_text: Optional[List[str]] = None,
|
|
804
|
+
exclude_text: Optional[List[str]] = None,
|
|
772
805
|
exclude_source_domain: Optional[bool] = None,
|
|
773
806
|
category: Optional[str] = None,
|
|
774
807
|
) -> SearchResponse[_Result]:
|
|
@@ -793,6 +826,8 @@ class Exa:
|
|
|
793
826
|
end_crawl_date: Optional[str] = None,
|
|
794
827
|
start_published_date: Optional[str] = None,
|
|
795
828
|
end_published_date: Optional[str] = None,
|
|
829
|
+
include_text: Optional[List[str]] = None,
|
|
830
|
+
exclude_text: Optional[List[str]] = None,
|
|
796
831
|
exclude_source_domain: Optional[bool] = None,
|
|
797
832
|
category: Optional[str] = None,
|
|
798
833
|
) -> SearchResponse[ResultWithText]:
|
|
@@ -811,6 +846,8 @@ class Exa:
|
|
|
811
846
|
end_crawl_date: Optional[str] = None,
|
|
812
847
|
start_published_date: Optional[str] = None,
|
|
813
848
|
end_published_date: Optional[str] = None,
|
|
849
|
+
include_text: Optional[List[str]] = None,
|
|
850
|
+
exclude_text: Optional[List[str]] = None,
|
|
814
851
|
exclude_source_domain: Optional[bool] = None,
|
|
815
852
|
category: Optional[str] = None,
|
|
816
853
|
) -> SearchResponse[ResultWithText]:
|
|
@@ -829,6 +866,8 @@ class Exa:
|
|
|
829
866
|
end_crawl_date: Optional[str] = None,
|
|
830
867
|
start_published_date: Optional[str] = None,
|
|
831
868
|
end_published_date: Optional[str] = None,
|
|
869
|
+
include_text: Optional[List[str]] = None,
|
|
870
|
+
exclude_text: Optional[List[str]] = None,
|
|
832
871
|
exclude_source_domain: Optional[bool] = None,
|
|
833
872
|
category: Optional[str] = None,
|
|
834
873
|
) -> SearchResponse[ResultWithHighlights]:
|
|
@@ -848,6 +887,8 @@ class Exa:
|
|
|
848
887
|
end_crawl_date: Optional[str] = None,
|
|
849
888
|
start_published_date: Optional[str] = None,
|
|
850
889
|
end_published_date: Optional[str] = None,
|
|
890
|
+
include_text: Optional[List[str]] = None,
|
|
891
|
+
exclude_text: Optional[List[str]] = None,
|
|
851
892
|
exclude_source_domain: Optional[bool] = None,
|
|
852
893
|
category: Optional[str] = None,
|
|
853
894
|
) -> SearchResponse[ResultWithTextAndHighlights]:
|
|
@@ -866,6 +907,8 @@ class Exa:
|
|
|
866
907
|
end_crawl_date: Optional[str] = None,
|
|
867
908
|
start_published_date: Optional[str] = None,
|
|
868
909
|
end_published_date: Optional[str] = None,
|
|
910
|
+
include_text: Optional[List[str]] = None,
|
|
911
|
+
exclude_text: Optional[List[str]] = None,
|
|
869
912
|
exclude_source_domain: Optional[bool] = None,
|
|
870
913
|
category: Optional[str] = None,
|
|
871
914
|
) -> SearchResponse[ResultWithSummary]:
|
|
@@ -885,6 +928,8 @@ class Exa:
|
|
|
885
928
|
end_crawl_date: Optional[str] = None,
|
|
886
929
|
start_published_date: Optional[str] = None,
|
|
887
930
|
end_published_date: Optional[str] = None,
|
|
931
|
+
include_text: Optional[List[str]] = None,
|
|
932
|
+
exclude_text: Optional[List[str]] = None,
|
|
888
933
|
exclude_source_domain: Optional[bool] = None,
|
|
889
934
|
category: Optional[str] = None,
|
|
890
935
|
) -> SearchResponse[ResultWithTextAndSummary]:
|
|
@@ -904,6 +949,8 @@ class Exa:
|
|
|
904
949
|
end_crawl_date: Optional[str] = None,
|
|
905
950
|
start_published_date: Optional[str] = None,
|
|
906
951
|
end_published_date: Optional[str] = None,
|
|
952
|
+
include_text: Optional[List[str]] = None,
|
|
953
|
+
exclude_text: Optional[List[str]] = None,
|
|
907
954
|
exclude_source_domain: Optional[bool] = None,
|
|
908
955
|
category: Optional[str] = None,
|
|
909
956
|
) -> SearchResponse[ResultWithHighlightsAndSummary]:
|
|
@@ -924,6 +971,8 @@ class Exa:
|
|
|
924
971
|
end_crawl_date: Optional[str] = None,
|
|
925
972
|
start_published_date: Optional[str] = None,
|
|
926
973
|
end_published_date: Optional[str] = None,
|
|
974
|
+
include_text: Optional[List[str]] = None,
|
|
975
|
+
exclude_text: Optional[List[str]] = None,
|
|
927
976
|
exclude_source_domain: Optional[bool] = None,
|
|
928
977
|
category: Optional[str] = None,
|
|
929
978
|
) -> SearchResponse[ResultWithTextAndHighlightsAndSummary]:
|
|
@@ -979,6 +1028,8 @@ class Exa:
|
|
|
979
1028
|
end_crawl_date: Optional[str] = None,
|
|
980
1029
|
start_published_date: Optional[str] = None,
|
|
981
1030
|
end_published_date: Optional[str] = None,
|
|
1031
|
+
include_text: Optional[List[str]] = None,
|
|
1032
|
+
exclude_text: Optional[List[str]] = None,
|
|
982
1033
|
use_autoprompt: Optional[bool] = True,
|
|
983
1034
|
type: Optional[str] = None,
|
|
984
1035
|
category: Optional[str] = None,
|
|
@@ -995,6 +1046,8 @@ class Exa:
|
|
|
995
1046
|
"end_crawl_date": end_crawl_date,
|
|
996
1047
|
"start_published_date": start_published_date,
|
|
997
1048
|
"end_published_date": end_published_date,
|
|
1049
|
+
"include_text": include_text,
|
|
1050
|
+
"exclude_text": exclude_text,
|
|
998
1051
|
"use_autoprompt": use_autoprompt,
|
|
999
1052
|
"type": type,
|
|
1000
1053
|
"category": category,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
exa_py/__init__.py,sha256=aVF1zB_UV3dagJ5Vn2WrdcInzibdIW61M89sjwRCU_g,29
|
|
2
|
+
exa_py/api.py,sha256=6xiQ1yNRqM4z6Qh-PyQWx_HBBKAx3Iq1h9q7Lh31DG0,41075
|
|
3
|
+
exa_py/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
exa_py/utils.py,sha256=Rc1FJjoR9LQ7L_OJM91Sd1GNkbHjcLyEvJENhRix6gc,2405
|
|
5
|
+
exa_py-1.0.17.dist-info/METADATA,sha256=Ow1jUrcf5JE6jueKxDMdD4DTjrCBgbuurn3gTCcioZc,3083
|
|
6
|
+
exa_py-1.0.17.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
|
7
|
+
exa_py-1.0.17.dist-info/top_level.txt,sha256=Mfkmscdw9HWR1PtVhU1gAiVo6DHu_tyiVdb89gfZBVI,7
|
|
8
|
+
exa_py-1.0.17.dist-info/RECORD,,
|
exa_py-1.0.15.dist-info/RECORD
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
exa_py/__init__.py,sha256=aVF1zB_UV3dagJ5Vn2WrdcInzibdIW61M89sjwRCU_g,29
|
|
2
|
-
exa_py/api.py,sha256=QT0gp-cow6aDDmHJARIgKfi-TFUngxmpr4PWKVyYZRc,38176
|
|
3
|
-
exa_py/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
exa_py/utils.py,sha256=Rc1FJjoR9LQ7L_OJM91Sd1GNkbHjcLyEvJENhRix6gc,2405
|
|
5
|
-
exa_py-1.0.15.dist-info/METADATA,sha256=agZ-1DeqIjSwZlWzrs2YOGN5DD_-QHGPMKHvgoEiFkY,3083
|
|
6
|
-
exa_py-1.0.15.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
|
7
|
-
exa_py-1.0.15.dist-info/top_level.txt,sha256=Mfkmscdw9HWR1PtVhU1gAiVo6DHu_tyiVdb89gfZBVI,7
|
|
8
|
-
exa_py-1.0.15.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|