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

ChatZhipuAI module httpx.HTTPStatusError #21399

Open
5 tasks done
Krasjet-Yu opened this issue May 8, 2024 · 2 comments
Open
5 tasks done

ChatZhipuAI module httpx.HTTPStatusError #21399

Krasjet-Yu opened this issue May 8, 2024 · 2 comments
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature

Comments

@Krasjet-Yu
Copy link

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangChain documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

from langchain_community.chat_models import ChatZhipuAI
llm = ChatZhipuAI(
model="glm-4",
api_key=os.getenv("ZHIPUAI_API_KEY"),
temperature=temperature,
max_tokens=1024,
)
messages = [
AIMessage(content="Hi."),
SystemMessage(content="Your role is a poet."),
HumanMessage(content="Write a short poem about AI in four lines."),
]
response = chat.invoke(messages)

Error Message and Stack Trace (if applicable)

When code runs to the invoke function, an error occurs:
httpx.HTTPStatusError: Client error '400 Bad Request' for url 'https://open.bigmodel.cn/api/paas/v4/chat/completions'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400

Description

When code runs to the invoke function, an error occurs:
httpx.HTTPStatusError: Client error '400 Bad Request' for url 'https://open.bigmodel.cn/api/paas/v4/chat/completions'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400

System Info

langchain==0.1.14
langchain-community==0.0.33
langchain-core==0.1.44
zhipuai==2.0.1.20240429
platform: linux
python: 3.8

@dosubot dosubot bot added the 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature label May 8, 2024
@liugddx
Copy link
Contributor

liugddx commented May 8, 2024

Let me see.

@Krasjet-Yu
Copy link
Author

I'm sorry. I found the reason for the mistake. Because I set the temperature to 0.
I saw a hint in The source code: “What sampling temperature to use. The value ranges from 0.0 to 1.0 and cannot be equal to 0.”

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants