mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-01-19 13:23:16 +08:00
新功能: - 将 LLM_MODEL 配置项改为 LLM_MODELS 列表,同时启动多个模型 - 将 wiki 纳入 samples 知识库 依赖变化: - 指定 streamlit~=1.27.0。1.26.0会报rerun错误,1.28.0会有无限刷新错误 修复优化: - 优化 get_default_llm_model 逻辑 - 适配 Qwen 在线 API 做 Embeddings 时最大 25 行的限制 - 列出知识库磁盘文件时跳过 . 开头的文件
22 lines
692 B
Python
22 lines
692 B
Python
from server.utils import get_ChatOpenAI
|
|
from configs.model_config import LLM_MODELS, TEMPERATURE
|
|
from langchain.chains import LLMChain
|
|
from langchain.prompts.chat import (
|
|
ChatPromptTemplate,
|
|
HumanMessagePromptTemplate,
|
|
)
|
|
|
|
model = get_ChatOpenAI(model_name=LLM_MODELS[0], temperature=TEMPERATURE)
|
|
|
|
|
|
human_prompt = "{input}"
|
|
human_message_template = HumanMessagePromptTemplate.from_template(human_prompt)
|
|
|
|
chat_prompt = ChatPromptTemplate.from_messages(
|
|
[("human", "我们来玩成语接龙,我先来,生龙活虎"),
|
|
("ai", "虎头虎脑"),
|
|
("human", "{input}")])
|
|
|
|
|
|
chain = LLMChain(prompt=chat_prompt, llm=model, verbose=True)
|
|
print(chain({"input": "恼羞成怒"})) |