Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(flo-ai): adding pre-commit
  • Loading branch information
jacobsanosh committed Nov 13, 2025
commit b2fc79e19982771ee45941ef6ea26569a0c03340
18 changes: 15 additions & 3 deletions flo_ai/examples/agent_builder_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ async def example_simple_agent():
.build()
)

response = await agent.run([UserMessage(TextMessageContent(type='text', text='What is the formula for the area of a circle?'))])
response = await agent.run(
[
UserMessage(
TextMessageContent(
type='text', text='What is the formula for the area of a circle?'
)
)
]
)
print(f'Simple Agent Response: {response}')


Expand Down Expand Up @@ -68,10 +76,14 @@ async def calculate(operation: str, x: float, y: float) -> float:
.build()
)

response = await agent_openai.run([UserMessage(TextMessageContent(type='text', text='Calculate 5 plus 3'))])
response = await agent_openai.run(
[UserMessage(TextMessageContent(type='text', text='Calculate 5 plus 3'))]
)
print(f'OpenAI Tool Agent Response: {response}')

response = await agent_claude.run([UserMessage(TextMessageContent(type='text', text='Calculate 5 plus 3'))])
response = await agent_claude.run(
[UserMessage(TextMessageContent(type='text', text='Calculate 5 plus 3'))]
)
print(f'Claude Tool Agent Response: {response}')


Expand Down
37 changes: 22 additions & 15 deletions flo_ai/examples/arium_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,33 @@
from flo_ai.tool.base_tool import Tool
from flo_ai.arium.memory import MessageMemory


@flo_tool(
description="Calculate mathematical expressions",
description='Calculate mathematical expressions',
parameter_descriptions={
"result": "The result to print",

}
'result': 'The result to print',
},
)
async def print_result(result: str) -> str:
print(f"Result: {result}")
print(f'Result: {result}')
return result



# Example 1: Simple Linear Workflow
async def example_linear_workflow():
"""Example of a simple linear workflow: Agent -> Tool -> Agent"""

# Create some example agents and tools (these would be your actual implementations)
analyzer_agent = Agent(name='analyzer', system_prompt='Analyze the input', llm=OpenAI(model='gpt-4o-mini'))
summarizer_agent = Agent(name='summarizer', system_prompt='Summarize the results', llm=OpenAI(model='gpt-4o-mini'))
analyzer_agent = Agent(
name='analyzer',
system_prompt='Analyze the input',
llm=OpenAI(model='gpt-4o-mini'),
)
summarizer_agent = Agent(
name='summarizer',
system_prompt='Summarize the results',
llm=OpenAI(model='gpt-4o-mini'),
)

# Build and run the workflow
result = await (
Expand All @@ -40,7 +49,9 @@ async def example_linear_workflow():
.connect(analyzer_agent, print_result.tool)
.connect(print_result.tool, summarizer_agent)
.end_with(summarizer_agent)
.build_and_run([UserMessage(TextMessageContent(type='text', text='Analyze this text'))])
.build_and_run(
[UserMessage(TextMessageContent(type='text', text='Analyze this text'))]
)
)

return result
Expand Down Expand Up @@ -132,14 +143,10 @@ async def example_convenience_function():
"""Example using the create_arium convenience function"""

agent1 = Agent(
name='agent1',
system_prompt='First agent',
llm=OpenAI(model='gpt-4o-mini')
name='agent1', system_prompt='First agent', llm=OpenAI(model='gpt-4o-mini')
)
agent2 = Agent(
name='agent2',
system_prompt='Second agent',
llm=OpenAI(model='gpt-4o-mini')
name='agent2', system_prompt='Second agent', llm=OpenAI(model='gpt-4o-mini')
)

# Fix: Use proper InputMessage format for consistency
Expand Down
44 changes: 32 additions & 12 deletions flo_ai/examples/arium_yaml_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,16 +321,21 @@ async def run_simple_example():
# Run the workflow
result = await builder.build_and_run(
[
UserMessage(TextMessageContent(type='text', text='Machine learning is transforming healthcare by enabling predictive analytics, '
'personalized treatment recommendations, and automated medical imaging analysis. '
'However, challenges include data privacy concerns, the need for regulatory approval, '
'and ensuring AI systems are transparent and unbiased in their decision-making.')),
UserMessage(
TextMessageContent(
type='text',
text='Machine learning is transforming healthcare by enabling predictive analytics, '
'personalized treatment recommendations, and automated medical imaging analysis. '
'However, challenges include data privacy concerns, the need for regulatory approval, '
'and ensuring AI systems are transparent and unbiased in their decision-making.',
)
),
]
)

print('Result:')
for i, message in enumerate(result):
print(f'{i+1}. {message}')
print(f'{i+1}. {message}')

return result

Expand Down Expand Up @@ -371,8 +376,18 @@ async def run_complex_example():

result2 = await builder.build_and_run(
[
UserMessage(TextMessageContent(type='text', text="Please analyze this text and process it: 'The quick brown fox jumps over the lazy dog. ")),
UserMessage(TextMessageContent(type='text', text="This sentence contains every letter of the alphabet at least once.'")),
UserMessage(
TextMessageContent(
type='text',
text="Please analyze this text and process it: 'The quick brown fox jumps over the lazy dog. ",
)
),
UserMessage(
TextMessageContent(
type='text',
text="This sentence contains every letter of the alphabet at least once.'",
)
),
]
)

Expand All @@ -395,10 +410,15 @@ async def run_mixed_config_example():
# Run the workflow
result = await builder.build_and_run(
[
UserMessage(TextMessageContent(type='text', text='Please analyze this business report: Our Q3 revenue increased by 15% compared to Q2, '
'driven primarily by strong performance in the software division. However, hardware sales '
'declined by 8%. Customer satisfaction scores improved to 4.2/5.0. We recommend focusing '
'on digital transformation initiatives and reconsidering the hardware product line.')),
UserMessage(
TextMessageContent(
type='text',
text='Please analyze this business report: Our Q3 revenue increased by 15% compared to Q2, '
'driven primarily by strong performance in the software division. However, hardware sales '
'declined by 8%. Customer satisfaction scores improved to 4.2/5.0. We recommend focusing '
'on digital transformation initiatives and reconsidering the hardware product line.',
)
),
]
)

Expand Down Expand Up @@ -449,7 +469,7 @@ async def run_prebuilt_agents_example():
.with_name('summarizer')
.with_role('Executive Summarizer')
.with_prompt(
'Create a concise executive summary from the content analysis. Focus on actionable insights and key recommendations.'
'Create a concise executive summary from the content analysis. Focus on actionable insights and key recommendations.'
)
.with_llm(llm)
.with_reasoning(ReasoningPattern.DIRECT)
Expand Down
39 changes: 25 additions & 14 deletions flo_ai/examples/chat_history.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import asyncio
from typing import Any
from flo_ai.builder.agent_builder import AgentBuilder
from flo_ai.llm import Gemini
from flo_ai.llm import Gemini
from flo_ai.models.agent import Agent
from flo_ai.models import AssistantMessage, UserMessage, TextMessageContent
from flo_ai.models import AssistantMessage, UserMessage, TextMessageContent


async def main() -> None:
# Create a simple conversational agent
Expand All @@ -16,28 +17,38 @@ async def main() -> None:
)

response: Any = await agent.run(
[
[
UserMessage(
TextMessageContent(type='text', text='What is the formula for the area of a circle?'),
TextMessageContent(
type='text', text='What is the formula for the area of a circle?'
),
),
AssistantMessage(
TextMessageContent(type='text', text='The formula for the area of a circle is πr^2.'),
TextMessageContent(
type='text', text='The formula for the area of a circle is πr^2.'
),
),
UserMessage(
TextMessageContent(type='text', text='What is the formula for the area of a rectangle?')
TextMessageContent(
type='text', text='What is the formula for the area of a rectangle?'
)
),
AssistantMessage(
TextMessageContent(type='text', text='The formula for the area of a rectangle is length * width.'),
TextMessageContent(
type='text',
text='The formula for the area of a rectangle is length * width.',
),
),

UserMessage(
TextMessageContent(type='text', text='What is the area of a rectable of length <length> and breadth <breadth>'),
UserMessage(
TextMessageContent(
type='text',
text='What is the area of a rectable of length <length> and breadth <breadth>',
),
),
],
variables={
"length":10,
"breadth":70
},
variables={'length': 10, 'breadth': 70},
)
print(f'Response: {response}')


asyncio.run(main())
13 changes: 11 additions & 2 deletions flo_ai/examples/cot_agent_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,17 @@ async def main():
# Test questions
questions = [
UserMessage(TextMessageContent(type='text', text='What is 15 + 27?')),
UserMessage(TextMessageContent(type='text', text='If I have 100 apples and I give away 23, then buy 15 more, how many do I have?')),
UserMessage(TextMessageContent(type='text', text='Calculate 8 * 7 and then add 12 to the result.')),
UserMessage(
TextMessageContent(
type='text',
text='If I have 100 apples and I give away 23, then buy 15 more, how many do I have?',
)
),
UserMessage(
TextMessageContent(
type='text', text='Calculate 8 * 7 and then add 12 to the result.'
)
),
]

print('=== Chain of Thought (CoT) Reasoning Demo ===\n')
Expand Down
21 changes: 18 additions & 3 deletions flo_ai/examples/cot_conversational_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,24 @@ async def main():

# Test questions that require step-by-step reasoning
questions = [
UserMessage(TextMessageContent(type='text', text='If a train leaves station A at 2 PM traveling 60 mph and another train leaves station B at 3 PM traveling 80 mph, and the stations are 300 miles apart, when will they meet?')),
UserMessage(TextMessageContent(type='text', text='A store has a 20% discount on all items. If a customer buys 3 items that originally cost $50, $30, and $20, what is the final total after the discount?')),
UserMessage(TextMessageContent(type='text', text='Explain why the sky appears blue during the day but red during sunset.')),
UserMessage(
TextMessageContent(
type='text',
text='If a train leaves station A at 2 PM traveling 60 mph and another train leaves station B at 3 PM traveling 80 mph, and the stations are 300 miles apart, when will they meet?',
)
),
UserMessage(
TextMessageContent(
type='text',
text='A store has a 20% discount on all items. If a customer buys 3 items that originally cost $50, $30, and $20, what is the final total after the discount?',
)
),
UserMessage(
TextMessageContent(
type='text',
text='Explain why the sky appears blue during the day but red during sunset.',
)
),
]

print('=== Conversational Chain of Thought (CoT) Reasoning Demo ===\n')
Expand Down
7 changes: 6 additions & 1 deletion flo_ai/examples/custom_plan_execute_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,12 @@ async def main():
)

# Execute task
task = UserMessage(TextMessageContent(type='text', text='Research the impact of AI on software development productivity'))
task = UserMessage(
TextMessageContent(
type='text',
text='Research the impact of AI on software development productivity',
)
)
print(f'📋 Task: {task}')
print('🔄 Executing custom research workflow...\n')

Expand Down
Loading
Loading