Warning
Otto is in very early stages of development, the application aspects of it are still under heavy experimentation.
Nevertheless, you may use it as library in your own Frappe app to manage interaction with LLMs.
Library documentation for reference.
Otto is a Frappe Framework app which will be used for adding intelligent automation capabilities to Frappe apps. It's still a work in progress that's being tested out internally.
Otto's app features are built on top of it's library. You may use this in your Frappe app to handle LLM integrations. (Docs)
Brief example of how the library can be used. Link to full library docs for more details.
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"])You can install this app using the bench CLI, first setup a Frappe bench directory and create a new site then:
# In you bench directory
bench get-app otto --branch develop
bench --site site-name install-app otto