mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-08 12:52:12 +02:00
Merge a943c4d4b6 into 80a7579639
This commit is contained in:
commit
c8ca8276f5
2 changed files with 8 additions and 3 deletions
|
|
@ -475,8 +475,11 @@ class PerformanceMonitor:
|
||||||
cache_types = set()
|
cache_types = set()
|
||||||
for metric_name in self.metrics_collector.counters.keys():
|
for metric_name in self.metrics_collector.counters.keys():
|
||||||
if 'cache_type=' in metric_name:
|
if 'cache_type=' in metric_name:
|
||||||
cache_type = metric_name.split('cache_type=')[1].split(',')[0].split('}')[0]
|
# Safely extract cache_type label value
|
||||||
cache_types.add(cache_type)
|
parts = metric_name.split('cache_type=')
|
||||||
|
if len(parts) >= 2:
|
||||||
|
cache_type = parts[1].split(',')[0].split('}')[0]
|
||||||
|
cache_types.add(cache_type)
|
||||||
|
|
||||||
for cache_type in cache_types:
|
for cache_type in cache_types:
|
||||||
labels = {'cache_type': cache_type}
|
labels = {'cache_type': cache_type}
|
||||||
|
|
|
||||||
|
|
@ -203,10 +203,12 @@ ASK {{
|
||||||
if response and isinstance(response, dict):
|
if response and isinstance(response, dict):
|
||||||
query = response.get('query', '').strip()
|
query = response.get('query', '').strip()
|
||||||
if query.upper().startswith(('SELECT', 'ASK', 'CONSTRUCT', 'DESCRIBE')):
|
if query.upper().startswith(('SELECT', 'ASK', 'CONSTRUCT', 'DESCRIBE')):
|
||||||
|
parts = query.split()
|
||||||
|
query_type = parts[0].upper() if parts else 'UNKNOWN'
|
||||||
return SPARQLQuery(
|
return SPARQLQuery(
|
||||||
query=query,
|
query=query,
|
||||||
variables=self._extract_variables(query),
|
variables=self._extract_variables(query),
|
||||||
query_type=query.split()[0].upper(),
|
query_type=query_type,
|
||||||
explanation=response.get('explanation', 'Generated by LLM'),
|
explanation=response.get('explanation', 'Generated by LLM'),
|
||||||
complexity_score=self._calculate_complexity(query)
|
complexity_score=self._calculate_complexity(query)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue