File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from langchain .agents import AgentExecutor
2+ from langchain .prompts import PromptTemplate
3+ from langchain_community .llms import NanoGPT
4+ import logging
5+
6+ logger = logging .getLogger (__name__ )
7+
8+ def create_langchain_agent ():
9+ try :
10+ prompt_template = PromptTemplate (
11+ input_variables = ["input" ],
12+ template = "Process the following command for the Vial MCP: {input}"
13+ )
14+ llm = NanoGPT (model_name = "nano-gpt" , api_key = "mock-api-key" )
15+ agent = AgentExecutor .from_llm_and_tools (llm = llm , tools = [])
16+ logger .info ("LangChain agent created" )
17+ return agent
18+ except Exception as e :
19+ logger .error (f"LangChain agent creation error: { str (e )} " )
20+ with open ("errorlog.md" , "a" ) as f :
21+ f .write (f"- **[2025-08-10T20:23:00Z]** LangChain agent creation error: { str (e )} \n " )
22+ raise
You can’t perform that action at this time.
0 commit comments