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

[Hotfix]: resolve ChatCompletionMessage object is not subscriptable #1771

Merged
merged 2 commits into from
Jun 7, 2024

Conversation

aybruhm
Copy link
Member

@aybruhm aybruhm commented Jun 7, 2024

Description

This PR resolves the ChatComletionMessage is not subscriptable error when running auto ai critique evaluation.

Additional Information

Full Error Traceback:

[2024-06-07 13:39:28,371: DEBUG/ForkPoolWorker-1] Result: evaluator_config=ObjectId('666309d686a85ea3911dbc99') result=Result(type='error', value=None, error=Error(message='Error during Auto AI Critique', stacktrace="'ChatCompletionMessage' object is not subscriptable"))
[2024-06-07 13:39:28,403: ERROR/ForkPoolWorker-1] Task agenta_backend.tasks.evaluations.evaluate[67ad4369-e935-42e2-b400-fc962af27510] raised unexpected: TypeError('expected string or bytes-like object')
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/celery/app/trace.py", line 453, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/celery/app/trace.py", line 736, in __protected_call__
    return self.run(*args, **kwargs)
  File "/app/agenta_backend/tasks/evaluations.py", line 324, in evaluate
    aggregated_results = loop.run_until_complete(
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/app/agenta_backend/tasks/evaluations.py", line 368, in aggregate_evaluator_results
    result = aggregation_service.aggregate_ai_critique(results)
  File "/app/agenta_backend/services/aggregation_service.py", line 21, in aggregate_ai_critique
    match = re.search(r"\d+", result.value)
  File "/usr/local/lib/python3.9/re.py", line 201, in search
    return _compile(pattern, flags).search(string)
TypeError: expected string or bytes-like object

Copy link

vercel bot commented Jun 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
agenta ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 7, 2024 2:34pm

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 7, 2024
@aybruhm aybruhm requested a review from mmabrouk June 7, 2024 13:49
@dosubot dosubot bot added Backend bug Something isn't working labels Jun 7, 2024
Copy link
Member

@mmabrouk mmabrouk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @aybruhm !
Any clue why the tests are failing?

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jun 7, 2024
@aybruhm
Copy link
Member Author

aybruhm commented Jun 7, 2024

Thanks @aybruhm ! Any clue why the tests are failing?

Yup, it turns out that the issue was because of the AGENTA_TEMPLATE_REPO change I made in the test compose.

@aybruhm aybruhm requested a review from mmabrouk June 7, 2024 14:43
@mmabrouk mmabrouk merged commit e94ff73 into main Jun 7, 2024
10 checks passed
@mmabrouk mmabrouk deleted the hotfix/buggy-auto-ai-critique-evaluator branch June 7, 2024 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend bug Something isn't working lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants