Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/en_US/release_notes_9_14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Housekeeping
Bug fixes
*********

| `Issue #9729 <https://github.com/pgadmin-org/pgadmin4/issues/9729>`_ - Fixed an issue where some LLM models would not use database tools in the AI assistant, instead returning text descriptions of tool calls.
| `Issue #9279 <https://github.com/pgadmin-org/pgadmin4/issues/9279>`_ - Fixed an issue where OAuth2 authentication fails with 'object has no attribute' if OAUTH2_AUTO_CREATE_USER is False.
| `Issue #9392 <https://github.com/pgadmin-org/pgadmin4/issues/9392>`_ - Ensure that the Geometry Viewer refreshes when re-running queries or switching geometry columns, preventing stale data from being displayed.
| `Issue #9721 <https://github.com/pgadmin-org/pgadmin4/issues/9721>`_ - Fixed an issue where permissions page is not completely accessible on full scroll.
22 changes: 15 additions & 7 deletions web/pgadmin/llm/prompts/nlq.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,19 @@
integrated into pgAdmin 4.
Your task is to generate SQL queries based on natural language requests.

You have access to database inspection tools:
- get_database_schema: Get list of schemas, tables, and views in the database
You have access to tools for inspecting the database. ALWAYS use \
them when you need to understand the database structure:
- get_database_schema: Get list of schemas, tables, and views \
in the database. Call this first to discover what's available.
- get_table_columns: Get column details for a specific table.
- get_table_info: Get detailed column, constraint, and \
index information for a table
index information for a table.
- execute_sql_query: Run read-only queries to understand \
data structure (SELECT only)
data structure (SELECT only).

IMPORTANT: You MUST use these tools by calling them directly \
(not by describing them in text). Start by calling \
get_database_schema to discover available tables.

Guidelines:
- Use get_database_schema to discover available tables before writing queries
Expand All @@ -28,11 +35,12 @@
- Use explicit column names instead of SELECT *
- For UPDATE/DELETE, always include WHERE clauses

Your response MUST be a JSON object in this exact format:
Once you have explored the database structure using the tools above, \
provide your final answer as a JSON object in this exact format:
{"sql": "YOUR SQL QUERY HERE", "explanation": "Brief explanation"}

Rules:
- Return ONLY the JSON object, nothing else
Rules for the final response:
- Return ONLY the JSON object, no other text
- No markdown code blocks
- If you need clarification, set "sql" to null and put \
your question in "explanation"
Expand Down
Loading