Skip to content

Commit 4ece779

Browse files
committed
completions
1 parent 3558346 commit 4ece779

File tree

15 files changed

+618
-198
lines changed

15 files changed

+618
-198
lines changed

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,8 @@ skip-magic-trailing-comma = false
8383

8484
[tool.pytest.ini_options]
8585
timeout = 120
86+
asyncio_mode = "auto"
87+
filterwarnings = [
88+
"ignore::DeprecationWarning:litellm.*",
89+
"ignore::PendingDeprecationWarning:litellm.*",
90+
]

src/controlflow/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
from .settings import settings
2+
import controlflow.llm
3+
4+
default_history = controlflow.llm.history.InMemoryHistory()
25

36
from .core.flow import Flow
47
from .core.task import Task
58
from .core.agent import Agent
69
from .core.controller.controller import Controller
10+
711
from .instructions import instructions
812
from .decorators import flow, task

src/controlflow/core/agent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class LiteAgent(ControlFlowModel, ExposeSyncMethodsMixin):
8989
description="The model used by the agent. If not provided, the default model will be used.",
9090
)
9191

92-
async def say_async(self, messages: Union[str, dict]) -> Response:
92+
async def run_async(self, messages: Union[str, dict]) -> Response:
9393
if not isinstance(messages, list):
9494
raise ValueError("Messages must be provided as a list.")
9595

@@ -102,7 +102,7 @@ async def say_async(self, messages: Union[str, dict]) -> Response:
102102
messages=messages, model=self.model, tools=self.tools
103103
)
104104

105-
async def say(self, messages: Union[str, dict]) -> Response:
105+
async def run(self, messages: Union[str, dict]) -> Response:
106106
if not isinstance(messages, list):
107107
raise ValueError("Messages must be provided as a list.")
108108

src/controlflow/core/controller/controller.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from controlflow.core.graph import Graph
2727
from controlflow.core.task import Task
2828
from controlflow.instructions import get_instructions
29+
from controlflow.llm.history import BaseHistory
2930
from controlflow.tui.app import TUIApp as TUI
3031
from controlflow.utilities.context import ctx
3132
from controlflow.utilities.prefect import (
@@ -34,7 +35,7 @@
3435
wrap_prefect_tool,
3536
)
3637
from controlflow.utilities.tasks import all_complete, any_incomplete
37-
from controlflow.utilities.types import FunctionTool, Thread
38+
from controlflow.utilities.types import FunctionTool
3839

3940
logger = logging.getLogger(__name__)
4041

@@ -67,6 +68,7 @@ class Controller(BaseModel, ExposeSyncMethodsMixin):
6768
description="Tasks that the controller will complete.",
6869
)
6970
agents: Union[list[Agent], None] = None
71+
history: BaseHistory = Field()
7072
context: dict = {}
7173
model_config: dict = dict(extra="forbid")
7274
enable_tui: bool = Field(default_factory=lambda: controlflow.settings.enable_tui)
@@ -101,20 +103,13 @@ def help_im_stuck():
101103

102104
return help_im_stuck
103105

104-
async def _run_agent(
105-
self, agent: Agent, tasks: list[Task] = None, thread: Thread = None
106-
) -> Run:
106+
async def _run_agent(self, agent: Agent, tasks: list[Task] = None) -> Run:
107107
"""
108108
Run a single agent.
109109
"""
110110

111111
@prefect_task(task_run_name=f'Run Agent: "{agent.name}"')
112-
async def _run_agent(
113-
controller: Controller,
114-
agent: Agent,
115-
tasks: list[Task],
116-
thread: Thread = None,
117-
):
112+
async def _run_agent(controller: Controller, agent: Agent, tasks: list[Task]):
118113
from controlflow.core.controller.instruction_template import MainTemplate
119114

120115
tasks = tasks or controller.tasks

src/controlflow/llm/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import controlflow.llm.history
2+
import controlflow.llm.tools
3+
import controlflow.llm.completions

0 commit comments

Comments
 (0)