mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
feat: Implement MistralCloud Chat & Embeddings nodes (#8239)
Signed-off-by: Oleg Ivaniv <me@olegivaniv.com> Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
parent
38d91c43e3
commit
d37b9084b2
|
@ -89,7 +89,8 @@
|
|||
"typescript": "^5.3.0",
|
||||
"xml2js": "^0.5.0",
|
||||
"cpy@8>globby": "^11.1.0",
|
||||
"qqjs>globby": "^11.1.0"
|
||||
"qqjs>globby": "^11.1.0",
|
||||
"@langchain/core": "^0.1.8"
|
||||
},
|
||||
"patchedDependencies": {
|
||||
"typedi@0.10.0": "patches/typedi@0.10.0.patch",
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
import type {
|
||||
IAuthenticateGeneric,
|
||||
ICredentialTestRequest,
|
||||
ICredentialType,
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export class MistralCloudApi implements ICredentialType {
|
||||
name = 'mistralCloudApi';
|
||||
|
||||
displayName = 'Mistral Cloud API';
|
||||
|
||||
documentationUrl = 'mistralCloud';
|
||||
|
||||
properties: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'API Key',
|
||||
name: 'apiKey',
|
||||
type: 'string',
|
||||
typeOptions: { password: true },
|
||||
required: true,
|
||||
default: '',
|
||||
},
|
||||
];
|
||||
|
||||
authenticate: IAuthenticateGeneric = {
|
||||
type: 'generic',
|
||||
properties: {
|
||||
headers: {
|
||||
Authorization: '=Bearer {{$credentials.apiKey}}',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
test: ICredentialTestRequest = {
|
||||
request: {
|
||||
baseURL: 'https://api.mistral.ai/v1',
|
||||
url: '/models',
|
||||
method: 'GET',
|
||||
},
|
||||
};
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import {
|
||||
NodeConnectionType,
|
||||
type IExecuteFunctions,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type SupplyData,
|
||||
} from 'n8n-workflow';
|
||||
import type { MistralAIEmbeddingsParams } from '@langchain/mistralai';
|
||||
import { MistralAIEmbeddings } from '@langchain/mistralai';
|
||||
import { logWrapper } from '../../../utils/logWrapper';
|
||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
||||
|
||||
export class EmbeddingsMistralCloud implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Embeddings Mistral Cloud',
|
||||
name: 'embeddingsMistralCloud',
|
||||
icon: 'file:mistral.svg',
|
||||
credentials: [
|
||||
{
|
||||
name: 'mistralCloudApi',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
group: ['transform'],
|
||||
version: 1,
|
||||
description: 'Use Embeddings Mistral Cloud',
|
||||
defaults: {
|
||||
name: 'Embeddings Mistral Cloud',
|
||||
},
|
||||
|
||||
codex: {
|
||||
categories: ['AI'],
|
||||
subcategories: {
|
||||
AI: ['Embeddings'],
|
||||
},
|
||||
resources: {
|
||||
primaryDocumentation: [
|
||||
{
|
||||
url: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.embeddingsmistralcloud/',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
// 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'],
|
||||
requestDefaults: {
|
||||
ignoreHttpStatusErrors: true,
|
||||
baseURL: 'https://api.mistral.ai/v1',
|
||||
},
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiVectorStore]),
|
||||
{
|
||||
displayName: 'Model',
|
||||
name: 'model',
|
||||
type: 'options',
|
||||
description:
|
||||
'The model which will compute the embeddings. <a href="https://docs.mistral.ai/platform/endpoints/">Learn more</a>.',
|
||||
typeOptions: {
|
||||
loadOptions: {
|
||||
routing: {
|
||||
request: {
|
||||
method: 'GET',
|
||||
url: '/models',
|
||||
},
|
||||
output: {
|
||||
postReceive: [
|
||||
{
|
||||
type: 'rootProperty',
|
||||
properties: {
|
||||
property: 'data',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'filter',
|
||||
properties: {
|
||||
pass: "={{ $responseItem.id.includes('embed') }}",
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'setKeyValue',
|
||||
properties: {
|
||||
name: '={{ $responseItem.id }}',
|
||||
value: '={{ $responseItem.id }}',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'sort',
|
||||
properties: {
|
||||
key: 'name',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
routing: {
|
||||
send: {
|
||||
type: 'body',
|
||||
property: 'model',
|
||||
},
|
||||
},
|
||||
default: 'mistral-embed',
|
||||
},
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
placeholder: 'Add Option',
|
||||
description: 'Additional options to add',
|
||||
type: 'collection',
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Batch Size',
|
||||
name: 'batchSize',
|
||||
default: 512,
|
||||
typeOptions: { maxValue: 2048 },
|
||||
description: 'Maximum number of documents to send in each request',
|
||||
type: 'number',
|
||||
},
|
||||
{
|
||||
displayName: 'Strip New Lines',
|
||||
name: 'stripNewLines',
|
||||
default: true,
|
||||
description: 'Whether to strip new lines from the input text',
|
||||
type: 'boolean',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
async supplyData(this: IExecuteFunctions, itemIndex: number): Promise<SupplyData> {
|
||||
const credentials = await this.getCredentials('mistralCloudApi');
|
||||
const modelName = this.getNodeParameter('model', itemIndex) as string;
|
||||
const options = this.getNodeParameter(
|
||||
'options',
|
||||
itemIndex,
|
||||
{},
|
||||
) as Partial<MistralAIEmbeddingsParams>;
|
||||
|
||||
const embeddings = new MistralAIEmbeddings({
|
||||
apiKey: credentials.apiKey as string,
|
||||
modelName,
|
||||
...options,
|
||||
});
|
||||
|
||||
return {
|
||||
response: logWrapper(embeddings, this),
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,262 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
width="216"
|
||||
height="216"
|
||||
version="1.1"
|
||||
id="svg41"
|
||||
sodipodi:docname="mistral.svg"
|
||||
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview41"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:zoom="1.936488"
|
||||
inkscape:cx="197.78072"
|
||||
inkscape:cy="79.00901"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1017"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg41" />
|
||||
<style
|
||||
id="style1"><![CDATA[.I{fill:#ff7000}.J{fill:#ff4900}.K{fill:#ffa300}.L{fill:#1c1c1b icc-color(adobe-rgb-1998, 0.13299561, 0.13299561, 0.1289978)}]]></style>
|
||||
<defs
|
||||
id="defs10">
|
||||
<clipPath
|
||||
id="A">
|
||||
<path
|
||||
d="M 0,184.252 H 481.89 V 0 H 0 Z"
|
||||
transform="translate(-206.251,-140.139)"
|
||||
id="path1" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
id="B">
|
||||
<path
|
||||
d="M 0,184.252 H 481.89 V 0 H 0 Z"
|
||||
transform="translate(-247.436,-104.865)"
|
||||
id="path2" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
id="C">
|
||||
<path
|
||||
d="M 0,184.252 H 481.89 V 0 H 0 Z"
|
||||
transform="translate(-285.938,-102.089)"
|
||||
id="path3" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
id="D">
|
||||
<path
|
||||
d="M 0,184.252 H 481.89 V 0 H 0 Z"
|
||||
transform="translate(-337.769,-131.877)"
|
||||
id="path4" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
id="E">
|
||||
<path
|
||||
d="M 0,184.252 H 481.89 V 0 H 0 Z"
|
||||
transform="translate(-377.247,-132.319)"
|
||||
id="path5" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
id="F">
|
||||
<path
|
||||
d="M 0,184.252 H 481.89 V 0 H 0 Z"
|
||||
transform="translate(-418.107,-114.634)"
|
||||
id="path6" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
id="G">
|
||||
<path
|
||||
d="M 0,184.252 H 481.89 V 0 H 0 Z"
|
||||
transform="translate(-450.023,-140.139)"
|
||||
id="path7" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
id="H">
|
||||
<path
|
||||
d="M 0,184.252 H 481.89 V 0 H 0 Z"
|
||||
transform="translate(-217.694,-44.794)"
|
||||
id="path8" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
id="I">
|
||||
<path
|
||||
d="M 0,184.252 H 481.89 V 0 H 0 Z"
|
||||
transform="translate(-247.436,-35.025)"
|
||||
id="path9" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
id="J">
|
||||
<path
|
||||
d="M 0,184.252 H 481.89 V 0 H 0 Z"
|
||||
id="path10" />
|
||||
</clipPath>
|
||||
<path
|
||||
id="K"
|
||||
d="m 173.987,134.362 h -37.795 l 9.633,-37.776 h 37.796 z" />
|
||||
</defs>
|
||||
<g
|
||||
transform="matrix(1,0,0.254535,1,-51.362792,-7.4725007)"
|
||||
id="g32">
|
||||
<g
|
||||
class="L"
|
||||
id="g22">
|
||||
<path
|
||||
d="M 98.397,134.362 H 60.602 l 9.633,-37.776 h 37.796 z"
|
||||
id="path11" />
|
||||
<path
|
||||
d="M 126.558,172.138 H 88.763 l 9.633,-37.776 h 37.796 z"
|
||||
id="path12" />
|
||||
<path
|
||||
d="M 136.192,134.362 H 98.397 l 9.633,-37.776 h 37.796 z"
|
||||
id="path13" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
id="use13" />
|
||||
<path
|
||||
d="M 108.031,96.585 H 70.236 l 9.633,-37.776 h 37.796 z"
|
||||
id="path14" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="9.6339998"
|
||||
y="-37.777"
|
||||
id="use14" />
|
||||
<path
|
||||
d="M 60.602,134.362 H 22.807 L 32.44,96.586 h 37.796 z"
|
||||
id="path15" />
|
||||
<path
|
||||
d="M 70.236,96.585 H 32.441 L 42.074,58.809 H 79.87 Z"
|
||||
id="path16" />
|
||||
<path
|
||||
d="M 79.87,58.809 H 42.075 l 9.633,-37.776 h 37.796 z"
|
||||
id="path17" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="57.063"
|
||||
y="-75.553001"
|
||||
id="use17" />
|
||||
<path
|
||||
d="M 50.968,172.138 H 13.173 l 9.633,-37.776 h 37.796 z"
|
||||
id="path18" />
|
||||
<path
|
||||
d="M 41.334,209.915 H 3.539 l 9.633,-37.776 h 37.796 z"
|
||||
id="path19" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="37.794998"
|
||||
id="use19" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="47.429001"
|
||||
y="-37.777"
|
||||
id="use20" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="28.160999"
|
||||
y="37.776001"
|
||||
id="use21" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="18.527"
|
||||
y="75.553001"
|
||||
id="use22" />
|
||||
</g>
|
||||
<path
|
||||
d="M 114.115,134.359 H 76.321 l 9.633,-37.776 h 37.796 z"
|
||||
class="I"
|
||||
id="path22" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="-31.709999"
|
||||
y="37.772999"
|
||||
class="J"
|
||||
id="use23" />
|
||||
<g
|
||||
class="I"
|
||||
id="g25">
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="-22.076"
|
||||
y="-0.003"
|
||||
id="use24" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="15.719"
|
||||
y="-0.003"
|
||||
id="use25" />
|
||||
</g>
|
||||
<g
|
||||
class="K"
|
||||
id="g26">
|
||||
<path
|
||||
d="M 123.749,96.582 H 85.955 l 9.633,-37.776 h 37.796 z"
|
||||
id="path25" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="25.353001"
|
||||
y="-37.779999"
|
||||
id="use26" />
|
||||
</g>
|
||||
<path
|
||||
d="M 76.32,134.359 H 38.526 l 9.633,-37.776 h 37.796 z"
|
||||
class="I"
|
||||
id="path26" />
|
||||
<path
|
||||
d="M 85.954,96.582 H 48.16 l 9.633,-37.776 h 37.796 z"
|
||||
class="K"
|
||||
id="path27" />
|
||||
<g
|
||||
fill="#ffce00"
|
||||
id="g28">
|
||||
<path
|
||||
d="M 95.588,58.806 H 57.794 L 67.427,21.03 h 37.796 z"
|
||||
id="path28" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="72.781998"
|
||||
y="-75.556"
|
||||
id="use28" />
|
||||
</g>
|
||||
<path
|
||||
d="M 66.686,172.135 H 28.892 l 9.633,-37.776 h 37.796 z"
|
||||
class="J"
|
||||
id="path29" />
|
||||
<path
|
||||
d="M 57.052,209.912 H 19.258 l 9.633,-37.776 h 37.796 z"
|
||||
fill="#ff0107"
|
||||
id="path30" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="53.514"
|
||||
y="-0.003"
|
||||
class="I"
|
||||
id="use30" />
|
||||
<path
|
||||
d="M 237.135,96.582 H 199.34 l 9.633,-37.776 h 37.796 z"
|
||||
class="K"
|
||||
id="path31" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="43.880001"
|
||||
y="37.772999"
|
||||
class="J"
|
||||
id="use31" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="34.245998"
|
||||
y="75.550003"
|
||||
fill="#ff0107"
|
||||
id="use32" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 6.5 KiB |
|
@ -0,0 +1,197 @@
|
|||
/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
|
||||
import {
|
||||
NodeConnectionType,
|
||||
type IExecuteFunctions,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
type SupplyData,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import type { ChatMistralAIInput } from '@langchain/mistralai';
|
||||
import { ChatMistralAI } from '@langchain/mistralai';
|
||||
import { logWrapper } from '../../../utils/logWrapper';
|
||||
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
|
||||
|
||||
export class LmChatMistralCloud implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Mistral Cloud Chat Model',
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-name-miscased
|
||||
name: 'lmChatMistralCloud',
|
||||
icon: 'file:mistral.svg',
|
||||
group: ['transform'],
|
||||
version: 1,
|
||||
description: 'For advanced usage with an AI chain',
|
||||
defaults: {
|
||||
name: 'Mistral Cloud Chat Model',
|
||||
},
|
||||
codex: {
|
||||
categories: ['AI'],
|
||||
subcategories: {
|
||||
AI: ['Language Models'],
|
||||
},
|
||||
resources: {
|
||||
primaryDocumentation: [
|
||||
{
|
||||
url: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmchatmistralcloud/',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
// 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.AiLanguageModel],
|
||||
outputNames: ['Model'],
|
||||
credentials: [
|
||||
{
|
||||
name: 'mistralCloudApi',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
requestDefaults: {
|
||||
ignoreHttpStatusErrors: true,
|
||||
baseURL: 'https://api.mistral.ai/v1',
|
||||
},
|
||||
properties: [
|
||||
getConnectionHintNoticeField([NodeConnectionType.AiChain, NodeConnectionType.AiAgent]),
|
||||
{
|
||||
displayName: 'Model',
|
||||
name: 'model',
|
||||
type: 'options',
|
||||
description:
|
||||
'The model which will generate the completion. <a href="https://docs.mistral.ai/platform/endpoints/">Learn more</a>.',
|
||||
typeOptions: {
|
||||
loadOptions: {
|
||||
routing: {
|
||||
request: {
|
||||
method: 'GET',
|
||||
url: '/models',
|
||||
},
|
||||
output: {
|
||||
postReceive: [
|
||||
{
|
||||
type: 'rootProperty',
|
||||
properties: {
|
||||
property: 'data',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'filter',
|
||||
properties: {
|
||||
pass: "={{ !$responseItem.id.includes('embed') }}",
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'setKeyValue',
|
||||
properties: {
|
||||
name: '={{ $responseItem.id }}',
|
||||
value: '={{ $responseItem.id }}',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'sort',
|
||||
properties: {
|
||||
key: 'name',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
routing: {
|
||||
send: {
|
||||
type: 'body',
|
||||
property: 'model',
|
||||
},
|
||||
},
|
||||
default: 'mistral-small',
|
||||
},
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
placeholder: 'Add Option',
|
||||
description: 'Additional options to add',
|
||||
type: 'collection',
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Maximum Number of Tokens',
|
||||
name: 'maxTokens',
|
||||
default: -1,
|
||||
description:
|
||||
'The maximum number of tokens to generate in the completion. Most models have a context length of 2048 tokens (except for the newest models, which support 32,768).',
|
||||
type: 'number',
|
||||
typeOptions: {
|
||||
maxValue: 32768,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Sampling Temperature',
|
||||
name: 'temperature',
|
||||
default: 0.7,
|
||||
typeOptions: { maxValue: 1, minValue: 0, numberPrecision: 1 },
|
||||
description:
|
||||
'Controls randomness: Lowering results in less random completions. As the temperature approaches zero, the model will become deterministic and repetitive.',
|
||||
type: 'number',
|
||||
},
|
||||
{
|
||||
displayName: 'Max Retries',
|
||||
name: 'maxRetries',
|
||||
default: 2,
|
||||
description: 'Maximum number of retries to attempt',
|
||||
type: 'number',
|
||||
},
|
||||
{
|
||||
displayName: 'Top P',
|
||||
name: 'topP',
|
||||
default: 1,
|
||||
typeOptions: { maxValue: 1, minValue: 0, numberPrecision: 1 },
|
||||
description:
|
||||
'Controls diversity via nucleus sampling: 0.5 means half of all likelihood-weighted options are considered. We generally recommend altering this or temperature but not both.',
|
||||
type: 'number',
|
||||
},
|
||||
{
|
||||
displayName: 'Enable Safe Mode',
|
||||
name: 'safeMode',
|
||||
default: false,
|
||||
type: 'boolean',
|
||||
description: 'Whether to inject a safety prompt before all conversations',
|
||||
},
|
||||
{
|
||||
displayName: 'Random Seed',
|
||||
name: 'randomSeed',
|
||||
default: undefined,
|
||||
type: 'number',
|
||||
description:
|
||||
'The seed to use for random sampling. If set, different calls will generate deterministic results.',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
async supplyData(this: IExecuteFunctions, itemIndex: number): Promise<SupplyData> {
|
||||
const credentials = await this.getCredentials('mistralCloudApi');
|
||||
|
||||
const modelName = this.getNodeParameter('model', itemIndex) as string;
|
||||
const options = this.getNodeParameter('options', itemIndex, {
|
||||
maxRetries: 2,
|
||||
topP: 1,
|
||||
temperature: 0.7,
|
||||
maxTokens: -1,
|
||||
safeMode: false,
|
||||
randomSeed: undefined,
|
||||
}) as Partial<ChatMistralAIInput>;
|
||||
|
||||
const model = new ChatMistralAI({
|
||||
apiKey: credentials.apiKey as string,
|
||||
modelName,
|
||||
...options,
|
||||
});
|
||||
|
||||
return {
|
||||
response: logWrapper(model, this),
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,262 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
width="216"
|
||||
height="216"
|
||||
version="1.1"
|
||||
id="svg41"
|
||||
sodipodi:docname="mistral.svg"
|
||||
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview41"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:zoom="1.936488"
|
||||
inkscape:cx="197.78072"
|
||||
inkscape:cy="79.00901"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1017"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg41" />
|
||||
<style
|
||||
id="style1"><![CDATA[.I{fill:#ff7000}.J{fill:#ff4900}.K{fill:#ffa300}.L{fill:#1c1c1b icc-color(adobe-rgb-1998, 0.13299561, 0.13299561, 0.1289978)}]]></style>
|
||||
<defs
|
||||
id="defs10">
|
||||
<clipPath
|
||||
id="A">
|
||||
<path
|
||||
d="M 0,184.252 H 481.89 V 0 H 0 Z"
|
||||
transform="translate(-206.251,-140.139)"
|
||||
id="path1" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
id="B">
|
||||
<path
|
||||
d="M 0,184.252 H 481.89 V 0 H 0 Z"
|
||||
transform="translate(-247.436,-104.865)"
|
||||
id="path2" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
id="C">
|
||||
<path
|
||||
d="M 0,184.252 H 481.89 V 0 H 0 Z"
|
||||
transform="translate(-285.938,-102.089)"
|
||||
id="path3" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
id="D">
|
||||
<path
|
||||
d="M 0,184.252 H 481.89 V 0 H 0 Z"
|
||||
transform="translate(-337.769,-131.877)"
|
||||
id="path4" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
id="E">
|
||||
<path
|
||||
d="M 0,184.252 H 481.89 V 0 H 0 Z"
|
||||
transform="translate(-377.247,-132.319)"
|
||||
id="path5" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
id="F">
|
||||
<path
|
||||
d="M 0,184.252 H 481.89 V 0 H 0 Z"
|
||||
transform="translate(-418.107,-114.634)"
|
||||
id="path6" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
id="G">
|
||||
<path
|
||||
d="M 0,184.252 H 481.89 V 0 H 0 Z"
|
||||
transform="translate(-450.023,-140.139)"
|
||||
id="path7" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
id="H">
|
||||
<path
|
||||
d="M 0,184.252 H 481.89 V 0 H 0 Z"
|
||||
transform="translate(-217.694,-44.794)"
|
||||
id="path8" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
id="I">
|
||||
<path
|
||||
d="M 0,184.252 H 481.89 V 0 H 0 Z"
|
||||
transform="translate(-247.436,-35.025)"
|
||||
id="path9" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
id="J">
|
||||
<path
|
||||
d="M 0,184.252 H 481.89 V 0 H 0 Z"
|
||||
id="path10" />
|
||||
</clipPath>
|
||||
<path
|
||||
id="K"
|
||||
d="m 173.987,134.362 h -37.795 l 9.633,-37.776 h 37.796 z" />
|
||||
</defs>
|
||||
<g
|
||||
transform="matrix(1,0,0.254535,1,-51.362792,-7.4725007)"
|
||||
id="g32">
|
||||
<g
|
||||
class="L"
|
||||
id="g22">
|
||||
<path
|
||||
d="M 98.397,134.362 H 60.602 l 9.633,-37.776 h 37.796 z"
|
||||
id="path11" />
|
||||
<path
|
||||
d="M 126.558,172.138 H 88.763 l 9.633,-37.776 h 37.796 z"
|
||||
id="path12" />
|
||||
<path
|
||||
d="M 136.192,134.362 H 98.397 l 9.633,-37.776 h 37.796 z"
|
||||
id="path13" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
id="use13" />
|
||||
<path
|
||||
d="M 108.031,96.585 H 70.236 l 9.633,-37.776 h 37.796 z"
|
||||
id="path14" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="9.6339998"
|
||||
y="-37.777"
|
||||
id="use14" />
|
||||
<path
|
||||
d="M 60.602,134.362 H 22.807 L 32.44,96.586 h 37.796 z"
|
||||
id="path15" />
|
||||
<path
|
||||
d="M 70.236,96.585 H 32.441 L 42.074,58.809 H 79.87 Z"
|
||||
id="path16" />
|
||||
<path
|
||||
d="M 79.87,58.809 H 42.075 l 9.633,-37.776 h 37.796 z"
|
||||
id="path17" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="57.063"
|
||||
y="-75.553001"
|
||||
id="use17" />
|
||||
<path
|
||||
d="M 50.968,172.138 H 13.173 l 9.633,-37.776 h 37.796 z"
|
||||
id="path18" />
|
||||
<path
|
||||
d="M 41.334,209.915 H 3.539 l 9.633,-37.776 h 37.796 z"
|
||||
id="path19" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="37.794998"
|
||||
id="use19" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="47.429001"
|
||||
y="-37.777"
|
||||
id="use20" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="28.160999"
|
||||
y="37.776001"
|
||||
id="use21" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="18.527"
|
||||
y="75.553001"
|
||||
id="use22" />
|
||||
</g>
|
||||
<path
|
||||
d="M 114.115,134.359 H 76.321 l 9.633,-37.776 h 37.796 z"
|
||||
class="I"
|
||||
id="path22" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="-31.709999"
|
||||
y="37.772999"
|
||||
class="J"
|
||||
id="use23" />
|
||||
<g
|
||||
class="I"
|
||||
id="g25">
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="-22.076"
|
||||
y="-0.003"
|
||||
id="use24" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="15.719"
|
||||
y="-0.003"
|
||||
id="use25" />
|
||||
</g>
|
||||
<g
|
||||
class="K"
|
||||
id="g26">
|
||||
<path
|
||||
d="M 123.749,96.582 H 85.955 l 9.633,-37.776 h 37.796 z"
|
||||
id="path25" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="25.353001"
|
||||
y="-37.779999"
|
||||
id="use26" />
|
||||
</g>
|
||||
<path
|
||||
d="M 76.32,134.359 H 38.526 l 9.633,-37.776 h 37.796 z"
|
||||
class="I"
|
||||
id="path26" />
|
||||
<path
|
||||
d="M 85.954,96.582 H 48.16 l 9.633,-37.776 h 37.796 z"
|
||||
class="K"
|
||||
id="path27" />
|
||||
<g
|
||||
fill="#ffce00"
|
||||
id="g28">
|
||||
<path
|
||||
d="M 95.588,58.806 H 57.794 L 67.427,21.03 h 37.796 z"
|
||||
id="path28" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="72.781998"
|
||||
y="-75.556"
|
||||
id="use28" />
|
||||
</g>
|
||||
<path
|
||||
d="M 66.686,172.135 H 28.892 l 9.633,-37.776 h 37.796 z"
|
||||
class="J"
|
||||
id="path29" />
|
||||
<path
|
||||
d="M 57.052,209.912 H 19.258 l 9.633,-37.776 h 37.796 z"
|
||||
fill="#ff0107"
|
||||
id="path30" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="53.514"
|
||||
y="-0.003"
|
||||
class="I"
|
||||
id="use30" />
|
||||
<path
|
||||
d="M 237.135,96.582 H 199.34 l 9.633,-37.776 h 37.796 z"
|
||||
class="K"
|
||||
id="path31" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="43.880001"
|
||||
y="37.772999"
|
||||
class="J"
|
||||
id="use31" />
|
||||
<use
|
||||
xlink:href="#K"
|
||||
x="34.245998"
|
||||
y="75.550003"
|
||||
fill="#ff0107"
|
||||
id="use32" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 6.5 KiB |
|
@ -31,6 +31,7 @@
|
|||
"dist/credentials/GooglePalmApi.credentials.js",
|
||||
"dist/credentials/HuggingFaceApi.credentials.js",
|
||||
"dist/credentials/MotorheadApi.credentials.js",
|
||||
"dist/credentials/MistralCloudApi.credentials.js",
|
||||
"dist/credentials/OllamaApi.credentials.js",
|
||||
"dist/credentials/PineconeApi.credentials.js",
|
||||
"dist/credentials/QdrantApi.credentials.js",
|
||||
|
@ -54,11 +55,13 @@
|
|||
"dist/nodes/embeddings/EmbeddingsAwsBedrock/EmbeddingsAwsBedrock.node.js",
|
||||
"dist/nodes/embeddings/EmbeddingsGooglePalm/EmbeddingsGooglePalm.node.js",
|
||||
"dist/nodes/embeddings/EmbeddingsHuggingFaceInference/EmbeddingsHuggingFaceInference.node.js",
|
||||
"dist/nodes/embeddings/EmbeddingsMistralCloud/EmbeddingsMistralCloud.node.js",
|
||||
"dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js",
|
||||
"dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js",
|
||||
"dist/nodes/llms/LmGooglePalm/LmGooglePalm.node.js",
|
||||
"dist/nodes/llms/LmChatAwsBedrock/LmChatAwsBedrock.node.js",
|
||||
"dist/nodes/llms/LmChatGooglePalm/LmChatGooglePalm.node.js",
|
||||
"dist/nodes/llms/LmChatMistralCloud/LmChatMistralCloud.node.js",
|
||||
"dist/nodes/llms/LMChatOllama/LmChatOllama.node.js",
|
||||
"dist/nodes/llms/LMChatOpenAi/LmChatOpenAi.node.js",
|
||||
"dist/nodes/llms/LMOpenAi/LmOpenAi.node.js",
|
||||
|
@ -118,6 +121,8 @@
|
|||
"@getzep/zep-js": "0.9.0",
|
||||
"@google-ai/generativelanguage": "0.2.1",
|
||||
"@huggingface/inference": "2.6.4",
|
||||
"@langchain/core": "0.1.8",
|
||||
"@langchain/mistralai": "0.0.6",
|
||||
"@n8n/vm2": "3.9.20",
|
||||
"@pinecone-database/pinecone": "1.1.2",
|
||||
"@qdrant/js-client-rest": "1.7.0",
|
||||
|
|
|
@ -21,6 +21,7 @@ overrides:
|
|||
xml2js: ^0.5.0
|
||||
cpy@8>globby: ^11.1.0
|
||||
qqjs>globby: ^11.1.0
|
||||
'@langchain/core': ^0.1.8
|
||||
|
||||
patchedDependencies:
|
||||
'@sentry/cli@2.17.0':
|
||||
|
@ -186,6 +187,12 @@ importers:
|
|||
'@huggingface/inference':
|
||||
specifier: 2.6.4
|
||||
version: 2.6.4
|
||||
'@langchain/core':
|
||||
specifier: ^0.1.8
|
||||
version: 0.1.8
|
||||
'@langchain/mistralai':
|
||||
specifier: 0.0.6
|
||||
version: 0.0.6
|
||||
'@n8n/vm2':
|
||||
specifier: 3.9.20
|
||||
version: 3.9.20
|
||||
|
@ -218,7 +225,7 @@ importers:
|
|||
version: 1.2.0
|
||||
langchain:
|
||||
specifier: 0.0.198
|
||||
version: 0.0.198(@aws-sdk/client-bedrock-runtime@3.454.0)(@getzep/zep-js@0.9.0)(@google-ai/generativelanguage@0.2.1)(@huggingface/inference@2.6.4)(@pinecone-database/pinecone@1.1.2)(@qdrant/js-client-rest@1.7.0)(@supabase/supabase-js@2.38.5)(@xata.io/client@0.25.3)(cohere-ai@6.2.2)(d3-dsv@2.0.0)(epub2@3.0.1)(html-to-text@9.0.5)(lodash@4.17.21)(mammoth@1.6.0)(pdf-parse@1.1.1)(pg@8.11.3)(redis@4.6.11)(typeorm@0.3.17)
|
||||
version: 0.0.198(@aws-sdk/client-bedrock-runtime@3.454.0)(@getzep/zep-js@0.9.0)(@google-ai/generativelanguage@0.2.1)(@huggingface/inference@2.6.4)(@pinecone-database/pinecone@1.1.2)(@qdrant/js-client-rest@1.7.0)(@supabase/supabase-js@2.38.5)(@xata.io/client@0.25.3)(axios@1.6.2)(cohere-ai@6.2.2)(d3-dsv@2.0.0)(epub2@3.0.1)(html-to-text@9.0.5)(lodash@4.17.21)(mammoth@1.6.0)(pdf-parse@1.1.1)(pg@8.11.3)(redis@4.6.11)(typeorm@0.3.17)
|
||||
lodash:
|
||||
specifier: 4.17.21
|
||||
version: 4.17.21
|
||||
|
@ -5878,8 +5885,8 @@ packages:
|
|||
resolution: {integrity: sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==}
|
||||
dev: false
|
||||
|
||||
/@langchain/core@0.0.2:
|
||||
resolution: {integrity: sha512-Q3koIjjI295wUKrSMLTXoc3GUyGOS8L4NiLNWD05lozv9mXCNYG6/kmykzQLbiSWXVRKG4zQ82Kr7EHb39tQQw==}
|
||||
/@langchain/core@0.1.8:
|
||||
resolution: {integrity: sha512-ZTQ/NFjBbOKktVL+BlT/Fal5Ys0GAhygWeWdGNoFZg0qJfSt54fQzFhljNSpnQQ4Wavj8NkkCLiSFMnxDAuHjg==}
|
||||
engines: {node: '>=18'}
|
||||
dependencies:
|
||||
ansi-styles: 5.2.0
|
||||
|
@ -5887,12 +5894,23 @@ packages:
|
|||
decamelize: 1.2.0
|
||||
js-tiktoken: 1.0.8
|
||||
langsmith: 0.0.48
|
||||
ml-distance: 4.0.1
|
||||
p-queue: 6.6.2
|
||||
p-retry: 4.6.2
|
||||
uuid: 9.0.0
|
||||
zod: 3.22.4
|
||||
dev: false
|
||||
|
||||
/@langchain/mistralai@0.0.6:
|
||||
resolution: {integrity: sha512-zA/xxKNF+rDM9IF1uvVx+LI/eWPZSO85tJBX60ENeQrcM35np92Sm3ca0D4ixcdBAkG0vnn+9ELcYHGdknCbHQ==}
|
||||
engines: {node: '>=18'}
|
||||
dependencies:
|
||||
'@langchain/core': 0.1.8
|
||||
'@mistralai/mistralai': 0.0.7
|
||||
transitivePeerDependencies:
|
||||
- debug
|
||||
dev: false
|
||||
|
||||
/@lezer/common@1.1.0:
|
||||
resolution: {integrity: sha512-XPIN3cYDXsoJI/oDWoR2tD++juVrhgIago9xyKhZ7IhGlzdDM9QgC8D8saKNCz5pindGcznFr2HBSsEQSWnSjw==}
|
||||
dev: false
|
||||
|
@ -6020,6 +6038,15 @@ packages:
|
|||
resolution: {integrity: sha512-M/BexG/p05C5lFfMunxo/QcgIJnMT2vDVCd00wNqK2ImZONIlEETZwWJu1QtLxtmYlSHlCFl3JNzp0tLe7OJ5g==}
|
||||
dev: true
|
||||
|
||||
/@mistralai/mistralai@0.0.7:
|
||||
resolution: {integrity: sha512-47FiV/GBnt6gug99ZfDBcBofYuYvqT5AyhUDdtktUbCN+gq52tmiAbtwc88k7hlyUWHzJ28VpHRDfNTRfaWKxA==}
|
||||
dependencies:
|
||||
axios: 1.6.2(debug@3.2.7)
|
||||
axios-retry: 4.0.0(axios@1.6.2)
|
||||
transitivePeerDependencies:
|
||||
- debug
|
||||
dev: false
|
||||
|
||||
/@mongodb-js/saslprep@1.1.0:
|
||||
resolution: {integrity: sha512-Xfijy7HvfzzqiOAhAepF4SGN5e9leLkMvg/OPOF97XemjfVCYN/oWa75wnkc6mltMSTwY+XlbhWgUOJmkFspSw==}
|
||||
dependencies:
|
||||
|
@ -12059,6 +12086,15 @@ packages:
|
|||
is-retry-allowed: 2.2.0
|
||||
dev: false
|
||||
|
||||
/axios-retry@4.0.0(axios@1.6.2):
|
||||
resolution: {integrity: sha512-F6P4HVGITD/v4z9Lw2mIA24IabTajvpDZmKa6zq/gGwn57wN5j1P3uWrAV0+diqnW6kTM2fTqmWNfgYWGmMuiA==}
|
||||
peerDependencies:
|
||||
axios: 0.x || 1.x
|
||||
dependencies:
|
||||
axios: 1.6.2(debug@3.2.7)
|
||||
is-retry-allowed: 2.2.0
|
||||
dev: false
|
||||
|
||||
/axios@0.21.4:
|
||||
resolution: {integrity: sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==}
|
||||
dependencies:
|
||||
|
@ -18590,7 +18626,7 @@ packages:
|
|||
resolution: {integrity: sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==}
|
||||
dev: false
|
||||
|
||||
/langchain@0.0.198(@aws-sdk/client-bedrock-runtime@3.454.0)(@getzep/zep-js@0.9.0)(@google-ai/generativelanguage@0.2.1)(@huggingface/inference@2.6.4)(@pinecone-database/pinecone@1.1.2)(@qdrant/js-client-rest@1.7.0)(@supabase/supabase-js@2.38.5)(@xata.io/client@0.25.3)(cohere-ai@6.2.2)(d3-dsv@2.0.0)(epub2@3.0.1)(html-to-text@9.0.5)(lodash@4.17.21)(mammoth@1.6.0)(pdf-parse@1.1.1)(pg@8.11.3)(redis@4.6.11)(typeorm@0.3.17):
|
||||
/langchain@0.0.198(@aws-sdk/client-bedrock-runtime@3.454.0)(@getzep/zep-js@0.9.0)(@google-ai/generativelanguage@0.2.1)(@huggingface/inference@2.6.4)(@pinecone-database/pinecone@1.1.2)(@qdrant/js-client-rest@1.7.0)(@supabase/supabase-js@2.38.5)(@xata.io/client@0.25.3)(axios@1.6.2)(cohere-ai@6.2.2)(d3-dsv@2.0.0)(epub2@3.0.1)(html-to-text@9.0.5)(lodash@4.17.21)(mammoth@1.6.0)(pdf-parse@1.1.1)(pg@8.11.3)(redis@4.6.11)(typeorm@0.3.17):
|
||||
resolution: {integrity: sha512-YC0O1g8r61InCWyF5NmiQjdghdq6LKcgMrDZtqLbgDxAe4RoSldonm+5oNXS3yjCISG0j3s5Cty+yB7klqvUpg==}
|
||||
engines: {node: '>=18'}
|
||||
peerDependencies:
|
||||
|
@ -18901,11 +18937,12 @@ packages:
|
|||
'@getzep/zep-js': 0.9.0
|
||||
'@google-ai/generativelanguage': 0.2.1
|
||||
'@huggingface/inference': 2.6.4
|
||||
'@langchain/core': 0.0.2
|
||||
'@langchain/core': 0.1.8
|
||||
'@pinecone-database/pinecone': 1.1.2
|
||||
'@qdrant/js-client-rest': 1.7.0(typescript@5.3.2)
|
||||
'@supabase/supabase-js': 2.38.5
|
||||
'@xata.io/client': 0.25.3(typescript@5.3.2)
|
||||
axios: 1.6.2(debug@3.2.7)
|
||||
binary-extensions: 2.2.0
|
||||
cohere-ai: 6.2.2
|
||||
d3-dsv: 2.0.0
|
||||
|
|
Loading…
Reference in a new issue