diff --git a/docs/API/SEARCH.md b/docs/API/SEARCH.md index 3a28a78..b67b62b 100644 --- a/docs/API/SEARCH.md +++ b/docs/API/SEARCH.md @@ -33,6 +33,7 @@ The API accepts a JSON object in the request body, where you define the focus mo ["human", "Hi, how are you?"], ["assistant", "I am doing well, how can I help you today?"] ], + "systemInstructions": "Focus on providing technical details about Perplexica's architecture.", "stream": false } ``` @@ -63,6 +64,8 @@ The API accepts a JSON object in the request body, where you define the focus mo - **`query`** (string, required): The search query or question. +- **`systemInstructions`** (string, optional): Custom instructions provided by the user to guide the AI's response. These instructions are treated as user preferences and have lower priority than the system's core instructions. For example, you can specify a particular writing style, format, or focus area. + - **`history`** (array, optional): An array of message pairs representing the conversation history. Each pair consists of a role (either 'human' or 'assistant') and the message content. This allows the system to use the context of the conversation to refine results. Example: ```json diff --git a/src/app/api/search/route.ts b/src/app/api/search/route.ts index 563cebe..970ec42 100644 --- a/src/app/api/search/route.ts +++ b/src/app/api/search/route.ts @@ -34,6 +34,7 @@ interface ChatRequestBody { query: string; history: Array<[string, string]>; stream?: boolean; + systemInstructions?: string; } export const POST = async (req: Request) => { @@ -125,7 +126,7 @@ export const POST = async (req: Request) => { embeddings, body.optimizationMode, [], - '', + body.systemInstructions || '', ); if (!body.stream) {