Skip to content

Commit

Permalink
feat: add 00-quick-start
Browse files Browse the repository at this point in the history
  • Loading branch information
NikiforovAll committed Oct 18, 2024
1 parent 2fda6f8 commit 8d1aad1
Show file tree
Hide file tree
Showing 6 changed files with 342 additions and 42 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,6 @@ jupyter-lab
* .NET Interactive | Samples - <https://github.com/dotnet/interactive/tree/main/samples/notebooks/csharp>
* .NET Interactive - <https://github.com/dotnet/interactive/blob/main/docs/README.md>
* Elasticsearch Labs <https://github.com/elastic/elasticsearch-labs>
* <https://www.elastic.co/start-local>
* <https://www.elastic.co/start-local>
* <https://devblogs.microsoft.com/dotnet/introducing-microsoft-extensions-ai-preview/>
* <https://www.galileo.ai/blog/mastering-rag-how-to-select-an-embedding-model>
173 changes: 173 additions & 0 deletions src/_infra/azure-infra.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Deploy Azure Resources\n",
"\n",
"https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?pivots=cli"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"dotnet_interactive": {
"language": "pwsh"
},
"polyglot_notebook": {
"kernelName": "pwsh"
}
},
"outputs": [],
"source": [
"az account show\n",
"\n",
"$location = \"eastus\"\n",
"$resourceGroup = \"rg-elasticsearch-playground\"\n",
"$aiResourceName = \"ai-elasticsearch-playground\"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"dotnet_interactive": {
"language": "pwsh"
},
"polyglot_notebook": {
"kernelName": "pwsh"
}
},
"outputs": [],
"source": [
"az group create `\n",
" --name rg-elasticsearch-playground `\n",
" --location $location"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"dotnet_interactive": {
"language": "pwsh"
},
"polyglot_notebook": {
"kernelName": "pwsh"
}
},
"outputs": [],
"source": [
"az group show --name rg-elasticsearch-playground"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"dotnet_interactive": {
"language": "pwsh"
},
"polyglot_notebook": {
"kernelName": "pwsh"
}
},
"outputs": [],
"source": [
"az cognitiveservices account create `\n",
" --name $aiResourceName `\n",
" --resource-group $resourceGroup `\n",
" --location $location `\n",
" --kind OpenAI --sku s0"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"dotnet_interactive": {
"language": "pwsh"
},
"polyglot_notebook": {
"kernelName": "pwsh"
}
},
"outputs": [],
"source": [
"az cognitiveservices account show `\n",
" --name $aiResourceName `\n",
" --resource-group $resourceGroup | jq -r '.properties.endpoint'\n",
"\n",
"az cognitiveservices account keys list `\n",
" --name $aiResourceName `\n",
" --resource-group $resourceGroup | jq -r .key1"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"dotnet_interactive": {
"language": "pwsh"
},
"polyglot_notebook": {
"kernelName": "pwsh"
}
},
"outputs": [],
"source": [
"az cognitiveservices account `\n",
" deployment create `\n",
" --name $aiResourceName `\n",
" --resource-group $resourceGroup `\n",
" --deployment-name \"text-embedding-3-small\" `\n",
" --model-name \"text-embedding-3-small\" `\n",
" --model-version \"1\" `\n",
" --model-format OpenAI `\n",
" --sku-capacity \"1\" `\n",
" --sku-name \"Standard\" `\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"dotnet_interactive": {
"language": "pwsh"
},
"polyglot_notebook": {
"kernelName": "pwsh"
}
},
"outputs": [],
"source": [
"az cognitiveservices account deployment list `\n",
" --name $aiResourceName `\n",
" --resource-group $resourceGroup"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".NET (C#)",
"language": "C#",
"name": ".net-csharp"
},
"polyglot_notebook": {
"kernelInfo": {
"defaultKernelName": "csharp",
"items": [
{
"aliases": [],
"languageName": "csharp",
"name": "csharp"
}
]
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
4 changes: 2 additions & 2 deletions src/_infra/get-connection-string.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
"source": [
"using dotenv.net;\n",
"\n",
"var variables = DotEnv.Read(new DotEnvOptions(envFilePaths: new[] {\"../../.env\"}));\n",
"var envs = DotEnv.Read(new DotEnvOptions(envFilePaths: new[] {\"../../.env\"}));\n",
"\n",
"if (!variables.TryGetValue(\"PLAYGROUND_CONNECTION_STRING\", out var connectionStringInput)\n",
"if (!envs.TryGetValue(\"PLAYGROUND_CONNECTION_STRING\", out var connectionStringInput)\n",
" || string.IsNullOrEmpty(connectionStringInput))\n",
"{\n",
" connectionStringInput = await Microsoft.DotNet.Interactive.Kernel.GetInputAsync(\"Please provide a connection string.\");\n",
Expand Down
18 changes: 2 additions & 16 deletions src/_infra/setup-elastic-infrastructure.ipynb
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
},
"polyglot_notebook": {
"kernelName": "csharp"
}
},
"outputs": [],
"source": [
"#r \"nuget: Testcontainers.Elasticsearch\""
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -39,6 +23,8 @@
},
"outputs": [],
"source": [
"#r \"nuget: Testcontainers.Elasticsearch\"\n",
"\n",
"using Testcontainers.Elasticsearch;\n",
"\n",
"var elasticsearchContainer = new ElasticsearchBuilder()\n",
Expand Down
Loading

0 comments on commit 8d1aad1

Please sign in to comment.