Commit ·
434a9c4
1
Parent(s): 64235d1
init commit of amirkia_test branch
Browse files- .env.sample +2 -1
- gradio_app.py +2 -2
- langchain_mcp_client.py +2 -1
- postgre_smolagent_clinet.py +4 -1
.env.sample
CHANGED
|
@@ -1 +1,2 @@
|
|
| 1 |
-
API_KEY
|
|
|
|
|
|
| 1 |
+
API_KEY=
|
| 2 |
+
MCP_SERVER_PATH=/home/andre/andre/postgre_mcp_server.py
|
gradio_app.py
CHANGED
|
@@ -24,8 +24,8 @@ async def run_agent(request, history):
|
|
| 24 |
# final_answer, last_tool_answer, = await pg_mcp_exec(request)
|
| 25 |
# return final_answer, last_tool_answer
|
| 26 |
|
| 27 |
-
|
| 28 |
-
return
|
| 29 |
|
| 30 |
# Gradio UI
|
| 31 |
demo = gr.Interface(
|
|
|
|
| 24 |
# final_answer, last_tool_answer, = await pg_mcp_exec(request)
|
| 25 |
# return final_answer, last_tool_answer
|
| 26 |
|
| 27 |
+
response, message = await lc_mcp_exec(request, history)
|
| 28 |
+
return response
|
| 29 |
|
| 30 |
# Gradio UI
|
| 31 |
demo = gr.Interface(
|
langchain_mcp_client.py
CHANGED
|
@@ -94,9 +94,10 @@ def load_table_summary(path: str) -> str:
|
|
| 94 |
|
| 95 |
def get_server_params() -> StdioServerParameters:
|
| 96 |
# TODO: give server params from config
|
|
|
|
| 97 |
return StdioServerParameters(
|
| 98 |
command="python",
|
| 99 |
-
args=[
|
| 100 |
)
|
| 101 |
|
| 102 |
async def load_and_enrich_tools(session: ClientSession):
|
|
|
|
| 94 |
|
| 95 |
def get_server_params() -> StdioServerParameters:
|
| 96 |
# TODO: give server params from config
|
| 97 |
+
load_dotenv()
|
| 98 |
return StdioServerParameters(
|
| 99 |
command="python",
|
| 100 |
+
args=[os.environ["MCP_SERVER_PATH"]],
|
| 101 |
)
|
| 102 |
|
| 103 |
async def load_and_enrich_tools(session: ClientSession):
|
postgre_smolagent_clinet.py
CHANGED
|
@@ -8,6 +8,8 @@ from conversation_memory import ConversationMemory
|
|
| 8 |
from utils import parse_mcp_output, classify_intent
|
| 9 |
import logging
|
| 10 |
from smolagents import LiteLLMModel, ToolCollection, CodeAgent
|
|
|
|
|
|
|
| 11 |
|
| 12 |
logger = logging.getLogger(__name__)
|
| 13 |
|
|
@@ -63,9 +65,10 @@ def load_table_summary(path: str) -> str:
|
|
| 63 |
|
| 64 |
def get_server_params() -> StdioServerParameters:
|
| 65 |
# TODO: give server params from config
|
|
|
|
| 66 |
return StdioServerParameters(
|
| 67 |
command="python",
|
| 68 |
-
args=[
|
| 69 |
)
|
| 70 |
|
| 71 |
async def load_or_create_memory() -> ConversationMemory:
|
|
|
|
| 8 |
from utils import parse_mcp_output, classify_intent
|
| 9 |
import logging
|
| 10 |
from smolagents import LiteLLMModel, ToolCollection, CodeAgent
|
| 11 |
+
from dotenv import load_dotenv
|
| 12 |
+
|
| 13 |
|
| 14 |
logger = logging.getLogger(__name__)
|
| 15 |
|
|
|
|
| 65 |
|
| 66 |
def get_server_params() -> StdioServerParameters:
|
| 67 |
# TODO: give server params from config
|
| 68 |
+
load_dotenv()
|
| 69 |
return StdioServerParameters(
|
| 70 |
command="python",
|
| 71 |
+
args=[os.environ["MCP_SERVER_PATH"]],
|
| 72 |
)
|
| 73 |
|
| 74 |
async def load_or_create_memory() -> ConversationMemory:
|