galah
galah copied to clipboard
Add more control over response generation
Implement a dynamic, rule-based approach to gain more control over response generation. With this approach, we can further reduce OpenAI API costs and enhance the accuracy of generated responses.
For example, add a rule processing module with a separate configuration file to add rules for specific requests, such as responding to '/' with predefined static/dynamic responses (HTTP headers + body), while reserving the OpenAI API for more unique and unanticipated requests.
An example rule config:
rules:
- name: "Rule for Known Scanners"
conditions:
isKnownScanner: true
httpRequest: "/"
response:
type: "static"
template: "path/to/template_for_scanner"
- name: "Controlled LLM-generated response"
conditions:
httpRequest: ”/.aws/credential”
response:
type: "hybrid"
template: "path/to/default_dynamic_template"
openaiPrompt: "example instruction to append to the prompt."