fix: Remove Tensorflow embeddings node (no-changelog) (#7922)

## Summary
This PR removes `embeddingsTensorFlow` node and reverts our fix to
accommodate the Docker build in #7893 .
The node itself has been extracted as a [community node available from
npm](https://www.npmjs.com/package/n8n-nodes-tensorflow)

---------

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
This commit is contained in:
oleg
2023-12-04 17:48:10 +01:00
committed by GitHub
parent 6448d4c8a5
commit e4ae11c2ad
5 changed files with 18 additions and 371 deletions

View File

@@ -1,64 +0,0 @@
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
import {
NodeConnectionType,
type IExecuteFunctions,
type INodeType,
type INodeTypeDescription,
type SupplyData,
} from 'n8n-workflow';
import '@tensorflow/tfjs-backend-cpu';
import { TensorFlowEmbeddings } from 'langchain/embeddings/tensorflow';
import { logWrapper } from '../../../utils/logWrapper';
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
export class EmbeddingsTensorFlow implements INodeType {
description: INodeTypeDescription = {
displayName: 'Embeddings TensorFlow',
name: 'embeddingsTensorFlow',
icon: 'file:tensorflow.svg',
group: ['transform'],
version: 1,
description: 'Use Embeddings TensorFlow',
defaults: {
name: 'Embeddings TensorFlow',
},
codex: {
categories: ['AI'],
subcategories: {
AI: ['Embeddings'],
},
resources: {
primaryDocumentation: [
{
url: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.embeddingstensorflow/',
},
],
},
},
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
inputs: [],
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
outputs: [NodeConnectionType.AiEmbedding],
outputNames: ['Embeddings'],
properties: [
getConnectionHintNoticeField([NodeConnectionType.AiVectorStore]),
{
displayName:
'The TensorFlow model we use for generating embeddings is using 512-dimensional embeddings. Please make sure to use the same dimensionality for your vector store. Be aware that running this model with high-dimensional embeddings may result in high CPU usage on the machine.',
name: 'notice',
type: 'notice',
default: '',
},
],
};
async supplyData(this: IExecuteFunctions): Promise<SupplyData> {
this.logger.verbose('Supply data for embeddings tensorflow');
const embeddings = new TensorFlowEmbeddings({ maxConcurrency: Infinity });
return {
response: logWrapper(embeddings, this),
};
}
}

View File

@@ -1,49 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
id="svg8"
version="1.1"
viewBox="0 0 30.31081 32.499828"
height="122.83399"
width="114.56054">
<defs
id="defs2" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(-77.942529,-177.00005)"
id="layer1">
<g
id="g4550">
<path
style="fill:#e55b2d;fill-opacity:1"
d="m 360.04883,687.87305 v 18.89843 l 32.73047,18.89844 v -18.89844 z m -65.46289,18.89843 v 18.89844 l 16.36523,9.44727 V 716.2207 Z m 49.0957,9.44922 -16.36523,9.44922 v 56.69141 l 16.36523,9.44922 v -37.79493 l 16.36719,9.44922 v -18.89843 l -16.36719,-9.44922 z"
transform="scale(0.26458333)"
id="path4508" />
<path
style="fill:#ed8e24;fill-opacity:1"
d="m 360.04883,687.87305 -49.09766,28.34765 v 18.89649 l 32.73047,-18.89649 v 18.89649 l 16.36719,-9.44727 z m 49.09765,9.44922 -16.36718,9.44921 v 18.89844 l 16.36718,-9.44922 z m -32.73242,37.79492 -16.36523,9.44922 v 18.89843 l 16.36523,-9.44922 z m -16.36523,28.34765 -16.36719,-9.44922 v 37.79493 l 16.36719,-9.44922 z"
transform="scale(0.26458333)"
id="path4491" />
<path
style="fill:#f8bf3c;fill-opacity:1"
d="m 360.04883,668.97656 -65.46289,37.79492 16.36523,9.44922 49.09766,-28.34765 32.73047,18.89843 16.36718,-9.44921 z m 0,56.69336 -16.36719,9.44727 16.36719,9.44922 16.36523,-9.44922 z"
transform="scale(0.26458333)"
id="path4506" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.0 KiB