mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-07-07 17:18:38 +00:00
feat(Tavily): update sample configuration for Tavily integration
This commit is contained in:
@ -7,7 +7,7 @@ import { PromptTemplate } from '@langchain/core/prompts';
|
||||
import formatChatHistoryAsString from '../utils/formatHistory';
|
||||
import { BaseMessage } from '@langchain/core/messages';
|
||||
import { StringOutputParser } from '@langchain/core/output_parsers';
|
||||
import { searchSearxng } from '../searxng';
|
||||
import { searchSearxng } from '../searchEngines/searxng';
|
||||
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
||||
|
||||
const imageSearchChainPrompt = `
|
||||
|
@ -7,7 +7,7 @@ import { PromptTemplate } from '@langchain/core/prompts';
|
||||
import formatChatHistoryAsString from '../utils/formatHistory';
|
||||
import { BaseMessage } from '@langchain/core/messages';
|
||||
import { StringOutputParser } from '@langchain/core/output_parsers';
|
||||
import { searchSearxng } from '../searxng';
|
||||
import { searchSearxng } from '../searchEngines/searxng';
|
||||
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
||||
|
||||
const VideoSearchChainPrompt = `
|
||||
|
@ -17,8 +17,8 @@ import LineListOutputParser from '../outputParsers/listLineOutputParser';
|
||||
import LineOutputParser from '../outputParsers/lineOutputParser';
|
||||
import { getDocumentsFromLinks } from '../utils/documents';
|
||||
import { Document } from 'langchain/document';
|
||||
import { searchTavily } from '../tavily';
|
||||
import { searchSearxng } from '../searxng';
|
||||
import { searchTavily } from '../searchEngines/tavily';
|
||||
import { searchSearxng } from '../searchEngines/searxng';
|
||||
import { getSearchEngine } from '../config';
|
||||
import path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
@ -208,7 +208,6 @@ class MetaSearchAgent implements MetaSearchAgentType {
|
||||
question = question.replace(/<think>.*?<\/think>/g, '');
|
||||
|
||||
const searchEngine = getSearchEngine();
|
||||
console.log(`Using search engine: ${searchEngine}`);
|
||||
|
||||
let res;
|
||||
|
||||
@ -226,12 +225,8 @@ class MetaSearchAgent implements MetaSearchAgentType {
|
||||
});
|
||||
}
|
||||
|
||||
// If we have an AI-generated answer from Tavily, create a document for it
|
||||
let documents: Document[] = [];
|
||||
|
||||
|
||||
|
||||
// Add the regular search results
|
||||
documents = documents.concat(
|
||||
res.results.map(
|
||||
(result) =>
|
||||
|
@ -1,5 +1,5 @@
|
||||
import axios from 'axios';
|
||||
import { getSearxngApiEndpoint } from './config';
|
||||
import { getSearxngApiEndpoint } from '../config';
|
||||
|
||||
interface SearxngSearchOptions {
|
||||
categories?: string[];
|
@ -1,5 +1,5 @@
|
||||
import axios from 'axios';
|
||||
import { getTavilyApiKey } from './config';
|
||||
import { getTavilyApiKey } from '../config';
|
||||
|
||||
interface TavilySearchOptions {
|
||||
topic?: 'general' | 'news';
|
Reference in New Issue
Block a user