mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 21:00:58 +03:00
Support getNumTokens for ChatGoogleGenerativeAI (#4149)
This commit is contained in:
+6
@@ -209,6 +209,12 @@ class LangchainChatGoogleGenerativeAI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getNumTokens(prompt: BaseMessage[]) {
|
||||||
|
const contents = convertBaseMessagesToContent(prompt, this._isMultimodalModel)
|
||||||
|
const { totalTokens } = await this.client.countTokens({ contents })
|
||||||
|
return totalTokens
|
||||||
|
}
|
||||||
|
|
||||||
async _generateNonStreaming(
|
async _generateNonStreaming(
|
||||||
prompt: Content[],
|
prompt: Content[],
|
||||||
options: this['ParsedCallOptions'],
|
options: this['ParsedCallOptions'],
|
||||||
|
|||||||
Reference in New Issue
Block a user