Repository navigation
Expand file tree
/
Copy pathtestGroqAPI.py
More file actions
51 lines (39 loc) · 1.7 KB
/
Copy pathtestGroqAPI.py
File metadata and controls
51 lines (39 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from groq import Groq
from test import transcriptFinal
# Assuming you've imported transcriptFinal from another file
# from some_module import transcriptFinal
api_key = "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"
client = Groq(api_key=api_key)
# Define your prompt using the provided template
prompt = f"""
Using the following transcript:
{transcriptFinal}
1. Provide a funny text
2. Relate the funny text to an educational question derived from the transcript
3. Provide 4 possible answers
4. Provide the correct answer
5. Provide ten of these
6. The content should be relevant to the entire transcript provided
7. Follow this template strictly and add no other symbol or text:
Create ten funny memes for the topic following this exact template from the funniest to least funniest:
Joke {{INSERT JOKE NUMBER}}: {{INSERT JOKE RELATED TO THE TRANSCRIPT WITH ANSWER}}
Question {{INSERT QUESTION NUMBER}}: {{INSERT EDUCATIONAL QUESTION RELATED TO THE JOKE AND TRANSCRIPT}}
Option 1: {{INSERT CORRECT OR INCORRECT OPTION 1}}
Option 2: {{INSERT CORRECT OR INCORRECT OPTION 2}}
Option 3: {{INSERT CORRECT OR INCORRECT OPTION 3}}
Option 4: {{INSERT CORRECT OR INCORRECT OPTION 4}}
Answer: {{INSERT CORRECT OPTION NUMBER}}
Ensure the jokes and questions are related to the transcript, and include exactly four answer choices with only one correct answer. Follow the template precisely and avoid adding any extra information.
"""
# Send the prompt to the API
chat_completion = client.chat.completions.create(
messages=[
{
"role": "user",
"content": prompt,
}
],
model="llama3-8b-8192",
)
# Print the response
print(chat_completion.choices[0].message.content)