Otto: Intelligent Automation and LLM Integration for Frappe Framework

Summary
Otto is an early-stage Frappe Framework application designed to bring intelligent automation and large language model (LLM) capabilities to the Frappe ecosystem. It serves as both a standalone app for task automation and a library for seamless LLM integration within custom Frappe applications. This project aims to empower Frappe users with advanced AI functionalities for various business processes.
Repository Info
Tags
Click on any tag to explore related repositories
Introduction
Otto is an innovative application built on the Frappe Framework, designed to introduce intelligent automation and advanced Large Language Model (LLM) capabilities into the Frappe ecosystem. While currently in its early stages of development, Otto aims to provide a robust framework for automating tasks, building custom AI assistants over Frappe apps, and facilitating LLM integrations. It functions both as a Frappe app with defined doctypes for managing tasks, tools, and LLMs, and as a powerful library for developers to embed LLM interactions directly into their custom Frappe solutions.
Installation
To install Otto, you will need a Frappe bench directory with a site already set up. Follow these commands in your bench directory:
# In your bench directory
bench get-app otto --branch develop
bench --site site-name install-app otto
After installation, you can configure API keys in the Otto Settings doctype and explore the available models and functionalities.
Examples
Otto's library provides a straightforward way to integrate LLMs into your Frappe applications. Here's a brief example demonstrating how to fetch a model, create a session, interact with it, and handle tool use:
import otto.lib as otto
from otto.lib.types import ToolUseUpdate
# 1. Fetch model matching some criteria
model = otto.get_model(supports_vision=True, size="Small", provider="OpenAI") # str model id
# 2. Create new session
session = otto.new(
model=model,
instruction="You are a helpful coding assistant",
tools=[calculator_tool_schema],
)
# Save id to resume session later
session_id = session.id
# 3. Interact (streaming)
stream = session.interact("Calculate 15 * 23", stream=True)
for chunk in stream:
print(chunk.get("text", ""), end="")
result = stream.item
# 4. Handle tool use
for tool in session.get_pending_tool_use():
result = execute_tool(tool.name, tool.args) # execute tool
# update session with tool result
session.update_tool_use(
ToolUseUpdate(id=tool.id, status="success", result=result)
)
# Continue session with tool result
session.interact(stream=False)
# 5. Load and resume interaction (non-streaming)
session = otto.load(session_id)
response, _ = session.interact("What was the result?", stream=False)
if response:
print(response["content"])
For more detailed examples and comprehensive documentation, refer to the Otto Library Documentation.
Why Use Otto?
Otto offers a compelling solution for organizations looking to enhance their Frappe applications with AI-driven capabilities. Its primary benefits include:
- Intelligent Task Automation: Automate routine tasks within Frappe using defined "Otto Tasks" and "Otto Tools," triggered manually or by doctype lifecycle events.
- Custom AI Assistants: Build tailored assistants that can interact with and leverage data from your Frappe apps, providing intelligent support and insights.
- Seamless LLM Integration: Developers can easily integrate various Large Language Models into their custom Frappe apps using Otto's flexible library, abstracting away the complexities of LLM interaction.
- Enhanced Business Processes: By automating responses and providing intelligent insights, Otto can significantly improve efficiency, as demonstrated by its internal use case in handling support tickets for Frappe's Helpdesk.
- Future-Proofing: As part of Frappe's broader initiative to explore state-of-the-art AI, Otto positions Frappe apps at the forefront of AI innovation.
Links
- GitHub Repository: https://github.com/frappe/otto
- Otto Library Documentation: https://github.com/frappe/otto/blob/develop/otto/lib/docs/README.md
- Frappe Framework: https://github.com/frappe/frappe
- Frappe Technologies: https://frappe.io