refactor(OpenAI Model Node Node, Google PaLM Language Model Node, Google PaLM Chat Model Node): Mark nodes as deprecated (#10119)

This commit is contained in:
oleg 2024-07-19 17:57:50 +02:00 committed by GitHub
parent 0542765b98
commit a8b5551331
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 26 additions and 8 deletions

View file

@ -9,7 +9,6 @@ import type {
} from 'n8n-workflow'; } from 'n8n-workflow';
import { OpenAI, type ClientOptions } from '@langchain/openai'; import { OpenAI, type ClientOptions } from '@langchain/openai';
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
import { N8nLlmTracing } from '../N8nLlmTracing'; import { N8nLlmTracing } from '../N8nLlmTracing';
type LmOpenAiOptions = { type LmOpenAiOptions = {
@ -28,6 +27,7 @@ export class LmOpenAi implements INodeType {
displayName: 'OpenAI Model', displayName: 'OpenAI Model',
// eslint-disable-next-line n8n-nodes-base/node-class-description-name-miscased // eslint-disable-next-line n8n-nodes-base/node-class-description-name-miscased
name: 'lmOpenAi', name: 'lmOpenAi',
hidden: true,
icon: { light: 'file:openAiLight.svg', dark: 'file:openAiLight.dark.svg' }, icon: { light: 'file:openAiLight.svg', dark: 'file:openAiLight.dark.svg' },
group: ['transform'], group: ['transform'],
version: 1, version: 1,
@ -65,7 +65,13 @@ export class LmOpenAi implements INodeType {
'={{ $parameter.options?.baseURL?.split("/").slice(0,-1).join("/") || "https://api.openai.com" }}', '={{ $parameter.options?.baseURL?.split("/").slice(0,-1).join("/") || "https://api.openai.com" }}',
}, },
properties: [ properties: [
getConnectionHintNoticeField([NodeConnectionType.AiChain, NodeConnectionType.AiAgent]), {
displayName:
'This node is using OpenAI completions which are now deprecated. Please use the OpenAI Chat Model node instead.',
name: 'deprecated',
type: 'notice',
default: '',
},
{ {
displayName: 'Model', displayName: 'Model',
name: 'model', name: 'model',

View file

@ -7,7 +7,6 @@ import {
type SupplyData, type SupplyData,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { ChatGooglePaLM } from '@langchain/community/chat_models/googlepalm'; import { ChatGooglePaLM } from '@langchain/community/chat_models/googlepalm';
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
import { N8nLlmTracing } from '../N8nLlmTracing'; import { N8nLlmTracing } from '../N8nLlmTracing';
export class LmChatGooglePalm implements INodeType { export class LmChatGooglePalm implements INodeType {
@ -16,6 +15,7 @@ export class LmChatGooglePalm implements INodeType {
// eslint-disable-next-line n8n-nodes-base/node-class-description-name-miscased // eslint-disable-next-line n8n-nodes-base/node-class-description-name-miscased
name: 'lmChatGooglePalm', name: 'lmChatGooglePalm',
icon: 'file:google.svg', icon: 'file:google.svg',
hidden: true,
group: ['transform'], group: ['transform'],
version: 1, version: 1,
description: 'Chat Model Google PaLM', description: 'Chat Model Google PaLM',
@ -51,7 +51,13 @@ export class LmChatGooglePalm implements INodeType {
baseURL: '={{ $credentials.host }}', baseURL: '={{ $credentials.host }}',
}, },
properties: [ properties: [
getConnectionHintNoticeField([NodeConnectionType.AiChain, NodeConnectionType.AiAgent]), {
displayName:
"Google PaLM API is <a href='https://ai.google.dev/palm_docs/deprecation' target='_blank'>deprecated</a>. Please use Google Vertex or Google Gemini nodes instead.",
name: 'deprecated',
type: 'notice',
default: '',
},
{ {
displayName: 'Model', displayName: 'Model',
name: 'modelName', name: 'modelName',

View file

@ -14,8 +14,8 @@ import type { SafetySetting } from '@google/generative-ai';
import { ProjectsClient } from '@google-cloud/resource-manager'; import { ProjectsClient } from '@google-cloud/resource-manager';
import { getConnectionHintNoticeField } from '../../../utils/sharedFields'; import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
import { N8nLlmTracing } from '../N8nLlmTracing'; import { N8nLlmTracing } from '../N8nLlmTracing';
import { makeErrorFromStatus } from './error-handling';
import { additionalOptions } from '../gemini-common/additional-options'; import { additionalOptions } from '../gemini-common/additional-options';
import { makeErrorFromStatus } from './error-handling';
export class LmChatGoogleVertex implements INodeType { export class LmChatGoogleVertex implements INodeType {
description: INodeTypeDescription = { description: INodeTypeDescription = {

View file

@ -7,7 +7,6 @@ import {
type SupplyData, type SupplyData,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { GooglePaLM } from '@langchain/community/llms/googlepalm'; import { GooglePaLM } from '@langchain/community/llms/googlepalm';
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
import { N8nLlmTracing } from '../N8nLlmTracing'; import { N8nLlmTracing } from '../N8nLlmTracing';
export class LmGooglePalm implements INodeType { export class LmGooglePalm implements INodeType {
@ -15,6 +14,7 @@ export class LmGooglePalm implements INodeType {
displayName: 'Google PaLM Language Model', displayName: 'Google PaLM Language Model',
// eslint-disable-next-line n8n-nodes-base/node-class-description-name-miscased // eslint-disable-next-line n8n-nodes-base/node-class-description-name-miscased
name: 'lmGooglePalm', name: 'lmGooglePalm',
hidden: true,
icon: 'file:google.svg', icon: 'file:google.svg',
group: ['transform'], group: ['transform'],
version: 1, version: 1,
@ -51,7 +51,13 @@ export class LmGooglePalm implements INodeType {
baseURL: '={{ $credentials.host }}', baseURL: '={{ $credentials.host }}',
}, },
properties: [ properties: [
getConnectionHintNoticeField([NodeConnectionType.AiChain, NodeConnectionType.AiAgent]), {
displayName:
"Google PaLM API is <a href='https://ai.google.dev/palm_docs/deprecation' target='_blank'>deprecated</a>. Please use Google Vertex or Google Gemini nodes instead.",
name: 'deprecated',
type: 'notice',
default: '',
},
{ {
displayName: 'Model', displayName: 'Model',
name: 'modelName', name: 'modelName',

View file

@ -1080,7 +1080,7 @@ export default defineComponent({
}, },
watch: { watch: {
node(newNode: INodeUi, prevNode: INodeUi) { node(newNode: INodeUi, prevNode: INodeUi) {
if (newNode.id === prevNode.id) return; if (newNode?.id === prevNode?.id) return;
this.init(); this.init();
}, },
hasNodeRun() { hasNodeRun() {