Updated and fixed the issues in Agent code
This commit is contained in:
parent
863eddb24f
commit
ff894d47a8
2 changed files with 11 additions and 9 deletions
|
|
@ -35,7 +35,7 @@ def save_uploaded_file(uploaded_file):
|
||||||
# load the .env file
|
# load the .env file
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
# Set up Groq API key
|
# Set up Groq API key
|
||||||
groq_api_key = os.environ.get("GROQ_API_KEY") # os.environ["GROQ_API_KEY"] =
|
groq_api_key = os.getenv("GROQ_API_KEY") # os.environ["GROQ_API_KEY"] =
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
@ -62,7 +62,7 @@ def main():
|
||||||
st.sidebar.title('LLM Model')
|
st.sidebar.title('LLM Model')
|
||||||
model = st.sidebar.selectbox(
|
model = st.sidebar.selectbox(
|
||||||
'Model',
|
'Model',
|
||||||
["llama3-70b-8192"]
|
["groq/llama-3.1-8b-instant"]
|
||||||
)
|
)
|
||||||
|
|
||||||
# Initialize LLM
|
# Initialize LLM
|
||||||
|
|
@ -102,13 +102,15 @@ def main():
|
||||||
crew = Crew(
|
crew = Crew(
|
||||||
agents=list(agents.values()),
|
agents=list(agents.values()),
|
||||||
tasks=tasks,
|
tasks=tasks,
|
||||||
verbose=2
|
verbose=True
|
||||||
)
|
)
|
||||||
|
|
||||||
result = crew.kickoff()
|
result = crew.kickoff()
|
||||||
|
|
||||||
if result: # Only call st_ace if code has a valid value
|
if result: # Only call st_ace if code has a valid value
|
||||||
code = result.strip("```")
|
code = str(result).strip("```")
|
||||||
|
if 'python' in code:
|
||||||
|
code = code[code.index('python')+1:]
|
||||||
try:
|
try:
|
||||||
filt_idx = code.index("```")
|
filt_idx = code.index("```")
|
||||||
code = code[:filt_idx]
|
code = code[:filt_idx]
|
||||||
|
|
@ -136,13 +138,13 @@ def main():
|
||||||
crew = Crew(
|
crew = Crew(
|
||||||
agents=list(agents.values()),
|
agents=list(agents.values()),
|
||||||
tasks=tasks,
|
tasks=tasks,
|
||||||
verbose=2
|
verbose=True
|
||||||
)
|
)
|
||||||
|
|
||||||
result = crew.kickoff()
|
result = crew.kickoff()
|
||||||
|
|
||||||
if result: # Only call st_ace if code has a valid value
|
if result: # Only call st_ace if code has a valid value
|
||||||
code = result.strip("```")
|
code = str(result).strip("```")
|
||||||
try:
|
try:
|
||||||
filter_idx = code.index("```")
|
filter_idx = code.index("```")
|
||||||
code = code[:filter_idx]
|
code = code[:filter_idx]
|
||||||
|
|
@ -168,13 +170,13 @@ def main():
|
||||||
crew = Crew(
|
crew = Crew(
|
||||||
agents=list(agents.values()),
|
agents=list(agents.values()),
|
||||||
tasks=tasks,
|
tasks=tasks,
|
||||||
verbose=2
|
verbose=True
|
||||||
)
|
)
|
||||||
|
|
||||||
result = crew.kickoff()
|
result = crew.kickoff()
|
||||||
|
|
||||||
if result: # Only call st_ace if code has a valid value
|
if result: # Only call st_ace if code has a valid value
|
||||||
code = result.strip("```")
|
code = str(result).strip("```")
|
||||||
try:
|
try:
|
||||||
filter_idx = code.index("```")
|
filter_idx = code.index("```")
|
||||||
code = code[:filter_idx]
|
code = code[:filter_idx]
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ def initialize_agents(llm,file_name,Temp_dir):
|
||||||
),
|
),
|
||||||
"Compiler_Agent":Agent(
|
"Compiler_Agent":Agent(
|
||||||
role = "Code_compiler",
|
role = "Code_compiler",
|
||||||
goal = "Extract only the python code.",
|
goal = "Extract only the python code. Remove any other things like backticks ``` and any thing like ```python```",
|
||||||
backstory = "You are the compiler which extract only the python code.",
|
backstory = "You are the compiler which extract only the python code.",
|
||||||
verbose = True,
|
verbose = True,
|
||||||
allow_delegation = False,
|
allow_delegation = False,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue