cv / groq_api.py
saherPervaiz's picture
Create groq_api.py
84bc138 verified
raw
history blame
681 Bytes
# groq_api.py
import os
import openai
# Set your Groq API key
openai.api_key = os.getenv("GROQ_API_KEY")
openai.api_base = "https://api.groq.com/openai/v1"
MODEL_NAME = "mixtral-8x7b-32768" # You can change to another Groq-supported model
def get_summary(jd_text, matched_cvs):
joined_cvs = "\n\n".join(matched_cvs)
prompt = f"""
Given the following job description:
{jd_text}
And these CVs:
{joined_cvs}
Summarize which candidates best match the job description and why:
"""
response = openai.ChatCompletion.create(
model=MODEL_NAME,
messages=[{"role": "user", "content": prompt}]
)
return response.choices[0].message.content.strip()