mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor: Implement LLM tracing callback to improve parsing of tokens usage stats (#9311)
Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
This commit is contained in:
@@ -8,8 +8,8 @@ import {
|
||||
} from 'n8n-workflow';
|
||||
import { ChatGoogleGenerativeAI } from '@langchain/google-genai';
|
||||
import type { HarmBlockThreshold, HarmCategory, SafetySetting } from '@google/generative-ai';
|
||||
import { logWrapper } from '../../../utils/logWrapper';
|
||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
||||
import { N8nLlmTracing } from '../N8nLlmTracing';
|
||||
import { harmCategories, harmThresholds } from './options';
|
||||
|
||||
export class LmChatGoogleGemini implements INodeType {
|
||||
@@ -224,10 +224,11 @@ export class LmChatGoogleGemini implements INodeType {
|
||||
temperature: options.temperature,
|
||||
maxOutputTokens: options.maxOutputTokens,
|
||||
safetySettings,
|
||||
callbacks: [new N8nLlmTracing(this)],
|
||||
});
|
||||
|
||||
return {
|
||||
response: logWrapper(model, this),
|
||||
response: model,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user