Update app.py
Browse files
app.py
CHANGED
@@ -482,7 +482,7 @@ def display_results(data):
|
|
482 |
# Add the generate_literature_survey function below your other function definitions
|
483 |
def generate_literature_survey(papers, api_key="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"):
|
484 |
"""
|
485 |
-
Generate a literature survey based on paper abstracts using Groq API with Llama-3.3-70B-
|
486 |
|
487 |
Parameters:
|
488 |
papers (list): List of papers with abstracts
|
@@ -522,14 +522,14 @@ Format your response with markdown headings for better readability.
|
|
522 |
"""
|
523 |
|
524 |
# Make the API request to Groq
|
525 |
-
url = "https://api.groq.com/openai/v1/completions" #
|
526 |
headers = {
|
527 |
"Authorization": f"Bearer {api_key}",
|
528 |
"Content-Type": "application/json"
|
529 |
}
|
530 |
|
531 |
data = {
|
532 |
-
"model": "llama-3.3-70b-
|
533 |
"messages": [
|
534 |
{"role": "system", "content": "You are an academic research assistant that creates comprehensive literature surveys."},
|
535 |
{"role": "user", "content": prompt}
|
@@ -555,7 +555,7 @@ Format your response with markdown headings for better readability.
|
|
555 |
|
556 |
# Example usage
|
557 |
papers = [
|
558 |
-
{"Title": "Sample Paper", "Author(s)": "
|
559 |
]
|
560 |
survey = generate_literature_survey(papers, api_key="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")
|
561 |
print(survey)
|
|
|
482 |
# Add the generate_literature_survey function below your other function definitions
|
483 |
def generate_literature_survey(papers, api_key="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"):
|
484 |
"""
|
485 |
+
Generate a literature survey based on paper abstracts using Groq API with Llama-3.3-70B-Instruct
|
486 |
|
487 |
Parameters:
|
488 |
papers (list): List of papers with abstracts
|
|
|
522 |
"""
|
523 |
|
524 |
# Make the API request to Groq
|
525 |
+
url = "https://api.groq.com/openai/v1/chat/completions" # Ensure this is the correct endpoint
|
526 |
headers = {
|
527 |
"Authorization": f"Bearer {api_key}",
|
528 |
"Content-Type": "application/json"
|
529 |
}
|
530 |
|
531 |
data = {
|
532 |
+
"model": "llama-3.3-70b-instruct", # Updated model name here
|
533 |
"messages": [
|
534 |
{"role": "system", "content": "You are an academic research assistant that creates comprehensive literature surveys."},
|
535 |
{"role": "user", "content": prompt}
|
|
|
555 |
|
556 |
# Example usage
|
557 |
papers = [
|
558 |
+
{"Title": "Sample Paper", "Author(s)": "Mahatir Ahmed Tusher", "Published": "2023", "Abstract": "This is a sample abstract with more than 50 characters to test the function."}
|
559 |
]
|
560 |
survey = generate_literature_survey(papers, api_key="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")
|
561 |
print(survey)
|