aurelian 0.4.1__py3-none-any.whl → 0.4.2__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.
- aurelian/agents/ubergraph/ubergraph_tools.py +18 -6
- {aurelian-0.4.1.dist-info → aurelian-0.4.2.dist-info}/METADATA +1 -1
- {aurelian-0.4.1.dist-info → aurelian-0.4.2.dist-info}/RECORD +6 -6
- {aurelian-0.4.1.dist-info → aurelian-0.4.2.dist-info}/LICENSE +0 -0
- {aurelian-0.4.1.dist-info → aurelian-0.4.2.dist-info}/WHEEL +0 -0
- {aurelian-0.4.1.dist-info → aurelian-0.4.2.dist-info}/entry_points.txt +0 -0
@@ -4,9 +4,9 @@ Tools for interacting with the UberGraph SPARQL endpoint.
|
|
4
4
|
import asyncio
|
5
5
|
from typing import Any, Dict, List, Optional
|
6
6
|
|
7
|
+
import requests
|
7
8
|
from pydantic import BaseModel
|
8
9
|
from pydantic_ai import RunContext, ModelRetry
|
9
|
-
from SPARQLWrapper import JSON, SPARQLWrapper
|
10
10
|
|
11
11
|
from .ubergraph_config import Dependencies, get_config
|
12
12
|
|
@@ -88,13 +88,23 @@ async def query_ubergraph(ctx: RunContext[Dependencies], query: str) -> QueryRes
|
|
88
88
|
print("##")
|
89
89
|
|
90
90
|
try:
|
91
|
-
#
|
92
|
-
|
93
|
-
|
94
|
-
|
91
|
+
# Define a function to execute in a thread pool
|
92
|
+
def run_query():
|
93
|
+
response = requests.post(
|
94
|
+
endpoint,
|
95
|
+
data={
|
96
|
+
'query': prefixed_query,
|
97
|
+
},
|
98
|
+
headers={
|
99
|
+
'Accept': 'application/sparql-results+json',
|
100
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
101
|
+
}
|
102
|
+
)
|
103
|
+
response.raise_for_status() # Raise an exception for HTTP errors
|
104
|
+
return response.json()
|
95
105
|
|
96
106
|
# Execute the query in a thread pool
|
97
|
-
ret = await asyncio.to_thread(
|
107
|
+
ret = await asyncio.to_thread(run_query)
|
98
108
|
|
99
109
|
# Process the results
|
100
110
|
results = simplify_results(ret, prefixes, limit=config.max_results)
|
@@ -105,6 +115,8 @@ async def query_ubergraph(ctx: RunContext[Dependencies], query: str) -> QueryRes
|
|
105
115
|
raise ModelRetry(f"No results found for SPARQL query. Try refining your query.")
|
106
116
|
|
107
117
|
return QueryResults(results=results)
|
118
|
+
except requests.RequestException as e:
|
119
|
+
raise ModelRetry(f"Error connecting to SPARQL endpoint: {str(e)}")
|
108
120
|
except Exception as e:
|
109
121
|
if "ModelRetry" in str(type(e)):
|
110
122
|
raise e
|
@@ -215,7 +215,7 @@ aurelian/agents/ubergraph/ubergraph_agent.py,sha256=dW1IG35w7OgNgC5SDgNFB6K2RJCs
|
|
215
215
|
aurelian/agents/ubergraph/ubergraph_config.py,sha256=Fi2hFVu92v55IinNYFlLjdvt9THXtRFPkSEcXtTrC10,2774
|
216
216
|
aurelian/agents/ubergraph/ubergraph_gradio.py,sha256=Gig_3AK0B4AkfvjlNklHkr87z2vcphll2I9DLgfdmdU,1372
|
217
217
|
aurelian/agents/ubergraph/ubergraph_mcp.py,sha256=p_YbEkSF4yN0T5OJ8FKIkuOtutOYvFL3TJDtJydSnws,2475
|
218
|
-
aurelian/agents/ubergraph/ubergraph_tools.py,sha256=
|
218
|
+
aurelian/agents/ubergraph/ubergraph_tools.py,sha256=OtyqOyRviuBInCuMwK5dn1jaFJRJIZq6QFImqK3uFWk,3909
|
219
219
|
aurelian/agents/uniprot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
220
220
|
aurelian/agents/uniprot/uniprot_agent.py,sha256=KMTRKGVpRpSchz7YEShh9ZSSGHzmeaGEUaNFKJPDWSI,1648
|
221
221
|
aurelian/agents/uniprot/uniprot_config.py,sha256=YhL265Z0GnTeXINHawe5iMcpR2ETLmdY3XhNXcYIc8w,1404
|
@@ -259,8 +259,8 @@ aurelian/utils/pubmed_utils.py,sha256=Gk00lu1Lv0GRSNeF5M4zplp3UMSpe5byCaVKCJimUH
|
|
259
259
|
aurelian/utils/pytest_report_to_markdown.py,sha256=WH1NlkVYj0UfUqpXjRD1KMpkMgEW3qev3fDdPvZG9Yw,1406
|
260
260
|
aurelian/utils/robot_ontology_utils.py,sha256=aaRe9eyLgJCtj1EfV13v4Q7khFTWzUoFFEE_lizGuGg,3591
|
261
261
|
aurelian/utils/search_utils.py,sha256=9MloT3SzOE4JsElsYlCznp9N6fv_OQK7YWOU8MIy1WU,2818
|
262
|
-
aurelian-0.4.
|
263
|
-
aurelian-0.4.
|
264
|
-
aurelian-0.4.
|
265
|
-
aurelian-0.4.
|
266
|
-
aurelian-0.4.
|
262
|
+
aurelian-0.4.2.dist-info/LICENSE,sha256=FB6RpUUfbUeKS4goWrvpp1QmOtyywrMiNBsYPMlLT3A,1086
|
263
|
+
aurelian-0.4.2.dist-info/METADATA,sha256=Wtded6_NxBHSXTCFxjUcXUrbLz00vOQgoy7xsHPM8YM,3557
|
264
|
+
aurelian-0.4.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
265
|
+
aurelian-0.4.2.dist-info/entry_points.txt,sha256=EnGehbtRm0YmhdfwfcoGJjVG3Man-zgKvob20fTIBik,102
|
266
|
+
aurelian-0.4.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|