Spaces:
Sleeping
Sleeping
Update src/paper.py
Browse files- src/paper.py +7 -12
src/paper.py
CHANGED
|
@@ -2,7 +2,7 @@ import os
|
|
| 2 |
import json
|
| 3 |
import logging
|
| 4 |
from datetime import datetime, timedelta
|
| 5 |
-
from
|
| 6 |
from langchain.schema import SystemMessage, HumanMessage
|
| 7 |
|
| 8 |
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
|
|
@@ -16,7 +16,7 @@ class Agent:
|
|
| 16 |
self.goal = goal
|
| 17 |
self.backstory = backstory
|
| 18 |
self.personality = personality
|
| 19 |
-
self.tools = []
|
| 20 |
self.llm = llm
|
| 21 |
|
| 22 |
class Task:
|
|
@@ -29,14 +29,12 @@ class Task:
|
|
| 29 |
self.expected_output = expected_output
|
| 30 |
self.context = context or []
|
| 31 |
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
|
|
|
| 36 |
|
| 37 |
-
# -------------------------------------------------------------------------------
|
| 38 |
-
# Define Academic Research Agents
|
| 39 |
-
# -------------------------------------------------------------------------------
|
| 40 |
literature_research_agent = Agent(
|
| 41 |
role="Literature Research Agent",
|
| 42 |
goal="Research and provide a comprehensive review of existing literature on the research topic.",
|
|
@@ -85,9 +83,6 @@ chatbot_agent = Agent(
|
|
| 85 |
llm=llm,
|
| 86 |
)
|
| 87 |
|
| 88 |
-
# -------------------------------------------------------------------------------
|
| 89 |
-
# Define Tasks for Academic Research and Writing
|
| 90 |
-
# -------------------------------------------------------------------------------
|
| 91 |
literature_research_task = Task(
|
| 92 |
description="""Research academic literature on {topic} considering the keywords {keywords}.
|
| 93 |
|
|
|
|
| 2 |
import json
|
| 3 |
import logging
|
| 4 |
from datetime import datetime, timedelta
|
| 5 |
+
from langchain_groq import ChatGroq
|
| 6 |
from langchain.schema import SystemMessage, HumanMessage
|
| 7 |
|
| 8 |
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
|
|
|
|
| 16 |
self.goal = goal
|
| 17 |
self.backstory = backstory
|
| 18 |
self.personality = personality
|
| 19 |
+
self.tools = []
|
| 20 |
self.llm = llm
|
| 21 |
|
| 22 |
class Task:
|
|
|
|
| 29 |
self.expected_output = expected_output
|
| 30 |
self.context = context or []
|
| 31 |
|
| 32 |
+
groq_api_key = os.getenv("GROQ_API_KEY")
|
| 33 |
+
os.environ['GROQ_API_KEY'] = groq_api_key
|
| 34 |
+
if not groq_api_key:
|
| 35 |
+
logging.error("GROQ_API_KEY is not set in the environment variables.")
|
| 36 |
+
llm = ChatGroq(model="llama-3.3-70b-versatile",max_tokens = 4000)
|
| 37 |
|
|
|
|
|
|
|
|
|
|
| 38 |
literature_research_agent = Agent(
|
| 39 |
role="Literature Research Agent",
|
| 40 |
goal="Research and provide a comprehensive review of existing literature on the research topic.",
|
|
|
|
| 83 |
llm=llm,
|
| 84 |
)
|
| 85 |
|
|
|
|
|
|
|
|
|
|
| 86 |
literature_research_task = Task(
|
| 87 |
description="""Research academic literature on {topic} considering the keywords {keywords}.
|
| 88 |
|