mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 08:08:32 +00:00
Fix lint errors: Remove unused variable and fix whitespace
Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
@@ -378,11 +378,8 @@ class EventListener(BaseEventListener):
|
|||||||
@crewai_event_bus.on(LLMStreamChunkEvent)
|
@crewai_event_bus.on(LLMStreamChunkEvent)
|
||||||
def on_llm_stream_chunk(source, event: LLMStreamChunkEvent):
|
def on_llm_stream_chunk(source, event: LLMStreamChunkEvent):
|
||||||
self.text_stream.write(event.chunk)
|
self.text_stream.write(event.chunk)
|
||||||
|
|
||||||
self.text_stream.seek(self.next_chunk)
|
self.text_stream.seek(self.next_chunk)
|
||||||
|
self.text_stream.read()
|
||||||
# Read from the in-memory stream
|
|
||||||
content = self.text_stream.read()
|
|
||||||
self.next_chunk = self.text_stream.tell()
|
self.next_chunk = self.text_stream.tell()
|
||||||
|
|
||||||
# ----------- LLM GUARDRAIL EVENTS -----------
|
# ----------- LLM GUARDRAIL EVENTS -----------
|
||||||
|
|||||||
@@ -7,10 +7,8 @@ from pydantic import Field
|
|||||||
from crewai.agent import Agent
|
from crewai.agent import Agent
|
||||||
from crewai.agents.crew_agent_executor import CrewAgentExecutor
|
from crewai.agents.crew_agent_executor import CrewAgentExecutor
|
||||||
from crewai.crew import Crew
|
from crewai.crew import Crew
|
||||||
from crewai.flow.flow import Flow, listen, start
|
from crewai.events.event_bus import crewai_event_bus
|
||||||
from crewai.llm import LLM
|
from crewai.events.event_listener import EventListener
|
||||||
from crewai.task import Task
|
|
||||||
from crewai.tools.base_tool import BaseTool
|
|
||||||
from crewai.events.types.agent_events import (
|
from crewai.events.types.agent_events import (
|
||||||
AgentExecutionCompletedEvent,
|
AgentExecutionCompletedEvent,
|
||||||
AgentExecutionErrorEvent,
|
AgentExecutionErrorEvent,
|
||||||
@@ -24,9 +22,6 @@ from crewai.events.types.crew_events import (
|
|||||||
CrewTestResultEvent,
|
CrewTestResultEvent,
|
||||||
CrewTestStartedEvent,
|
CrewTestStartedEvent,
|
||||||
)
|
)
|
||||||
from crewai.events.event_bus import crewai_event_bus
|
|
||||||
from crewai.events.event_listener import EventListener
|
|
||||||
from crewai.events.types.tool_usage_events import ToolUsageFinishedEvent
|
|
||||||
from crewai.events.types.flow_events import (
|
from crewai.events.types.flow_events import (
|
||||||
FlowCreatedEvent,
|
FlowCreatedEvent,
|
||||||
FlowFinishedEvent,
|
FlowFinishedEvent,
|
||||||
@@ -47,7 +42,12 @@ from crewai.events.types.task_events import (
|
|||||||
)
|
)
|
||||||
from crewai.events.types.tool_usage_events import (
|
from crewai.events.types.tool_usage_events import (
|
||||||
ToolUsageErrorEvent,
|
ToolUsageErrorEvent,
|
||||||
|
ToolUsageFinishedEvent,
|
||||||
)
|
)
|
||||||
|
from crewai.flow.flow import Flow, listen, start
|
||||||
|
from crewai.llm import LLM
|
||||||
|
from crewai.task import Task
|
||||||
|
from crewai.tools.base_tool import BaseTool
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
@@ -994,7 +994,7 @@ def test_llm_emits_event_with_lite_agent():
|
|||||||
|
|
||||||
def test_llm_stream_chunks_do_not_print_to_stdout(capsys):
|
def test_llm_stream_chunks_do_not_print_to_stdout(capsys):
|
||||||
"""Test that LLM streaming chunks are not printed to stdout.
|
"""Test that LLM streaming chunks are not printed to stdout.
|
||||||
|
|
||||||
This test verifies the fix for issue #3715 where LLM stream chunks
|
This test verifies the fix for issue #3715 where LLM stream chunks
|
||||||
were being printed directly to stdout via print() statement.
|
were being printed directly to stdout via print() statement.
|
||||||
"""
|
"""
|
||||||
@@ -1008,7 +1008,7 @@ def test_llm_stream_chunks_do_not_print_to_stdout(capsys):
|
|||||||
|
|
||||||
# Manually emit stream chunk events to simulate streaming
|
# Manually emit stream chunk events to simulate streaming
|
||||||
llm = LLM(model="gpt-4o", stream=True)
|
llm = LLM(model="gpt-4o", stream=True)
|
||||||
|
|
||||||
test_chunks = ["Hello", " ", "world", "!"]
|
test_chunks = ["Hello", " ", "world", "!"]
|
||||||
for chunk in test_chunks:
|
for chunk in test_chunks:
|
||||||
crewai_event_bus.emit(llm, event=LLMStreamChunkEvent(chunk=chunk))
|
crewai_event_bus.emit(llm, event=LLMStreamChunkEvent(chunk=chunk))
|
||||||
|
|||||||
6403
uv.lock.broken
Normal file
6403
uv.lock.broken
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user