-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_tiny_bot.py
47 lines (40 loc) · 1.43 KB
/
example_tiny_bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""Bot with no extra logging or config."""
import asyncio
from dotenv import load_dotenv
import ai_shell
load_dotenv()
async def main():
async def static_keep_going(toolkit: ai_shell.ToolKit):
usage = toolkit.get_tool_usage_for("ls")
if usage["count"] > 0:
# Objective completion of goal.
return "DONE"
# TODO: Let people thank the bot.
# " Great job! You've used ls. Summarize in paragraph form and we're done."
return (
"You haven't used the ls tool yet. Do you have access to the ls tool? If"
" there is a problem report it to the report_text tool to end the session."
)
# Creates temporary bots
bot = ai_shell.TaskBot(
ai_shell.Config(),
name="Folder inspection bot.",
bot_instructions="Run the ls tool and tell me what you see.",
model="gpt-4o-mini",
dialog_logger_md=ai_shell.DialogLoggerWithMarkdown("./tmp"),
)
await bot.initialize()
the_ask = """You are in the './' folder. You do not need to guess the pwd, it is './'.
Run ls and tell me what you see in paragraph format."""
await bot.basic_tool_loop(
the_ask=the_ask,
root_folder="./src",
tool_names=[
"ls",
"report_text",
],
keep_going_prompt=static_keep_going,
stop_on_no_tool_use=True,
)
if __name__ == "__main__":
asyncio.run(main())