Add today date to query
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import tempfile
|
|
|
2 |
import gradio as gr
|
3 |
import janus_swi as janus
|
4 |
from crewai import Agent, Task, Crew
|
@@ -6,11 +7,21 @@ from crewai_tools import tool
|
|
6 |
from crewai_tools import MDXSearchTool
|
7 |
from crewai_tools import WebsiteSearchTool
|
8 |
from langchain_anthropic import ChatAnthropic
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
DOC_URL = 'https://secure.ssa.gov/apps10/poms.nsf/lnx/0500502100'
|
16 |
MODEL_NAME = "claude-3-5-sonnet-20240620"
|
@@ -142,7 +153,8 @@ crew = Crew(
|
|
142 |
|
143 |
|
144 |
def yes_man(user_query, history):
|
145 |
-
|
|
|
146 |
|
147 |
gr.ChatInterface(
|
148 |
yes_man,
|
|
|
1 |
import tempfile
|
2 |
+
import datetime
|
3 |
import gradio as gr
|
4 |
import janus_swi as janus
|
5 |
from crewai import Agent, Task, Crew
|
|
|
7 |
from crewai_tools import MDXSearchTool
|
8 |
from crewai_tools import WebsiteSearchTool
|
9 |
from langchain_anthropic import ChatAnthropic
|
10 |
+
|
11 |
+
|
12 |
+
def add_today_date_to_string(input_string: str) -> str:
|
13 |
+
"""Adds today's date to the given string in a natural language format.
|
14 |
+
|
15 |
+
Args:
|
16 |
+
input_string (str): The original string to which the date will be added.
|
17 |
+
|
18 |
+
Returns:
|
19 |
+
str: The modified string with today's date added in a natural language format.
|
20 |
+
"""
|
21 |
+
today = datetime.date.today()
|
22 |
+
formatted_date = today.strftime("%B %d, %Y")
|
23 |
+
return f"# Date\nToday is {formatted_date}.\n# Query\n{input_string}"
|
24 |
+
|
25 |
|
26 |
DOC_URL = 'https://secure.ssa.gov/apps10/poms.nsf/lnx/0500502100'
|
27 |
MODEL_NAME = "claude-3-5-sonnet-20240620"
|
|
|
153 |
|
154 |
|
155 |
def yes_man(user_query, history):
|
156 |
+
query = add_today_date_to_string(user_query)
|
157 |
+
return crew.kickoff(inputs={"query": query}).raw
|
158 |
|
159 |
gr.ChatInterface(
|
160 |
yes_man,
|