Skip to main content

Prompt injection with context

Any additional context you’d like to provide to your LLM can be added in adding the context section to your .agent.yml file, as shown below:
context:
  - name: files
    type: file
    src:
      - "*.txt"
This means that SQL files can be added to your oxy repository as plain .sql files, then supplied to the agent using the context object.
context:
  - name: queries
    type: file
    src:
      - "*.sql"
You can then reference these within the system_instructions using Jinja, as follows:
{{ context.queries }}
where queries references the name given in the context field.

Best practices for SQL

For SQL queries, in particular, at the top of these files, you should generally add a comment that describes what the query does (we call this “front matter” internally).
The accepted format of this front matter will likely change in the future.
/*
 * The following query gets the date range over which the data is available.
 */

select
  min(PARSE_DATE('%Y-%m', month)) as min_date,
  max(PARSE_DATE('%Y-%m', month)) as max_date
from 'user_events.csv';

Retrieval configuration

To configure data instead for retrieval, see the agents section.