MervinPraison / PraisonAI

PraisonAI application combines AutoGen and CrewAI or similar frameworks into a low-code solution for building and managing multi-agent LLM systems, focusing on simplicity, customisation, and efficient human-agent collaboration.
https://docs.praison.ai
MIT License
1.05k stars 159 forks source link

chainlit_ui.py ERROR: Connection pool is full #56

Closed yiouyou closed 2 weeks ago

yiouyou commented 2 weeks ago

Error as below. Not sure it's from crewai or praisonai. Need help, thanks!!

2024-06-21 12:16:31 - HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK"
2024-06-21 12:16:31 - Context impl SQLiteImpl.
2024-06-21 12:16:31 - Will assume non-transactional DDL.
2024-06-21 12:16:31 - Context impl SQLiteImpl.
2024-06-21 12:16:31 - Will assume non-transactional DDL.
2024-06-21 12:16:31 - Context impl SQLiteImpl.
2024-06-21 12:16:31 - Will assume non-transactional DDL.
2024-06-21 12:16:31 - Context impl SQLiteImpl.
2024-06-21 12:16:31 - Will assume non-transactional DDL.
2024-06-21 12:16:31 - Context impl SQLiteImpl.
2024-06-21 12:16:31 - Will assume non-transactional DDL.
2024-06-21 12:16:31 - Context impl SQLiteImpl.
2024-06-21 12:16:31 - Will assume non-transactional DDL.
2024-06-21 12:16:31 - Context impl SQLiteImpl.
2024-06-21 12:16:31 - Will assume non-transactional DDL.
2024-06-21 12:16:31 - Context impl SQLiteImpl.
2024-06-21 12:16:31 - Will assume non-transactional DDL.
2024-06-21 12:16:31 - Context impl SQLiteImpl.
2024-06-21 12:16:31 - Will assume non-transactional DDL.
2024-06-21 12:16:31 - Context impl SQLiteImpl.
2024-06-21 12:16:31 - Will assume non-transactional DDL.
2024-06-21 12:16:32 - Context impl SQLiteImpl.
2024-06-21 12:16:32 - Will assume non-transactional DDL.
2024-06-21 12:16:32 - Context impl SQLiteImpl.
2024-06-21 12:16:32 - Will assume non-transactional DDL.
2024-06-21 12:16:32 - Context impl SQLiteImpl.
2024-06-21 12:16:32 - Will assume non-transactional DDL.
 [2024-06-21 12:16:32][DEBUG]: == Working Agent: Concept Researcher
 [2024-06-21 12:16:32][INFO]: == Starting Task: Research existing literature, articles, and real-world scenarios of AI and human interactions to uncover potential conflicts and resolutions.
2024-06-21 12:16:33 - HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK"
2024-06-21 12:16:33 - 'generator' object does not support the context manager protocol
Traceback (most recent call last):
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/chainlit/utils.py", line 44, in wrapper
    return await user_function(**params_values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/songz/free/chainlit-gongan/app.py", line 194, in main
    result = agents_generator.generate_crew_and_kickoff()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/praisonai/agents_generator.py", line 269, in generate_crew_and_kickoff
    response = crew.kickoff()
               ^^^^^^^^^^^^^^
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/crewai/crew.py", line 271, in kickoff
    result = self._run_sequential_process()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/crewai/crew.py", line 357, in _run_sequential_process
    output = task.execute(context=task_output)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/crewai/task.py", line 187, in execute
    result = self._execute(
             ^^^^^^^^^^^^^^
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/crewai/task.py", line 196, in _execute
    result = agent.execute_task(
             ^^^^^^^^^^^^^^^^^^^
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/crewai/agent.py", line 243, in execute_task
    result = self.agent_executor.invoke(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/langchain/chains/base.py", line 163, in invoke
    raise e
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/langchain/chains/base.py", line 153, in invoke
    self._call(inputs, run_manager=run_manager)
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/crewai/agents/executor.py", line 128, in _call
    next_step_output = self._take_next_step(
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/langchain/agents/agent.py", line 1138, in _take_next_step
    [
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/langchain/agents/agent.py", line 1138, in <listcomp>
    [
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/crewai/agents/executor.py", line 192, in _iter_next_step
    output = self.agent.plan(  # type: ignore #  Incompatible types in assignment (expression has type "AgentAction | AgentFinish | list[AgentAction]", variable has type "AgentAction")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/langchain/agents/agent.py", line 397, in plan
    for chunk in self.runnable.stream(inputs, config={"callbacks": callbacks}):
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 2875, in stream
    yield from self.transform(iter([input]), config, **kwargs)
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 2862, in transform
    yield from self._transform_stream_with_config(
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 1881, in _transform_stream_with_config
    chunk: Output = context.run(next, iterator)  # type: ignore
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 2826, in _transform
    for output in final_pipeline:
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 1282, in transform
    for ichunk in input:
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 4736, in transform
    yield from self.bound.transform(
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 1300, in transform
    yield from self.stream(final, config, **kwargs)
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 249, in stream
    raise e
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 229, in stream
    for chunk in self._stream(messages, stop=stop, **kwargs):
  File "/home/songz/miniconda3/envs/free-cl-gongan/lib/python3.11/site-packages/langchain_openai/chat_models/base.py", line 480, in _stream
    with self.client.create(messages=message_dicts, **params) as response:
TypeError: 'generator' object does not support the context manager protocol
2024-06-21 12:16:34 - Connection pool is full, discarding connection: us-api.i.posthog.com. Connection pool size: 10
2024-06-21 12:16:34 - Connection pool is full, discarding connection: us-api.i.posthog.com. Connection pool size: 10
2024-06-21 12:16:34 - Connection pool is full, discarding connection: us-api.i.posthog.com. Connection pool size: 10
dgaddis11235 commented 2 weeks ago

I am also getting this error, but it doesn't seem to break anything. I didn't notice it the first time I tried to get the app to complete a task, but now I see it every time.

2024-06-21 11:27:22,507 - 13862301696 - connectionpool.py-connectionpool:329 - WARNING: Connection pool is full, discarding connection: us-api.i.posthog.com. Connection pool size: 10
2024-06-21 11:27:22,528 - 13828648960 - connectionpool.py-connectionpool:329 - WARNING: Connection pool is full, discarding connection: us-api.i.posthog.com. Connection pool size: 10
2024-06-21 11:27:22,534 - 13845475328 - connectionpool.py-connectionpool:329 - WARNING: Connection pool is full, discarding connection: us-api.i.posthog.com. Connection pool size: 10
yiouyou commented 2 weeks ago

Agree, the problem suddenly shows up from nowhere, then it's everywhere now.

MervinPraison commented 2 weeks ago

@yiouyou I have fixed this in the latest release

pip install -U "praisonai[ui]"

Please let me know if you still find any issues. Thanks