Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug/<short-name> #3772

Open
Minh7-byte opened this issue Nov 3, 2024 · 0 comments
Open

bug/<short-name> #3772

Minh7-byte opened this issue Nov 3, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Minh7-byte
Copy link

Minh7-byte commented Nov 3, 2024

Describe the bug
A clear and concise description of what the bug is.
{
"name": "ServerError",
"message": "{"detail":"API key is invalid, please provide a valid API key in the header."}",
"stack": "---------------------------------------------------------------------------
ServerError Traceback (most recent call last)
Cell In[3], line 10
3 loader = UnstructuredLoader(
4 file_path=file_path,
5 strategy="hi_res",
6 partition_via_api=True,
7 coordinates=True,
8 )
9 docs = []
---> 10 for doc in loader.lazy_load():
11 docs.append(doc)

File c:\Users\AppData\Local\Programs\Python\Python312\Lib\site-packages\langchain_unstructured\document_loaders.py:178, in UnstructuredLoader.lazy_load(self)
175 return
177 # Call _UnstructuredBaseLoader normally since file and file_path are not lists
--> 178 yield from load_file(f=self.file, f_path=self.file_path)

File c:\Users\AppData\Local\Programs\Python\Python312\Lib\site-packages\langchain_unstructured\document_loaders.py:212, in _SingleDocumentLoader.lazy_load(self)
207 def lazy_load(self) -> Iterator[Document]:
208 """Load file."""
209 elements_json = (
210 self._post_process_elements_json(self._elements_json)
211 if self.post_processors
--> 212 else self._elements_json
213 )
214 for element in elements_json:
215 metadata = self._get_metadata()

File c:\Users\AppData\Local\Programs\Python\Python312\Lib\site-packages\langchain_unstructured\document_loaders.py:229, in _SingleDocumentLoader._elements_json(self)
227 """Get elements as a list of dictionaries from local partition or via API."""
228 if self.partition_via_api:
--> 229 return self._elements_via_api
231 return self._convert_elements_to_dicts(self._elements_via_local)

File c:\Users\AppData\Local\Programs\Python\Python312\Lib\site-packages\langchain_unstructured\document_loaders.py:258, in _SingleDocumentLoader._elements_via_api(self)
256 client = self.client
257 req = self._sdk_partition_request
--> 258 response = client.general.partition(req) # type: ignore
259 if response.status_code == 200:
260 return json.loads(response.raw_response.text)

File c:\Users\AppData\Local\Programs\Python\Python312\Lib\site-packages\unstructured_client\general.py:107, in General.partition(self, request, retries)
105 if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
106 out = utils.unmarshal_json(http_res.text, errors.ServerError)
--> 107 raise out
108 else:
109 content_type = http_res.headers.get('Content-Type')

ServerError: {"detail":"API key is invalid, please provide a valid API key in the header."}"
}
To Reproduce
Provide a code snippet that reproduces the issue.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment Info
Please run python scripts/collect_env.py and paste the output here.
This will help us understand more about the environment in which the bug occurred.

Additional context
Add any other context about the problem here.

@Minh7-byte Minh7-byte added the bug Something isn't working label Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant