Spaces:
Sleeping
Sleeping
added quarter
Browse files
app.py
CHANGED
@@ -44,23 +44,24 @@ def create_tools(cfg):
|
|
44 |
"""
|
45 |
return years
|
46 |
|
47 |
-
class
|
48 |
query: str = Field(..., description="The user query.")
|
49 |
year: int = Field(..., description=f"The year. an integer between {min(years)} and {max(years)}.")
|
|
|
50 |
ticker: str = Field(..., description=f"The company ticker. Must be a valid ticket symbol from the list {tickers.keys()}.")
|
51 |
|
52 |
tools_factory = ToolsFactory(vectara_api_key=cfg.api_key,
|
53 |
vectara_customer_id=cfg.customer_id,
|
54 |
vectara_corpus_id=cfg.corpus_id)
|
55 |
-
|
56 |
-
tool_name = "
|
57 |
tool_description = """
|
58 |
Given a company name and year,
|
59 |
-
returns a response (str) to a user query based on analyst
|
60 |
make sure to provide the a valid company ticker and year.
|
61 |
""",
|
62 |
-
tool_args_schema =
|
63 |
-
tool_filter_template = "doc.year = {year} and doc.ticker = '{ticker}'",
|
64 |
reranker = "multilingual_reranker_v1", rerank_k = 100,
|
65 |
n_sentences_before = 2, n_sentences_after = 2, lambda_val = 0.01,
|
66 |
summary_num_results = 10,
|
@@ -76,7 +77,7 @@ def create_tools(cfg):
|
|
76 |
tools_factory.standard_tools() +
|
77 |
tools_factory.financial_tools() +
|
78 |
tools_factory.guardrail_tools() +
|
79 |
-
[
|
80 |
)
|
81 |
|
82 |
def initialize_agent(agent_type: AgentType, _cfg):
|
|
|
44 |
"""
|
45 |
return years
|
46 |
|
47 |
+
class QueryTranscriptsArgs(BaseModel):
|
48 |
query: str = Field(..., description="The user query.")
|
49 |
year: int = Field(..., description=f"The year. an integer between {min(years)} and {max(years)}.")
|
50 |
+
quarter: int = Field(..., description="The quarter. an integer between 1 and 4.")
|
51 |
ticker: str = Field(..., description=f"The company ticker. Must be a valid ticket symbol from the list {tickers.keys()}.")
|
52 |
|
53 |
tools_factory = ToolsFactory(vectara_api_key=cfg.api_key,
|
54 |
vectara_customer_id=cfg.customer_id,
|
55 |
vectara_corpus_id=cfg.corpus_id)
|
56 |
+
ask_transcripts = tools_factory.create_rag_tool(
|
57 |
+
tool_name = "ask_transcripts",
|
58 |
tool_description = """
|
59 |
Given a company name and year,
|
60 |
+
returns a response (str) to a user query based on analyst transcripts about the company's financial reports for that year.
|
61 |
make sure to provide the a valid company ticker and year.
|
62 |
""",
|
63 |
+
tool_args_schema = QueryTranscriptsArgs,
|
64 |
+
tool_filter_template = "doc.year = {year} and doc.quarter = {quarter} and doc.ticker = '{ticker}'",
|
65 |
reranker = "multilingual_reranker_v1", rerank_k = 100,
|
66 |
n_sentences_before = 2, n_sentences_after = 2, lambda_val = 0.01,
|
67 |
summary_num_results = 10,
|
|
|
77 |
tools_factory.standard_tools() +
|
78 |
tools_factory.financial_tools() +
|
79 |
tools_factory.guardrail_tools() +
|
80 |
+
[ask_transcripts]
|
81 |
)
|
82 |
|
83 |
def initialize_agent(agent_type: AgentType, _cfg):
|