Skip to content

Commit 6b5f128

Browse files
authored
Merge pull request #408 from SylphAI-Inc/main
[release] blog section
2 parents bb63095 + f5ac488 commit 6b5f128

15 files changed

Lines changed: 2096 additions & 10 deletions

File tree

adalflow/adalflow/core/runner.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ def call(
256256

257257
while step_count < self.max_steps:
258258
try:
259+
printc(f'agent planner prompt: {self.agent.planner.get_prompt(**prompt_kwargs)}')
259260
# Execute one step
260261
output = self.agent.planner.call(
261262
prompt_kwargs=prompt_kwargs,
@@ -313,7 +314,6 @@ def _tool_execute_sync(
313314
# Handle cases where result is not wrapped in FunctionOutput (e.g., in tests)
314315
if not isinstance(result, FunctionOutput):
315316
# If it's a direct result from mocks or other sources, wrap it in FunctionOutput
316-
from adalflow.core.types import FunctionOutput
317317
if hasattr(result, 'output'):
318318
# Already has output attribute, use it directly
319319
wrapped_result = FunctionOutput(
@@ -367,6 +367,7 @@ async def acall(
367367

368368
while step_count < self.max_steps:
369369
try:
370+
printc(f'agent planner prompt: {self.agent.planner.get_prompt(**prompt_kwargs)}')
370371
# Execute one step asynchronously
371372
output = await self.agent.planner.acall(
372373
prompt_kwargs=prompt_kwargs,
@@ -405,7 +406,7 @@ async def acall(
405406
self.agent.planner.get_prompt(**prompt_kwargs)
406407
)
407408
)
408-
printc(f'agent planner prompt: {self.agent.planner.get_prompt(**prompt_kwargs)}')
409+
409410

410411
step_count += 1
411412

@@ -480,7 +481,8 @@ async def impl_astream(
480481
if not isinstance(function_result, FunctionOutput):
481482
raise ValueError(f"Result must be wrapped in FunctionOutput, got {type(function_result)}")
482483

483-
function_output = function_result.output
484+
function_output = function_result.output
485+
# TODO: function needs a stream_events
484486
real_function_output = None
485487

486488
if inspect.iscoroutine(function_output):
@@ -493,6 +495,9 @@ async def impl_astream(
493495
self._event_queue.put_nowait(item)
494496
function_results.append(item)
495497
real_function_output = function_results[-1]
498+
else:
499+
real_function_output = function_output
500+
self._event_queue.put_nowait(function_output)
496501
# function_results = []
497502
# async for item in function_output:
498503
# function_results.append(item)

adalflow/adalflow/core/tool_manager.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,10 +434,9 @@ async def execute_func_async(self, func: Function) -> FunctionOutput:
434434
raise ValueError(error_msg)
435435

436436
# it can only be coroutine or function output
437-
printc(f"result: {result}", color="yellow")
438437
if inspect.iscoroutine(result):
439-
printc(f"result is coroutine", color="yellow")
440438
result = await result
439+
printc(f"result after await: {result}", color="yellow")
441440
else:
442441
printc(f"result is not coroutine", color="yellow")
443442

adalflow/adalflow/core/types.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,16 @@ class FunctionOutput(DataClass):
603603
)
604604

605605

606+
#######################################################################################
607+
# Data modeling for component tool
608+
######################################################################################
609+
@dataclass
610+
class ComponentToolOutput(DataClass):
611+
output: Any = field(default=None, metadata={"description": "The output of the tool"})
612+
observation: Optional[str] = field(default=None, metadata={"description": "The observation of the llm see of the output of the tool"})
613+
is_streaming: Optional[bool] = field(default=False, metadata={"description": "Whether the tool output is streaming"})
614+
615+
606616
#######################################################################################
607617
# Data modeling for agent component
608618
######################################################################################

docs/Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,14 @@ update_files:
5858

5959
html: apidoc update_files
6060
@$(SPHINXBUILD) -b html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
61+
62+
# Convenience target to build docs with design documents
63+
build-with-design: apidoc html
64+
@echo "Documentation built with design documents included!"
65+
66+
# Quick build command
67+
quick:
68+
@$(SPHINXBUILD) -b html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
69+
70+
# Clean and rebuild everything
71+
rebuild: clean build-with-design

0 commit comments

Comments
 (0)