linting ongoing

This commit is contained in:
Shannon Sands 2025-05-23 13:56:05 +10:00
parent 80affdb191
commit 33926d44ec
2 changed files with 11 additions and 10 deletions

View file

@ -29,7 +29,10 @@ class MyAgent(Agent):
turn_detection=MultilingualModel(),
mcp_servers=[
mcp.MCPServerHTTP(
url="https://mcp.gumloop.com/gcalendar/cY3bcaFS1qNdeVBnj0XIhnP4FEp2%3Aae99858e75594251bea9e05f32bb99b3",
url=(
"https://mcp.gumloop.com/gcalendar/"
"cY3bcaFS1qNdeVBnj0XIhnP4FEp2%3Aae99858e75594251bea9e05f32bb99b3"
),
timeout=5,
client_session_timeout_seconds=5,
),

View file

@ -4,11 +4,7 @@ import os
from dotenv import load_dotenv
from livekit.agents import mcp
from livekit.agents.llm import ( # Removed ChatRole as using strings
LLM,
ChatContext,
ChatMessage,
)
from livekit.agents.llm import LLM, ChatContext # Removed ChatRole as using strings
from livekit.plugins import openai
logger = logging.getLogger("text-perplexity-agent")
@ -37,7 +33,8 @@ def get_perplexity_mcp_server():
if not os.path.exists(mcp_script_path):
logger.error(
f"❌ MCP script not found at {mcp_script_path}. Make sure you've run 'npm install && npm run build' in the server directory."
f"❌ MCP script not found at {mcp_script_path}. Make sure you've run "
"'npm install && npm run build' in the server directory."
)
logger.warning("⚠️ Perplexity tools will be unavailable.")
return None
@ -78,8 +75,8 @@ async def run_chat_loop(
You are a specialized assistant for answering general knowledge questions, providing explanations,
and performing web searches using the 'perplexity_ask' tool.
When the user asks for information, facts, or to 'search the web', you are the designated expert.
When calling the 'perplexity_ask' tool, ensure the 'messages' argument is an array containing a single object
with 'role': 'user' and 'content' set to the user's question.
When calling the 'perplexity_ask' tool, ensure the 'messages' argument is an array containing
a single object with 'role': 'user' and 'content' set to the user's question.
For example: {"messages": [{"role": "user", "content": "What is the capital of France?"}]}
You do not have other tools. Do not try to delegate.
"""
@ -192,7 +189,8 @@ if __name__ == "__main__":
if not os.path.exists(mcp_script_path):
logger.error(f"❌ Critical: MCP script not found at {mcp_script_path}.")
logger.error(
"❌ The agent cannot use Perplexity tools. Please build the MCP server ('npm install && npm run build' in its directory)."
"❌ The agent cannot use Perplexity tools. Please build the MCP server "
"('npm install && npm run build' in its directory)."
)
exit(1)