galah icon indicating copy to clipboard operation
galah copied to clipboard

Add more control over response generation

Open 0x4D31 opened this issue 1 year ago • 0 comments

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."

0x4D31 avatar Jan 22 '24 18:01 0x4D31