Skip to content
This repository was archived by the owner on Dec 2, 2025. It is now read-only.
This repository was archived by the owner on Dec 2, 2025. It is now read-only.

Runtime issue: module 'openai' has no attribute 'aiosession' #23

@McCryptoFace

Description

@McCryptoFace

After starting main.py I receive the following output. Every time I issue a command to the bot or it otherwise receives an input, I see the same Python error: AttributeError: module 'openai' has no attribute 'aiosession'. Predictably, no output is returned by the bot.

Context:

[11-20 07:49:02] [client.py:42] WARNING - Discord.active_channels = "all", bot will interact with every channel!
[11-20 07:49:02] [client.py:603] INFO - logging in using static token
[11-20 07:49:03] [gateway.py:563] INFO - Shard ID None has connected to Gateway (Session ID: [REDACTED]).
[11-20 07:49:05] [client.py:497] INFO - Logged in as [REDACTED]
[11-20 07:49:05] [client.py:157] INFO - LLM: openai
[11-20 07:49:05] [oai.py:65] DEBUG - Updating tokenizer encoding for gpt-4
[11-20 07:49:06] [client.py:169] INFO - Current model: gpt-4
[11-20 07:49:06] [client.py:135] INFO - TTS: silero
[11-20 07:49:14] [client.py:515] ERROR - Ignoring exception in on_ready
Traceback (most recent call last):
  File "/opt/conda/lib/python3.10/site-packages/discord/client.py", line 441, in _run_event
    await coro(*args, **kwargs)
  File "/home/ubuntu/LLMChat/llmchat/client.py", line 508, in on_ready
    await self.setup_tts()
  File "/home/ubuntu/LLMChat/llmchat/client.py", line 146, in setup_tts
    self.tts = SileroTTS(*params)
  File "/home/ubuntu/LLMChat/llmchat/tts_sources/silero.py", line 20, in __init__
    os.mkdir("models/torch/")
FileNotFoundError: [Errno 2] No such file or directory: 'models/torch/'
[11-20 07:49:31] [client.py:515] ERROR - Ignoring exception in on_message
Traceback (most recent call last):
  File "/opt/conda/lib/python3.10/site-packages/discord/client.py", line 441, in _run_event
    await coro(*args, **kwargs)
  File "/home/ubuntu/LLMChat/llmchat/client.py", line 629, in on_message
    await self.store_embedding((message.author.id, message.content, message.id))
  File "/home/ubuntu/LLMChat/llmchat/client.py", line 519, in store_embedding
    openai.aiosession.set(s)
AttributeError: module 'openai' has no attribute 'aiosession'

Anyone else running into this?

EDIT: It appears that the openai module is no longer using aiosession in favor of httpx. Possibly a module version issue? Ref: openai/openai-python#742

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions