Skip to content
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

Fix wenxin config in .env.template #965

Merged
merged 1 commit into from
Dec 22, 2023
Merged

Conversation

TJJ120635
Copy link
Contributor

Fix wenxin config in .env.template

In dbgpt/_private/config.py, os.getenv("WEN_XIN_API_SECRET") is used to get API_SECRET.
But in .env.template WEN_XIN_SECRET_KEY is set.
Thus config.py cannot get correct API_KEY.

And PROXY_API is not needed because dbgpt/model/proxy/llms/wenxin.py automatically choose api url.

def wenxin_generate_stream(
model: ProxyModel, tokenizer, params, device, context_len=2048
):
MODEL_VERSION = {
"ERNIE-Bot": "completions",
"ERNIE-Bot-turbo": "eb-instant",
}
model_params = model.get_params()
model_name = model_params.proxyllm_backend
model_version = MODEL_VERSION.get(model_name)
if not model_version:
yield f"Unsupport model version {model_name}"
proxy_api_key = model_params.proxy_api_key
proxy_api_secret = model_params.proxy_api_secret
access_token = _build_access_token(proxy_api_key, proxy_api_secret)
headers = {"Content-Type": "application/json", "Accept": "application/json"}
proxy_server_url = f"https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/{model_version}?access_token={access_token}"

Refer to issue #964

Copy link
Collaborator

@csunny csunny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

Copy link
Collaborator

@fangyinc fangyinc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@fangyinc fangyinc merged commit e1ace14 into eosphoros-ai:main Dec 22, 2023
4 checks passed
vshy108 pushed a commit to vshy108/DB-GPT that referenced this pull request Jan 18, 2024
Hopshine pushed a commit to Hopshine/DB-GPT that referenced this pull request Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants