forked from agiresearch/AIOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from ...react_agent import ReactAgent | ||
|
||
class TranscribeAgent(ReactAgent): | ||
def __init__(self, | ||
agent_name, | ||
task_input, | ||
agent_process_factory, | ||
log_mode: str | ||
): | ||
ReactAgent.__init__(self, agent_name, task_input, agent_process_factory, log_mode) | ||
self.workflow_mode = "automatic" | ||
|
||
def manual_workflow(self): | ||
pass | ||
|
||
def run(self): | ||
return super().run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "transcribe_agent", | ||
"description": [ | ||
"You are an agent who can transcribe audio from the microphone into text. " | ||
], | ||
"tools": [ | ||
"transcriber/transcriber" | ||
], | ||
"meta": { | ||
"author": "Om Raheja", | ||
"version": "0.0.1", | ||
"license": "CC0" | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
pyopenagi/agents/om-raheja/transcribe_agent/meta_requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
RealtimeSTT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
from ..base import BaseTool | ||
from time import sleep | ||
|
||
class CurrencyConverter(BaseTool): | ||
def __init__(self): | ||
""" big library, not everyone needs it installed """ | ||
try: | ||
from RealtimeSTT import AudioToTextRecorder | ||
except ImportError: | ||
raise ImportError( | ||
"Please install RealtimeSTT: `pip install RealtimeSTT`" | ||
) | ||
|
||
# this is hardcoded for now | ||
self.recorder = AudioToTextRecorder( | ||
model="tiny.en", | ||
) | ||
|
||
def run(self, params: dict): | ||
duration = 5 | ||
try: | ||
duration = int(params["duration"]) | ||
except ValueError: | ||
raise KeyError( | ||
"The keys in params do not match the excepted key in params for transcriber api. " | ||
"Please make sure it contain the key 'duration'" | ||
) | ||
|
||
self.record.start() | ||
sleep(duration) | ||
self.recorder.stop() | ||
return self.recorder.text() | ||
|
||
def get_tool_call_format(self): | ||
tool_call_format = { | ||
"type": "function", | ||
"function": { | ||
"name": "transcriber", | ||
"description": "Transcribes audiio into text", | ||
"parameters": { | ||
"type": "object", | ||
"properties": { | ||
"duration": { | ||
"type": "string", | ||
"description": "How long to record audio for in seconds", | ||
}, | ||
}, | ||
"required": [] | ||
} | ||
} | ||
} | ||
return tool_call_format |