from typing import List, Dict | |
from appsearch import AppSearchClient | |
def get_us_speeches() -> List[Dict]: | |
appsearch = AppSearchClient() | |
us_speeches = appsearch.list_existing_docs("us-speeches") | |
for items in us_speeches: | |
if "_meta" in items: | |
del items["_meta"] | |
us_speeches_dict = [ | |
{ | |
'content': speech["text"], | |
'meta': {'filename': speech["filename"], 'speaker': speech["speaker"], 'date': speech["date"], | |
'url': speech["url"]} | |
} for speech in us_speeches | |
] | |
return us_speeches_dict | |