exa-py 1.0.17__tar.gz → 1.0.18b1__tar.gz

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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: exa_py
3
- Version: 1.0.17
3
+ Version: 1.0.18b1
4
4
  Summary: Python SDK for Exa API.
5
5
  Home-page: https://github.com/exa-labs/exa-py
6
6
  Author: Exa
@@ -9,13 +9,15 @@ Classifier: Development Status :: 5 - Production/Stable
9
9
  Classifier: Intended Audience :: Developers
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Typing :: Typed
12
- Classifier: Programming Language :: Python :: 3.7
13
12
  Classifier: Programming Language :: Python :: 3.8
14
13
  Classifier: Programming Language :: Python :: 3.9
15
14
  Classifier: Programming Language :: Python :: 3.10
16
15
  Classifier: Programming Language :: Python :: 3.11
17
16
  Classifier: Programming Language :: Python :: 3.12
18
17
  Description-Content-Type: text/markdown
18
+ Requires-Dist: requests
19
+ Requires-Dist: typing-extensions
20
+ Requires-Dist: openai>=1.10.0
19
21
 
20
22
  # Exa
21
23
 
@@ -27,6 +27,12 @@ from exa_py.utils import (
27
27
  format_exa_result,
28
28
  maybe_get_query,
29
29
  )
30
+ from dotenv import load_dotenv
31
+ import os
32
+
33
+ load_dotenv()
34
+
35
+ is_beta = os.getenv("IS_BETA") == "True"
30
36
 
31
37
 
32
38
  def snake_to_camel(snake_str: str) -> str:
@@ -132,8 +138,18 @@ CONTENTS_OPTIONS_TYPES = {
132
138
  "text": [dict, bool],
133
139
  "highlights": [dict, bool],
134
140
  "summary": [dict, bool],
141
+ "metadata": [dict, bool],
142
+
135
143
  }
136
144
 
145
+ if is_beta:
146
+ # the livecrawl options
147
+ LIVECRAWL_OPTIONS = Literal["always", "fallback", "never"]
148
+
149
+ CONTENTS_OPTIONS_TYPES["livecrawl_timeout"] = [int]
150
+ CONTENTS_OPTIONS_TYPES["livecrawl"] = [LIVECRAWL_OPTIONS]
151
+ CONTENTS_OPTIONS_TYPES["filter_empty_results"] = [bool]
152
+
137
153
 
138
154
  def validate_search_options(
139
155
  options: Dict[str, Optional[object]], expected: dict
@@ -399,15 +415,20 @@ class SearchResponse(Generic[T]):
399
415
  Attributes:
400
416
  results (List[Result]): A list of search results.
401
417
  autoprompt_string (str, optional): The Exa query created by the autoprompt functionality.
418
+ resolved_search_type (str, optional): What "auto" search resolved to. "neural" or "keyword".
402
419
  """
403
420
 
404
421
  results: List[T]
405
422
  autoprompt_string: Optional[str]
423
+ resolved_search_type: Optional[str]
406
424
 
407
425
  def __str__(self):
408
426
  output = "\n\n".join(str(result) for result in self.results)
409
427
  if self.autoprompt_string:
410
428
  output += f"\n\nAutoprompt String: {self.autoprompt_string}"
429
+ if self.resolved_search_type:
430
+ output += f"\nResolved Search Type: {self.resolved_search_type}"
431
+
411
432
  return output
412
433
 
413
434
 
@@ -435,7 +456,7 @@ class Exa:
435
456
  self,
436
457
  api_key: Optional[str],
437
458
  base_url: str = "https://api.exa.ai",
438
- user_agent: str = "exa-py 1.0.17",
459
+ user_agent: str = "exa-py 1.0.18",
439
460
  ):
440
461
  """Initialize the Exa client with the provided API key and optional base URL and user agent.
441
462
 
@@ -505,6 +526,7 @@ class Exa:
505
526
  return SearchResponse(
506
527
  [Result(**to_snake_case(result)) for result in data["results"]],
507
528
  data["autopromptString"] if "autopromptString" in data else None,
529
+ data["resolvedSearchType"] if "resolvedSearchType" in data else None,
508
530
  )
509
531
 
510
532
  @overload
@@ -524,6 +546,9 @@ class Exa:
524
546
  use_autoprompt: Optional[bool] = None,
525
547
  type: Optional[str] = None,
526
548
  category: Optional[str] = None,
549
+ livecrawl_timeout: Optional[int] = None,
550
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
551
+ filter_empty_results: Optional[bool] = None,
527
552
  ) -> SearchResponse[ResultWithText]:
528
553
  ...
529
554
 
@@ -545,6 +570,9 @@ class Exa:
545
570
  use_autoprompt: Optional[bool] = None,
546
571
  type: Optional[str] = None,
547
572
  category: Optional[str] = None,
573
+ livecrawl_timeout: Optional[int] = None,
574
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
575
+ filter_empty_results: Optional[bool] = None,
548
576
  ) -> SearchResponse[ResultWithText]:
549
577
  ...
550
578
 
@@ -566,6 +594,9 @@ class Exa:
566
594
  use_autoprompt: Optional[bool] = None,
567
595
  type: Optional[str] = None,
568
596
  category: Optional[str] = None,
597
+ livecrawl_timeout: Optional[int] = None,
598
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
599
+ filter_empty_results: Optional[bool] = None,
569
600
  ) -> SearchResponse[ResultWithHighlights]:
570
601
  ...
571
602
 
@@ -588,6 +619,9 @@ class Exa:
588
619
  use_autoprompt: Optional[bool] = None,
589
620
  type: Optional[str] = None,
590
621
  category: Optional[str] = None,
622
+ livecrawl_timeout: Optional[int] = None,
623
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
624
+ filter_empty_results: Optional[bool] = None,
591
625
  ) -> SearchResponse[ResultWithTextAndHighlights]:
592
626
  ...
593
627
 
@@ -609,6 +643,9 @@ class Exa:
609
643
  use_autoprompt: Optional[bool] = None,
610
644
  type: Optional[str] = None,
611
645
  category: Optional[str] = None,
646
+ livecrawl_timeout: Optional[int] = None,
647
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
648
+ filter_empty_results: Optional[bool] = None,
612
649
  ) -> SearchResponse[ResultWithSummary]:
613
650
  ...
614
651
 
@@ -631,6 +668,9 @@ class Exa:
631
668
  use_autoprompt: Optional[bool] = None,
632
669
  type: Optional[str] = None,
633
670
  category: Optional[str] = None,
671
+ livecrawl_timeout: Optional[int] = None,
672
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
673
+ filter_empty_results: Optional[bool] = None,
634
674
  ) -> SearchResponse[ResultWithTextAndSummary]:
635
675
  ...
636
676
 
@@ -653,6 +693,9 @@ class Exa:
653
693
  use_autoprompt: Optional[bool] = None,
654
694
  type: Optional[str] = None,
655
695
  category: Optional[str] = None,
696
+ livecrawl_timeout: Optional[int] = None,
697
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
698
+ filter_empty_results: Optional[bool] = None,
656
699
  ) -> SearchResponse[ResultWithHighlightsAndSummary]:
657
700
  ...
658
701
 
@@ -676,6 +719,9 @@ class Exa:
676
719
  use_autoprompt: Optional[bool] = None,
677
720
  type: Optional[str] = None,
678
721
  category: Optional[str] = None,
722
+ livecrawl_timeout: Optional[int] = None,
723
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
724
+ filter_empty_results: Optional[bool] = None,
679
725
  ) -> SearchResponse[ResultWithTextAndHighlightsAndSummary]:
680
726
  ...
681
727
 
@@ -696,12 +742,16 @@ class Exa:
696
742
  return SearchResponse(
697
743
  [Result(**to_snake_case(result)) for result in data["results"]],
698
744
  data["autopromptString"] if "autopromptString" in data else None,
745
+ data["resolvedSearchType"] if "resolvedSearchType" in data else None,
699
746
  )
700
747
 
701
748
  @overload
702
749
  def get_contents(
703
750
  self,
704
751
  ids: Union[str, List[str], List[_Result]],
752
+ livecrawl_timeout: Optional[int] = None,
753
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
754
+ filter_empty_results: Optional[bool] = None,
705
755
  ) -> SearchResponse[ResultWithText]:
706
756
  ...
707
757
 
@@ -711,6 +761,9 @@ class Exa:
711
761
  ids: Union[str, List[str], List[_Result]],
712
762
  *,
713
763
  text: Union[TextContentsOptions, Literal[True]],
764
+ livecrawl_timeout: Optional[int] = None,
765
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
766
+ filter_empty_results: Optional[bool] = None,
714
767
  ) -> SearchResponse[ResultWithText]:
715
768
  ...
716
769
 
@@ -720,6 +773,9 @@ class Exa:
720
773
  ids: Union[str, List[str], List[_Result]],
721
774
  *,
722
775
  highlights: Union[HighlightsContentsOptions, Literal[True]],
776
+ livecrawl_timeout: Optional[int] = None,
777
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
778
+ filter_empty_results: Optional[bool] = None,
723
779
  ) -> SearchResponse[ResultWithHighlights]:
724
780
  ...
725
781
 
@@ -730,6 +786,9 @@ class Exa:
730
786
  *,
731
787
  text: Union[TextContentsOptions, Literal[True]],
732
788
  highlights: Union[HighlightsContentsOptions, Literal[True]],
789
+ livecrawl_timeout: Optional[int] = None,
790
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
791
+ filter_empty_results: Optional[bool] = None,
733
792
  ) -> SearchResponse[ResultWithTextAndHighlights]:
734
793
  ...
735
794
 
@@ -739,6 +798,9 @@ class Exa:
739
798
  ids: Union[str, List[str], List[_Result]],
740
799
  *,
741
800
  summary: Union[SummaryContentsOptions, Literal[True]],
801
+ livecrawl_timeout: Optional[int] = None,
802
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
803
+ filter_empty_results: Optional[bool] = None,
742
804
  ) -> SearchResponse[ResultWithSummary]:
743
805
  ...
744
806
 
@@ -749,6 +811,9 @@ class Exa:
749
811
  *,
750
812
  text: Union[TextContentsOptions, Literal[True]],
751
813
  summary: Union[SummaryContentsOptions, Literal[True]],
814
+ livecrawl_timeout: Optional[int] = None,
815
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
816
+ filter_empty_results: Optional[bool] = None,
752
817
  ) -> SearchResponse[ResultWithTextAndSummary]:
753
818
  ...
754
819
 
@@ -759,6 +824,9 @@ class Exa:
759
824
  *,
760
825
  highlights: Union[HighlightsContentsOptions, Literal[True]],
761
826
  summary: Union[SummaryContentsOptions, Literal[True]],
827
+ livecrawl_timeout: Optional[int] = None,
828
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
829
+ filter_empty_results: Optional[bool] = None,
762
830
  ) -> SearchResponse[ResultWithHighlightsAndSummary]:
763
831
  ...
764
832
 
@@ -770,6 +838,9 @@ class Exa:
770
838
  text: Union[TextContentsOptions, Literal[True]],
771
839
  highlights: Union[HighlightsContentsOptions, Literal[True]],
772
840
  summary: Union[SummaryContentsOptions, Literal[True]],
841
+ livecrawl_timeout: Optional[int] = None,
842
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
843
+ filter_empty_results: Optional[bool] = None,
773
844
  ) -> SearchResponse[ResultWithTextAndHighlightsAndSummary]:
774
845
  ...
775
846
 
@@ -787,6 +858,7 @@ class Exa:
787
858
  return SearchResponse(
788
859
  [Result(**to_snake_case(result)) for result in data["results"]],
789
860
  data["autopromptString"] if "autopromptString" in data else None,
861
+ data["resolvedSearchType"] if "resolvedSearchType" in data else None,
790
862
  )
791
863
 
792
864
  def find_similar(
@@ -812,6 +884,7 @@ class Exa:
812
884
  return SearchResponse(
813
885
  [Result(**to_snake_case(result)) for result in data["results"]],
814
886
  data["autopromptString"] if "autopromptString" in data else None,
887
+ data["resolvedSearchType"] if "resolvedSearchType" in data else None,
815
888
  )
816
889
 
817
890
  @overload
@@ -830,6 +903,9 @@ class Exa:
830
903
  exclude_text: Optional[List[str]] = None,
831
904
  exclude_source_domain: Optional[bool] = None,
832
905
  category: Optional[str] = None,
906
+ livecrawl_timeout: Optional[int] = None,
907
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
908
+ filter_empty_results: Optional[bool] = None,
833
909
  ) -> SearchResponse[ResultWithText]:
834
910
  ...
835
911
 
@@ -850,6 +926,9 @@ class Exa:
850
926
  exclude_text: Optional[List[str]] = None,
851
927
  exclude_source_domain: Optional[bool] = None,
852
928
  category: Optional[str] = None,
929
+ livecrawl_timeout: Optional[int] = None,
930
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
931
+ filter_empty_results: Optional[bool] = None,
853
932
  ) -> SearchResponse[ResultWithText]:
854
933
  ...
855
934
 
@@ -870,6 +949,9 @@ class Exa:
870
949
  exclude_text: Optional[List[str]] = None,
871
950
  exclude_source_domain: Optional[bool] = None,
872
951
  category: Optional[str] = None,
952
+ livecrawl_timeout: Optional[int] = None,
953
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
954
+ filter_empty_results: Optional[bool] = None,
873
955
  ) -> SearchResponse[ResultWithHighlights]:
874
956
  ...
875
957
 
@@ -891,6 +973,9 @@ class Exa:
891
973
  exclude_text: Optional[List[str]] = None,
892
974
  exclude_source_domain: Optional[bool] = None,
893
975
  category: Optional[str] = None,
976
+ livecrawl_timeout: Optional[int] = None,
977
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
978
+ filter_empty_results: Optional[bool] = None,
894
979
  ) -> SearchResponse[ResultWithTextAndHighlights]:
895
980
  ...
896
981
 
@@ -911,6 +996,9 @@ class Exa:
911
996
  exclude_text: Optional[List[str]] = None,
912
997
  exclude_source_domain: Optional[bool] = None,
913
998
  category: Optional[str] = None,
999
+ livecrawl_timeout: Optional[int] = None,
1000
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
1001
+ filter_empty_results: Optional[bool] = None,
914
1002
  ) -> SearchResponse[ResultWithSummary]:
915
1003
  ...
916
1004
 
@@ -932,6 +1020,9 @@ class Exa:
932
1020
  exclude_text: Optional[List[str]] = None,
933
1021
  exclude_source_domain: Optional[bool] = None,
934
1022
  category: Optional[str] = None,
1023
+ livecrawl_timeout: Optional[int] = None,
1024
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
1025
+ filter_empty_results: Optional[bool] = None,
935
1026
  ) -> SearchResponse[ResultWithTextAndSummary]:
936
1027
  ...
937
1028
 
@@ -953,6 +1044,9 @@ class Exa:
953
1044
  exclude_text: Optional[List[str]] = None,
954
1045
  exclude_source_domain: Optional[bool] = None,
955
1046
  category: Optional[str] = None,
1047
+ livecrawl_timeout: Optional[int] = None,
1048
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
1049
+ filter_empty_results: Optional[bool] = None,
956
1050
  ) -> SearchResponse[ResultWithHighlightsAndSummary]:
957
1051
  ...
958
1052
 
@@ -975,6 +1069,9 @@ class Exa:
975
1069
  exclude_text: Optional[List[str]] = None,
976
1070
  exclude_source_domain: Optional[bool] = None,
977
1071
  category: Optional[str] = None,
1072
+ livecrawl_timeout: Optional[int] = None,
1073
+ livecrawl: Optional[LIVECRAWL_OPTIONS] = None,
1074
+ filter_empty_results: Optional[bool] = None,
978
1075
  ) -> SearchResponse[ResultWithTextAndHighlightsAndSummary]:
979
1076
  ...
980
1077
 
@@ -995,6 +1092,7 @@ class Exa:
995
1092
  return SearchResponse(
996
1093
  [Result(**to_snake_case(result)) for result in data["results"]],
997
1094
  data["autopromptString"] if "autopromptString" in data else None,
1095
+ data["resolvedSearchType"] if "resolvedSearchType" in data else None,
998
1096
  )
999
1097
 
1000
1098
  def wrap(self, client: OpenAI):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
- Name: exa-py
3
- Version: 1.0.17
2
+ Name: exa_py
3
+ Version: 1.0.18b1
4
4
  Summary: Python SDK for Exa API.
5
5
  Home-page: https://github.com/exa-labs/exa-py
6
6
  Author: Exa
@@ -9,13 +9,15 @@ Classifier: Development Status :: 5 - Production/Stable
9
9
  Classifier: Intended Audience :: Developers
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Typing :: Typed
12
- Classifier: Programming Language :: Python :: 3.7
13
12
  Classifier: Programming Language :: Python :: 3.8
14
13
  Classifier: Programming Language :: Python :: 3.9
15
14
  Classifier: Programming Language :: Python :: 3.10
16
15
  Classifier: Programming Language :: Python :: 3.11
17
16
  Classifier: Programming Language :: Python :: 3.12
18
17
  Description-Content-Type: text/markdown
18
+ Requires-Dist: requests
19
+ Requires-Dist: typing-extensions
20
+ Requires-Dist: openai>=1.10.0
19
21
 
20
22
  # Exa
21
23
 
@@ -1,4 +1,5 @@
1
1
  README.md
2
+ pyproject.toml
2
3
  setup.py
3
4
  exa_py/__init__.py
4
5
  exa_py/api.py
@@ -0,0 +1,24 @@
1
+ [tool.poetry]
2
+ name = "exa-py"
3
+ version = "1.0.18"
4
+ description = "Python SDK for Exa API."
5
+ authors = ["Exa AI <hello@exa.ai>"]
6
+ readme = "README.md"
7
+
8
+ [tool.poetry.dependencies]
9
+ python = "^3.9"
10
+ requests = "^2.32.3"
11
+ typing-extensions = "^4.12.2"
12
+ openai = "^1.10"
13
+
14
+
15
+ [tool.poetry.group.dev.dependencies]
16
+ python-dotenv = "^1.0.1"
17
+ setuptools = "^74.0.0"
18
+ docutils = "^0.21.2"
19
+ twine = "^5.1.1"
20
+
21
+
22
+ [build-system]
23
+ requires = ["poetry-core"]
24
+ build-backend = "poetry.core.masonry.api"
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="exa_py",
5
- version="1.0.17",
5
+ version="1.0.18b1",
6
6
  description="Python SDK for Exa API.",
7
7
  long_description_content_type="text/markdown",
8
8
  long_description=open("README.md").read(),
@@ -21,7 +21,6 @@ setup(
21
21
  "Intended Audience :: Developers",
22
22
  "License :: OSI Approved :: MIT License",
23
23
  "Typing :: Typed",
24
- "Programming Language :: Python :: 3.7",
25
24
  "Programming Language :: Python :: 3.8",
26
25
  "Programming Language :: Python :: 3.9",
27
26
  "Programming Language :: Python :: 3.10",
File without changes
File without changes
File without changes
File without changes
File without changes