Add main.py
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
from langchain_ollama import ChatOllama
|
||||
from langchain.agents import create_agent
|
||||
|
||||
# Initialize the LLM (using a local Ollama model)
|
||||
llm = ChatOllama(model="llama3")
|
||||
|
||||
# No external tools needed for this simple greeting agent
|
||||
tools = []
|
||||
|
||||
# Create the agent using the modern API
|
||||
agent = create_agent(model=llm, tools=tools)
|
||||
|
||||
# Invoke the agent with a user message asking for a greeting
|
||||
response = agent.invoke({"messages": [{"role": "user", "content": "Hello"}]})
|
||||
print(response["output_text"] if isinstance(response, dict) else response)
|
||||
Reference in New Issue
Block a user