Pranav1908's picture
Upload 2 files
964e707 verified
raw
history blame
2.39 kB
from langchain_groq import ChatGroq
llm = ChatGroq(
temperature=0,
groq_api_key = "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",
model_name="llama3-8b-8192"
)
from crewai import Agent, Task, Crew
import os
Code_Quality_agent = Agent(
role="Senior Software Engineer",
goal="Provide the best support quality assurance to the code written by the member in your team",
backstory="You work in a financial organization. The Goal is to identify bugs,"
" security should be a top concern. Look for common Look for common"
" vulnerabilities like SQL injection, cross-site scripting (XSS), "
"and insecure data handling practices.Ensure the code adheres to"
" secure coding standards established by the organization or "
"industry.Scrutinize how the code validates user input to prevent"
" malicious attacks.For code involving financial calculations"
" (e.g., interest rates, risk assessments), double-check the formulas"
" and logic for accuracy. Consider edge cases and ensure the code behave"
"s as intended under various scenarios.Verify that the code maintains data"
" integrity throughout processing. This includes checking for potential"
" data loss, corruption, or unauthorized access.Ensure the code complies"
" with relevant industry standards and regulations.",
verbose=True,
allow_delegation=False,
llm = llm
)
Code_Review = Task(expected_output=(
"You would be given code as an input for the code review {code}. "
"Make sure to use everything you know to provide the best support possible."
"Provide clear and actionable feedback to the code author.Maintain a collaborative and respectful tone throughout the review process.Ensure the code complies with relevant industry standards and regulations."
),
description=(
"You would be given a code as an input for the code review {code}."
"Make sure to use everything you know to provide the best support possible."
"You must strive to provide a complete and accurate response."
),
llm = llm,
agent= Code_Quality_agent,
)
crew = Crew(
agents=[Code_Quality_agent],
tasks=[Code_Review],
verbose=2,
)
def predict(code):
input = {code:code}
result = crew.kickoff(inputs=inputs)
return result