exa-py 1.14.3__py3-none-any.whl → 1.14.5__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
@@ -166,6 +166,7 @@ CONTENTS_OPTIONS_TYPES = {
166
166
  "text": [dict, bool],
167
167
  "highlights": [dict, bool],
168
168
  "summary": [dict, bool],
169
+ "context": [dict, bool],
169
170
  "metadata": [dict, bool],
170
171
  "livecrawl_timeout": [int],
171
172
  "livecrawl": [LIVECRAWL_OPTIONS],
@@ -292,6 +293,16 @@ class SummaryContentsOptions(TypedDict, total=False):
292
293
  schema: JSONSchema
293
294
 
294
295
 
296
+ class ContextContentsOptions(TypedDict, total=False):
297
+ """Options for retrieving aggregated context from a set of search results.
298
+
299
+ Attributes:
300
+ max_characters (int): The maximum number of characters to include in the context string.
301
+ """
302
+
303
+ max_characters: int
304
+
305
+
295
306
  class ExtrasOptions(TypedDict, total=False):
296
307
  """A class representing additional extraction fields (e.g. links, images)"""
297
308
 
@@ -788,6 +799,15 @@ class AsyncStreamAnswerResponse:
788
799
 
789
800
  T = TypeVar("T")
790
801
 
802
+ @dataclass
803
+ class ContentStatus:
804
+ """A class representing the status of a content retrieval operation."""
805
+
806
+ id: str
807
+ status: str
808
+ source: str
809
+
810
+
791
811
 
792
812
  @dataclass
793
813
  class SearchResponse(Generic[T]):
@@ -798,16 +818,23 @@ class SearchResponse(Generic[T]):
798
818
  autoprompt_string (str, optional): The Exa query created by autoprompt.
799
819
  resolved_search_type (str, optional): 'neural' or 'keyword' if auto.
800
820
  auto_date (str, optional): A date for filtering if autoprompt found one.
821
+ context (str, optional): Combined context string when requested via contents.context.
822
+ statuses (List[ContentStatus], optional): Status list from get_contents.
823
+ cost_dollars (CostDollars, optional): Cost breakdown.
801
824
  """
802
825
 
803
826
  results: List[T]
804
827
  autoprompt_string: Optional[str]
805
828
  resolved_search_type: Optional[str]
806
829
  auto_date: Optional[str]
830
+ context: Optional[str] = None
831
+ statuses: Optional[List[ContentStatus]] = None
807
832
  cost_dollars: Optional[CostDollars] = None
808
833
 
809
834
  def __str__(self):
810
835
  output = "\n\n".join(str(result) for result in self.results)
836
+ if self.context:
837
+ output += f"\nContext: {self.context}"
811
838
  if self.autoprompt_string:
812
839
  output += f"\n\nAutoprompt String: {self.autoprompt_string}"
813
840
  if self.resolved_search_type:
@@ -818,6 +845,8 @@ class SearchResponse(Generic[T]):
818
845
  output += f"\n - search: {self.cost_dollars.search}"
819
846
  if self.cost_dollars.contents:
820
847
  output += f"\n - contents: {self.cost_dollars.contents}"
848
+ if self.statuses:
849
+ output += f"\nStatuses: {self.statuses}"
821
850
  return output
822
851
 
823
852
 
@@ -1242,6 +1271,7 @@ class Exa:
1242
1271
  "text",
1243
1272
  "highlights",
1244
1273
  "summary",
1274
+ "context",
1245
1275
  "subpages",
1246
1276
  "subpage_target",
1247
1277
  "livecrawl",
@@ -1258,6 +1288,7 @@ class Exa:
1258
1288
  data["autopromptString"] if "autopromptString" in data else None,
1259
1289
  data["resolvedSearchType"] if "resolvedSearchType" in data else None,
1260
1290
  data["autoDate"] if "autoDate" in data else None,
1291
+ context=data.get("context"),
1261
1292
  cost_dollars=cost_dollars,
1262
1293
  )
1263
1294
 
@@ -1405,12 +1436,15 @@ class Exa:
1405
1436
  options = to_camel_case(options)
1406
1437
  data = self.request("/contents", options)
1407
1438
  cost_dollars = parse_cost_dollars(data.get("costDollars"))
1439
+ statuses = [ContentStatus(**status) for status in data.get("statuses", [])]
1408
1440
  return SearchResponse(
1409
1441
  [Result(**to_snake_case(result)) for result in data["results"]],
1410
1442
  data.get("autopromptString"),
1411
1443
  data.get("resolvedSearchType"),
1412
1444
  data.get("autoDate"),
1445
+ context=data.get("context"),
1413
1446
  cost_dollars=cost_dollars,
1447
+ statuses=statuses,
1414
1448
  )
1415
1449
 
1416
1450
  def find_similar(
@@ -1700,6 +1734,7 @@ class Exa:
1700
1734
  "text",
1701
1735
  "highlights",
1702
1736
  "summary",
1737
+ "context",
1703
1738
  "subpages",
1704
1739
  "subpage_target",
1705
1740
  "livecrawl",
@@ -1716,6 +1751,7 @@ class Exa:
1716
1751
  data.get("autopromptString"),
1717
1752
  data.get("resolvedSearchType"),
1718
1753
  data.get("autoDate"),
1754
+ context=data.get("context"),
1719
1755
  cost_dollars=cost_dollars,
1720
1756
  )
1721
1757
 
@@ -2052,6 +2088,7 @@ class AsyncExa(Exa):
2052
2088
  "text",
2053
2089
  "highlights",
2054
2090
  "summary",
2091
+ "context",
2055
2092
  "subpages",
2056
2093
  "subpage_target",
2057
2094
  "livecrawl",
@@ -2068,6 +2105,7 @@ class AsyncExa(Exa):
2068
2105
  data["autopromptString"] if "autopromptString" in data else None,
2069
2106
  data["resolvedSearchType"] if "resolvedSearchType" in data else None,
2070
2107
  data["autoDate"] if "autoDate" in data else None,
2108
+ context=data.get("context"),
2071
2109
  cost_dollars=cost_dollars,
2072
2110
  )
2073
2111
 
@@ -2092,12 +2130,15 @@ class AsyncExa(Exa):
2092
2130
  options = to_camel_case(options)
2093
2131
  data = await self.async_request("/contents", options)
2094
2132
  cost_dollars = parse_cost_dollars(data.get("costDollars"))
2133
+ statuses = [ContentStatus(**status) for status in data.get("statuses", [])]
2095
2134
  return SearchResponse(
2096
2135
  [Result(**to_snake_case(result)) for result in data["results"]],
2097
2136
  data.get("autopromptString"),
2098
2137
  data.get("resolvedSearchType"),
2099
2138
  data.get("autoDate"),
2139
+ context=data.get("context"),
2100
2140
  cost_dollars=cost_dollars,
2141
+ statuses=statuses,
2101
2142
  )
2102
2143
 
2103
2144
  async def find_similar(
@@ -2175,6 +2216,7 @@ class AsyncExa(Exa):
2175
2216
  "text",
2176
2217
  "highlights",
2177
2218
  "summary",
2219
+ "context",
2178
2220
  "subpages",
2179
2221
  "subpage_target",
2180
2222
  "livecrawl",
@@ -2191,6 +2233,7 @@ class AsyncExa(Exa):
2191
2233
  data.get("autopromptString"),
2192
2234
  data.get("resolvedSearchType"),
2193
2235
  data.get("autoDate"),
2236
+ context=data.get("context"),
2194
2237
  cost_dollars=cost_dollars,
2195
2238
  )
2196
2239
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: exa-py
3
- Version: 1.14.3
3
+ Version: 1.14.5
4
4
  Summary: Python SDK for Exa API.
5
5
  Home-page: https://github.com/exa-labs/exa-py
6
6
  Author: Exa
@@ -1,5 +1,5 @@
1
1
  exa_py/__init__.py,sha256=M2GC9oSdoV6m2msboW0vMWWl8wrth4o6gmEV4MYLGG8,66
2
- exa_py/api.py,sha256=HEv52SYYtG6f4FkJb9wGhNDaknZkcgxp0Fr7Kw2BrPc,84916
2
+ exa_py/api.py,sha256=ez32FoYovsujjMKmnY0eArgilVgG3EpAVZycOdN8Z8w,86443
3
3
  exa_py/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  exa_py/utils.py,sha256=Rc1FJjoR9LQ7L_OJM91Sd1GNkbHjcLyEvJENhRix6gc,2405
5
5
  exa_py/research/__init__.py,sha256=QeY-j6bP4QP5tF9ytX0IeQhJvd0Wn4cJCD69U8pP7kA,271
@@ -22,7 +22,7 @@ exa_py/websets/searches/__init__.py,sha256=_0Zx8ES5fFTEL3T8mhLxq_xK2t0JONx6ad6At
22
22
  exa_py/websets/searches/client.py,sha256=X3f7axWGfecmxf-2tBTX0Yf_--xToz1X8ZHbbudEzy0,1790
23
23
  exa_py/websets/webhooks/__init__.py,sha256=iTPBCxFd73z4RifLQMX6iRECx_6pwlI5qscLNjMOUHE,77
24
24
  exa_py/websets/webhooks/client.py,sha256=zsIRMTeJU65yj-zo7Zz-gG02Prtzgcx6utGFSoY4HQQ,4222
25
- exa_py-1.14.3.dist-info/METADATA,sha256=-UJmHBKQXJq-uc_KalQQ4EinqRuRGvh2eu2gI35nukE,3835
26
- exa_py-1.14.3.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
27
- exa_py-1.14.3.dist-info/top_level.txt,sha256=Mfkmscdw9HWR1PtVhU1gAiVo6DHu_tyiVdb89gfZBVI,7
28
- exa_py-1.14.3.dist-info/RECORD,,
25
+ exa_py-1.14.5.dist-info/METADATA,sha256=PFRpXGH3t0yYznx9VIX2FHATR9AJ6MbCr251jMxFddo,3835
26
+ exa_py-1.14.5.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
27
+ exa_py-1.14.5.dist-info/top_level.txt,sha256=Mfkmscdw9HWR1PtVhU1gAiVo6DHu_tyiVdb89gfZBVI,7
28
+ exa_py-1.14.5.dist-info/RECORD,,