|
1 | 1 | import os |
2 | 2 | import asyncio |
| 3 | +import json |
3 | 4 | from typing import Dict, Any, Optional, List |
4 | | -from qwen_agent.agents import Assistant |
5 | | -from .tools import register_tools |
6 | | -from . import auth, prompts, utils |
| 5 | + |
7 | 6 | from dotenv import load_dotenv |
8 | 7 | from fastmcp import FastMCP, Context |
9 | 8 | from googleapiclient.errors import HttpError |
10 | 9 |
|
11 | 10 |
|
| 11 | +from . import auth, prompts |
| 12 | + |
12 | 13 | # --- LLM and Environment Configuration --- |
13 | 14 | ENVIRONMENT = os.getenv('ENVIRONMENT', 'dev-local') |
14 | 15 | if ENVIRONMENT == 'dev-local': |
15 | 16 | dotenv_path = os.path.join(os.path.dirname(__file__), '..', '..', '.env') |
16 | 17 | if os.path.exists(dotenv_path): |
17 | 18 | load_dotenv(dotenv_path=dotenv_path) |
18 | 19 |
|
19 | | -OPENAI_API_BASE_URL = os.getenv("OPENAI_API_BASE_URL", "http://localhost:11434") |
20 | | -OPENAI_MODEL_NAME = os.getenv("OPENAI_MODEL_NAME", "qwen3:4b") |
21 | | -OPENAI_API_KEY = os.getenv("OPENAI_API_KEY", "ollama") |
22 | | - |
23 | | -def get_generator_agent(): |
24 | | - """Initializes a Qwen agent specifically for generating JSON outlines internally.""" |
25 | | - llm_cfg = { |
26 | | - 'model': OPENAI_MODEL_NAME, |
27 | | - 'model_server': f"{OPENAI_API_BASE_URL.rstrip('/')}/v1", |
28 | | - 'api_key': OPENAI_API_KEY, |
29 | | - } |
30 | | - return Assistant(llm=llm_cfg, system_message=prompts.JSON_GENERATOR_SYSTEM_PROMPT, function_list=[]) |
31 | | - |
32 | 20 | mcp = FastMCP( |
33 | 21 | name="GDocsServer", |
34 | 22 | instructions="This server provides tools to create and manage Google Docs.", |
35 | 23 | ) |
36 | 24 |
|
37 | | -register_tools(mcp) |
38 | | - |
39 | 25 | @mcp.resource("prompt://gdocs-agent-system") |
40 | 26 | def get_gdocs_system_prompt() -> str: |
41 | 27 | """Provides the system prompt that instructs the main orchestrator agent on how to use the gdocs tools.""" |
|
0 commit comments