Merge pull request #720 from OmarElKadri/master

feat(search): add optional systemInstructions to API request body
This commit is contained in:
ItzCrazyKns
2025-04-06 10:34:29 +05:30
committed by GitHub
2 changed files with 5 additions and 1 deletions

View File

@ -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

View File

@ -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) {