()
| 10 | |
| 11 | |
| 12 | def ner_lookup_retrieval(): |
| 13 | |
| 14 | text = ("The new Miko Marks album is one of the best I have ever heard in a number of years. " |
| 15 | "She is definitely an artist worth exploring further.") |
| 16 | |
| 17 | # create agent |
| 18 | agent = LLMfx() |
| 19 | agent.load_work(text) |
| 20 | agent.load_tool("ner") |
| 21 | named_entities = agent.ner() |
| 22 | ner_dict= named_entities["llm_response"] |
| 23 | |
| 24 | # take named entities found and package into a lookup list |
| 25 | |
| 26 | lookup = [] |
| 27 | for keys, value in ner_dict.items(): |
| 28 | if value: |
| 29 | lookup.append(value) |
| 30 | |
| 31 | for entries in lookup: |
| 32 | |
| 33 | # run a wiki topic query with each of the named entities found |
| 34 | |
| 35 | wiki_info = WikiParser().add_wiki_topic(entries, target_results=1) |
| 36 | |
| 37 | print("update: wiki_info - ", wiki_info) |
| 38 | summary = wiki_info["articles"][0]["summary"] |
| 39 | |
| 40 | print("update: summary - ", summary) |
| 41 | |
| 42 | return 0 |
| 43 | |
| 44 | |
| 45 | if __name__ == "__main__": |
no test coverage detected