Spaces:
Sleeping
Sleeping
RubenPeeters
commited on
Commit
·
47a0a0e
1
Parent(s):
fdd0d57
Change agents
Browse files
agents.py
CHANGED
@@ -33,6 +33,7 @@ model = OpenAIServerModel(
|
|
33 |
|
34 |
kgc_agent = CodeAgent(
|
35 |
tools=[get_types_from_ontology, get_entities_from_kg, get_relations_from_ontology],
|
|
|
36 |
model=model,
|
37 |
name="named_entity_recognition_expert",
|
38 |
description="An agent that is an expert in Named Entity Recognition. Named Entity Recognition (NER) is a subfield of computer science and Natural Language Processing (NLP) that focuses on identifying and classifying entities in unstructured text into predefined categories, such as persons, geographical locations and organizations. Provide content to this agent to detect the entities inside.",
|
@@ -40,6 +41,7 @@ kgc_agent = CodeAgent(
|
|
40 |
|
41 |
validation_agent = CodeAgent(
|
42 |
tools=[validate_rdf_syntax],
|
|
|
43 |
model=model,
|
44 |
name="knowledge_graph_expert",
|
45 |
description="Has extensive knowledge on knowledge graphs. Has the final say before writing the output to a file.",
|
|
|
33 |
|
34 |
kgc_agent = CodeAgent(
|
35 |
tools=[get_types_from_ontology, get_entities_from_kg, get_relations_from_ontology],
|
36 |
+
additional_authorized_imports=["rdflib"],
|
37 |
model=model,
|
38 |
name="named_entity_recognition_expert",
|
39 |
description="An agent that is an expert in Named Entity Recognition. Named Entity Recognition (NER) is a subfield of computer science and Natural Language Processing (NLP) that focuses on identifying and classifying entities in unstructured text into predefined categories, such as persons, geographical locations and organizations. Provide content to this agent to detect the entities inside.",
|
|
|
41 |
|
42 |
validation_agent = CodeAgent(
|
43 |
tools=[validate_rdf_syntax],
|
44 |
+
additional_authorized_imports=["rdflib"],
|
45 |
model=model,
|
46 |
name="knowledge_graph_expert",
|
47 |
description="Has extensive knowledge on knowledge graphs. Has the final say before writing the output to a file.",
|
app.py
CHANGED
@@ -14,10 +14,7 @@ def start_process(text):
|
|
14 |
Returns:
|
15 |
str: The reversed string.
|
16 |
"""
|
17 |
-
return manager_agent.run(f"Please derive a knowledge graph from the text between <TEXT></TEXT>. Do NOT look up new facts.
|
18 |
-
Named Entity Recognition, Entity Typing, Entity Linking, Coreference Resolution, Relation Extraction, and finally Knowledge Graph Validation. \
|
19 |
-
You don't currently have a validation tool, so use your best guess. \
|
20 |
-
Do make sure that your final output is a valid RDF file. \
|
21 |
<TEXT>{text}</TEXT>")
|
22 |
|
23 |
# Create the Gradio interface.
|
|
|
14 |
Returns:
|
15 |
str: The reversed string.
|
16 |
"""
|
17 |
+
return manager_agent.run(f"Please derive a knowledge graph from the text between <TEXT></TEXT>. Do NOT look up new facts. Make sure that your final output is a valid RDF file. \
|
|
|
|
|
|
|
18 |
<TEXT>{text}</TEXT>")
|
19 |
|
20 |
# Create the Gradio interface.
|