Spaces:
Running
Running
bugfix
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ import os
|
|
5 |
from PIL import Image
|
6 |
import re
|
7 |
import sys
|
|
|
8 |
|
9 |
from pydantic import Field, BaseModel
|
10 |
from vectara_agent.agent import Agent, AgentType, AgentStatusType
|
@@ -79,16 +80,15 @@ def create_tools(cfg):
|
|
79 |
|
80 |
@st.cache_resource
|
81 |
def initialize_agent(agent_type: AgentType, _cfg):
|
82 |
-
|
83 |
-
|
84 |
-
-
|
85 |
-
-
|
86 |
-
-
|
87 |
-
-
|
|
|
88 |
- If you calculate a metric, make sure you have all the necessary information to complete the calculation. Don't guess.
|
89 |
-
- Report financial data in a consistent manner. For example if you report revenue in thousands, always report revenue in thousands.
|
90 |
- Be very careful not to report results you are not confident about.
|
91 |
-
- Report results in the most relevant multiple. For example, revenues in millions, not thousands.
|
92 |
"""
|
93 |
|
94 |
def update_func(status_type: AgentStatusType, msg: str):
|
@@ -129,8 +129,7 @@ def launch_bot(agent_type: AgentType):
|
|
129 |
st.markdown("## Welcome to the financial assistant demo.\n\n\n")
|
130 |
companies = ", ".join(tickers.values())
|
131 |
st.markdown(
|
132 |
-
f"This assistant can help you with any questions about the financials of
|
133 |
-
"You can ask questions, analyze data, provide insights, or summarize any information from financial reports."
|
134 |
)
|
135 |
|
136 |
st.markdown("\n\n")
|
|
|
5 |
from PIL import Image
|
6 |
import re
|
7 |
import sys
|
8 |
+
import datetime
|
9 |
|
10 |
from pydantic import Field, BaseModel
|
11 |
from vectara_agent.agent import Agent, AgentType, AgentStatusType
|
|
|
80 |
|
81 |
@st.cache_resource
|
82 |
def initialize_agent(agent_type: AgentType, _cfg):
|
83 |
+
date = datetime.datetime.now().strftime("%Y-%m-%d")
|
84 |
+
financial_bot_instructions = f"""
|
85 |
+
- You are a helpful financial assistant, with expertise in finanal reporting, in conversation with a user.
|
86 |
+
- Today's date is {date}.
|
87 |
+
- Report in a concise and clear manner, and provide the most relevant information to the user.
|
88 |
+
- Respond in a concise format by using appropriate units of measure (e.g., K for thousands, M for millions, B for billions).
|
89 |
+
- Use tools when available instead of depending on your own knowledge.
|
90 |
- If you calculate a metric, make sure you have all the necessary information to complete the calculation. Don't guess.
|
|
|
91 |
- Be very careful not to report results you are not confident about.
|
|
|
92 |
"""
|
93 |
|
94 |
def update_func(status_type: AgentStatusType, msg: str):
|
|
|
129 |
st.markdown("## Welcome to the financial assistant demo.\n\n\n")
|
130 |
companies = ", ".join(tickers.values())
|
131 |
st.markdown(
|
132 |
+
f"This assistant can help you with any questions about the financials of several companies:\n\n **{companies}**.\n"
|
|
|
133 |
)
|
134 |
|
135 |
st.markdown("\n\n")
|