From 1620364a9bb745d7ad1eb0c7c1d3be863c787ca6 Mon Sep 17 00:00:00 2001 From: dianjixz <18637716021@163.com> Date: Mon, 31 Mar 2025 11:23:47 +0800 Subject: [PATCH 1/2] [update] ModuleLLMOpenAIPlugin down --- projects/llm_framework/config_defaults.mk | 1 - projects/llm_framework/main_openai_api/SConstruct | 15 ++++----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/projects/llm_framework/config_defaults.mk b/projects/llm_framework/config_defaults.mk index 5517ada..09d6a4b 100644 --- a/projects/llm_framework/config_defaults.mk +++ b/projects/llm_framework/config_defaults.mk @@ -17,7 +17,6 @@ CONFIG_TOOLCHAIN_FLAGS="-O0" CONFIG_EVENTPP_ENABLED=y CONFIG_LHV_ENABLED=y CONFIG_LHV_WITH_EVPP=y -CONFIG_EVENTPP_ENABLED=y CONFIG_STACKFLOW_ENABLED=y CONFIG_UTILITIES_BASE64_ENABLED=y CONFIG_SINGLE_HEADER_LIBS_ENABLED=y diff --git a/projects/llm_framework/main_openai_api/SConstruct b/projects/llm_framework/main_openai_api/SConstruct index 18b2f26..99ae621 100644 --- a/projects/llm_framework/main_openai_api/SConstruct +++ b/projects/llm_framework/main_openai_api/SConstruct @@ -17,20 +17,14 @@ LDFLAGS = [] LINK_SEARCH_PATH = [] STATIC_FILES = [] -down_path = check_wget_down("https://github.com/Abandon-ht/ModuleLLM-OpenAI-Plugin/archive/1077efbe201ea3f29517f5ce4a0cfc3b04c25d1d.zip", 'M5Module-LLM_OpenAI_API.zip') +ModuleLLMOpenAIPluginPath = os.path.join(os.environ['GIT_REPO_PATH'], 'ModuleLLM-OpenAI-Plugin') +if not os.path.exists(ModuleLLMOpenAIPluginPath): + wget_github_commit('https://github.com/Abandon-ht/ModuleLLM-OpenAI-Plugin.git', '1077efbe201ea3f29517f5ce4a0cfc3b04c25d1d') -old_dir_name = 'ModuleLLM-OpenAI-Plugin-1077efbe201ea3f29517f5ce4a0cfc3b04c25d1d' -new_dir_name = 'ModuleLLM-OpenAI-Plugin' - -old_dir_path = os.path.join(down_path, old_dir_name) -new_dir_path = os.path.join(down_path, new_dir_name) python_venv = check_wget_down("https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/linux/llm/m5stack_llm-openai-api-python-venv_v1.5.tar.gz", 'm5stack_llm-llm-openai-api-python-venv_v1.5.tar.gz') -if os.path.exists(old_dir_path): - os.rename(old_dir_path, new_dir_path) - DEFINITIONS += ['-O3', '-fopenmp', '-std=c++17'] LDFLAGS+=['-Wl,-rpath=/opt/m5stack/lib', '-Wl,-rpath=/usr/local/m5stack/lib', '-Wl,-rpath=/usr/local/m5stack/lib/gcc-10.3', '-Wl,-rpath=/opt/lib', '-Wl,-rpath=/opt/usr/lib', '-Wl,-rpath=./'] LINK_SEARCH_PATH += [ADir('../static_lib')] @@ -38,8 +32,7 @@ LINK_SEARCH_PATH += [ADir('../static_lib')] STATIC_FILES += Glob('mode_*.json') -# STATIC_FILES += [os.path.join(down_path, 'M5Module-LLM_OpenAI_API-e3c467b8d8e5e0605b17436a5c5361f9ec1a7e96')] -STATIC_FILES += [new_dir_path] +STATIC_FILES += [ModuleLLMOpenAIPluginPath] STATIC_FILES += [os.path.join(python_venv, 'openai-api')] env['COMPONENTS'].append({'target':'llm_openai_api', From 1ed2f9af6857501149f50e796cd0b97ecaf25c8c Mon Sep 17 00:00:00 2001 From: LittleMouse Date: Mon, 31 Mar 2025 11:28:50 +0800 Subject: [PATCH 2/2] [update] update melotts doc --- .../llm_melotts_en.md | 37 +++++++++++++++++++ .../llm_melotts_zh.md | 36 ++++++++++++++++++ 2 files changed, 73 insertions(+) diff --git a/doc/projects_llm_framework_doc/llm_melotts_en.md b/doc/projects_llm_framework_doc/llm_melotts_en.md index 66a705f..f45eb0e 100644 --- a/doc/projects_llm_framework_doc/llm_melotts_en.md +++ b/doc/projects_llm_framework_doc/llm_melotts_en.md @@ -53,6 +53,43 @@ Response JSON: - created: Message creation time, UNIX time. - work_id: Successfully created work_id unit. +## inference + +### streaming input + +```json +{ + "request_id": "2", + "work_id": "melotts.1003", + "action": "inference", + "object": "melotts.utf-8.stream", + "data": { + "delta": "What's ur name?", + "index": 0, + "finish": true + } +} +``` +- object: The data type transmitted is melotts.utf-8.stream, indicating a streaming input from the user's UTF-8. +- delta: Segment data of the streaming input. +- index: Index of the segment in the streaming input. +- finish: A flag indicating whether the streaming input has completed. + +### non-streaming input + +```json +{ + "request_id": "2", + "work_id": "melotts.1003", + "action": "inference", + "object": "melotts.utf-8", + "data": "What's ur name?" +} +``` + +- object: The data type transmitted is melotts.utf-8, indicating a non-streaming input from the user's UTF-8. +- data: Data for non-streaming input. + ## link Link the output of the upper-level unit. diff --git a/doc/projects_llm_framework_doc/llm_melotts_zh.md b/doc/projects_llm_framework_doc/llm_melotts_zh.md index 40d40c8..7d23b51 100644 --- a/doc/projects_llm_framework_doc/llm_melotts_zh.md +++ b/doc/projects_llm_framework_doc/llm_melotts_zh.md @@ -51,6 +51,42 @@ - created:消息创建时间,unix 时间。 - work_id:返回成功创建的 work_id 单元。 +## inference + +### 流式输入 + +```json +{ + "request_id": "2", + "work_id": "melotts.1003", + "action": "inference", + "object": "melotts.utf-8.stream", + "data": { + "delta": "今天天气真好!", + "index": 0, + "finish": true + } +} +``` +- object:传输的数据类型为 `melotts.utf-8.stream` 代表的是从用户 utf-8 的流式输入 +- delta:流式输入的分段数据 +- index:流式输入的分段索引 +- finish:流式输入是否完成的标志位 + +### 非流式输入 + +```json +{ + "request_id": "2", + "work_id": "melotts.1003", + "action": "inference", + "object": "melotts.utf-8", + "data": "今天天气真好!" +} +``` +- object:传输的数据类型为 `melotts.utf-8` 代表的是从用户 utf-8 的非流式输入 +- data:非流式输入的数据 + ## link 链接上级单元的输出。