Feature: Add SambaNova (#4961)

* add sambanova

* add sambanova credential

* fix samba nova chat node

---------

Co-authored-by: Henry <hzj94@hotmail.com>
This commit is contained in:
Luis Felipe Salazar Ucros
2025-08-18 09:09:39 -05:00
committed by GitHub
parent ad0679801a
commit bf1ddc3be5
6 changed files with 218 additions and 0 deletions
@@ -0,0 +1,71 @@
import { getBaseClasses, getCredentialData, getCredentialParam, ICommonObject, INode, INodeData, INodeParams } from '../../../src'
import { OpenAI } from '@langchain/openai'
import { BaseCache } from '@langchain/core/caches'
class Sambanova_LLMs implements INode {
label: string
name: string
version: number
type: string
icon: string
category: string
description: string
baseClasses: string[]
credential: INodeParams
inputs: INodeParams[]
constructor() {
this.label = 'Sambanova'
this.name = 'sambanova'
this.version = 1.0
this.type = 'Sambanova'
this.icon = 'sambanova.png'
this.category = 'LLMs'
this.description = 'Wrapper around Sambanova API for large language models'
this.baseClasses = [this.type, ...getBaseClasses(OpenAI)]
this.credential = {
label: 'Connect Credential',
name: 'credential',
type: 'credential',
credentialNames: ['sambanovaApi']
}
this.inputs = [
{
label: 'Cache',
name: 'cache',
type: 'BaseCache',
optional: true
},
{
label: 'Model Name',
name: 'modelName',
type: 'string',
default: 'Meta-Llama-3.3-70B-Instruct',
description: 'For more details see https://docs.sambanova.ai/cloud/docs/get-started/supported-models',
optional: true
}
]
}
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
const cache = nodeData.inputs?.cache as BaseCache
const modelName = nodeData.inputs?.modelName as string
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
const sambanovaKey = getCredentialParam('sambanovaApiKey', credentialData, nodeData)
const obj: any = {
model: modelName,
configuration: {
baseURL: 'https://api.sambanova.ai/v1',
apiKey: sambanovaKey
}
}
if (cache) obj.cache = cache
const sambanova = new OpenAI(obj)
return sambanova
}
}
module.exports = { nodeClass: Sambanova_LLMs }
Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB