diff --git a/docs/ar/concepts/checkpointing.mdx b/docs/ar/concepts/checkpointing.mdx index d7fbfa9f1..9bb989a99 100644 --- a/docs/ar/concepts/checkpointing.mdx +++ b/docs/ar/concepts/checkpointing.mdx @@ -242,20 +242,36 @@ mode: "wide" ```python Sync + from __future__ import annotations + + from typing import TYPE_CHECKING, Any + from crewai.events.event_bus import crewai_event_bus from crewai.events.types.llm_events import LLMCallCompletedEvent + if TYPE_CHECKING: + from crewai.state.runtime import RuntimeState + + @crewai_event_bus.on(LLMCallCompletedEvent) - def on_llm_done(source, event, state): + def on_llm_done(source: Any, event: LLMCallCompletedEvent, state: RuntimeState) -> None: path = state.checkpoint("./my_checkpoints") print(f"تم حفظ نقطة الحفظ: {path}") ``` ```python Async + from __future__ import annotations + + from typing import TYPE_CHECKING, Any + from crewai.events.event_bus import crewai_event_bus from crewai.events.types.llm_events import LLMCallCompletedEvent + if TYPE_CHECKING: + from crewai.state.runtime import RuntimeState + + @crewai_event_bus.on(LLMCallCompletedEvent) - async def on_llm_done_async(source, event, state): + async def on_llm_done_async(source: Any, event: LLMCallCompletedEvent, state: RuntimeState) -> None: path = await state.acheckpoint("./my_checkpoints") print(f"تم حفظ نقطة الحفظ: {path}") ``` diff --git a/docs/en/concepts/checkpointing.mdx b/docs/en/concepts/checkpointing.mdx index 396e8fded..91c7908cb 100644 --- a/docs/en/concepts/checkpointing.mdx +++ b/docs/en/concepts/checkpointing.mdx @@ -242,20 +242,36 @@ This walkthrough takes ~5 minutes. You will run a two-task crew, kill it midway, ```python Sync + from __future__ import annotations + + from typing import TYPE_CHECKING, Any + from crewai.events.event_bus import crewai_event_bus from crewai.events.types.llm_events import LLMCallCompletedEvent + if TYPE_CHECKING: + from crewai.state.runtime import RuntimeState + + @crewai_event_bus.on(LLMCallCompletedEvent) - def on_llm_done(source, event, state): + def on_llm_done(source: Any, event: LLMCallCompletedEvent, state: RuntimeState) -> None: path = state.checkpoint("./my_checkpoints") print(f"Saved checkpoint: {path}") ``` ```python Async + from __future__ import annotations + + from typing import TYPE_CHECKING, Any + from crewai.events.event_bus import crewai_event_bus from crewai.events.types.llm_events import LLMCallCompletedEvent + if TYPE_CHECKING: + from crewai.state.runtime import RuntimeState + + @crewai_event_bus.on(LLMCallCompletedEvent) - async def on_llm_done_async(source, event, state): + async def on_llm_done_async(source: Any, event: LLMCallCompletedEvent, state: RuntimeState) -> None: path = await state.acheckpoint("./my_checkpoints") print(f"Saved checkpoint: {path}") ``` diff --git a/docs/ko/concepts/checkpointing.mdx b/docs/ko/concepts/checkpointing.mdx index b4c66e7ec..00b85b3c6 100644 --- a/docs/ko/concepts/checkpointing.mdx +++ b/docs/ko/concepts/checkpointing.mdx @@ -242,20 +242,36 @@ CrewAI에는 두 가지 프로바이더가 포함되어 있습니다: ```python Sync + from __future__ import annotations + + from typing import TYPE_CHECKING, Any + from crewai.events.event_bus import crewai_event_bus from crewai.events.types.llm_events import LLMCallCompletedEvent + if TYPE_CHECKING: + from crewai.state.runtime import RuntimeState + + @crewai_event_bus.on(LLMCallCompletedEvent) - def on_llm_done(source, event, state): + def on_llm_done(source: Any, event: LLMCallCompletedEvent, state: RuntimeState) -> None: path = state.checkpoint("./my_checkpoints") print(f"체크포인트 저장: {path}") ``` ```python Async + from __future__ import annotations + + from typing import TYPE_CHECKING, Any + from crewai.events.event_bus import crewai_event_bus from crewai.events.types.llm_events import LLMCallCompletedEvent + if TYPE_CHECKING: + from crewai.state.runtime import RuntimeState + + @crewai_event_bus.on(LLMCallCompletedEvent) - async def on_llm_done_async(source, event, state): + async def on_llm_done_async(source: Any, event: LLMCallCompletedEvent, state: RuntimeState) -> None: path = await state.acheckpoint("./my_checkpoints") print(f"체크포인트 저장: {path}") ``` diff --git a/docs/pt-BR/concepts/checkpointing.mdx b/docs/pt-BR/concepts/checkpointing.mdx index 618b7b844..a473d68a3 100644 --- a/docs/pt-BR/concepts/checkpointing.mdx +++ b/docs/pt-BR/concepts/checkpointing.mdx @@ -242,20 +242,36 @@ Este passo a passo leva cerca de 5 minutos. Voce executara uma crew de duas tare ```python Sync + from __future__ import annotations + + from typing import TYPE_CHECKING, Any + from crewai.events.event_bus import crewai_event_bus from crewai.events.types.llm_events import LLMCallCompletedEvent + if TYPE_CHECKING: + from crewai.state.runtime import RuntimeState + + @crewai_event_bus.on(LLMCallCompletedEvent) - def on_llm_done(source, event, state): + def on_llm_done(source: Any, event: LLMCallCompletedEvent, state: RuntimeState) -> None: path = state.checkpoint("./my_checkpoints") print(f"Checkpoint salvo: {path}") ``` ```python Async + from __future__ import annotations + + from typing import TYPE_CHECKING, Any + from crewai.events.event_bus import crewai_event_bus from crewai.events.types.llm_events import LLMCallCompletedEvent + if TYPE_CHECKING: + from crewai.state.runtime import RuntimeState + + @crewai_event_bus.on(LLMCallCompletedEvent) - async def on_llm_done_async(source, event, state): + async def on_llm_done_async(source: Any, event: LLMCallCompletedEvent, state: RuntimeState) -> None: path = await state.acheckpoint("./my_checkpoints") print(f"Checkpoint salvo: {path}") ```