File tree 1 file changed +18
-1
lines changed
1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -279,7 +279,24 @@ public function get_ai_response( $search_term, $search_vectors = null ) {
279
279
];
280
280
}
281
281
282
- $ prompt = $ this ->get_prompt ( $ posts_representations );
282
+ /**
283
+ * Filters the AI prompt before it goes to the request.
284
+ *
285
+ * This filter allows developers to short-circuit the AI prompt set in the plugin settings.
286
+ * Use this if you want to conditionally manipulate the prompt or implement more sophisticated logic.
287
+ *
288
+ * @param {string} $prompt The prompt as set in the plugin settings.
289
+ * @param {array} $posts_representations The posts to be used as context.
290
+ *
291
+ * @return {string} TRhe prompt for the AI model.
292
+ * @since 2.5.0
293
+ * @hook ep_rag_prompt
294
+ */
295
+ $ prompt = apply_filters (
296
+ 'ep_rag_prompt ' ,
297
+ $ this ->get_prompt ( $ posts_representations ),
298
+ $ posts_representations
299
+ );
283
300
$ response = $ this ->ai_api_request ( $ prompt , $ search_term );
284
301
285
302
/**
You can’t perform that action at this time.
0 commit comments