mirror of
https://github.com/NousResearch/atropos.git
synced 2026-04-19 12:57:58 +00:00
Fix formatting issues in community environments - Applied black, isort, trailing whitespace, and end-of-file fixes - Remaining flake8 issues (unused imports, line length) noted for future cleanup
This commit is contained in:
parent
e85a170c34
commit
7f2e1a4f90
34 changed files with 1560 additions and 821 deletions
|
|
@ -1,31 +1,42 @@
|
|||
import logging
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
from pathlib import Path
|
||||
from livekit.agents import Agent, AgentSession, JobContext, WorkerOptions, cli, mcp, ChatContext, function_tool, RunContext
|
||||
from typing import List, Optional
|
||||
|
||||
from dotenv import load_dotenv
|
||||
from livekit.agents import (
|
||||
Agent,
|
||||
AgentSession,
|
||||
ChatContext,
|
||||
JobContext,
|
||||
RunContext,
|
||||
WorkerOptions,
|
||||
cli,
|
||||
function_tool,
|
||||
mcp,
|
||||
)
|
||||
from livekit.plugins import deepgram, openai, silero
|
||||
from livekit.plugins.turn_detector.multilingual import MultilingualModel
|
||||
from typing import Optional, List
|
||||
|
||||
|
||||
load_dotenv(os.path.join(os.path.dirname(__file__), '..', '..', '.env'))
|
||||
load_dotenv(os.path.join(os.path.dirname(__file__), "..", "..", ".env"))
|
||||
|
||||
|
||||
logger = logging.getLogger("gmail-agent")
|
||||
|
||||
|
||||
class GmailAgent(Agent):
|
||||
def __init__(self,
|
||||
chat_ctx: ChatContext,
|
||||
tools: Optional[List[function_tool]] = None) -> None:
|
||||
|
||||
def __init__(
|
||||
self, chat_ctx: ChatContext, tools: Optional[List[function_tool]] = None
|
||||
) -> None:
|
||||
|
||||
final_instructions = (
|
||||
"You are a Gmail specialist. You can manage emails by reading, searching, sending, and updating them (e.g., marking as read/unread, moving to folders). " +
|
||||
"Use tools like 'read_emails', 'send_email', and 'update_email' to interact with Gmail. " +
|
||||
"If sending an email, you might need a recipient; you know Gabin (gabin.fay@gmail.com). " +
|
||||
"If your task is complete or the user asks for something outside your email management capabilities (e.g., math, calendar), " +
|
||||
"you MUST use the 'delegate_to_router_agent' tool to return to the main assistant."
|
||||
)
|
||||
|
||||
"You are a Gmail specialist. You can manage emails by reading, searching, sending, and updating them (e.g., marking as read/unread, moving to folders). "
|
||||
+ "Use tools like 'read_emails', 'send_email', and 'update_email' to interact with Gmail. "
|
||||
+ "If sending an email, you might need a recipient; you know Gabin (gabin.fay@gmail.com). "
|
||||
+ "If your task is complete or the user asks for something outside your email management capabilities (e.g., math, calendar), "
|
||||
+ "you MUST use the 'delegate_to_router_agent' tool to return to the main assistant."
|
||||
)
|
||||
|
||||
all_tools = tools if tools is not None else []
|
||||
|
||||
mcp_servers_list = []
|
||||
|
|
@ -39,19 +50,22 @@ class GmailAgent(Agent):
|
|||
)
|
||||
)
|
||||
else:
|
||||
logger.warning("GUMLOOP_GMAIL_MCP_URL not set. Gmail agent may not have all its tools.")
|
||||
logger.warning(
|
||||
"GUMLOOP_GMAIL_MCP_URL not set. Gmail agent may not have all its tools."
|
||||
)
|
||||
|
||||
super().__init__(
|
||||
instructions=final_instructions,
|
||||
chat_ctx=chat_ctx,
|
||||
allow_interruptions=True,
|
||||
mcp_servers=mcp_servers_list,
|
||||
tools=all_tools
|
||||
tools=all_tools,
|
||||
)
|
||||
|
||||
async def on_enter(self):
|
||||
self.session.generate_reply()
|
||||
|
||||
|
||||
async def entrypoint(ctx: JobContext):
|
||||
await ctx.connect()
|
||||
|
||||
|
|
@ -67,4 +81,4 @@ async def entrypoint(ctx: JobContext):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint))
|
||||
cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue