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]: Calling opik.search_traces sometimes returns an error #1054

Open
4 tasks
jverre opened this issue Jan 15, 2025 · 2 comments
Open
4 tasks

[Bug]: Calling opik.search_traces sometimes returns an error #1054

jverre opened this issue Jan 15, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@jverre
Copy link
Collaborator

jverre commented Jan 15, 2025

What component(s) are affected?

  • Python SDK
  • Opik UI
  • Opik Server
  • Documentation

Opik version

  • Opik version: latest

Describe the problem

I'm running:

import opik
client = opik.Opik()

client.search_traces(project_name="Default Project")

and sometimes get the error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jacquesverre/Documents/code/opik/sdks/python/src/opik/api_objects/opik_client.py", line 629, in search_traces
    page_traces = self._rest_client.traces.get_traces_by_project(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/py312_llm_eval/lib/python3.12/site-packages/tenacity/__init__.py", line 336, in wrapped_f
    return copy(f, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/py312_llm_eval/lib/python3.12/site-packages/tenacity/__init__.py", line 475, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/py312_llm_eval/lib/python3.12/site-packages/tenacity/__init__.py", line 376, in iter
    result = action(retry_state)
             ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/py312_llm_eval/lib/python3.12/site-packages/tenacity/__init__.py", line 398, in <lambda>
    self._add_action_func(lambda rs: rs.outcome.result())
                                     ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/py312_llm_eval/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/py312_llm_eval/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/opt/homebrew/Caskroom/miniconda/base/envs/py312_llm_eval/lib/python3.12/site-packages/tenacity/__init__.py", line 478, in __call__
    result = fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^
  File "/Users/jacquesverre/Documents/code/opik/sdks/python/src/opik/rest_api/traces/client.py", line 182, in get_traces_by_project
    parse_obj_as(
  File "/Users/jacquesverre/Documents/code/opik/sdks/python/src/opik/rest_api/core/pydantic_utilities.py", line 65, in parse_obj_as
    return adapter.validate_python(dealiased_object)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/py312_llm_eval/lib/python3.12/site-packages/pydantic/type_adapter.py", line 135, in wrapped
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/py312_llm_eval/lib/python3.12/site-packages/pydantic/type_adapter.py", line 366, in validate_python
    return self.validator.validate_python(object, strict=strict, from_attributes=from_attributes, context=context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 16 validation errors for TracePagePublic
content.0.input
  Input should be a valid dictionary [type=dict_type, input_value=[{'content': '\n        Y...     ', 'role': 'user'}], input_type=list]
    For further information visit https://errors.pydantic.dev/2.9/v/dict_type
content.1.input
  Input should be a valid dictionary [type=dict_type, input_value=[{'content': '\n        Y...     ', 'role': 'user'}], input_type=list]
    For further information visit https://errors.pydantic.dev/2.9/v/dict_type
content.2.input
  Input should be a valid dictionary [type=dict_type, input_value=[{'content': '\n        Y...     ', 'role': 'user'}], input_type=list]
    For further information visit https://errors.pydantic.dev/2.9/v/dict_type
content.3.input
  Input should be a valid dictionary [type=dict_type, input_value=[{'content': '\n        Y...     ', 'role': 'user'}], input_type=list]
    For further information visit https://errors.pydantic.dev/2.9/v/dict_type
content.4.input
  Input should be a valid dictionary [type=dict_type, input_value=[{'content': '\n        Y...     ', 'role': 'user'}], input_type=list]
    For further information visit https://errors.pydantic.dev/2.9/v/dict_type
content.5.input
  Input should be a valid dictionary [type=dict_type, input_value=[{'content': '\n        Y...     ', 'role': 'user'}], input_type=list]
    For further information visit https://errors.pydantic.dev/2.9/v/dict_type
content.6.input
  Input should be a valid dictionary [type=dict_type, input_value=[{'content': '\n        Y...     ', 'role': 'user'}], input_type=list]
    For further information visit https://errors.pydantic.dev/2.9/v/dict_type
content.7.input
  Input should be a valid dictionary [type=dict_type, input_value=[{'role': 'user', 'conten...on of LLMs important?'}], input_type=list]
    For further information visit https://errors.pydantic.dev/2.9/v/dict_type
content.8.input
  Input should be a valid dictionary [type=dict_type, input_value=[{'role': 'user', 'conten...on of LLMs important?'}], input_type=list]
    For further information visit https://errors.pydantic.dev/2.9/v/dict_type
content.9.input
  Input should be a valid dictionary [type=dict_type, input_value=[{'role': 'user', 'conten...on of LLMs important?'}], input_type=list]
    For further information visit https://errors.pydantic.dev/2.9/v/dict_type
content.10.input
  Input should be a valid dictionary [type=dict_type, input_value=[{'role': 'user', 'conten...on of LLMs important?'}], input_type=list]
    For further information visit https://errors.pydantic.dev/2.9/v/dict_type
content.11.input
  Input should be a valid dictionary [type=dict_type, input_value=[{'role': 'user', 'conten...on of LLMs important?'}], input_type=list]
    For further information visit https://errors.pydantic.dev/2.9/v/dict_type
content.12.input
  Input should be a valid dictionary [type=dict_type, input_value=[{'role': 'user', 'conten...on of LLMs important?'}], input_type=list]
    For further information visit https://errors.pydantic.dev/2.9/v/dict_type
content.13.input
  Input should be a valid dictionary [type=dict_type, input_value=[{'role': 'user', 'conten...on of LLMs important?'}], input_type=list]
    For further information visit https://errors.pydantic.dev/2.9/v/dict_type
content.14.input
  Input should be a valid dictionary [type=dict_type, input_value=[{'role': 'user', 'conten...on of LLMs important?'}], input_type=list]
    For further information visit https://errors.pydantic.dev/2.9/v/dict_type
content.15.input
  Input should be a valid dictionary [type=dict_type, input_value=[{'role': 'user', 'conten...on of LLMs important?'}], input_type=list]
    For further information visit https://errors.pydantic.dev/2.9/v/dict_type

This seems to depend on the project, it doesn't always happen

Reproduction steps

No response

@jverre jverre added the bug Something isn't working label Jan 15, 2025
@dsblank
Copy link
Contributor

dsblank commented Feb 12, 2025

@jverre does this still happen?

@jverre
Copy link
Collaborator Author

jverre commented Feb 12, 2025

Yes, it's due to data inconsistencies between expected data formats and what you can send. It's planned as OPIK-794 to be tackled in the upcoming week

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

2 participants