abaddonpuff / project_G

Game on Python!
GNU General Public License v3.0
2 stars 0 forks source link

can you hit enter after a text message without crash? #23

Closed bbelderbos closed 3 months ago

bbelderbos commented 3 months ago

doing that I get this:


Message sent: how are you today?
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/pybob/code/pdm/gerardo/project_G/sim/main_game.py", line 190, in <module>
    pG.run_game()
  File "/Users/pybob/code/pdm/gerardo/project_G/sim/main_game.py", line 124, in run_game
    self._check_events()
  File "/Users/pybob/code/pdm/gerardo/project_G/sim/main_game.py", line 165, in _check_events
    char_response = generate_response(
                    ^^^^^^^^^^^^^^^^^^
  File "/Users/pybob/code/pdm/gerardo/project_G/mechanics/input_processing.py", line 37, in generate_response
    message_sentiment = marvin.classify(
                        ^^^^^^^^^^^^^^^^
  File "/Users/pybob/code/pdm/gerardo/project_G/venv/lib/python3.11/site-packages/marvin/ai/text.py", line 867, in classify
    return run_sync(
           ^^^^^^^^^
  File "/Users/pybob/code/pdm/gerardo/project_G/venv/lib/python3.11/site-packages/marvin/utilities/asyncio.py", line 106, in run_sync
    return context.run(asyncio.run, coroutine)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/pybob/code/pdm/gerardo/project_G/venv/lib/python3.11/site-packages/marvin/ai/text.py", line 414, in classify_async
    return await _generate_typed_llm_response_with_logit_bias(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pybob/code/pdm/gerardo/project_G/venv/lib/python3.11/site-packages/marvin/ai/text.py", line 247, in _generate_typed_llm_response_with_logit_bias
    response = await generate_llm_response(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pybob/code/pdm/gerardo/project_G/venv/lib/python3.11/site-packages/marvin/ai/text.py", line 113, in generate_llm_response
    client = client or get_default_async_client()
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pybob/code/pdm/gerardo/project_G/venv/lib/python3.11/site-packages/marvin/client/openai.py", line 350, in get_default_async_client
    return client_cls(**client_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pybob/code/pdm/gerardo/project_G/venv/lib/python3.11/site-packages/pydantic/main.py", line 193, in __init__
    self.__pydantic_validator__.validate_python(data, self_instance=self)
  File "/Users/pybob/code/pdm/gerardo/project_G/venv/lib/python3.11/site-packages/marvin/client/openai.py", line 255, in <lambda>
    default_factory=lambda: get_openai_client(is_async=True)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pybob/code/pdm/gerardo/project_G/venv/lib/python3.11/site-packages/marvin/utilities/openai.py", line 38, in get_openai_client
    marvin.settings.openai.api_key.get_secret_value()
  File "/Users/pybob/code/pdm/gerardo/project_G/venv/lib/python3.11/site-packages/pydantic/types.py", line 1679, in __len__
    return len(self._secret_value)
           ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: object of type 'NoneType' has no len()
``
abaddonpuff commented 3 months ago

Discussed during PDM Call! Closed

bbelderbos commented 3 months ago

yeah this was me setting the wrong env variable, oops, sorry 😅