Skip to content

Commit

Permalink
Documentation changes for 0.0.4 release (#57)
Browse files Browse the repository at this point in the history
* Documentation changes for 0.0.4

* Improved readme

* Readme updated for tools

* Documentation update and change in facade to allow agent creation using Flo.create

* Updating doc with blogs and logging

* Updating roadmap

* Fix to open readme links in new tab [#42]

* Fixes while testing
  • Loading branch information
vizsatiz authored Nov 17, 2024
1 parent 4d4d4ec commit 8e13305
Show file tree
Hide file tree
Showing 10 changed files with 615 additions and 307 deletions.
165 changes: 161 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ Rootflo is an alternative to <b>Langgraph</b>, and <b>CrewAI</b>. It lets you e

<p align="center">
<br/>
<a href="https://flo-ai.rootflo.ai" rel=""><strong>Checkout the docs »</strong></a>
<a href="https://flo-ai.rootflo.ai" rel="" target="_blank"><strong>Checkout the docs »</strong></a>
<br/>
<br/>
<a href="https://github.com/rootflo/flo-ai">Github</a>
<a href="https://rootflo.ai">Website</a>
<a href="https://rootflo.ai" target="_blank">Website</a>
<a href="https://github.com/rootflo/flo-ai/blob/develop/ROADMAP.md">Roadmap</a>
<a href="https://github.com/rootflo/flo-ai/blob/develop/ROADMAP.md" target="_blank">Roadmap</a>
</p>

<hr />
Expand All @@ -52,6 +52,13 @@ Flo AI is a Python framework that makes building production-ready AI agents and

## 🚀 Quick Start

FloAI follows an agent team architecture, where agents are the basic building blocks, and teams can have multiple agents and teams themselves can be part of bigger teams.

Building a working agent or team involves 3 steps:
1. Create a session using `FloSession`, and register your tools and models
2. Define you agent/team/team of teams using yaml or code
3. Build and run using `Flo`

### Installation

```bash
Expand All @@ -60,11 +67,63 @@ pip install flo-ai
poetry add flo-ai
```

### Create Your First AI Agent in 30 secs

```python
from flo_ai import Flo, FloSession
from langchain_openai import ChatOpenAI
from langchain_community.tools.tavily_search.tool import TavilySearchResults

# init your LLM
llm = ChatOpenAI(temperature=0)

# create a session and register your tools
session = FloSession(llm).register_tool(name="TavilySearchResults", tool=TavilySearchResults())

# define your agent yaml
simple_weather_checking_agent = """
apiVersion: flo/alpha-v1
kind: FloAgent
name: weather-assistant
agent:
name: WeatherAssistant
job: >
Given the city name you are capable of answering the latest whether this time of the year by searching the internet
tools:
- name: InternetSearchTool
"""
flo = Flo.build(session, yaml=simple_weather_checking_agent)

# Start streaming results
for response in flo.stream("Write about recent AI developments"):
print(response)
```

## Lets create the same agent using code

```python
from flo_ai import FloAgent

session = FloSession(llm)

weather_agent = FloAgent.create(
session=session,
name="WeatherAssistant",
job="Given the city name you are capable of answering the latest whether this time of the year by searching the internet",
tools=[TavilySearchResults()]
)

agent_flo: Flo = Flo.create(session, weather_agent)
result = agent_flo.invoke("Whats the whether in New Delhi, India ?")
```

### Create Your First AI Team in 30 Seconds

```python
from flo_ai import Flo, FloSession
from langchain_openai import ChatOpenAI
from langchain_community.tools.tavily_search.tool import TavilySearchResults


# Define your team in YAML
yaml_config = """
Expand Down Expand Up @@ -97,12 +156,93 @@ for response in flo.stream("Write about recent AI developments"):
print(response)
```

**Note:** You can make each of the above agents including the router to different models, giving flexibility to combine the power of different LLMs.
To know more, check multi-model integration in detailed [documentation](https://flo-ai.rootflo.ai)

### Lets Create a AI team using code

```python
from flo_ai import FloSupervisor, FloAgent, FloSession, FloTeam, FloLinear
from langchain_openai import ChatOpenAI
from langchain_community.tools.tavily_search.tool import TavilySearchResults

llm = ChatOpenAI(temperature=0, model_name='gpt-4o')
session = FloSession(llm).register_tool(
name="TavilySearchResults",
tool=TavilySearchResults()
)

researcher = FloAgent.create(
session,
name="Researcher",
role="Internet Researcher", # optional
job="Do a research on the internet and find articles of relevent to the topic asked by the user",
tools=[TavilySearchResults()]
)

blogger = FloAgent.create(
session,
name="BlogWriter",
role="Thought Leader", # optional
job="Able to write a blog using information provided",
tools=[TavilySearchResults()]
)

marketing_team = FloTeam.create(session, "Marketing", [researcher, blogger])
head_of_marketing = FloSupervisor.create(session, "Head-of-Marketing", marketing_team)
marketing_flo = Flo.create(session, routed_team=head_of_marketing)

```

## Tools

FloAI supports all the tools built and available in `langchain_community` package. To know more these tools, go [here](https://python.langchain.com/docs/integrations/tools/).

Along with that FloAI has a decorator `@flotool` which makes any function into a tool.

Creating a simple tool using `@flotool`:

```python
from flo_ai import flotool
from pydantic import BaseModel, Field

# define argument schema
class AdditionToolInput(BaseModel):
numbers: List[int] = Field(..., description='List of numbers to add')

@flotool(name='AdditionTool', description='Tool to add numbers')
async def addition_tool(numbers: List[int]) -> str:
result = sum(numbers)
await asyncio.sleep(1)
return f'The sum is {result}'

# async tools can also be defined
# when using async tool, while running the flo use async invoke
@flotool(
name='MultiplicationTool',
description='Tool to multiply numbers to get product of numbers',
)
async def mul_tool(numbers: List[int]) -> str:
result = sum(numbers)
await asyncio.sleep(1)
return f'The product is {result}'

# register your tool or use directly in code impl
session.register_tool(name='Adder', tool=addition_tool)
```

**Note:** `@flotool` comes with inherent error handling capabilities to retry if an exception is thrown. Use `unsafe=True` to disable error handling

## 📖 Documentation

Visit our [comprehensive documentation](https://flo-ai.rootflo.ai) for:
- Detailed tutorials
- Architecture deep-dives
- API reference
- Logging
- Error handling
- Observers
- Dynamic model switching
- Best practices
- Advanced examples

Expand Down Expand Up @@ -145,10 +285,27 @@ Built with ❤️ using:
- [LangChain](https://github.com/hwchase17/langchain)
- [LangGraph](https://github.com/langchain-ai/langgraph)

<h2>📚 Latest Blog Posts</h2>

<div style="display: flex; gap: 10px;">
<a href="https://medium.com/rootflo/flo-simple-way-to-create-composable-ai-agents-6946c2922a94" target="_blank" style="text-decoration: none;">
<img src="./images/blog-image.png" width="150" style="border-radius: 10px;" />
<p><b>Flo: 🔥🔥🔥 Simple way to create composable AI agents</b><br />Unlock the Power of Customizable AI Workflows with FloAI’s Intuitive and Flexible Agentic Framework</p>
</a>
<a href="https://medium.com/rootflo/build-an-agentic-ai-customer-support-bot-using-floai-533660fb9c9b" target="_blank" style="text-decoration: none;">
<img src="./images/customer-support.png" width="150" style="border-radius: 10px;" />
<p><b>Build an Agentic AI customer support bot using FloAI</b><br />We built an open-source agentic AI workflow builder named FloAI and used it to create an agentic customer support agent.</p>
</a>
<a href="https://medium.com/rootflo/build-an-agentic-rag-using-floai-in-minutes-0be260304c98" target="_blank" style="text-decoration: none;">
<img src="./examples/images/agentic-rag.png" width="150" style="border-radius: 10px;" />
<p><b>Build an Agentic RAG using FloAI in minutes</b><br />FloAI has just made implementing agentic RAG simple and easy to manage</p>
</a>
</div>

---

<div align="center">
<strong>Built with ❤️ by the Rootflo team</strong>
<strong>Built with ❤️ by the <a href="http://rootflo.ai">rootflo</a> team</strong>
<br><a href="https://github.com/rootflo/flo-ai/discussions">Community</a> •
<a href="https://flo-ai.rootflo.ai">Documentation</a>
</div>
12 changes: 6 additions & 6 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ Core features improve the library itself to cater wider range of functionalities

| Name | Description | Status | Release version |
|------|-------------|--------|-----------------|
| Full composability | Right now teams can only be combined with teams and agents with agents. We want to extend this to team + agent composibility | Develop👨‍💻| 0.0.4 |
| Error handling | Ability to handle errors autonomously | Develop👨‍💻 | 0.0.4|
|LLM Extensibilty| Ability to different LLMs across different agents and teams| Develop👨‍💻 | 0.0.4|
|Async Tools| Ability create tools easily within asyncio | Develop👨‍💻 | 0.0.4|
|Observer| Observer framework for raising agent decision events and other important events | Yet to start | 0.0.4|
| Full composability | Right now teams can only be combined with teams and agents with agents. We want to extend this to team + agent composibility | | 0.0.4 |
| Error handling | Ability to handle errors autonomously | | 0.0.4|
|LLM Extensibilty| Ability to different LLMs across different agents and teams| | 0.0.4|
|Async Tools| Ability create tools easily within asyncio | | 0.0.4|
|Observer| Observer framework for raising agent decision events and other important events | | 0.0.4|
|Output formatter| Ability to templatize output format using pydantic| Yet to start| 0.0.4|
|Auto-Query RAG| Ability to make metadata query within the agentic, which can automatically add metadata while rag query runs, like timestamp or other data|Yet to start|TBD|
|Parellel Router| A router to execute tasks or agents in parallel if the tasks are independent | Yet to start | TBD
Expand All @@ -24,7 +24,7 @@ These features improve logging and debugging abilities while building.
| Name | Description | Status | Release version |
|------|-------------|--------|-----------------|
|Recursion control| Expose parameters like recursion control to limit recursions and policy in case of recursion etc | Yet to start | 0.0.5
|Set up tests| Create a framework for unit-testing flo-ai and its internal functionalities| Develop👨‍💻 | 0.0.4
|Set up tests| Create a framework for unit-testing flo-ai and its internal functionalities| | 0.0.4

## Community

Expand Down
Loading

0 comments on commit 8e13305

Please sign in to comment.