Skip to content

Commit f7916df

Browse files
authored
feat: clientId no longer required in base language model (#4411)
1 parent b61cba5 commit f7916df

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

packages/ai-native/src/node/base-language-model.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,14 @@ export abstract class BaseLanguageModel {
4141
): Promise<any> {
4242
const provider = this.initializeProvider(options);
4343
const clientId = options.clientId;
44-
if (!clientId) {
45-
throw new Error('clientId is required');
44+
45+
let allFunctions: ToolRequest[] = [];
46+
// 如果没有传入 clientId,则不使用工具
47+
if (clientId) {
48+
const registry = this.toolInvocationRegistryManager.getRegistry(clientId);
49+
allFunctions = options.noTool ? [] : registry.getAllFunctions();
4650
}
47-
const registry = this.toolInvocationRegistryManager.getRegistry(clientId);
48-
const allFunctions = options.noTool ? [] : registry.getAllFunctions();
51+
4952
return this.handleStreamingRequest(
5053
provider,
5154
request,

0 commit comments

Comments
 (0)