Spaces:
Sleeping
Sleeping
WilliamGazeley
commited on
Commit
·
c2bd3f5
1
Parent(s):
033ecfe
Pass analysis meta data to model
Browse files- src/functions.py +8 -2
src/functions.py
CHANGED
@@ -4,6 +4,7 @@ import requests
|
|
4 |
import pandas as pd
|
5 |
import yfinance as yf
|
6 |
import concurrent.futures
|
|
|
7 |
|
8 |
from typing import List
|
9 |
from bs4 import BeautifulSoup
|
@@ -34,7 +35,7 @@ def get_analysis(query: str) -> dict:
|
|
34 |
results = az_search_client.search(
|
35 |
query_type="simple",
|
36 |
search_text=query,
|
37 |
-
select="title,content",
|
38 |
include_total_count=True,
|
39 |
top=config.az_search_top_k
|
40 |
)
|
@@ -42,7 +43,12 @@ def get_analysis(query: str) -> dict:
|
|
42 |
output = []
|
43 |
for x in results:
|
44 |
if x["@search.score"] >= config.az_search_min_score:
|
45 |
-
output.append({
|
|
|
|
|
|
|
|
|
|
|
46 |
return output
|
47 |
|
48 |
@tool
|
|
|
4 |
import pandas as pd
|
5 |
import yfinance as yf
|
6 |
import concurrent.futures
|
7 |
+
from datetime import datetime
|
8 |
|
9 |
from typing import List
|
10 |
from bs4 import BeautifulSoup
|
|
|
35 |
results = az_search_client.search(
|
36 |
query_type="simple",
|
37 |
search_text=query,
|
38 |
+
select="title,content,asset_name,write_date",
|
39 |
include_total_count=True,
|
40 |
top=config.az_search_top_k
|
41 |
)
|
|
|
43 |
output = []
|
44 |
for x in results:
|
45 |
if x["@search.score"] >= config.az_search_min_score:
|
46 |
+
output.append({
|
47 |
+
"security": x["asset_name"],
|
48 |
+
"date written": datetime.strptime(x["write_date"], "%Y%m%d").date(),
|
49 |
+
"title": x["title"],
|
50 |
+
"content": x["content"]
|
51 |
+
})
|
52 |
return output
|
53 |
|
54 |
@tool
|