Bugfix/Add astradb collection name and namespace (#2071)
add astradb collection name and namespace
This commit is contained in:
parent
a09b7f7e39
commit
70706a7183
|
|
@ -10,13 +10,8 @@ class AstraDBApi implements INodeCredential {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.label = 'Astra DB API'
|
this.label = 'Astra DB API'
|
||||||
this.name = 'AstraDBApi'
|
this.name = 'AstraDBApi'
|
||||||
this.version = 1.0
|
this.version = 2.0
|
||||||
this.inputs = [
|
this.inputs = [
|
||||||
{
|
|
||||||
label: 'Astra DB Collection Name',
|
|
||||||
name: 'collectionName',
|
|
||||||
type: 'string'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: 'Astra DB Application Token',
|
label: 'Astra DB Application Token',
|
||||||
name: 'applicationToken',
|
name: 'applicationToken',
|
||||||
|
|
|
||||||
|
|
@ -23,13 +23,12 @@ class Astra_VectorStores implements INode {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.label = 'Astra'
|
this.label = 'Astra'
|
||||||
this.name = 'Astra'
|
this.name = 'Astra'
|
||||||
this.version = 1.0
|
this.version = 2.0
|
||||||
this.type = 'Astra'
|
this.type = 'Astra'
|
||||||
this.icon = 'astra.svg'
|
this.icon = 'astra.svg'
|
||||||
this.category = 'Vector Stores'
|
this.category = 'Vector Stores'
|
||||||
this.description = `Upsert embedded data and perform similarity or mmr search upon query using DataStax Astra DB, a serverless vector database that’s perfect for managing mission-critical AI workloads`
|
this.description = `Upsert embedded data and perform similarity or mmr search upon query using DataStax Astra DB, a serverless vector database that’s perfect for managing mission-critical AI workloads`
|
||||||
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
|
this.baseClasses = [this.type, 'VectorStoreRetriever', 'BaseRetriever']
|
||||||
this.badge = 'NEW'
|
|
||||||
this.credential = {
|
this.credential = {
|
||||||
label: 'Connect Credential',
|
label: 'Connect Credential',
|
||||||
name: 'credential',
|
name: 'credential',
|
||||||
|
|
@ -49,6 +48,16 @@ class Astra_VectorStores implements INode {
|
||||||
name: 'embeddings',
|
name: 'embeddings',
|
||||||
type: 'Embeddings'
|
type: 'Embeddings'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'Namespace',
|
||||||
|
name: 'astraNamespace',
|
||||||
|
type: 'string'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Collection',
|
||||||
|
name: 'astraCollection',
|
||||||
|
type: 'string'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'Vector Dimension',
|
label: 'Vector Dimension',
|
||||||
name: 'vectorDimension',
|
name: 'vectorDimension',
|
||||||
|
|
@ -96,6 +105,8 @@ class Astra_VectorStores implements INode {
|
||||||
const docs = nodeData.inputs?.document as Document[]
|
const docs = nodeData.inputs?.document as Document[]
|
||||||
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
||||||
const vectorDimension = nodeData.inputs?.vectorDimension as number
|
const vectorDimension = nodeData.inputs?.vectorDimension as number
|
||||||
|
const astraNamespace = nodeData.inputs?.astraNamespace as string
|
||||||
|
const astraCollection = nodeData.inputs?.astraCollection as string
|
||||||
const similarityMetric = nodeData.inputs?.similarityMetric as 'cosine' | 'euclidean' | 'dot_product' | undefined
|
const similarityMetric = nodeData.inputs?.similarityMetric as 'cosine' | 'euclidean' | 'dot_product' | undefined
|
||||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||||
|
|
||||||
|
|
@ -111,7 +122,8 @@ class Astra_VectorStores implements INode {
|
||||||
|
|
||||||
const astraConfig: AstraLibArgs = {
|
const astraConfig: AstraLibArgs = {
|
||||||
...clientConfig,
|
...clientConfig,
|
||||||
collection: credentialData.collectionName ?? 'flowise_test',
|
namespace: astraNamespace ?? 'default_keyspace',
|
||||||
|
collection: astraCollection ?? credentialData.collectionName ?? 'flowise_test',
|
||||||
collectionOptions: {
|
collectionOptions: {
|
||||||
vector: {
|
vector: {
|
||||||
dimension: vectorDimension ?? 1536,
|
dimension: vectorDimension ?? 1536,
|
||||||
|
|
@ -141,7 +153,8 @@ class Astra_VectorStores implements INode {
|
||||||
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
const embeddings = nodeData.inputs?.embeddings as Embeddings
|
||||||
const vectorDimension = nodeData.inputs?.vectorDimension as number
|
const vectorDimension = nodeData.inputs?.vectorDimension as number
|
||||||
const similarityMetric = nodeData.inputs?.similarityMetric as 'cosine' | 'euclidean' | 'dot_product' | undefined
|
const similarityMetric = nodeData.inputs?.similarityMetric as 'cosine' | 'euclidean' | 'dot_product' | undefined
|
||||||
|
const astraNamespace = nodeData.inputs?.astraNamespace as string
|
||||||
|
const astraCollection = nodeData.inputs?.astraCollection as string
|
||||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||||
|
|
||||||
const expectedSimilarityMetric = ['cosine', 'euclidean', 'dot_product']
|
const expectedSimilarityMetric = ['cosine', 'euclidean', 'dot_product']
|
||||||
|
|
@ -156,7 +169,8 @@ class Astra_VectorStores implements INode {
|
||||||
|
|
||||||
const astraConfig: AstraLibArgs = {
|
const astraConfig: AstraLibArgs = {
|
||||||
...clientConfig,
|
...clientConfig,
|
||||||
collection: credentialData.collectionName ?? 'flowise_test',
|
namespace: astraNamespace ?? 'default_keyspace',
|
||||||
|
collection: astraCollection ?? credentialData.collectionName ?? 'flowise_test',
|
||||||
collectionOptions: {
|
collectionOptions: {
|
||||||
vector: {
|
vector: {
|
||||||
dimension: vectorDimension ?? 1536,
|
dimension: vectorDimension ?? 1536,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue