Skip to content

变更模型,从openai变更为chatglm2 #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .idea/.gitignore

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

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from langchain_openai import ChatOpenAI
from langchain.chains import LLMChain
from langchain.llms import ChatGLM

from langchain.prompts.chat import (
ChatPromptTemplate,
Expand Down Expand Up @@ -30,6 +31,9 @@ def __init__(self, model_name: str = "gpt-3.5-turbo", verbose: bool = True):

# 为了翻译结果的稳定性,将 temperature 设置为 0
chat = ChatOpenAI(model_name=model_name, temperature=0, verbose=verbose)
if model_name == "chat_glm":
endpoint_url = ("http://127.0.0.1:8000") # endpoint_url 填写跑模型的地址
chat = ChatGLM(endpoint_url=endpoint_url, temperature=0, verbose=verbose)

self.chain = LLMChain(llm=chat, prompt=chat_prompt_template, verbose=verbose)

Expand Down