diff --git a/README.md b/README.md index 95720a0..b797f9c 100644 --- a/README.md +++ b/README.md @@ -6,17 +6,22 @@ The application is a Minimal API that exposes endpoints to load documents, gener > [!NOTE] > If you prefer to use straight SQL, check out the [sql branch](https://github.com/marcominerva/SqlDatabaseVectorSearch/tree/sql). -![SQL Database Vector Search](https://raw.githubusercontent.com/marcominerva/SqlDatabaseVectorSearch/refs/heads/master/SqlDatabaseVectorSearch.png) +### Web App +![SQL Database Vector Search Web App](https://github.com/marcominerva/SqlDatabaseVectorSearch/blob/master/docs/SqlDatabaseVectorSearch_API_.png) + +### Web API +![SQL Database Vector Search API](https://github.com/marcominerva/SqlDatabaseVectorSearch/blob/master/docs/SqlDatabaseVectorSearch_API_.png) ## Setup -- [Create an Azure SQL Database](https://learn.microsoft.com/en-us/azure/azure-sql/database/single-database-create-quickstart) on a server that has the Vector Support feature enabled -- Execute the [Scripts.sql](https://github.com/marcominerva/SqlDatabaseVectorSearch/blob/master/Scripts.sql) file to create the tables needed by the application - - You may need to update the size of the [`VECTOR`](https://github.com/marcominerva/SqlDatabaseVectorSearch/blob/master/Scripts.sql#L17) column to match the size of the embedding model. Currently, the maximum allowed value is 1998. +- [Create an Azure SQL Database](https://learn.microsoft.com/en-us/azure/azure-sql/database/single-database-create-quickstart) - Open the [appsettings.json](https://github.com/marcominerva/SqlDatabaseVectorSearch/blob/master/SqlDatabaseVectorSearch/appsettings.json) file and set the connection string to the database and the other settings required by Azure OpenAI - - If your embedding model supports shortening, like **text-embedding-3-small** and **text-embedding-3-large**, and you want to use this feature, you need to set the [`Dimensions`](https://github.com/marcominerva/SqlDatabaseVectorSearch/blob/master/SqlDatabaseVectorSearch/appsettings.json#L17) property to match the value you have used in the SQL script. If your model doesn't provide this feature, or do you want to use the default size, just leave the [`Dimensions`](https://github.com/marcominerva/SqlDatabaseVectorSearch/blob/master/SqlDatabaseVectorSearch/appsettings.json#L17) property to NULL. Keep in mind that **text-embedding-3-small** has a dimension of 1536, while **text-embedding-3-large** uses vectors with 3072 elements, so with this latter model it is mandatory to specify a value (that, as said, must be less or equal to 1998). -- Run the application and start importing your documents with `/api/documents` endpoint. -- Ask questions using `/api/ask` or `/api/ask-streaming` endpoints. + - If your embedding model supports shortening, like **text-embedding-3-small** and **text-embedding-3-large**, and you want to use this feature, you need to set the [`Dimensions`](https://github.com/marcominerva/SqlDatabaseVectorSearch/blob/master/SqlDatabaseVectorSearch/appsettings.json#L17) property to the corresponding value. If your model doesn't provide this feature, or do you want to use the default size, just leave the [`Dimensions`](https://github.com/marcominerva/SqlDatabaseVectorSearch/blob/master/SqlDatabaseVectorSearch/appsettings.json#L17) property to NULL. Keep in mind that **text-embedding-3-small** has a dimension of 1536, while **text-embedding-3-large** uses vectors with 3072 elements, so with this latter model it is mandatory to specify a value (that, as said, must be less or equal to 1998). +- You may need to update the size of the [`VECTOR`](https://github.com/marcominerva/SqlDatabaseVectorSearch/blob/master/SqlDatabaseVectorSearch/DataAccessLayer/ApplicationDbContext.cs?plain=1#L42C1-L42C47) column to match the size of the embedding model. The default value is 1536. Currently, the maximum allowed value is 1998. If you change it, remember to update also the [Database Migration](https://github.com/marcominerva/SqlDatabaseVectorSearch/blob/master/SqlDatabaseVectorSearch/DataAccessLayer/Migrations/00000000000000_Initial.cs?plain=1#L35C1-L35C92). +- Run the application and start importing your documents +- If you want to directly use the APIs: + - import your documents with the `/api/documents` endpoint. + - Ask questions using `/api/ask` or `/api/ask-streaming` endpoints. ## Supported features diff --git a/SqlDatabaseVectorSearch/wwwroot/favicon.png b/SqlDatabaseVectorSearch/wwwroot/favicon.png index 4d1b256..0c3cb7f 100644 Binary files a/SqlDatabaseVectorSearch/wwwroot/favicon.png and b/SqlDatabaseVectorSearch/wwwroot/favicon.png differ diff --git a/SqlDatabaseVectorSearch.png b/docs/SqlDatabaseVectorSearch_API.png similarity index 100% rename from SqlDatabaseVectorSearch.png rename to docs/SqlDatabaseVectorSearch_API.png diff --git a/docs/SqlDatabaseVectorSearch_WebApp.png b/docs/SqlDatabaseVectorSearch_WebApp.png new file mode 100644 index 0000000..f1ebbb0 Binary files /dev/null and b/docs/SqlDatabaseVectorSearch_WebApp.png differ