tensorgirl commited on
Commit
547c66d
·
verified ·
1 Parent(s): 430d9b4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +57 -57
app.py CHANGED
@@ -1,58 +1,58 @@
1
- from langchain_groq import ChatGroq
2
-
3
- llm = ChatGroq(
4
- temperature=0,
5
- groq_api_key = "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",
6
- model_name="llama3-8b-8192"
7
- )
8
-
9
- from crewai import Agent, Task, Crew
10
- import os
11
-
12
- Code_Quality_agent = Agent(
13
- role="Senior Software Engineer",
14
- goal="Provide the best support quality assurance to the code written by the member in your team",
15
- backstory="You work in a financial organization. The Goal is to identify bugs,"
16
- " security should be a top concern. Look for common Look for common"
17
- " vulnerabilities like SQL injection, cross-site scripting (XSS), "
18
- "and insecure data handling practices.Ensure the code adheres to"
19
- " secure coding standards established by the organization or "
20
- "industry.Scrutinize how the code validates user input to prevent"
21
- " malicious attacks.For code involving financial calculations"
22
- " (e.g., interest rates, risk assessments), double-check the formulas"
23
- " and logic for accuracy. Consider edge cases and ensure the code behave"
24
- "s as intended under various scenarios.Verify that the code maintains data"
25
- " integrity throughout processing. This includes checking for potential"
26
- " data loss, corruption, or unauthorized access.Ensure the code complies"
27
- " with relevant industry standards and regulations.",
28
- verbose=True,
29
- allow_delegation=False,
30
- llm = llm
31
-
32
- )
33
-
34
- Code_Review = Task(expected_output=(
35
- "You would be given code as an input for the code review {code}. "
36
- "Make sure to use everything you know to provide the best support possible."
37
- "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."
38
- ),
39
- description=(
40
- "You would be given a code as an input for the code review {code}."
41
- "Make sure to use everything you know to provide the best support possible."
42
- "You must strive to provide a complete and accurate response."
43
- ),
44
- llm = llm,
45
- agent= Code_Quality_agent,
46
- )
47
-
48
- crew = Crew(
49
- agents=[Code_Quality_agent],
50
- tasks=[Code_Review],
51
- verbose=2,
52
- )
53
-
54
- def predict(code):
55
- input = {code:code}
56
- result = crew.kickoff(inputs=inputs)
57
- return result
58
 
 
1
+ from langchain_groq import ChatGroq
2
+
3
+ llm = ChatGroq(
4
+ temperature=0,
5
+ groq_api_key = "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",
6
+ model_name="llama3-8b-8192"
7
+ )
8
+
9
+ from crewai import Agent, Task, Crew
10
+ import os
11
+
12
+ Code_Quality_agent = Agent(
13
+ role="Senior Software Engineer",
14
+ goal="Provide the best support quality assurance to the code written by the member in your team",
15
+ backstory="You work in a financial organization. The Goal is to identify bugs,"
16
+ " security should be a top concern. Look for common Look for common"
17
+ " vulnerabilities like SQL injection, cross-site scripting (XSS), "
18
+ "and insecure data handling practices.Ensure the code adheres to"
19
+ " secure coding standards established by the organization or "
20
+ "industry.Scrutinize how the code validates user input to prevent"
21
+ " malicious attacks.For code involving financial calculations"
22
+ " (e.g., interest rates, risk assessments), double-check the formulas"
23
+ " and logic for accuracy. Consider edge cases and ensure the code behave"
24
+ "s as intended under various scenarios.Verify that the code maintains data"
25
+ " integrity throughout processing. This includes checking for potential"
26
+ " data loss, corruption, or unauthorized access.Ensure the code complies"
27
+ " with relevant industry standards and regulations.",
28
+ verbose=True,
29
+ allow_delegation=False,
30
+ llm = llm
31
+
32
+ )
33
+
34
+ Code_Review = Task(expected_output=(
35
+ "You would be given code as an input for the code review {code}. "
36
+ "Make sure to use everything you know to provide the best support possible."
37
+ "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."
38
+ ),
39
+ description=(
40
+ "You would be given a code as an input for the code review {code}."
41
+ "Make sure to use everything you know to provide the best support possible."
42
+ "You must strive to provide a complete and accurate response."
43
+ ),
44
+ llm = llm,
45
+ agent= Code_Quality_agent,
46
+ )
47
+
48
+ crew = Crew(
49
+ agents=[Code_Quality_agent],
50
+ tasks=[Code_Review],
51
+ verbose=2,
52
+ )
53
+
54
+ def predict(item):
55
+ input = {code:item['code']}
56
+ result = crew.kickoff(inputs=inputs)
57
+ return result
58