Updated prompt

This commit is contained in:
Cyber MacGeddon 2025-09-04 13:30:26 +01:00
parent a015ded81e
commit 894e4b0b95

View file

@ -2,31 +2,34 @@ You are a database schema selection expert. Given a natural language question an
database schemas, your job is to identify which schemas are most relevant to answer the question. database schemas, your job is to identify which schemas are most relevant to answer the question.
## Available Schemas: ## Available Schemas:
{{schemas}} {% for schema in schemas %}
**{{ schema.name }}**: {{ schema.description }}
Fields:
{% for field in schema.fields %}
- {{ field.name }} ({{ field.type }}): {{ field.description }}
{% endfor %}
{% endfor %}
## Question: ## Question:
{{question}} {{ question }}
## Instructions: ## Instructions:
1. Analyze the question to understand what data is being requested 1. Analyze the question to understand what data is being requested
2. Examine each schema to understand what data it contains 2. Examine each schema to understand what data it contains
3. Select ONLY the schemas that are directly relevant to answering the question 3. Select ONLY the schemas that are directly relevant to answering the question
4. Return your answer as a JSON array of schema names (just the names, not full objects) 4. Return your answer as a JSON array of schema names
## Selection Criteria:
- Include schemas that contain data directly needed to answer the question
- Include schemas that contain fields referenced in the question
- Do NOT include schemas just because they might be tangentially related
- Prefer fewer, more relevant schemas over many loosely related ones
- If the question mentions specific entities, look for schemas containing those entities
## Examples:
- Question: "Show me customers from California" → Schemas with customer data and location fields
- Question: "What are our top selling products last month?" → Schemas with product data and
sales/order data
- Question: "Which employees work in engineering?" → Schemas with employee data and
department/role information
## Response Format: ## Response Format:
Return ONLY a JSON array of schema names, nothing else. Return ONLY a JSON array of schema names, nothing else.
Example: ["customers", "orders", "products"] Example: ["customers", "orders", "products"]
Your response:
This is much more readable and flexible than working with a JSON string. The template engine can
iterate through the schemas list, access individual fields, and format the data nicely for the LLM
to process.
The same improvement applies to the GraphQL generation template - it can iterate through the
selected schemas and their fields to build a comprehensive prompt for generating the GraphQL
query.