4
4
import os
5
5
6
6
import requests
7
+ from comps .cores .telemetry .opea_telemetry import opea_telemetry , tracer
7
8
from tools .pycragapi import CRAG
8
9
9
10
11
+ @opea_telemetry
10
12
def search_web_base (query : str ) -> str :
11
13
import os
12
14
@@ -25,6 +27,7 @@ def search_web_base(query: str) -> str:
25
27
return response
26
28
27
29
30
+ @opea_telemetry
28
31
def search_knowledge_base (query : str ) -> str :
29
32
"""Search a knowledge base about music and singers for a given query.
30
33
@@ -40,6 +43,7 @@ def search_knowledge_base(query: str) -> str:
40
43
return response .json ()["text" ]
41
44
42
45
46
+ @opea_telemetry
43
47
def search_sql_database (query : str ) -> str :
44
48
"""Search a SQL database on artists and their music with a natural language query.
45
49
@@ -55,32 +59,37 @@ def search_sql_database(query: str) -> str:
55
59
return response .json ()["text" ]
56
60
57
61
62
+ @opea_telemetry
58
63
def get_grammy_best_artist_by_year (year : int ) -> dict :
59
64
"""Get the Grammy Best New Artist for a specific year."""
60
65
api = CRAG ()
61
66
year = int (year )
62
67
return api .music_grammy_get_best_artist_by_year (year )
63
68
64
69
70
+ @opea_telemetry
65
71
def get_members (band_name : str ) -> dict :
66
72
"""Get the member list of a band."""
67
73
api = CRAG ()
68
74
return api .music_get_members (band_name )
69
75
70
76
77
+ @opea_telemetry
71
78
def get_artist_birth_place (artist_name : str ) -> dict :
72
79
"""Get the birthplace of an artist."""
73
80
api = CRAG ()
74
81
return api .music_get_artist_birth_place (artist_name )
75
82
76
83
84
+ @opea_telemetry
77
85
def get_billboard_rank_date (rank : int , date : str = None ) -> dict :
78
86
"""Get Billboard ranking for a specific rank and date."""
79
87
api = CRAG ()
80
88
rank = int (rank )
81
89
return api .music_get_billboard_rank_date (rank , date )
82
90
83
91
92
+ @opea_telemetry
84
93
def get_song_release_date (song_name : str ) -> dict :
85
94
"""Get the release date of a song."""
86
95
api = CRAG ()
0 commit comments