MCPcopy
hub / github.com/llmware-ai/llmware / ner_lookup_retrieval

Function ner_lookup_retrieval

solutions/slim_agents/ner-retrieval.py:12–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10
11
12def 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
45if __name__ == "__main__":

Callers 1

ner-retrieval.pyFile · 0.85

Calls 7

load_workMethod · 0.95
load_toolMethod · 0.95
nerMethod · 0.95
LLMfxClass · 0.90
WikiParserClass · 0.90
itemsMethod · 0.80
add_wiki_topicMethod · 0.80

Tested by

no test coverage detected