Investment-Agent / agent.py
Satyanjay's picture
Update agent.py
57d98dd verified
raw
history blame contribute delete
672 Bytes
from transformers import pipeline
from langchain_community.llms import HuggingFacePipeline
from langchain.agents import initialize_agent
from tools import simple_interest, sip_return
from huggingface_hub import login
import os
token = os.getenv("HF_TOKEN")
if token:
login(token=token)
def create_agent():
pipe = pipeline(
"text-generation",
model="google/flan-t5-large",
max_new_tokens=200
)
llm = HuggingFacePipeline(pipeline=pipe)
tools = [simple_interest, sip_return]
agent = initialize_agent(
tools,
llm,
agent="zero-shot-react-description",
verbose=False
)
return agent