tonko22 commited on
Commit
6ebcb2e
·
1 Parent(s): 8fca8f3

Fix instrupctions

Browse files
Files changed (1) hide show
  1. tools/analysis_tools.py +8 -21
tools/analysis_tools.py CHANGED
@@ -25,7 +25,7 @@ class AnalyzeLyricsTool(Tool):
25
 
26
  def forward(self, song_title: str, artist: str, lyrics: str, format_output: bool = True) -> str:
27
  """
28
- Performs a deep analysis of the musical track, given its metadata.
29
 
30
  Args:
31
  song_title: Title of the song or music track.
@@ -34,7 +34,7 @@ class AnalyzeLyricsTool(Tool):
34
  format_output: Whether to format the output using rich formatting (default: True).
35
 
36
  Returns:
37
- A formatted analysis of the song's meaning in English or raw JSON if format_output is False.
38
  """
39
 
40
  prompt = f"""You are an expert in songs and their meanings.
@@ -42,14 +42,13 @@ class AnalyzeLyricsTool(Tool):
42
  Analyze the song "{song_title}" by {artist}. Return a structured JSON with the following information:
43
 
44
  1. Overall analysis of the song including themes, mood, meaning, and context.
45
- 2. Section-by-section analysis of each part of the song (verses, chorus, bridge, etc.).
46
- 3. Line-specific insights for particularly significant lines.
47
- 4. A conclusion about what makes this song unique or significant.
48
 
49
  Format your response as a valid JSON object with the following structure:
50
  ```
51
  {{
52
- "summary": "Overall analysis of the song themes, meaning and mood",
53
  "main_themes": ["theme1", "theme2", ...],
54
  "mood": "The overall mood/emotion of the song",
55
  "sections_analysis": [
@@ -57,14 +56,7 @@ class AnalyzeLyricsTool(Tool):
57
  "section_type": "verse/chorus/bridge/etc.",
58
  "section_number": 1,
59
  "lines": ["line1", "line2", ...],
60
- "analysis": "Analysis of this section"
61
- }},
62
- ...
63
- ],
64
- "significant_lines": [
65
- {{
66
- "line": "A specific important line",
67
- "significance": "Why this line is important"
68
  }},
69
  ...
70
  ],
@@ -78,13 +70,8 @@ class AnalyzeLyricsTool(Tool):
78
  {lyrics}
79
  """
80
 
81
- # Determine which model to use based on configuration
82
- if os.getenv("USE_ANTHROPIC", "false").lower() == "true":
83
- model_to_use = "claude-3-haiku-20240307"
84
- logger.info("Using Anthropic model: {} for lyrics analysis", model_to_use)
85
- else:
86
- model_to_use = "gemini/gemini-2.0-flash"
87
- logger.info("Using Gemini model: {} for lyrics analysis", model_to_use)
88
 
89
  # Use the function with retry mechanism
90
  logger.info("Analyzing lyrics for song: '{}' by '{}'", song_title, artist)
 
25
 
26
  def forward(self, song_title: str, artist: str, lyrics: str, format_output: bool = True) -> str:
27
  """
28
+ Performs a deep analysis of the given lyrics and artist metadata.
29
 
30
  Args:
31
  song_title: Title of the song or music track.
 
34
  format_output: Whether to format the output using rich formatting (default: True).
35
 
36
  Returns:
37
+ A formatted full lyrics analysis and meaning in English.
38
  """
39
 
40
  prompt = f"""You are an expert in songs and their meanings.
 
42
  Analyze the song "{song_title}" by {artist}. Return a structured JSON with the following information:
43
 
44
  1. Overall analysis of the song including themes, mood, meaning, and context.
45
+ 2. Section-by-section meaning analysis of each part of the song (verses, chorus, bridge, etc.).
46
+ 4. A conclusion about the vibes and concepts of the underlying meaning of the song.
 
47
 
48
  Format your response as a valid JSON object with the following structure:
49
  ```
50
  {{
51
+ "summary": "Overall analysis of the song vibes, meaning and mood",
52
  "main_themes": ["theme1", "theme2", ...],
53
  "mood": "The overall mood/emotion of the song",
54
  "sections_analysis": [
 
56
  "section_type": "verse/chorus/bridge/etc.",
57
  "section_number": 1,
58
  "lines": ["line1", "line2", ...],
59
+ "analysis": "Analysis of this section whith respect to the overall theme"
 
 
 
 
 
 
 
60
  }},
61
  ...
62
  ],
 
70
  {lyrics}
71
  """
72
 
73
+ model_to_use = "gemini/gemini-2.0-flash"
74
+ logger.info("Using Gemini model: {} for lyrics analysis", model_to_use)
 
 
 
 
 
75
 
76
  # Use the function with retry mechanism
77
  logger.info("Analyzing lyrics for song: '{}' by '{}'", song_title, artist)