update model server features from langchain-chatchat
This commit is contained in:
parent
2be6ffe4e0
commit
e9b40ee51c
|
@ -51,6 +51,17 @@ EMBEDDING_MODEL = "text2vec-base"
|
||||||
# Embedding 模型运行设备
|
# Embedding 模型运行设备
|
||||||
EMBEDDING_DEVICE = "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu"
|
EMBEDDING_DEVICE = "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu"
|
||||||
|
|
||||||
|
ONLINE_LLM_MODEL = {
|
||||||
|
# 线上模型。请在server_config中为每个在线API设置不同的端口
|
||||||
|
|
||||||
|
"openai-api": {
|
||||||
|
"model_name": "gpt-3.5-turbo",
|
||||||
|
"api_base_url": "https://api.openai.com/v1",
|
||||||
|
"api_key": "",
|
||||||
|
"openai_proxy": "",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
llm_model_dict = {
|
llm_model_dict = {
|
||||||
"chatglm-6b": {
|
"chatglm-6b": {
|
||||||
|
@ -123,6 +134,7 @@ llm_model_dict = llm_model_dict_c
|
||||||
|
|
||||||
# LLM 名称
|
# LLM 名称
|
||||||
LLM_MODEL = "gpt-3.5-turbo"
|
LLM_MODEL = "gpt-3.5-turbo"
|
||||||
|
LLM_MODELs = ["chatglm2-6b"]
|
||||||
USE_FASTCHAT = "gpt" not in LLM_MODEL # 判断是否进行fastchat
|
USE_FASTCHAT = "gpt" not in LLM_MODEL # 判断是否进行fastchat
|
||||||
|
|
||||||
# LLM 运行设备
|
# LLM 运行设备
|
||||||
|
|
|
@ -76,7 +76,7 @@ SANDBOX_SERVER = {
|
||||||
# 这些模型必须是在model_config.llm_model_dict中正确配置的。
|
# 这些模型必须是在model_config.llm_model_dict中正确配置的。
|
||||||
# 在启动startup.py时,可用通过`--model-worker --model-name xxxx`指定模型,不指定则为LLM_MODEL
|
# 在启动startup.py时,可用通过`--model-worker --model-name xxxx`指定模型,不指定则为LLM_MODEL
|
||||||
FSCHAT_MODEL_WORKERS = {
|
FSCHAT_MODEL_WORKERS = {
|
||||||
LLM_MODEL: {
|
"default": {
|
||||||
"host": DEFAULT_BIND_HOST,
|
"host": DEFAULT_BIND_HOST,
|
||||||
"port": 20002,
|
"port": 20002,
|
||||||
"device": LLM_DEVICE,
|
"device": LLM_DEVICE,
|
||||||
|
@ -100,8 +100,13 @@ FSCHAT_MODEL_WORKERS = {
|
||||||
# "stream_interval": 2,
|
# "stream_interval": 2,
|
||||||
# "no_register": False,
|
# "no_register": False,
|
||||||
},
|
},
|
||||||
|
"chatglm2-6b": {
|
||||||
|
"port": 20003
|
||||||
|
},
|
||||||
|
"baichuan2-7b-base": {
|
||||||
|
"port": 20004
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# fastchat multi model worker server
|
# fastchat multi model worker server
|
||||||
FSCHAT_MULTI_MODEL_WORKERS = {
|
FSCHAT_MULTI_MODEL_WORKERS = {
|
||||||
# todo
|
# todo
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,59 @@
|
||||||
|
import os, sys, requests
|
||||||
|
|
||||||
|
src_dir = os.path.join(
|
||||||
|
os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
)
|
||||||
|
sys.path.append(src_dir)
|
||||||
|
|
||||||
|
from dev_opsgpt.tools import (
|
||||||
|
toLangchainTools, get_tool_schema, DDGSTool, DocRetrieval,
|
||||||
|
TOOL_DICT, TOOL_SETS
|
||||||
|
)
|
||||||
|
|
||||||
|
from configs.model_config import *
|
||||||
|
from dev_opsgpt.connector.phase import BasePhase
|
||||||
|
from dev_opsgpt.connector.agents import BaseAgent
|
||||||
|
from dev_opsgpt.connector.chains import BaseChain
|
||||||
|
from dev_opsgpt.connector.schema import (
|
||||||
|
Message, Memory, load_role_configs, load_phase_configs, load_chain_configs
|
||||||
|
)
|
||||||
|
from dev_opsgpt.connector.configs import AGETN_CONFIGS, CHAIN_CONFIGS, PHASE_CONFIGS
|
||||||
|
import importlib
|
||||||
|
|
||||||
|
tools = toLangchainTools([TOOL_DICT[i] for i in TOOL_SETS if i in TOOL_DICT])
|
||||||
|
|
||||||
|
|
||||||
|
role_configs = load_role_configs(AGETN_CONFIGS)
|
||||||
|
chain_configs = load_chain_configs(CHAIN_CONFIGS)
|
||||||
|
phase_configs = load_phase_configs(PHASE_CONFIGS)
|
||||||
|
|
||||||
|
agent_module = importlib.import_module("dev_opsgpt.connector.agents")
|
||||||
|
|
||||||
|
|
||||||
|
phase_name = "codeChatPhase"
|
||||||
|
phase = BasePhase(phase_name,
|
||||||
|
task = None,
|
||||||
|
phase_config = PHASE_CONFIGS,
|
||||||
|
chain_config = CHAIN_CONFIGS,
|
||||||
|
role_config = AGETN_CONFIGS,
|
||||||
|
do_summary=False,
|
||||||
|
do_code_retrieval=True,
|
||||||
|
do_doc_retrieval=False,
|
||||||
|
do_search=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
# 代码一共有多少类 => 基于cypher
|
||||||
|
# 代码库里有哪些函数,返回5个就行 => 基于cypher
|
||||||
|
# remove 这个函数是做什么的 => 基于标签
|
||||||
|
# 有没有函数已经实现了从字符串删除指定字符串的功能,使用的话可以怎么使用,写个java代码 => 基于描述
|
||||||
|
# 有根据我以下的需求用 java 开发一个方法:输入为字符串,将输入中的 .java 字符串给删除掉,然后返回新的字符串 => 基于描述
|
||||||
|
|
||||||
|
# round-1
|
||||||
|
query_content = "代码一共有多少类"
|
||||||
|
query = Message(
|
||||||
|
role_name="user", role_type="human",
|
||||||
|
role_content=query_content, input_query=query_content, origin_query=query_content,
|
||||||
|
code_engine_name="client", score_threshold=1.0, top_k=3, cb_search_type="cypher"
|
||||||
|
)
|
||||||
|
|
||||||
|
output_message1, _ = phase.step(query)
|
|
@ -1,7 +1,7 @@
|
||||||
langchain==0.0.266
|
langchain==0.0.266
|
||||||
openai==0.28.1
|
openai==0.28.1
|
||||||
sentence_transformers
|
sentence_transformers
|
||||||
fschat==0.2.24
|
fschat==0.2.33
|
||||||
transformers>=4.31.0
|
transformers>=4.31.0
|
||||||
# torch~=2.0.0
|
# torch~=2.0.0
|
||||||
fastapi~=0.99.1
|
fastapi~=0.99.1
|
||||||
|
@ -45,3 +45,10 @@ javalang==0.13.0
|
||||||
jsonref==1.1.0
|
jsonref==1.1.0
|
||||||
chromadb==0.4.17
|
chromadb==0.4.17
|
||||||
nebula3-python==3.1.0
|
nebula3-python==3.1.0
|
||||||
|
|
||||||
|
|
||||||
|
# qwen model
|
||||||
|
protobuf==3.20.*
|
||||||
|
transformers_stream_generator
|
||||||
|
einops
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue