Skip to content

Commit

Permalink
align asr output and llm input without using orchestrator (#341)
Browse files Browse the repository at this point in the history
* align asr output and llm input without using orchestrator

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
Spycsh and pre-commit-ci[bot] authored Jul 25, 2024
1 parent 2792e28 commit 64e0421
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
6 changes: 3 additions & 3 deletions comps/asr/asr.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from comps import (
Base64ByteStrDoc,
LLMParamsDoc,
ServiceType,
TextDoc,
opea_microservices,
register_microservice,
register_statistics,
Expand All @@ -26,7 +26,7 @@
host="0.0.0.0",
port=9099,
input_datatype=Base64ByteStrDoc,
output_datatype=TextDoc,
output_datatype=LLMParamsDoc,
)
@register_statistics(names=["opea_service@asr"])
async def audio_to_text(audio: Base64ByteStrDoc):
Expand All @@ -37,7 +37,7 @@ async def audio_to_text(audio: Base64ByteStrDoc):
response = requests.post(url=f"{asr_endpoint}/v1/asr", data=json.dumps(inputs), proxies={"http": None})

statistics_dict["opea_service@asr"].append_latency(time.time() - start, None)
return TextDoc(text=response.json()["asr_result"])
return LLMParamsDoc(query=response.json()["asr_result"])


if __name__ == "__main__":
Expand Down
7 changes: 0 additions & 7 deletions comps/cores/mega/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,6 @@ def generate():

return StreamingResponse(generate(), media_type="text/event-stream"), cur_node
else:
if (
self.services[cur_node].service_type == ServiceType.LLM
and runtime_graph.predecessors(cur_node)
and "asr" in runtime_graph.predecessors(cur_node)[0]
):
inputs["query"] = inputs["text"]
del inputs["text"]
async with session.post(endpoint, json=inputs) as response:
print(response.status)
return await response.json(), cur_node
Expand Down

0 comments on commit 64e0421

Please sign in to comment.