fix: rag is not working for nitro (#2511)

Signed-off-by: James <james@jan.ai>
Co-authored-by: James <james@jan.ai>
This commit is contained in:
NamH 2024-03-27 11:17:43 +07:00 committed by GitHub
parent 84e1b09e84
commit 5eed8a5eca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -31,7 +31,6 @@ export class Retrieval {
public updateEmbeddingEngine(engine: string): void { public updateEmbeddingEngine(engine: string): void {
// Engine settings are not compatible with the current embedding model params // Engine settings are not compatible with the current embedding model params
// Switch case manually for now // Switch case manually for now
const settings = readEmbeddingEngine(engine)
if (engine === 'nitro') { if (engine === 'nitro') {
this.embeddingModel = new OpenAIEmbeddings( this.embeddingModel = new OpenAIEmbeddings(
{ openAIApiKey: 'nitro-embedding' }, { openAIApiKey: 'nitro-embedding' },
@ -40,6 +39,7 @@ export class Retrieval {
) )
} else { } else {
// Fallback to OpenAI Settings // Fallback to OpenAI Settings
const settings = readEmbeddingEngine(engine)
this.embeddingModel = new OpenAIEmbeddings({ this.embeddingModel = new OpenAIEmbeddings({
openAIApiKey: settings.api_key, openAIApiKey: settings.api_key,
}) })