Update app.py
Browse files
app.py
CHANGED
@@ -17,12 +17,13 @@ nest_asyncio.apply()
|
|
17 |
|
18 |
# OpenAI credentials
|
19 |
# key = os.getenv('OPENAI_API_KEY')
|
20 |
-
key = os.getenv('CLAUDE_API_KEY')
|
21 |
-
print(key)
|
22 |
-
os.environ["ANTHROPIC_API_KEY"] = key
|
23 |
# openai.api_key = key
|
24 |
# os.environ["OPENAI_API_KEY"] = key
|
25 |
|
|
|
|
|
|
|
|
|
26 |
# Streamlit UI
|
27 |
st.title("Auto Test Case Generation using LLM")
|
28 |
|
@@ -69,6 +70,7 @@ if uploaded_files:
|
|
69 |
# return response.choices[0].message.content
|
70 |
|
71 |
response = [
|
|
|
72 |
ChatMessage(role="user", content=prompt),
|
73 |
]
|
74 |
resp = Anthropic(model=model).chat(response)
|
@@ -102,16 +104,18 @@ if uploaded_files:
|
|
102 |
|
103 |
# Generation
|
104 |
# resp = ollama.generate(model='codellama',
|
105 |
-
# prompt=f"""
|
106 |
-
# \n\
|
107 |
-
# \n\
|
108 |
-
# \n\
|
|
|
109 |
# """)
|
110 |
|
111 |
-
prompt=f"""
|
112 |
-
\n\
|
113 |
-
\n\
|
114 |
-
\n\
|
|
|
115 |
"""
|
116 |
|
117 |
# print(prompt)
|
|
|
17 |
|
18 |
# OpenAI credentials
|
19 |
# key = os.getenv('OPENAI_API_KEY')
|
|
|
|
|
|
|
20 |
# openai.api_key = key
|
21 |
# os.environ["OPENAI_API_KEY"] = key
|
22 |
|
23 |
+
# Anthropic credentials
|
24 |
+
key = os.getenv('CLAUDE_API_KEY')
|
25 |
+
os.environ["ANTHROPIC_API_KEY"] = key
|
26 |
+
|
27 |
# Streamlit UI
|
28 |
st.title("Auto Test Case Generation using LLM")
|
29 |
|
|
|
70 |
# return response.choices[0].message.content
|
71 |
|
72 |
response = [
|
73 |
+
ChatMessage(role="system", content="You are a sincere and helpful coding assistant"),
|
74 |
ChatMessage(role="user", content=prompt),
|
75 |
]
|
76 |
resp = Anthropic(model=model).chat(response)
|
|
|
104 |
|
105 |
# Generation
|
106 |
# resp = ollama.generate(model='codellama',
|
107 |
+
# prompt=f""" Your task is to generate unit test cases for this function : {snippet}\
|
108 |
+
# \n\n Politely refuse if the function is not suitable for generating test cases.
|
109 |
+
# \n\n Generate atleast 5 unit test case. Include couple of edge cases as well.
|
110 |
+
# \n\n There should be no duplicate test cases.
|
111 |
+
# \n\n Avoid generating repeated statements.
|
112 |
# """)
|
113 |
|
114 |
+
prompt=f""" Your task is to generate unit test cases for this function : \n\n{snippet}\
|
115 |
+
\n\n Generate 5 to 10 unit test cases. Include couple of edge cases as well.
|
116 |
+
\n\n Politely refuse if the function is not suitable for generating test cases.
|
117 |
+
\n\n There should be no duplicate test cases.
|
118 |
+
\n\n Avoid generating repeated statements.
|
119 |
"""
|
120 |
|
121 |
# print(prompt)
|