Skip to content

Commit 8393d82

Browse files
azurecoderCopilot
andcommitted
Update readme to reflect full feature parity with DotPrompt 0.0.6.1
- Replace outdated feature list with full support table - Remove note about few-shot not being supported (now implemented) - Add installation snippet, code usage example, database schema section - Document new columns (Temperature, OutputSchema, FewShots) and migration behaviour - Fix broken image path Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 5258538 commit 8393d82

1 file changed

Lines changed: 63 additions & 20 deletions

File tree

readme.md

Lines changed: 63 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
# DotPrompt.Sql
1+
# DotPrompt.Sql
22

3-
This is a SQL store configured to be used with the the DotPrompt library. It currently has support for everything that you would find in DotPrompt prompt files bar a couple of things that are still in development. You can give it a prompt file and it will add the data from the prompt file to a set of related SQL tables.
3+
A SQL store for the [DotPrompt](https://github.com/elastacloud/dotprompt) library. It stores prompt files in a set of related SQL Server tables, with automatic versioning — a new version is only inserted when the content of a prompt actually changes.
44

5-
In order to use this a CLI is provided which will allow you to add a prompt file to the database as long it adheres to the rules defined in DotPrompt.
5+
A CLI is provided to add prompt files directly to the database.
66

7-
You can use the CLI with the following syntax:
7+
## Installation
88

99
```
10-
DotPrompt.Sql.Cli ./prompts/basic.prompt ./sample.yaml
10+
dotnet add package DotPrompt.Sql
1111
```
1212

13-
The YAML file should contain the connection details to SQL Server / Azure SQL DB or Microsoft Fabric SQL DB with the following format.
13+
## CLI Usage
14+
15+
```
16+
DotPrompt.Sql.Cli ./prompts/basic.prompt ./sample.yaml
17+
```
18+
19+
The YAML file should contain the connection details for SQL Server, Azure SQL DB, or Microsoft Fabric SQL DB:
1420

1521
```yaml
1622
server: "myserver.database.windows.net"
@@ -22,25 +28,62 @@ integrated_authentication: false
2228
aad_authentication: true
2329
```
2430
25-
**DotPrompt.SQL** currently supports the following features from a prompt file.
31+
## Supported Features
32+
33+
DotPrompt.Sql supports all current DotPrompt prompt file features:
34+
35+
| Feature | Supported |
36+
|---|---|
37+
| Name | ✅ |
38+
| Version | ✅ |
39+
| Model | ✅ |
40+
| System prompt | ✅ |
41+
| User prompt | ✅ |
42+
| Temperature | ✅ |
43+
| MaxTokens | ✅ |
44+
| Parameters | ✅ |
45+
| Default values | ✅ |
46+
| Output format | ✅ |
47+
| Output schema (JSON Schema) | ✅ |
48+
| Few-shot examples | ✅ |
49+
50+
## Using the Store in Code
51+
52+
Instantiate `SqlTablePromptStore` with an `IPromptRepository` backed by an open `IDbConnection`:
53+
54+
```csharp
55+
IDbConnection connection = new SqlConnection(connectionString);
56+
IPromptRepository repository = new SqlPromptRepository(connection);
57+
IPromptStore store = new SqlTablePromptStore(repository);
58+
59+
// Load all latest-version prompts
60+
IEnumerable<PromptFile> prompts = store.Load();
61+
62+
// Save a prompt file
63+
store.Save(myPromptFile, name: null);
64+
```
65+
66+
## Database Schema
67+
68+
Tables are created automatically on first run via `CreateDefaultPromptTables.sql`. The schema uses:
2669

27-
- System prompt
28-
- User prompt
29-
- Model
30-
- Name
31-
- Temperature
32-
- MaxTokens
33-
- Parameters
34-
- Default
70+
- **`PromptFile`** — one row per prompt version, with a unique constraint on `(PromptName, VersionNumber)`
71+
- **`PromptParameters`** — parameter name/type pairs linked to a prompt version
72+
- **`ParameterDefaults`** — default values linked to parameters
3573

36-
It doesn't currently support the **Few Shot Prompt** section but will shortly. It has been tested only for only username and password database access but will be tested with the others so whilst config is supported access may well break. Let me know if this is the case.
74+
New columns added in v0.2.3:
3775

38-
It will automatically create the tables with a unique constraint on PromptName which name which names that the names in the prompt files should be unique for now although I'll be looking at more composite uniqueness in the future with a **category table** and **categoryid** which will test for unique names within the category itself.
76+
| Column | Type | Purpose |
77+
|---|---|---|
78+
| `Temperature` | `FLOAT NULL` | Maps to `PromptConfig.Temperature` |
79+
| `OutputSchema` | `NVARCHAR(MAX) NULL` | JSON Schema document for structured output |
80+
| `FewShots` | `NVARCHAR(MAX) NULL` | JSON array of few-shot user/response pairs |
3981

40-
![Open Source Diagrams.png](..%2FOpen%20Source%20Diagrams.png)
82+
Existing databases are migrated automatically — the SQL scripts use `IF NOT EXISTS` guards to add missing columns without data loss.
4183

42-
The above is right as per v0.1 and I'll update until I get to a stable build which covers all of the features from DotPrompt.
84+
## Architecture
4385

44-
You can review DotPrompt [here](https://github.com/elastacloud/dotprompt).
86+
![Open Source Diagrams.png](Open%20Source%20Diagrams.png)
4587

88+
You can review the DotPrompt library [here](https://github.com/elastacloud/dotprompt).
4689

0 commit comments

Comments
 (0)