Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prompt to create Full-stack application from DB metadata #53

Merged
merged 1 commit into from
Oct 26, 2024
Merged
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
23 changes: 14 additions & 9 deletions src/main/java/io/github/jeddict/ai/JeddictChatModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -787,21 +787,26 @@ private String wrapLongLinesWithBr(String input, int maxLineLength) {
}

public String assistDbMetadata(String dbMetadata, String developerQuestion) {
StringBuilder dbPrompt = new StringBuilder("You are an API server that provides assistance with SQL queries and database-related questions. ");
StringBuilder dbPrompt = new StringBuilder("You are an API server that provides assistance. ");

dbPrompt.append("Given the following database schema metadata:\n")
.append(dbMetadata)
.append("\nRespond to the developer's question: \n")
.append("\nPlease respond to the developer's question:\n")
.append(developerQuestion)
.append("\n")
.append("""
Analyze the metadata and provide a relevant SQL query with a description. Offer guidance
or explanations to address the developer's question, error, or inquiry related to the database.
Ensure the SQL queries match the database structure, constraints, and relationships.
and do not wrap individual SQL keywords or table/column names in <code> tags
and do not wrap any partial sql query segment in <code> tags.
Always include a detailed explanation of the query, including its purpose and how it relates to the developer's question.
""");
There are two possible scenarios for your response:

1. **SQL Queries and Database-Related Questions**:
- Analyze the provided metadata and generate a relevant SQL query that addresses the developer's inquiry.
- Include a detailed explanation of the query, clarifying its purpose and how it relates to the developer's question.
- Ensure that the SQL syntax adheres to the database structure, constraints, and relationships.
- The full SQL query should be wrapped in ```sql for proper formatting.
- Avoid wrapping individual SQL keywords or table/column names in <code> tags, and do not wrap any partial SQL query segments in <code> tags.

2. **Generating Specific Code from Database Metadata**:
- If the developer requests specific code snippets related to the database metadata, generate the appropriate code and include a clear description of its functionality and relevance.
""");

String response = generate(dbPrompt.toString());
System.out.println(response);
Expand Down
Loading