Spaces:
Running
Running
Create singular_analysis_chat.py
Browse files
github_analytics/singular_analysis_chat.py
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from groq import Groq
|
2 |
+
|
3 |
+
import os
|
4 |
+
from dotenv import load_dotenv
|
5 |
+
load_dotenv()
|
6 |
+
|
7 |
+
|
8 |
+
def predict_2vars(data_a, data_b, a, b):
|
9 |
+
client = Groq(api_key=os.getenv("GROQ_API_KEY"))
|
10 |
+
completion = client.chat.completions.create(
|
11 |
+
model="llama3-70b-8192",
|
12 |
+
messages=[
|
13 |
+
{
|
14 |
+
"role": "system",
|
15 |
+
"content": f"""You are a Mentor proficient in GitHub.
|
16 |
+
|
17 |
+
Based on github repo data you have to suggest them things,
|
18 |
+
what repo should they contribute more to? Or which language they should do
|
19 |
+
more or where they lack.
|
20 |
+
Give Repo Contribution Suggestions
|
21 |
+
|
22 |
+
If you see any trends or patterns, do let me know.
|
23 |
+
for example: Trends & Patterns in your github profile:
|
24 |
+
|
25 |
+
Tell them Strength and Weaknesses of their data
|
26 |
+
Explicitly tell them what job are they suitable for in bullet points based on data
|
27 |
+
""",
|
28 |
+
},
|
29 |
+
{
|
30 |
+
"role": "user",
|
31 |
+
"content": f"""These are list of two data in which
|
32 |
+
{a} : {data_a} and {b} :{data_b}
|
33 |
+
Display the data in a tabular format way
|
34 |
+
Map it as indexes co-relate
|
35 |
+
|
36 |
+
"""
|
37 |
+
}
|
38 |
+
],
|
39 |
+
max_tokens=2048,
|
40 |
+
)
|
41 |
+
response = completion.choices[0].message.content
|
42 |
+
return response
|
43 |
+
|
44 |
+
|
45 |
+
def predict_df(df):
|
46 |
+
client = Groq(api_key=os.getenv("GROQ_API_KEY"))
|
47 |
+
completion = client.chat.completions.create(
|
48 |
+
model="llama3-70b-8192",
|
49 |
+
messages=[
|
50 |
+
{
|
51 |
+
"role": "system",
|
52 |
+
"content": f"""You are a Mentor proficient in GitHub.
|
53 |
+
Based on github repo data you have to suggest them things,
|
54 |
+
what repo should they contribute more to?
|
55 |
+
|
56 |
+
If you see any trends or patterns, do let me know.
|
57 |
+
for example: Trends & Patterns in your github profile:
|
58 |
+
|
59 |
+
Give Repo Contribution Suggestions
|
60 |
+
Tell them Strength and Weaknesses of their data.
|
61 |
+
Explicitly tell them what job are they suitable for in bullet points based on data
|
62 |
+
""",
|
63 |
+
},
|
64 |
+
{
|
65 |
+
"role": "user",
|
66 |
+
"content": f""" This is the list of data {df}
|
67 |
+
In it the columns are repo names, stars, forks, days since repo was created.
|
68 |
+
Display the entire data in a tabular format way
|
69 |
+
If you see any trends or patterns, do let me know.
|
70 |
+
For example: sometimes, a repo with less days is doing good,
|
71 |
+
so you can advise to mae it better so that it does even better
|
72 |
+
Map it as indexes co-relate.
|
73 |
+
Display the data in a tabular format way
|
74 |
+
"""
|
75 |
+
}
|
76 |
+
],
|
77 |
+
max_tokens=2048,
|
78 |
+
)
|
79 |
+
response = completion.choices[0].message.content
|
80 |
+
return response
|