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-python/deployment] Meet error when running custom_filed example #5758

Open
wsp317 opened this issue Dec 16, 2024 · 0 comments
Open

[BUG-python/deployment] Meet error when running custom_filed example #5758

wsp317 opened this issue Dec 16, 2024 · 0 comments

Comments

@wsp317
Copy link

wsp317 commented Dec 16, 2024

Describe the bug

Meet this error when running example at: https://github.com/argilla-io/argilla/blob/develop/examples/custom_field/custom_field.ipynb


HTTPStatusError Traceback (most recent call last)
File ~/opt/anaconda3/lib/python3.9/site-packages/argilla/_exceptions/_api.py:91, in api_error_handler.._handler_wrapper(*args, **kwargs)
90 try:
---> 91 return func(*args, **kwargs)
92 except HTTPStatusError as e:

File ~/opt/anaconda3/lib/python3.9/site-packages/argilla/_api/_records.py:196, in RecordsAPI.bulk_upsert(self, dataset_id, records)
192 response = self.http_client.put(
193 url=f"/api/v1/datasets/{dataset_id}/records/bulk",
194 json={"items": record_dicts},
195 )
--> 196 response.raise_for_status()
197 response_json = response.json()

File ~/opt/anaconda3/lib/python3.9/site-packages/httpx/_models.py:761, in Response.raise_for_status(self)
760 message = message.format(self, error_type=error_type)
--> 761 raise HTTPStatusError(message, request=request, response=self)

HTTPStatusError: Client error '422 Unprocessable Content' for url 'http://localhost:6900/api/v1/datasets/14b0a309-03f1-423c-9d63-ad4352cce2c1/records/bulk'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422

During handling of the above exception, another exception occurred:

UnprocessableEntityError Traceback (most recent call last)
Input In [48], in <cell line: 1>()
----> 1 dataset.records.log(ds)

File ~/opt/anaconda3/lib/python3.9/site-packages/argilla/records/_dataset_records.py:284, in DatasetRecords.log(self, records, mapping, user_id, batch_size, on_error)
282 self._log_message(message=f"Sending records from {batch} to {batch + batch_size}.")
283 batch_records = record_models[batch : batch + batch_size]
--> 284 models, updated = self._api.bulk_upsert(dataset_id=self.__dataset.id, records=batch_records)
285 created_or_updated.extend([Record.from_model(model=model, dataset=self.__dataset) for model in models])
286 records_updated += updated

File ~/opt/anaconda3/lib/python3.9/site-packages/argilla/_exceptions/_api.py:93, in api_error_handler.._handler_wrapper(*args, **kwargs)
91 return func(*args, **kwargs)
92 except HTTPStatusError as e:
---> 93 _error_switch(status_code=e.response.status_code, error_detail=e.response.text)

File ~/opt/anaconda3/lib/python3.9/site-packages/argilla/_exceptions/_api.py:87, in api_error_handler.._error_switch(status_code, error_detail)
77 switch = {
78 400: BadRequestError,
79 401: UnauthorizedError,
(...)
84 500: InternalServerError,
85 }
86 exception_class = switch.get(status_code, ArgillaAPIError)
---> 87 raise exception_class(f"{exception_class.message}. Details: {error_detail}", status_code=status_code)

UnprocessableEntityError: Argilla SDK error: UnprocessableEntityError: Unprocessable entity. The server cannot process the request. Details: {"detail":"Record at position 0 is not valid because custom field 'chosen' value must be a dictionary"}

Stacktrace and code to create the bug

No response

Expected behavior

No response

Environment

  • Argilla Version [e.g. 1.0.0]: 2.5.0
  • ElasticSearch Version [e.g. 7.10.2]:
  • Docker Image (optional) [e.g. argilla:v1.0.0]:

Additional context

No response

@wsp317 wsp317 changed the title [BUG-python/deployment] [BUG-python/deployment] Meet error when running custom_filed example Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant