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[patch]: chore: update chat iflytek xinghuo chatmodel version #6223

Merged
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
26 changes: 20 additions & 6 deletions libs/langchain-community/src/chat_models/iflytek_xinghuo/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ function messageToXinghuoRole(message: BaseMessage): XinghuoMessageRole {
}

declare interface IflytekXinghuoChatInput {
/** Model version to use. Available options are: v1.1, v2.1, v3.1
* @default "v2.1"
/** Model version to use. Available options are: v1.1, v2.1, v3.1, v3.5, v4.0
* @default "v3.1"
*/
version: string;

Expand Down Expand Up @@ -200,7 +200,7 @@ export abstract class BaseChatIflytekXinghuo

lc_serializable = true;

version = "v2.1";
version = "v3.1";

iflytekAppid: string;

Expand Down Expand Up @@ -256,7 +256,12 @@ export abstract class BaseChatIflytekXinghuo
this.top_k = fields?.top_k ?? this.top_k;

this.version = fields?.version ?? this.version;
if (["v1.1", "v2.1", "v3.1"].includes(this.version)) {
if (
["v1.1", "v2.1", "v3.1", "v3.5", "v4.0", "pro-128k"].includes(
this.version
)
) {
this.apiUrl = `wss://spark-api.xf-yun.com/${this.version}/chat`;
switch (this.version) {
case "v1.1":
this.domain = "general";
Expand All @@ -267,10 +272,19 @@ export abstract class BaseChatIflytekXinghuo
case "v3.1":
this.domain = "generalv3";
break;
case "v3.5":
this.domain = "generalv3.5";
break;
case "v4.0":
this.domain = "4.0Ultra";
break;
case "pro-128k":
this.domain = "pro-128k";
this.apiUrl = `wss://spark-api.xf-yun.com/chat/${this.version}`;
break;
default:
this.domain = "generalv2";
this.domain = "generalv3";
}
this.apiUrl = `wss://spark-api.xf-yun.com/${this.version}/chat`;
} else {
throw new Error(`Invalid model version: ${this.version}`);
}
Expand Down
Loading