Skip to content

UniMRCP server plugin for Deepgram Brain

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

deepgram/dgmrcp

Repository files navigation

Deepgram Logo

This is a server plugin for UniMRCP to allow Deepgram Brain to be used as a speechrecog resource in an MRCP server.

Installation

Download the libdgmrcp.so library from the releases page.

Place the library file libdgmrcp.so in the UniMRCP plugins directory (for example, /opt/unimrcp/plugin/).

Then edit the <plugin-factory> section of the UniMRCP server configuration file (for example, /opt/unimrcp/conf/unimrcpserver.xml). General information about configuring the UniMRCP server can be found in the Server Configuration Manual on this page.

A minimum configuration is as follows:

<plugin-factory>
  <engine id="Deepgram" name="libdgmrcp" enable="true">
    <param name="brain_url" value="wss://api.deepgram.com/v1/"/>
    <param name="brain_username" value="YOUR_USER_EMAIL"/>
    <param name="brain_password" value="YOUR_API_KEY"/>
  </engine>
</plugin-factory>

Configuration

The following options can be specified:

name value description
brain_url string (required) The URL of the Deepgram ASR API. You can set this to wss://api.deepgram.com/v1/ to use Deepgram's hosted API, or set it to the URL of your on-prem deployment. Note the trailing slash, which is significant.
brain_username string Your email.
brain_password string Your API key.
model string The default ASR model to use.
language string The default ASR language to use.
sensitivity_level float The default VAD sensitivity level, between 0.0 and 1.0.
plaintext_results boolean If true, then results in a RECOGNITION-COMPLETE message will be in plain text instead of the standard NLSML. Note that this does not conform to the MRCP specification, but it can be convenient for testing and development.

The following vendor-specific parameters are supported in a RECOGNIZE or SET-PARAMS message. In cases where a parameter can specified both here and in the plugin config, the parameters here take precedence.

name value description
com.deepgram.model string The ASR model to use.
com.deepgram.ner bool Enable/disable named entity recognition.
com.deepgram.numerals bool Enable/disable the numerals feature.
com.deepgram.no_delay bool Enable/disable the no_delay flag.
com.deepgram.plugin string Configure a plugin. Multiple plugins can be given, separated by commas.
com.deepgram.keywords string Boost keywords. Multiple keywords can be given, separated by commas.
com.deepgram.keyword_boost string Specify either standard or legacy keyword boosting strategy.

Building

A Dockerfile is provided that will download and build UniMRCP and its dependencies, as well as build the server plugin. This is used by GitHub Actions to build the plugin for releases.

The build environment itself downloads UniMRCP from its package repo. In order to access the package repo, you need credentials, which can be acquired from the UniMRCP website. These credentials must be passed to the Docker build environment:

$ docker build \
    --build-arg UNIMRCP_USERNAME=your_unimrcp_username \
    --build-arg UNIMRCP_PASSWORD=your_unimrcp_password \
    -t dgmrcp \
    .

In order to extract the plugin, we need to create a container from the image, and then copy the shared object out:

CONTAINER=$(docker create dgmrcp) \
  && docker cp $CONTAINER:/dgmrcp/target/release/libdgmrcp.so ./ \
  && docker rm $CONTAINER

If there is a better way to extract a file from a Docker image without creating an intermediate container, please let us know!

Development

While the Docker image can be used for local development, it may be more convenient to work in a VM. A Vagrantfile is provided along with some Ansible roles to get you up and running. As with the Docker image, you'll need credentials for the UniMRCP RPM repository.

vagrant up

# If you edit the Ansible roles or if something fails during the initial setup:
vagrant provision

vagrant ssh

To get started with development, follow these steps:

  1. Build the dgmrcp plugin in the shared folder that is mounted in the VM, and copy or symlink it into the UniMRCP plugin directory.
cd /vagrant
cargo build

sudo mkdir /opt/unimrcp/plugin
ln -s /vagrant/target/debug/libdgmrcp.so /opt/unimrcp/plugin/
  1. Edit the UniMRCP server config file at /opt/unimrcp/conf/unimrcpserver.xml, and add the dgmrcp plugin to the <plugin-factory> section as described above.

  2. Run the UniMRCP server.

cd /opt/unimrcp/bin
./unimrcpserver
  1. Run the UniMRCP client CLI and send a test request. UniMRCP includes two clients, unimrcpclient and umc, which have similar but maybe slightly different features. Their source code is found here.
cd /opt/unimrcp/bin
./unimrcpclient
> run recog

If all goes well, both the client and the server should show logs that, among other messages, include a RECOGNIZE and RECOGNITION-COMPLETE message. If this doesn't work or if these instructions are unclear, please open an issue or a PR!

License

Licensed under either of

at your option.

About

UniMRCP server plugin for Deepgram Brain

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published