bano1's picture
Update utils/summarizer.py
c804045 verified
Raw
History Blame Contribute Delete
889 Bytes
from groq import Groq
from typing import List, Dict
def summarize_genes(
genes: List[str],
api_key: str
) -> Dict[str, str]:
client = Groq(api_key=api_key)
summaries = {}
for gene in genes:
prompt = f"""
You are a bioinformatics expert.
Explain the biological relevance of {gene} as a disease biomarker.
Include:
- Gene function
- Associated diseases
- Why it can be a biomarker
Keep the answer concise (2-3 sentences).
"""
response = client.chat.completions.create(
model="llama-3.1-8b-instant",
messages=[
{
"role": "user",
"content": prompt
}
],
temperature=0.3
)
summaries[gene] = response.choices[0].message.content
return summaries