Skip to content

Commit

Permalink
Merge pull request #2 from malik727/feat-mapping
Browse files Browse the repository at this point in the history
release v0.3.0
  • Loading branch information
malik727 authored Oct 11, 2023
2 parents 82c8f1e + 8262aed commit aa2605d
Show file tree
Hide file tree
Showing 14 changed files with 1,060 additions and 89 deletions.
13 changes: 7 additions & 6 deletions agl_service_voiceagent/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
from agl_service_voiceagent.generated import voice_agent_pb2_grpc
from agl_service_voiceagent.utils.config import get_config_value

# following code is only reqired for logging
import logging
logging.basicConfig()
logging.getLogger("grpc").setLevel(logging.DEBUG)

SERVER_URL = get_config_value('SERVER_ADDRESS') + ":" + str(get_config_value('SERVER_PORT'))

def run_client(mode, nlu_model):
Expand Down Expand Up @@ -73,6 +68,12 @@ def run_client(mode, nlu_model):
print("Command:", record_result.command)
print("Status:", status)
print("Intent:", record_result.intent)
intent_slots = []
for slot in record_result.intent_slots:
print("Slot Name:", slot.name)
print("Slot Value:", slot.value)
print("Slot Value:", slot.value)
i_slot = voice_agent_pb2.IntentSlot(name=slot.name, value=slot.value)
intent_slots.append(i_slot)

exec_voice_command_request = voice_agent_pb2.ExecuteInput(intent=record_result.intent, intent_slots=intent_slots)
response = stub.ExecuteVoiceCommand(exec_voice_command_request)
17 changes: 11 additions & 6 deletions agl_service_voiceagent/config.ini
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
[General]
service_version = 0.2.0
service_version = 0.3.0
base_audio_dir = /usr/share/nlu/commands/
stt_model_path = /usr/share/vosk/vosk-model-small-en-us-0.15/
wake_word_model_path = /usr/share/vosk/vosk-model-small-en-us-0.15/
snips_model_path = /usr/share/nlu/snips/model/
channels = 1
sample_rate = 16000
bits_per_sample = 16
wake_word = hello auto
server_port = 51053
server_address = localhost
server_address = 0.0.0.0
rasa_model_path = /usr/share/nlu/rasa/models/
rasa_server_port = 51054
base_log_dir = /usr/share/nlu/logs/
store_voice_commands = 0
store_voice_commands = 1

[Kuksa]
ip = localhost
ip = 127.0.0.1
port = 8090
protocol = ws
insecure = False
token = /
insecure = True
token = /usr/lib/python3.10/site-packages/kuksa_certificates/jwt/super-admin.json.token

[Mapper]
intents_vss_map = /usr/share/nlu/mappings/intents_vss_map.json
vss_signals_spec = /usr/share/nlu/mappings/vss_signals_spec.json
52 changes: 52 additions & 0 deletions agl_service_voiceagent/generated/voice_agent_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

165 changes: 165 additions & 0 deletions agl_service_voiceagent/generated/voice_agent_pb2_grpc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

import voice_agent_pb2 as voice__agent__pb2


class VoiceAgentServiceStub(object):
"""Missing associated documentation comment in .proto file."""

def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.CheckServiceStatus = channel.unary_unary(
'/VoiceAgentService/CheckServiceStatus',
request_serializer=voice__agent__pb2.Empty.SerializeToString,
response_deserializer=voice__agent__pb2.ServiceStatus.FromString,
)
self.DetectWakeWord = channel.unary_stream(
'/VoiceAgentService/DetectWakeWord',
request_serializer=voice__agent__pb2.Empty.SerializeToString,
response_deserializer=voice__agent__pb2.WakeWordStatus.FromString,
)
self.RecognizeVoiceCommand = channel.stream_unary(
'/VoiceAgentService/RecognizeVoiceCommand',
request_serializer=voice__agent__pb2.RecognizeControl.SerializeToString,
response_deserializer=voice__agent__pb2.RecognizeResult.FromString,
)
self.ExecuteVoiceCommand = channel.unary_unary(
'/VoiceAgentService/ExecuteVoiceCommand',
request_serializer=voice__agent__pb2.ExecuteInput.SerializeToString,
response_deserializer=voice__agent__pb2.ExecuteResult.FromString,
)


class VoiceAgentServiceServicer(object):
"""Missing associated documentation comment in .proto file."""

def CheckServiceStatus(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def DetectWakeWord(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def RecognizeVoiceCommand(self, request_iterator, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ExecuteVoiceCommand(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')


def add_VoiceAgentServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'CheckServiceStatus': grpc.unary_unary_rpc_method_handler(
servicer.CheckServiceStatus,
request_deserializer=voice__agent__pb2.Empty.FromString,
response_serializer=voice__agent__pb2.ServiceStatus.SerializeToString,
),
'DetectWakeWord': grpc.unary_stream_rpc_method_handler(
servicer.DetectWakeWord,
request_deserializer=voice__agent__pb2.Empty.FromString,
response_serializer=voice__agent__pb2.WakeWordStatus.SerializeToString,
),
'RecognizeVoiceCommand': grpc.stream_unary_rpc_method_handler(
servicer.RecognizeVoiceCommand,
request_deserializer=voice__agent__pb2.RecognizeControl.FromString,
response_serializer=voice__agent__pb2.RecognizeResult.SerializeToString,
),
'ExecuteVoiceCommand': grpc.unary_unary_rpc_method_handler(
servicer.ExecuteVoiceCommand,
request_deserializer=voice__agent__pb2.ExecuteInput.FromString,
response_serializer=voice__agent__pb2.ExecuteResult.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'VoiceAgentService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))


# This class is part of an EXPERIMENTAL API.
class VoiceAgentService(object):
"""Missing associated documentation comment in .proto file."""

@staticmethod
def CheckServiceStatus(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/VoiceAgentService/CheckServiceStatus',
voice__agent__pb2.Empty.SerializeToString,
voice__agent__pb2.ServiceStatus.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def DetectWakeWord(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_stream(request, target, '/VoiceAgentService/DetectWakeWord',
voice__agent__pb2.Empty.SerializeToString,
voice__agent__pb2.WakeWordStatus.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def RecognizeVoiceCommand(request_iterator,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.stream_unary(request_iterator, target, '/VoiceAgentService/RecognizeVoiceCommand',
voice__agent__pb2.RecognizeControl.SerializeToString,
voice__agent__pb2.RecognizeResult.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def ExecuteVoiceCommand(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/VoiceAgentService/ExecuteVoiceCommand',
voice__agent__pb2.ExecuteInput.SerializeToString,
voice__agent__pb2.ExecuteResult.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
3 changes: 2 additions & 1 deletion agl_service_voiceagent/protos/voice_agent.proto
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,6 @@ message ExecuteInput {
}

message ExecuteResult {
ExecuteStatusType status = 1;
string response = 1;
ExecuteStatusType status = 2;
}
Loading

0 comments on commit aa2605d

Please sign in to comment.