Spaces:
Build error
Build error
File size: 1,756 Bytes
fe66a50 20bb0cc fe66a50 e26aba4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
import os
from crewai import Agent
from dotenv import load_dotenv
from langchain_groq import ChatGroq
from langchain.tools import DuckDuckGoSearchRun
import streamlit as st
search_tool = DuckDuckGoSearchRun()
load_dotenv()
groq_api_key = os.getenv("GROQ_API_KEY")
llm = ChatGroq(model="llama-3.1-70b-versatile", verbose=True, temperature=0.7, groq_api_key=groq_api_key)
def streamlit_callback(step_output):
st.markdown("---")
for step in step_output:
if isinstance(step, tuple) and len(step) == 2:
action, observation = step
if isinstance(action, dict):
st.markdown(f"# Action")
st.markdown(f"**Tool:** {action.get('tool', '')}")
st.markdown(f"**Tool Input:** {action.get('tool_input', '')}")
st.markdown(f"**Log:** {action.get('log', '')}")
st.markdown(f"**Action:** {action.get('action', '')}")
elif isinstance(action, str):
st.markdown(f"**Action:** {action}")
st.markdown(f"**Observation:** {str(observation)}")
class RoastAgent:
def r1(self):
return Agent(
role='Resume Roaster',
goal=""" This is the resume of a person, write a funny, brutal and uncensored very disrespectful roast for them. if given data doesn't seems like resume then tell me to upload resume and give me at least 300 words response and in proper text. also add emoji in resume and see your response should directly mention the person by you whoese resume it is""",
backstory="""You are very Famous Resume Roaster""",
tools=[search_tool],
llm=llm,
verbose=False,
#step_callback=streamlit_callback,
)
|