bugfix
This commit is contained in:
parent
dc3e4fd059
commit
b44a0f1d39
|
|
@ -249,14 +249,14 @@ class VectaraChain_Chains implements INode {
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const mmrRerankerId = 272725718 // Vectara reranker ID for MMR
|
const mmrRerankerId = 272725718 // Vectara reranker ID for MMR
|
||||||
const mmrEnabled = vectaraFilter?.mmrConfig?.mmrDiversityBias > 0
|
const mmrEnabled = vectaraFilter?.mmrConfig?.enabled
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
query: [
|
query: [
|
||||||
{
|
{
|
||||||
query: input,
|
query: input,
|
||||||
start: 0,
|
start: 0,
|
||||||
numResults: mmrEnabled ? vectaraFilter?.mmrK : topK,
|
numResults: mmrEnabled ? vectaraFilter?.mmrTopK : topK,
|
||||||
corpusKey: corpusKeys,
|
corpusKey: corpusKeys,
|
||||||
contextConfig: {
|
contextConfig: {
|
||||||
sentencesAfter: vectaraFilter?.contextConfig?.sentencesAfter ?? 2,
|
sentencesAfter: vectaraFilter?.contextConfig?.sentencesAfter ?? 2,
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,5 @@
|
||||||
import { flatten } from 'lodash'
|
import { flatten } from 'lodash'
|
||||||
import {
|
import { VectaraStore, VectaraLibArgs, VectaraFilter, VectaraContextConfig, VectaraFile, MMRConfig } from 'langchain/vectorstores/vectara'
|
||||||
VectaraStore,
|
|
||||||
VectaraLibArgs,
|
|
||||||
VectaraFilter,
|
|
||||||
VectaraContextConfig,
|
|
||||||
VectaraFile,
|
|
||||||
VectaraMMRConfig
|
|
||||||
} from 'langchain/vectorstores/vectara'
|
|
||||||
import { Document } from 'langchain/document'
|
import { Document } from 'langchain/document'
|
||||||
import { Embeddings } from 'langchain/embeddings/base'
|
import { Embeddings } from 'langchain/embeddings/base'
|
||||||
import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
|
||||||
|
|
@ -237,8 +230,9 @@ class Vectara_VectorStores implements INode {
|
||||||
if (sentencesBefore) vectaraContextConfig.sentencesBefore = sentencesBefore
|
if (sentencesBefore) vectaraContextConfig.sentencesBefore = sentencesBefore
|
||||||
if (sentencesAfter) vectaraContextConfig.sentencesAfter = sentencesAfter
|
if (sentencesAfter) vectaraContextConfig.sentencesAfter = sentencesAfter
|
||||||
vectaraFilter.contextConfig = vectaraContextConfig
|
vectaraFilter.contextConfig = vectaraContextConfig
|
||||||
const mmrConfig: VectaraMMRConfig = {}
|
const mmrConfig: MMRConfig = {}
|
||||||
mmrConfig.mmrK = mmrK
|
mmrConfig.enabled = mmrDiversityBias > 0
|
||||||
|
mmrConfig.mmrTopK = mmrK
|
||||||
mmrConfig.diversityBias = mmrDiversityBias
|
mmrConfig.diversityBias = mmrDiversityBias
|
||||||
vectaraFilter.mmrConfig = mmrConfig
|
vectaraFilter.mmrConfig = mmrConfig
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue