exa-py 1.1.4__py3-none-any.whl → 1.1.6__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
@@ -130,20 +130,21 @@ FIND_SIMILAR_OPTIONS_TYPES = {
130
130
  "category": [str],
131
131
  }
132
132
 
133
+ # the livecrawl options
134
+ LIVECRAWL_OPTIONS = Literal["always", "fallback", "never"]
135
+
133
136
  CONTENTS_OPTIONS_TYPES = {
134
137
  "ids": [list],
135
138
  "text": [dict, bool],
136
139
  "highlights": [dict, bool],
137
140
  "summary": [dict, bool],
138
141
  "metadata": [dict, bool],
139
-
142
+ "livecrawl_timeout": [int],
143
+ "livecrawl": [LIVECRAWL_OPTIONS],
144
+ "filter_empty_results": [bool],
140
145
  }
141
146
 
142
- # the livecrawl options
143
- LIVECRAWL_OPTIONS = Literal["always", "fallback", "never"]
144
- CONTENTS_OPTIONS_TYPES["livecrawl_timeout"] = [int]
145
- CONTENTS_OPTIONS_TYPES["livecrawl"] = [LIVECRAWL_OPTIONS]
146
- CONTENTS_OPTIONS_TYPES["filter_empty_results"] = [bool]
147
+
147
148
 
148
149
  # FOR BETA OPTIONS
149
150
  # if is_beta:
@@ -169,6 +170,25 @@ def validate_search_options(
169
170
  f"Invalid type for option '{key}': Expected one of {expected[key]}, got {type(value)}"
170
171
  )
171
172
 
173
+ def is_instance_or_subclass(obj, class_or_tuple):
174
+ if isinstance(class_or_tuple, tuple):
175
+ return any(is_instance_or_subclass(obj, cls) for cls in class_or_tuple)
176
+
177
+ if get_origin(class_or_tuple) is Literal:
178
+ return obj in get_args(class_or_tuple)
179
+
180
+ if get_origin(class_or_tuple) is not None:
181
+ # Handle subscripted generics
182
+ origin = get_origin(class_or_tuple)
183
+ args = get_args(class_or_tuple)
184
+
185
+ if origin is list:
186
+ return isinstance(obj, list) and all(isinstance(item, args[0]) for item in obj)
187
+ elif origin is dict:
188
+ return isinstance(obj, dict) and all(isinstance(k, args[0]) and isinstance(v, args[1]) for k, v in obj.items())
189
+ # Add more cases for other generic types as needed
190
+
191
+ return isinstance(obj, class_or_tuple)
172
192
 
173
193
  class TextContentsOptions(TypedDict, total=False):
174
194
  """A class representing the options that you can specify when requesting text
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: exa-py
3
- Version: 1.1.4
3
+ Version: 1.1.6
4
4
  Summary: Python SDK for Exa API.
5
5
  Home-page: https://github.com/exa-labs/exa-py
6
6
  Author: Exa
@@ -0,0 +1,8 @@
1
+ exa_py/__init__.py,sha256=aVF1zB_UV3dagJ5Vn2WrdcInzibdIW61M89sjwRCU_g,29
2
+ exa_py/api.py,sha256=rFMnDB82vxQXxpoe80h4lQn2553MhDDc14ya1um7LtU,47107
3
+ exa_py/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ exa_py/utils.py,sha256=Rc1FJjoR9LQ7L_OJM91Sd1GNkbHjcLyEvJENhRix6gc,2405
5
+ exa_py-1.1.6.dist-info/METADATA,sha256=3H57LZQwCrvPpedb1vw-I12XswPAtL90C_V3N9JOuOI,3069
6
+ exa_py-1.1.6.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92
7
+ exa_py-1.1.6.dist-info/top_level.txt,sha256=Mfkmscdw9HWR1PtVhU1gAiVo6DHu_tyiVdb89gfZBVI,7
8
+ exa_py-1.1.6.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- exa_py/__init__.py,sha256=aVF1zB_UV3dagJ5Vn2WrdcInzibdIW61M89sjwRCU_g,29
2
- exa_py/api.py,sha256=A0SRKJjz-Of5TuB_iWz74_IOnzbm6uLVLVa_PHuAL2o,46338
3
- exa_py/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- exa_py/utils.py,sha256=Rc1FJjoR9LQ7L_OJM91Sd1GNkbHjcLyEvJENhRix6gc,2405
5
- exa_py-1.1.4.dist-info/METADATA,sha256=BYt57SyQmC8rIhhszVMVpadyx0iBX2xqWQ6qlyzkpMU,3069
6
- exa_py-1.1.4.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92
7
- exa_py-1.1.4.dist-info/top_level.txt,sha256=Mfkmscdw9HWR1PtVhU1gAiVo6DHu_tyiVdb89gfZBVI,7
8
- exa_py-1.1.4.dist-info/RECORD,,
File without changes