aurelian 0.3.3__py3-none-any.whl → 0.4.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. aurelian/agents/biblio/biblio_agent.py +1 -0
  2. aurelian/agents/checklist/checklist_agent.py +1 -0
  3. aurelian/agents/chemistry/chemistry_agent.py +2 -1
  4. aurelian/agents/d4d/__init__.py +2 -2
  5. aurelian/agents/d4d/d4d_agent.py +4 -3
  6. aurelian/agents/d4d/d4d_gradio.py +2 -2
  7. aurelian/agents/diagnosis/diagnosis_agent.py +1 -0
  8. aurelian/agents/gocam/__init__.py +10 -1
  9. aurelian/agents/gocam/gocam_agent.py +3 -0
  10. aurelian/agents/gocam/gocam_evals.py +0 -3
  11. aurelian/agents/linkml/linkml_mcp.py +1 -6
  12. aurelian/agents/literature/literature_agent.py +20 -0
  13. aurelian/agents/monarch/__init__.py +0 -25
  14. aurelian/agents/monarch/monarch_agent.py +1 -0
  15. aurelian/agents/monarch/monarch_tools.py +0 -1
  16. aurelian/agents/ontology_mapper/ontology_mapper_agent.py +1 -0
  17. aurelian/agents/paperqa/__init__.py +27 -0
  18. aurelian/agents/paperqa/paperqa_agent.py +66 -0
  19. aurelian/agents/paperqa/paperqa_cli.py +305 -0
  20. aurelian/agents/paperqa/paperqa_config.py +142 -0
  21. aurelian/agents/paperqa/paperqa_gradio.py +90 -0
  22. aurelian/agents/paperqa/paperqa_mcp.py +155 -0
  23. aurelian/agents/paperqa/paperqa_tools.py +566 -0
  24. aurelian/agents/rag/rag_agent.py +1 -0
  25. aurelian/agents/talisman/talisman_mcp.py +50 -143
  26. aurelian/agents/ubergraph/ubergraph_agent.py +1 -0
  27. aurelian/agents/uniprot/__init__.py +0 -37
  28. aurelian/agents/web/web_tools.py +16 -3
  29. aurelian/cli.py +36 -0
  30. aurelian/evaluators/model.py +9 -0
  31. aurelian/evaluators/substring_evaluator.py +30 -0
  32. aurelian/utils/async_utils.py +6 -3
  33. {aurelian-0.3.3.dist-info → aurelian-0.4.1.dist-info}/METADATA +8 -4
  34. {aurelian-0.3.3.dist-info → aurelian-0.4.1.dist-info}/RECORD +37 -28
  35. {aurelian-0.3.3.dist-info → aurelian-0.4.1.dist-info}/WHEEL +1 -1
  36. aurelian-0.4.1.dist-info/entry_points.txt +4 -0
  37. aurelian-0.3.3.dist-info/entry_points.txt +0 -3
  38. {aurelian-0.3.3.dist-info → aurelian-0.4.1.dist-info}/LICENSE +0 -0
@@ -30,6 +30,7 @@ biblio_agent = Agent(
30
30
  " tables for this. Use your judgment in how to roll up tables, and whether values"
31
31
  " should be present/absent, increased/decreased, or more specific."
32
32
  ),
33
+ defer_model_check=True,
33
34
  )
34
35
 
35
36
 
@@ -22,6 +22,7 @@ checklist_agent = Agent(
22
22
  "\nThe available checklists are:"
23
23
  ),
24
24
  deps_type=ChecklistDependencies,
25
+ defer_model_check=True,
25
26
  )
26
27
 
27
28
 
@@ -39,7 +39,8 @@ chemistry_agent = Agent(
39
39
  Tool(retrieve_chemistry_web_page),
40
40
  Tool(inspect_file),
41
41
  Tool(list_files),
42
- ]
42
+ ],
43
+ defer_model_check=True,
43
44
  )
44
45
 
45
46
  # Remove the chat import to avoid circular imports
@@ -3,7 +3,7 @@ D4D (Datasheets for Datasets) agent package for extracting dataset metadata.
3
3
  """
4
4
 
5
5
  # isort: skip_file
6
- from .d4d_agent import data_sheets_agent # noqa: E402
6
+ from .d4d_agent import d4d_agent # noqa: E402
7
7
  from .d4d_config import D4DConfig, get_config # noqa: E402
8
8
  from .d4d_gradio import chat # noqa: E402
9
9
  from .d4d_tools import ( # noqa: E402
@@ -14,7 +14,7 @@ from .d4d_tools import ( # noqa: E402
14
14
 
15
15
  __all__ = [
16
16
  # Agent
17
- "data_sheets_agent",
17
+ "d4d_agent",
18
18
 
19
19
  # Config
20
20
  "D4DConfig",
@@ -8,7 +8,7 @@ from .d4d_tools import get_full_schema, process_website_or_pdf
8
8
 
9
9
 
10
10
  # Create the agent, the full schema will be loaded when needed
11
- data_sheets_agent = Agent(
11
+ d4d_agent = Agent(
12
12
  model="openai:gpt-4o",
13
13
  deps_type=D4DConfig,
14
14
  system_prompt="""
@@ -21,10 +21,11 @@ content, extract all the relevant metadata, and output a YAML document that exac
21
21
  conforms to the above schema. The output must be valid YAML with all required fields
22
22
  filled in, following the schema exactly.
23
23
  """,
24
+ defer_model_check=True,
24
25
  )
25
26
 
26
27
 
27
- @data_sheets_agent.system_prompt
28
+ @d4d_agent.system_prompt
28
29
  async def add_schema(ctx: RunContext[D4DConfig]) -> str:
29
30
  """
30
31
  Add the full schema to the system prompt.
@@ -39,7 +40,7 @@ async def add_schema(ctx: RunContext[D4DConfig]) -> str:
39
40
  return schema
40
41
 
41
42
 
42
- @data_sheets_agent.tool
43
+ @d4d_agent.tool
43
44
  async def extract_metadata(ctx: RunContext[D4DConfig], url: str) -> str:
44
45
  """
45
46
  Extract metadata from a dataset description document or webpage.
@@ -5,7 +5,7 @@ from typing import List, Optional
5
5
 
6
6
  import gradio as gr
7
7
 
8
- from .d4d_agent import data_sheets_agent
8
+ from .d4d_agent import d4d_agent
9
9
  from .d4d_config import D4DConfig, get_config
10
10
 
11
11
 
@@ -22,7 +22,7 @@ async def process_url(url: str, history: List[str], config: D4DConfig) -> str:
22
22
  YAML formatted metadata
23
23
  """
24
24
  # Run the agent with the URL
25
- result = await data_sheets_agent.run(url, deps=config)
25
+ result = await d4d_agent.run(url, deps=config)
26
26
  return result.data
27
27
 
28
28
 
@@ -44,6 +44,7 @@ diagnosis_agent = Agent(
44
44
  deps_type=DiagnosisDependencies,
45
45
  result_type=str,
46
46
  system_prompt=DIAGNOSIS_SYSTEM_PROMPT,
47
+ defer_model_check=True,
47
48
  )
48
49
 
49
50
  # Register tools
@@ -3,11 +3,13 @@ GOCAM agent module for working with Gene Ontology Causal Activity Models.
3
3
  """
4
4
  from pathlib import Path
5
5
 
6
+ from ...evaluators.substring_evaluator import SubstringEvaluator
7
+
6
8
  THIS_DIR = Path(__file__).parent
7
9
  DOCUMENTS_DIR = THIS_DIR / "documents"
8
10
 
9
11
  # isort: skip_file
10
- from .gocam_agent import gocam_agent # noqa: E402
12
+ from .gocam_agent import gocam_agent, gocam_reviewer_agent, gocam_review_summarizer_agent # noqa: E402
11
13
  from .gocam_config import GOCAMDependencies, get_config # noqa: E402
12
14
  from .gocam_gradio import chat # noqa: E402
13
15
  from .gocam_tools import ( # noqa: E402
@@ -18,6 +20,7 @@ from .gocam_tools import ( # noqa: E402
18
20
  fetch_document,
19
21
  validate_gocam_model,
20
22
  )
23
+ from .gocam_evals import create_eval_dataset # noqa: E402
21
24
 
22
25
  __all__ = [
23
26
  # Constants
@@ -26,6 +29,8 @@ __all__ = [
26
29
 
27
30
  # Agent
28
31
  "gocam_agent",
32
+ "gocam_reviewer_agent",
33
+ "gocam_review_summarizer_agent",
29
34
  # Config
30
35
  "GOCAMDependencies",
31
36
  "get_config",
@@ -40,4 +45,8 @@ __all__ = [
40
45
 
41
46
  # Gradio
42
47
  "chat",
48
+
49
+ # Evals
50
+ "create_eval_dataset",
51
+ "SubstringEvaluator",
43
52
  ]
@@ -135,6 +135,7 @@ gocam_agent = Agent(
135
135
  deps_type=GOCAMDependencies,
136
136
  system_prompt=SYSTEM,
137
137
  tools=core_tools,
138
+ defer_model_check=True,
138
139
  )
139
140
 
140
141
  def get_documents_for_prompt() -> str:
@@ -208,6 +209,7 @@ gocam_reviewer_agent = Agent(
208
209
  Tool(lookup_gocam_local),
209
210
  #Tool(validate_gocam_model),
210
211
  ],
212
+ defer_model_check=True,
211
213
  )
212
214
 
213
215
 
@@ -237,4 +239,5 @@ gocam_review_summarizer_agent = Agent(
237
239
  #Tool(lookup_gocam_local),
238
240
  ],
239
241
  result_type=GOCamReviewSummary,
242
+ defer_model_check=True,
240
243
  )
@@ -14,9 +14,6 @@ from pydantic_evals import Case, Dataset
14
14
  from aurelian.agents.gocam.gocam_agent import gocam_agent
15
15
  from aurelian.agents.gocam.gocam_config import GOCAMDependencies
16
16
 
17
- class GOCAMMetadata(Dict[str, Any]):
18
- """Simple metadata dictionary for GO-CAM evaluations."""
19
- pass
20
17
 
21
18
  # Define individual evaluation cases
22
19
  case1 = Case(
@@ -56,7 +56,6 @@ async def inspect_file(data_file: str) -> str:
56
56
  Inspect a file in the working directory.
57
57
 
58
58
  Args:
59
- ctx:
60
59
  data_file: name of file
61
60
 
62
61
  Returns:
@@ -71,7 +70,6 @@ async def list_files() -> str:
71
70
  List files in the working directory.
72
71
 
73
72
  Args:
74
- ctx:
75
73
 
76
74
  Returns:
77
75
 
@@ -84,7 +82,6 @@ async def write_to_file(data: str, file_name: str) -> str:
84
82
  Write data to a file in the working directory.
85
83
 
86
84
  Args:
87
- ctx:
88
85
  data:
89
86
  file_name:
90
87
 
@@ -104,7 +101,6 @@ async def validate_data(schema: str, data_file: str) -> str:
104
101
  You can write data to the working directory using the `write_to_file` tool.
105
102
 
106
103
  Args:
107
- ctx:
108
104
  schema: the schema (as a YAML string)
109
105
  data_file: the name of the data file in the working directory
110
106
 
@@ -167,7 +163,6 @@ async def download_web_page(url: str, local_file_name: str) -> str:
167
163
  Download contents of a web page.
168
164
 
169
165
  Args:
170
- ctx:
171
166
  url: URL of the web page
172
167
  local_file_name: Name of the local file to save the
173
168
 
@@ -183,4 +178,4 @@ async def download_web_page(url: str, local_file_name: str) -> str:
183
178
 
184
179
  if __name__ == "__main__":
185
180
  # Initialize and run the server
186
- mcp.run(transport='stdio')
181
+ mcp.run(transport='stdio')
@@ -1,6 +1,7 @@
1
1
  """
2
2
  Agent for working with scientific literature and publications.
3
3
  """
4
+ from aurelian.agents.web.web_tools import perplexity_query
4
5
  from aurelian.agents.literature.literature_config import LiteratureDependencies
5
6
  from aurelian.agents.literature.literature_tools import (
6
7
  lookup_pmid,
@@ -48,6 +49,25 @@ literature_agent = Agent(
48
49
  Tool(get_article_abstract),
49
50
  Tool(extract_text_from_pdf_url),
50
51
  Tool(search_literature_web),
52
+ #Tool(perplexity_query),
53
+ Tool(retrieve_literature_page),
54
+ Tool(inspect_file),
55
+ Tool(list_files),
56
+ ]
57
+ )
58
+
59
+ advanced_literature_agent = Agent(
60
+ model="openai:gpt-4o",
61
+ deps_type=LiteratureDependencies,
62
+ system_prompt=SYSTEM,
63
+ tools=[
64
+ Tool(lookup_pmid),
65
+ Tool(lookup_doi),
66
+ Tool(convert_pmid_to_doi),
67
+ Tool(convert_doi_to_pmid),
68
+ Tool(get_article_abstract),
69
+ Tool(extract_text_from_pdf_url),
70
+ Tool(perplexity_query),
51
71
  Tool(retrieve_literature_page),
52
72
  Tool(inspect_file),
53
73
  Tool(list_files),
@@ -1,25 +0,0 @@
1
- """
2
- Monarch agent package for interacting with the Monarch Knowledge Base.
3
- """
4
-
5
- from .monarch_agent import monarch_agent, MONARCH_SYSTEM_PROMPT
6
- from .monarch_config import MonarchDependencies, get_config
7
- from .monarch_gradio import chat
8
- from .monarch_tools import find_gene_associations, find_disease_associations
9
-
10
- __all__ = [
11
- # Agent
12
- "monarch_agent",
13
- "MONARCH_SYSTEM_PROMPT",
14
-
15
- # Config
16
- "MonarchDependencies",
17
- "get_config",
18
-
19
- # Tools
20
- "find_gene_associations",
21
- "find_disease_associations",
22
-
23
- # Gradio
24
- "chat",
25
- ]
@@ -37,6 +37,7 @@ monarch_agent = Agent(
37
37
  model="openai:gpt-4o",
38
38
  system_prompt=MONARCH_SYSTEM_PROMPT,
39
39
  deps_type=MonarchDependencies,
40
+ defer_model_check=True,
40
41
  )
41
42
 
42
43
  # Register the tools with the agent
@@ -7,7 +7,6 @@ from typing import Dict, List, Optional
7
7
  from pydantic_ai import RunContext, ModelRetry
8
8
 
9
9
  from aurelian.utils.data_utils import obj_to_dict
10
- from aurelian.utils.async_utils import run_sync
11
10
  from .monarch_config import MonarchDependencies, get_config
12
11
 
13
12
 
@@ -39,6 +39,7 @@ ontology_mapper_agent = Agent(
39
39
  deps_type=OntologyMapperDependencies,
40
40
  result_type=str,
41
41
  system_prompt=ONTOLOGY_MAPPER_SYSTEM_PROMPT,
42
+ defer_model_check=True,
42
43
  )
43
44
 
44
45
  # Register the tools with the agent
@@ -0,0 +1,27 @@
1
+ """
2
+ PaperQA agent package for scientific literature search and analysis.
3
+ """
4
+
5
+ # isort: skip_file
6
+ from .paperqa_agent import paperqa_agent # noqa: E402
7
+ from .paperqa_config import PaperQADependencies, get_config # noqa: E402
8
+ from .paperqa_gradio import chat # noqa: E402
9
+ from .paperqa_tools import ( # noqa: E402
10
+ search_papers,
11
+ query_papers,
12
+ add_paper,
13
+ add_papers,
14
+ list_papers,
15
+ )
16
+
17
+ __all__ = [
18
+ "paperqa_agent",
19
+ "PaperQADependencies",
20
+ "get_config",
21
+ "search_papers",
22
+ "query_papers",
23
+ "add_paper",
24
+ "add_papers",
25
+ "list_papers",
26
+ "chat",
27
+ ]
@@ -0,0 +1,66 @@
1
+ """
2
+ Agent for PaperQA integration with Aurelian.
3
+ """
4
+ import logging
5
+ from pydantic_ai import Agent
6
+
7
+ paperqa_logger = logging.getLogger("aurelian.agents.paperqa")
8
+ paperqa_logger.setLevel(logging.INFO)
9
+
10
+ for handler in list(paperqa_logger.handlers):
11
+ paperqa_logger.removeHandler(handler)
12
+
13
+ console = logging.StreamHandler()
14
+ console.setLevel(logging.INFO)
15
+ formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
16
+ console.setFormatter(formatter)
17
+ paperqa_logger.addHandler(console)
18
+
19
+ paperqa_logger.propagate = False
20
+
21
+ from .paperqa_config import PaperQADependencies
22
+ from .paperqa_tools import (
23
+ search_papers,
24
+ query_papers,
25
+ add_paper,
26
+ add_papers,
27
+ list_papers,
28
+ build_index
29
+ )
30
+
31
+ PAPERQA_SYSTEM_PROMPT = """
32
+ You are an AI assistant that helps explore scientific literature using PaperQA.
33
+ You can use different functions to search for papers and analyze them:
34
+ - `search_papers` to find papers by topic or keyword from outside this repository.
35
+ - `query_papers` to ask questions about the papers in the repository
36
+ - `add_paper` to add a specific paper by file path or URL (with auto_index=True by default)
37
+ - `add_papers` to add multiple papers from a directory (with auto_index=True by default)
38
+ - `list_papers` to see all papers in the collection
39
+ - `build_index` to manually rebuild the search index
40
+
41
+ When adding papers with `add_paper` or `add_papers`:
42
+ - For `add_paper`, the URL must be a direct link to a PDF (e.g., "https://example.com/paper.pdf")
43
+ - For `add_paper`, you can provide a citation string to attribute the source
44
+ - For `add_papers`, you provide a directory containing papers and an optional citation format
45
+ - By default, auto_index=True, which automatically rebuilds the index after adding papers
46
+ - You can set auto_index=False if you want to add multiple papers before indexing
47
+ - After adding papers with auto_index=False, use `build_index()` to make them searchable
48
+
49
+ When showing paper information, format using Markdown for readability.
50
+ When papers have been successfully retrieved, proceed to analyzing them.
51
+ """
52
+
53
+ paperqa_agent = Agent(
54
+ model="openai:gpt-4o-2024-11-20",
55
+ deps_type=PaperQADependencies,
56
+ result_type=str,
57
+ system_prompt=PAPERQA_SYSTEM_PROMPT,
58
+ defer_model_check=True,
59
+ )
60
+
61
+ paperqa_agent.tool(search_papers)
62
+ paperqa_agent.tool(query_papers)
63
+ paperqa_agent.tool(add_paper)
64
+ paperqa_agent.tool(add_papers)
65
+ paperqa_agent.tool(list_papers)
66
+ paperqa_agent.tool(build_index)