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

community[minor]: feat: add chat models for zhipuai #4644

Merged
merged 8 commits into from
Mar 13, 2024

Conversation

lukywong
Copy link
Contributor

@lukywong lukywong commented Mar 6, 2024

Fixes # (issue)

Copy link

vercel bot commented Mar 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 13, 2024 0:01am
langchainjs-docs ✅ Ready (Inspect) Visit Preview Mar 13, 2024 0:01am

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. auto:enhancement A large net-new component, integration, or chain. Use sparingly. The largest features labels Mar 6, 2024
@@ -0,0 +1,444 @@
import { BaseChatModel, type BaseChatModelParams } from "@langchain/core/language_models/chat_models";
Copy link

Choose a reason for hiding this comment

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

Hey team, just wanted to flag that this PR adds a new external HTTP request using the fetch function in the ChatZhipuAI class. This change should be reviewed by maintainers to ensure it aligns with our code standards and requirements.

@@ -0,0 +1,444 @@
import { BaseChatModel, type BaseChatModelParams } from "@langchain/core/language_models/chat_models";
Copy link

Choose a reason for hiding this comment

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

Hey team, just a heads up that I've flagged a change in the PR for review. The added code explicitly accesses and reads an environment variable using the getEnvironmentVariable function, so it's important to ensure that this is handled correctly. Let me know if you have any questions!

@jacoblee93 jacoblee93 changed the title feat: add chat models for zhipuai community[patch]: feat: add chat models for zhipuai Mar 10, 2024
@@ -1335,6 +1335,7 @@
"ignore": "^5.2.0",
"ioredis": "^5.3.2",
"jsdom": "*",
"jsonwebtoken": "^9.0.2",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is a mistake? Can you remove?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is a mistake? Can you remove?

@jacoblee93 Thanks, i move it to peer dependency

import { type CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager";
import { getEnvironmentVariable } from "@langchain/core/utils/env";
// eslint-disable-next-line import/no-extraneous-dependencies
import * as jwt from 'jsonwebtoken';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@lukywong lukywong Mar 12, 2024

Choose a reason for hiding this comment

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

Can we add this as an optional peer dependency instead?

https://github.com/langchain-ai/langchainjs/blob/main/.github/contributing/INTEGRATIONS.md#third-party-dependencies

yes, thanks for checking, please help to check this again @jacoblee93

/**
* Interface defining the input to the ZhipuAIChatInput class.
*/
interface ZhipuAIChatInput {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would be good to export this type - also maybe call ChatZhipuAIParams?

Copy link
Contributor Author

@lukywong lukywong Mar 12, 2024

Choose a reason for hiding this comment

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

Would be good to export this type - also maybe call ChatZhipuAIParams?

yes, thank you, i renamed and also export the interface @jacoblee93

}

this.apiUrl = "https://open.bigmodel.cn/api/paas/v4/chat/completions";
this.lc_serializable = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

You don't need to set this here

@jacoblee93 jacoblee93 added the close PRs that need one or two touch-ups to be ready label Mar 10, 2024
@jacoblee93 jacoblee93 changed the title community[patch]: feat: add chat models for zhipuai community[minor]: feat: add chat models for zhipuai Mar 12, 2024
@jacoblee93
Copy link
Collaborator

Thank you!

@jacoblee93 jacoblee93 added lgtm PRs that are ready to be merged as-is and removed close PRs that need one or two touch-ups to be ready labels Mar 12, 2024
@jacoblee93 jacoblee93 merged commit 5c16239 into langchain-ai:main Mar 13, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:enhancement A large net-new component, integration, or chain. Use sparingly. The largest features lgtm PRs that are ready to be merged as-is size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants