Skip to content

Commit dafd038

Browse files
authored
feat(community): add new filters and search options for ChatPerplexity (langchain-ai#8981)
1 parent 86e8976 commit dafd038

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

libs/langchain-community/src/chat_models/perplexity.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,18 @@ export interface PerplexityChatInput extends BaseChatModelParams {
140140
/** Filters search results to only include content published before this date. */
141141
searchBeforeDateFilter?: string;
142142

143+
/** Filters search results to only include content last updated after this date. */
144+
lastUpdatedAfterFilter?: string;
145+
146+
/** Filters search results to only include content last updated before this date. */
147+
lastUpdatedBeforeFilter?: string;
148+
149+
/** When set to true, disables web search completely and the model will only use its training data to respond. This is useful when you want deterministic responses without external information. */
150+
disableSearch?: boolean;
151+
152+
/** Enables a classifier that decides if web search is needed based on your query. */
153+
enableSearchClassifier?: boolean;
154+
143155
/**
144156
* Configuration for using web search in model responses.
145157
*/
@@ -204,6 +216,14 @@ export class ChatPerplexity
204216

205217
searchBeforeDateFilter?: string;
206218

219+
lastUpdatedAfterFilter?: string;
220+
221+
lastUpdatedBeforeFilter?: string;
222+
223+
disableSearch?: boolean;
224+
225+
enableSearchClassifier?: boolean;
226+
207227
webSearchOptions?: WebSearchOptions;
208228

209229
private client: OpenAI;
@@ -271,6 +291,10 @@ export class ChatPerplexity
271291
reasoning_effort: this.reasoningEffort,
272292
search_after_date_filter: this.searchAfterDateFilter,
273293
search_before_date_filter: this.searchBeforeDateFilter,
294+
last_updated_after_filter: this.lastUpdatedAfterFilter,
295+
last_updated_before_filter: this.lastUpdatedBeforeFilter,
296+
disable_search: this.disableSearch,
297+
enable_search_classifier: this.enableSearchClassifier,
274298
web_search_options: this.webSearchOptions as Record<string, unknown>, // Cast WebSearchOptions to generic type to avoid conflict with OpenAI's WebSearchOptions interface
275299
};
276300
}

0 commit comments

Comments
 (0)