exa-py 1.14.2__tar.gz → 1.14.4__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.

Files changed (38) hide show
  1. {exa_py-1.14.2 → exa_py-1.14.4}/PKG-INFO +13 -18
  2. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/api.py +18 -1
  3. exa_py-1.14.4/exa_py.egg-info/PKG-INFO +129 -0
  4. exa_py-1.14.4/exa_py.egg-info/SOURCES.txt +35 -0
  5. exa_py-1.14.4/exa_py.egg-info/dependency_links.txt +1 -0
  6. exa_py-1.14.4/exa_py.egg-info/requires.txt +6 -0
  7. exa_py-1.14.4/exa_py.egg-info/top_level.txt +1 -0
  8. {exa_py-1.14.2 → exa_py-1.14.4}/pyproject.toml +1 -1
  9. exa_py-1.14.4/setup.cfg +4 -0
  10. exa_py-1.14.4/setup.py +26 -0
  11. exa_py-1.14.4/tests/test_monitors.py +502 -0
  12. exa_py-1.14.4/tests/test_search_api.py +107 -0
  13. exa_py-1.14.4/tests/test_websets.py +418 -0
  14. exa_py-1.14.2/exa_py/websets/_generator/pydantic/BaseModel.jinja2 +0 -42
  15. {exa_py-1.14.2 → exa_py-1.14.4}/README.md +0 -0
  16. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/__init__.py +0 -0
  17. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/py.typed +0 -0
  18. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/research/__init__.py +0 -0
  19. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/research/client.py +0 -0
  20. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/research/models.py +0 -0
  21. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/utils.py +0 -0
  22. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/websets/__init__.py +0 -0
  23. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/websets/client.py +0 -0
  24. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/websets/core/__init__.py +0 -0
  25. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/websets/core/base.py +0 -0
  26. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/websets/enrichments/__init__.py +0 -0
  27. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/websets/enrichments/client.py +0 -0
  28. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/websets/items/__init__.py +0 -0
  29. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/websets/items/client.py +0 -0
  30. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/websets/monitors/__init__.py +0 -0
  31. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/websets/monitors/client.py +0 -0
  32. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/websets/monitors/runs/__init__.py +0 -0
  33. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/websets/monitors/runs/client.py +0 -0
  34. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/websets/searches/__init__.py +0 -0
  35. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/websets/searches/client.py +0 -0
  36. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/websets/types.py +0 -0
  37. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/websets/webhooks/__init__.py +0 -0
  38. {exa_py-1.14.2 → exa_py-1.14.4}/exa_py/websets/webhooks/client.py +0 -0
@@ -1,25 +1,21 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: exa-py
3
- Version: 1.14.2
3
+ Version: 1.14.4
4
4
  Summary: Python SDK for Exa API.
5
+ Home-page: https://github.com/exa-labs/exa-py
6
+ Author: Exa
7
+ Author-email: Exa AI <hello@exa.ai>
5
8
  License: MIT
6
- Author: Exa AI
7
- Author-email: hello@exa.ai
8
9
  Requires-Python: >=3.9
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.9
12
- Classifier: Programming Language :: Python :: 3.10
13
- Classifier: Programming Language :: Python :: 3.11
14
- Classifier: Programming Language :: Python :: 3.12
15
- Classifier: Programming Language :: Python :: 3.13
16
- Requires-Dist: httpx (>=0.28.1)
17
- Requires-Dist: openai (>=1.48)
18
- Requires-Dist: pydantic (>=2.10.6)
19
- Requires-Dist: pytest-mock (>=3.14.0)
20
- Requires-Dist: requests (>=2.32.3)
21
- Requires-Dist: typing-extensions (>=4.12.2)
22
10
  Description-Content-Type: text/markdown
11
+ Requires-Dist: requests>=2.32.3
12
+ Requires-Dist: typing-extensions>=4.12.2
13
+ Requires-Dist: openai>=1.48
14
+ Requires-Dist: pydantic>=2.10.6
15
+ Requires-Dist: pytest-mock>=3.14.0
16
+ Requires-Dist: httpx>=0.28.1
17
+ Dynamic: author
18
+ Dynamic: home-page
23
19
 
24
20
  # Exa
25
21
 
@@ -131,4 +127,3 @@ exa = Exa(api_key="your-api-key")
131
127
  output_schema=OUTPUT_SCHEMA,
132
128
  )
133
129
  ```
134
-
@@ -159,7 +159,7 @@ FIND_SIMILAR_OPTIONS_TYPES = {
159
159
  }
160
160
 
161
161
  # the livecrawl options
162
- LIVECRAWL_OPTIONS = Literal["always", "fallback", "never", "auto"]
162
+ LIVECRAWL_OPTIONS = Literal["always", "fallback", "never", "auto", "preferred"]
163
163
 
164
164
  CONTENTS_OPTIONS_TYPES = {
165
165
  "urls": [list],
@@ -788,6 +788,15 @@ class AsyncStreamAnswerResponse:
788
788
 
789
789
  T = TypeVar("T")
790
790
 
791
+ @dataclass
792
+ class ContentStatus:
793
+ """A class representing the status of a content retrieval operation."""
794
+
795
+ id: str
796
+ status: str
797
+ source: str
798
+
799
+
791
800
 
792
801
  @dataclass
793
802
  class SearchResponse(Generic[T]):
@@ -804,6 +813,7 @@ class SearchResponse(Generic[T]):
804
813
  autoprompt_string: Optional[str]
805
814
  resolved_search_type: Optional[str]
806
815
  auto_date: Optional[str]
816
+ statuses: Optional[List[ContentStatus]] = None
807
817
  cost_dollars: Optional[CostDollars] = None
808
818
 
809
819
  def __str__(self):
@@ -818,6 +828,8 @@ class SearchResponse(Generic[T]):
818
828
  output += f"\n - search: {self.cost_dollars.search}"
819
829
  if self.cost_dollars.contents:
820
830
  output += f"\n - contents: {self.cost_dollars.contents}"
831
+ if self.statuses:
832
+ output += f"\nStatuses: {self.statuses}"
821
833
  return output
822
834
 
823
835
 
@@ -1402,15 +1414,18 @@ class Exa:
1402
1414
  options,
1403
1415
  {**CONTENTS_OPTIONS_TYPES, **CONTENTS_ENDPOINT_OPTIONS_TYPES},
1404
1416
  )
1417
+
1405
1418
  options = to_camel_case(options)
1406
1419
  data = self.request("/contents", options)
1407
1420
  cost_dollars = parse_cost_dollars(data.get("costDollars"))
1421
+ statuses = [ContentStatus(**status) for status in data.get("statuses", [])]
1408
1422
  return SearchResponse(
1409
1423
  [Result(**to_snake_case(result)) for result in data["results"]],
1410
1424
  data.get("autopromptString"),
1411
1425
  data.get("resolvedSearchType"),
1412
1426
  data.get("autoDate"),
1413
1427
  cost_dollars=cost_dollars,
1428
+ statuses=statuses,
1414
1429
  )
1415
1430
 
1416
1431
  def find_similar(
@@ -2092,12 +2107,14 @@ class AsyncExa(Exa):
2092
2107
  options = to_camel_case(options)
2093
2108
  data = await self.async_request("/contents", options)
2094
2109
  cost_dollars = parse_cost_dollars(data.get("costDollars"))
2110
+ statuses = [ContentStatus(**status) for status in data.get("statuses", [])]
2095
2111
  return SearchResponse(
2096
2112
  [Result(**to_snake_case(result)) for result in data["results"]],
2097
2113
  data.get("autopromptString"),
2098
2114
  data.get("resolvedSearchType"),
2099
2115
  data.get("autoDate"),
2100
2116
  cost_dollars=cost_dollars,
2117
+ statuses=statuses,
2101
2118
  )
2102
2119
 
2103
2120
  async def find_similar(
@@ -0,0 +1,129 @@
1
+ Metadata-Version: 2.4
2
+ Name: exa-py
3
+ Version: 1.14.4
4
+ Summary: Python SDK for Exa API.
5
+ Home-page: https://github.com/exa-labs/exa-py
6
+ Author: Exa
7
+ Author-email: Exa AI <hello@exa.ai>
8
+ License: MIT
9
+ Requires-Python: >=3.9
10
+ Description-Content-Type: text/markdown
11
+ Requires-Dist: requests>=2.32.3
12
+ Requires-Dist: typing-extensions>=4.12.2
13
+ Requires-Dist: openai>=1.48
14
+ Requires-Dist: pydantic>=2.10.6
15
+ Requires-Dist: pytest-mock>=3.14.0
16
+ Requires-Dist: httpx>=0.28.1
17
+ Dynamic: author
18
+ Dynamic: home-page
19
+
20
+ # Exa
21
+
22
+ Exa (formerly Metaphor) API in Python
23
+
24
+ Note: This API is basically the same as `metaphor-python` but reflects new
25
+ features associated with Metaphor's rename to Exa. New site is https://exa.ai
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ pip install exa_py
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ Import the package and initialize the Exa client with your API key:
36
+
37
+ ```python
38
+ from exa_py import Exa
39
+
40
+ exa = Exa(api_key="your-api-key")
41
+ ```
42
+
43
+ ## Common requests
44
+
45
+ ```python
46
+
47
+ # basic search
48
+ results = exa.search("This is a Exa query:")
49
+
50
+ # keyword search (non-neural)
51
+ results = exa.search("Google-style query", type="keyword")
52
+
53
+ # search with date filters
54
+ results = exa.search("This is a Exa query:", start_published_date="2019-01-01", end_published_date="2019-01-31")
55
+
56
+ # search with domain filters
57
+ results = exa.search("This is a Exa query:", include_domains=["www.cnn.com", "www.nytimes.com"])
58
+
59
+ # search and get text contents
60
+ results = exa.search_and_contents("This is a Exa query:")
61
+
62
+ # search and get contents with contents options
63
+ results = exa.search_and_contents("This is a Exa query:",
64
+ text={"include_html_tags": True, "max_characters": 1000})
65
+
66
+ # find similar documents
67
+ results = exa.find_similar("https://example.com")
68
+
69
+ # find similar excluding source domain
70
+ results = exa.find_similar("https://example.com", exclude_source_domain=True)
71
+
72
+ # find similar with contents
73
+ results = exa.find_similar_and_contents("https://example.com", text=True)
74
+
75
+ # get text contents
76
+ results = exa.get_contents(["tesla.com"])
77
+
78
+ # get contents with contents options
79
+ results = exa.get_contents(["urls"],
80
+ text={"include_html_tags": True, "max_characters": 1000})
81
+
82
+ # basic answer
83
+ response = exa.answer("This is a query to answer a question")
84
+
85
+ # answer with full text, using the exa-pro model (sends 2 expanded quries to exa search)
86
+ response = exa.answer("This is a query to answer a question", text=True, model="exa-pro")
87
+
88
+ # answer with streaming
89
+ response = exa.stream_answer("This is a query to answer:")
90
+
91
+ # Print each chunk as it arrives when using the stream_answer method
92
+ for chunk in response:
93
+ print(chunk, end='', flush=True)
94
+
95
+ # research task example – answer a question with citations
96
+ # Example prompt & schema inspired by the TypeScript example.
97
+ QUESTION = (
98
+ "Summarize the history of San Francisco highlighting one or two major events "
99
+ "for each decade from 1850 to 1950"
100
+ )
101
+ OUTPUT_SCHEMA: Dict[str, Any] = {
102
+ "type": "object",
103
+ "required": ["timeline"],
104
+ "properties": {
105
+ "timeline": {
106
+ "type": "array",
107
+ "items": {
108
+ "type": "object",
109
+ "required": ["decade", "notableEvents"],
110
+ "properties": {
111
+ "decade": {
112
+ "type": "string",
113
+ "description": 'Decade label e.g. "1850s"',
114
+ },
115
+ "notableEvents": {
116
+ "type": "string",
117
+ "description": "A summary of notable events.",
118
+ },
119
+ },
120
+ },
121
+ },
122
+ },
123
+ }
124
+ resp = exa.research.create_task(
125
+ instructions=QUESTION,
126
+ model="exa-research",
127
+ output_schema=OUTPUT_SCHEMA,
128
+ )
129
+ ```
@@ -0,0 +1,35 @@
1
+ README.md
2
+ pyproject.toml
3
+ setup.py
4
+ exa_py/__init__.py
5
+ exa_py/api.py
6
+ exa_py/py.typed
7
+ exa_py/utils.py
8
+ exa_py.egg-info/PKG-INFO
9
+ exa_py.egg-info/SOURCES.txt
10
+ exa_py.egg-info/dependency_links.txt
11
+ exa_py.egg-info/requires.txt
12
+ exa_py.egg-info/top_level.txt
13
+ exa_py/research/__init__.py
14
+ exa_py/research/client.py
15
+ exa_py/research/models.py
16
+ exa_py/websets/__init__.py
17
+ exa_py/websets/client.py
18
+ exa_py/websets/types.py
19
+ exa_py/websets/core/__init__.py
20
+ exa_py/websets/core/base.py
21
+ exa_py/websets/enrichments/__init__.py
22
+ exa_py/websets/enrichments/client.py
23
+ exa_py/websets/items/__init__.py
24
+ exa_py/websets/items/client.py
25
+ exa_py/websets/monitors/__init__.py
26
+ exa_py/websets/monitors/client.py
27
+ exa_py/websets/monitors/runs/__init__.py
28
+ exa_py/websets/monitors/runs/client.py
29
+ exa_py/websets/searches/__init__.py
30
+ exa_py/websets/searches/client.py
31
+ exa_py/websets/webhooks/__init__.py
32
+ exa_py/websets/webhooks/client.py
33
+ tests/test_monitors.py
34
+ tests/test_search_api.py
35
+ tests/test_websets.py
@@ -0,0 +1,6 @@
1
+ requests>=2.32.3
2
+ typing-extensions>=4.12.2
3
+ openai>=1.48
4
+ pydantic>=2.10.6
5
+ pytest-mock>=3.14.0
6
+ httpx>=0.28.1
@@ -0,0 +1 @@
1
+ exa_py
@@ -32,7 +32,7 @@ in-project = true
32
32
 
33
33
  [project]
34
34
  name = "exa-py"
35
- version = "1.14.2"
35
+ version = "1.14.4"
36
36
  description = "Python SDK for Exa API."
37
37
  readme = "README.md"
38
38
  requires-python = ">=3.9"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
exa_py-1.14.4/setup.py ADDED
@@ -0,0 +1,26 @@
1
+ from setuptools import find_packages, setup
2
+
3
+ setup(
4
+ name="exa_py",
5
+ version="1.14.4",
6
+ description="Python SDK for Exa API.",
7
+ long_description_content_type="text/markdown",
8
+ long_description=open("README.md").read(),
9
+ author="Exa",
10
+ author_email="hello@exa.ai",
11
+ package_data={"exa_py": ["py.typed"]},
12
+ url="https://github.com/exa-labs/exa-py",
13
+ packages=find_packages(),
14
+ install_requires=["requests", "typing-extensions", "openai>=1.10.0"],
15
+ classifiers=[
16
+ "Development Status :: 5 - Production/Stable",
17
+ "Intended Audience :: Developers",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Typing :: Typed",
20
+ "Programming Language :: Python :: 3.8",
21
+ "Programming Language :: Python :: 3.9",
22
+ "Programming Language :: Python :: 3.10",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ ],
26
+ )