Skip to content

Commit 0a52498

Browse files
authored
Create langchain_manager.py
1 parent 9600da7 commit 0a52498

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

vial/langchain_manager.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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

0 commit comments

Comments
 (0)