forked from i-am-bee/beeai-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbeeai_platform.py
More file actions
24 lines (18 loc) · 1.02 KB
/
beeai_platform.py
File metadata and controls
24 lines (18 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from beeai_framework.adapters.beeai_platform.serve.server import BeeAIPlatformServer
from beeai_framework.agents.tool_calling.agent import ToolCallingAgent
from beeai_framework.backend import ChatModel
from beeai_framework.memory import UnconstrainedMemory
from beeai_framework.tools.search.duckduckgo import DuckDuckGoSearchTool
from beeai_framework.tools.weather import OpenMeteoTool
def main() -> None:
llm = ChatModel.from_name("ollama:granite3.1-dense:8b")
agent = ToolCallingAgent(llm=llm, tools=[DuckDuckGoSearchTool(), OpenMeteoTool()], memory=UnconstrainedMemory())
# Register the agent with the Beeai platform and run the HTTP server
# For the ToolCallingAgent and ReActAgent, we dont need to specify BeeAIPlatformAgent factory method
# because they are already registered in the BeeAIPlatformServer
BeeAIPlatformServer().register(
agent, name="chat_agent", description="Simple chat agent", ui={"type": "chat"}
).serve()
if __name__ == "__main__":
main()
# run: beeai agent run chat_agent