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

classify errors in chatbot #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

MaleicAcid
Copy link
Contributor

@MaleicAcid MaleicAcid commented Feb 23, 2025

  • add ClassifiedErrors to unified error handling
  • add a dev group in pyproject.yaml

try to run translator test but get following errror:

======================================================================
ERROR: test_single_chunk_translation (tests.test_translate.TestLLMTranslator.test_single_chunk_translation)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/user00/gitspace/openlrc/tests/test_translate.py", line 26, in test_single_chunk_translation
    translation = translator.translate(text, 'en', 'es')[0]
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user00/gitspace/openlrc/openlrc/translate.py", line 190, in translate
    guideline = context_reviewer.build_context(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user00/gitspace/openlrc/openlrc/agents.py", line 319, in build_context
    resp = self.chatbot.message(messages_list, output_checker=self.validate_prompter.check_format)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user00/gitspace/openlrc/openlrc/chatbot.py", line 190, in message
    results = asyncio.run(
              ^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/user00/gitspace/openlrc/openlrc/chatbot.py", line 156, in _amessage
    results = await asyncio.gather(
              ^^^^^^^^^^^^^^^^^^^^^
  File "/home/user00/gitspace/openlrc/openlrc/chatbot.py", line 260, in _create_achat
    self.update_fee(response)
  File "/home/user00/gitspace/openlrc/openlrc/chatbot.py", line 232, in update_fee
    prompt_tokens = response.usage.prompt_tokens
                    ^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'usage


@dataclass
class ClassifiedErrors:
long_wait: ErrorGroup = field(default_factory=lambda: ErrorGroup(set(), lambda: random.randint(30, 60)))

Check notice

Code scanning / Bandit

Standard pseudo-random generators are not suitable for security/cryptographic purposes. Note

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
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

Successfully merging this pull request may close these issues.

1 participant