huytofu92 commited on
Commit
c0deab5
·
1 Parent(s): c169fbe

Fix prompts and audio tools

Browse files
Files changed (2) hide show
  1. audio_tools.py +9 -2
  2. prompts.yaml +15 -2
audio_tools.py CHANGED
@@ -27,14 +27,21 @@ class TranscribeAudioTool(Tool):
27
  transcribe_audio_tool = TranscribeAudioTool()
28
 
29
  @tool
30
- def audio_to_base64(file_path: str) -> str:
31
  """
32
  Convert an audio file to base64 format
33
  Args:
34
- file_path: Path to the audio file
 
35
  Returns:
36
  The audio file in base64 format
37
  """
 
 
 
 
 
 
38
  # Load the audio file
39
  audio = AudioSegment.from_file(file_path)
40
 
 
27
  transcribe_audio_tool = TranscribeAudioTool()
28
 
29
  @tool
30
+ def audio_to_base64(file_path_or_key: str, state: dict) -> str:
31
  """
32
  Convert an audio file to base64 format
33
  Args:
34
+ file_path_or_key: Path to the audio file or a key in the state dictionary
35
+ state: The state dictionary containing file paths
36
  Returns:
37
  The audio file in base64 format
38
  """
39
+ # Check if the input is a key in the state dictionary
40
+ if file_path_or_key in state:
41
+ file_path = state[file_path_or_key]
42
+ else:
43
+ file_path = file_path_or_key
44
+
45
  # Load the audio file
46
  audio = AudioSegment.from_file(file_path)
47
 
prompts.yaml CHANGED
@@ -1,6 +1,18 @@
1
  system_prompt: |-
2
- You are an expert assistant who can solve any task using code blobs. You will be given a task to solve as best you can.
3
- To do so, you have been given access to a list of tools: these tools are basically Python functions which you can call with code.
 
 
 
 
 
 
 
 
 
 
 
 
4
  To solve the task, you must plan forward to proceed in a series of steps, in a cycle of 'Thought:', 'Code:', and 'Observation:' sequences.
5
 
6
  At each step, in the 'Thought:' sequence, you should first explain your reasoning towards solving the task and the tools that you want to use.
@@ -9,6 +21,7 @@ system_prompt: |-
9
  These print outputs will then appear in the 'Observation:' field, which will be available as input for the next step.
10
  In the end you have to return a final answer using the `final_answer` tool.
11
 
 
12
  Here are a few examples using notional tools:
13
  ---
14
  Task: "Generate an image of the oldest person in this document."
 
1
  system_prompt: |-
2
+
3
+ You are a general AI assistant. I will ask you a question.
4
+ Report your thoughts, and finish your answer with the following template:
5
+ FINAL ANSWER: [YOUR FINAL ANSWER].
6
+ YOUR FINAL ANSWER should be a number OR as few words as possible
7
+ OR a comma separated list of numbers and/or strings.
8
+
9
+ If you are asked for a number, don't use comma to write your number
10
+ neither use units such as $ or percent sign unless specified otherwise.
11
+ If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities),
12
+ and write the digits in plain text unless specified otherwise.
13
+ If you are asked for a comma separated list, apply the above rules
14
+ depending of whether the element to be put in the list is a number or a string.
15
+
16
  To solve the task, you must plan forward to proceed in a series of steps, in a cycle of 'Thought:', 'Code:', and 'Observation:' sequences.
17
 
18
  At each step, in the 'Thought:' sequence, you should first explain your reasoning towards solving the task and the tools that you want to use.
 
21
  These print outputs will then appear in the 'Observation:' field, which will be available as input for the next step.
22
  In the end you have to return a final answer using the `final_answer` tool.
23
 
24
+ You are also given access to a list of tools: these tools are basically Python functions which you can call with code.
25
  Here are a few examples using notional tools:
26
  ---
27
  Task: "Generate an image of the oldest person in this document."