exa-py 1.1.6__tar.gz → 1.1.7__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.1.6
3
+ Version: 1.1.7
4
4
  Summary: Python SDK for Exa API.
5
5
  Home-page: https://github.com/exa-labs/exa-py
6
6
  Author: Exa
@@ -15,6 +15,8 @@ from typing import (
15
15
  overload,
16
16
  Union,
17
17
  Literal,
18
+ get_origin,
19
+ get_args
18
20
  )
19
21
  from typing_extensions import TypedDict
20
22
 
@@ -144,8 +146,6 @@ CONTENTS_OPTIONS_TYPES = {
144
146
  "filter_empty_results": [bool],
145
147
  }
146
148
 
147
-
148
-
149
149
  # FOR BETA OPTIONS
150
150
  # if is_beta:
151
151
 
@@ -165,30 +165,20 @@ def validate_search_options(
165
165
  for key, value in options.items():
166
166
  if key not in expected:
167
167
  raise ValueError(f"Invalid option: '{key}'")
168
- if not any(isinstance(value, t) for t in expected[key]):
168
+ if value is None:
169
+ continue
170
+ expected_types = expected[key]
171
+ if not any(is_valid_type(value, t) for t in expected_types):
169
172
  raise ValueError(
170
- f"Invalid type for option '{key}': Expected one of {expected[key]}, got {type(value)}"
173
+ f"Invalid value for option '{key}': {value}. Expected one of {expected_types}"
171
174
  )
172
175
 
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)
176
+ def is_valid_type(value, expected_type):
177
+ if get_origin(expected_type) is Literal:
178
+ return value in get_args(expected_type)
179
+ if isinstance(expected_type, type):
180
+ return isinstance(value, expected_type)
181
+ return False # For any other case
192
182
 
193
183
  class TextContentsOptions(TypedDict, total=False):
194
184
  """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.6
3
+ Version: 1.1.7
4
4
  Summary: Python SDK for Exa API.
5
5
  Home-page: https://github.com/exa-labs/exa-py
6
6
  Author: Exa
@@ -9,4 +9,5 @@ exa_py.egg-info/PKG-INFO
9
9
  exa_py.egg-info/SOURCES.txt
10
10
  exa_py.egg-info/dependency_links.txt
11
11
  exa_py.egg-info/requires.txt
12
- exa_py.egg-info/top_level.txt
12
+ exa_py.egg-info/top_level.txt
13
+ test/test.py
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="exa_py",
5
- version="1.1.6",
5
+ version="1.1.7",
6
6
  description="Python SDK for Exa API.",
7
7
  long_description_content_type="text/markdown",
8
8
  long_description=open("README.md").read(),
@@ -0,0 +1,12 @@
1
+ from exa_py import Exa
2
+
3
+ exa = Exa("a4e1fa44-f6a3-432b-9725-03677ee13e2e");
4
+
5
+ result = exa.get_contents(
6
+ ["quizlet.com"],
7
+ text=True,
8
+ livecrawl="never",
9
+ filter_empty_results=False
10
+ )
11
+
12
+ print(result)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes