Skip to content

Commit 8d1aad1

Browse files
committed
feat: add 00-quick-start
1 parent 2fda6f8 commit 8d1aad1

File tree

6 files changed

+342
-42
lines changed

6 files changed

+342
-42
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,6 @@ jupyter-lab
4949
* .NET Interactive | Samples - <https://github.com/dotnet/interactive/tree/main/samples/notebooks/csharp>
5050
* .NET Interactive - <https://github.com/dotnet/interactive/blob/main/docs/README.md>
5151
* Elasticsearch Labs <https://github.com/elastic/elasticsearch-labs>
52-
* <https://www.elastic.co/start-local>
52+
* <https://www.elastic.co/start-local>
53+
* <https://devblogs.microsoft.com/dotnet/introducing-microsoft-extensions-ai-preview/>
54+
* <https://www.galileo.ai/blog/mastering-rag-how-to-select-an-embedding-model>

src/_infra/azure-infra.ipynb

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Deploy Azure Resources\n",
8+
"\n",
9+
"https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?pivots=cli"
10+
]
11+
},
12+
{
13+
"cell_type": "code",
14+
"execution_count": null,
15+
"metadata": {
16+
"dotnet_interactive": {
17+
"language": "pwsh"
18+
},
19+
"polyglot_notebook": {
20+
"kernelName": "pwsh"
21+
}
22+
},
23+
"outputs": [],
24+
"source": [
25+
"az account show\n",
26+
"\n",
27+
"$location = \"eastus\"\n",
28+
"$resourceGroup = \"rg-elasticsearch-playground\"\n",
29+
"$aiResourceName = \"ai-elasticsearch-playground\"\n"
30+
]
31+
},
32+
{
33+
"cell_type": "code",
34+
"execution_count": null,
35+
"metadata": {
36+
"dotnet_interactive": {
37+
"language": "pwsh"
38+
},
39+
"polyglot_notebook": {
40+
"kernelName": "pwsh"
41+
}
42+
},
43+
"outputs": [],
44+
"source": [
45+
"az group create `\n",
46+
" --name rg-elasticsearch-playground `\n",
47+
" --location $location"
48+
]
49+
},
50+
{
51+
"cell_type": "code",
52+
"execution_count": null,
53+
"metadata": {
54+
"dotnet_interactive": {
55+
"language": "pwsh"
56+
},
57+
"polyglot_notebook": {
58+
"kernelName": "pwsh"
59+
}
60+
},
61+
"outputs": [],
62+
"source": [
63+
"az group show --name rg-elasticsearch-playground"
64+
]
65+
},
66+
{
67+
"cell_type": "code",
68+
"execution_count": null,
69+
"metadata": {
70+
"dotnet_interactive": {
71+
"language": "pwsh"
72+
},
73+
"polyglot_notebook": {
74+
"kernelName": "pwsh"
75+
}
76+
},
77+
"outputs": [],
78+
"source": [
79+
"az cognitiveservices account create `\n",
80+
" --name $aiResourceName `\n",
81+
" --resource-group $resourceGroup `\n",
82+
" --location $location `\n",
83+
" --kind OpenAI --sku s0"
84+
]
85+
},
86+
{
87+
"cell_type": "code",
88+
"execution_count": null,
89+
"metadata": {
90+
"dotnet_interactive": {
91+
"language": "pwsh"
92+
},
93+
"polyglot_notebook": {
94+
"kernelName": "pwsh"
95+
}
96+
},
97+
"outputs": [],
98+
"source": [
99+
"az cognitiveservices account show `\n",
100+
" --name $aiResourceName `\n",
101+
" --resource-group $resourceGroup | jq -r '.properties.endpoint'\n",
102+
"\n",
103+
"az cognitiveservices account keys list `\n",
104+
" --name $aiResourceName `\n",
105+
" --resource-group $resourceGroup | jq -r .key1"
106+
]
107+
},
108+
{
109+
"cell_type": "code",
110+
"execution_count": null,
111+
"metadata": {
112+
"dotnet_interactive": {
113+
"language": "pwsh"
114+
},
115+
"polyglot_notebook": {
116+
"kernelName": "pwsh"
117+
}
118+
},
119+
"outputs": [],
120+
"source": [
121+
"az cognitiveservices account `\n",
122+
" deployment create `\n",
123+
" --name $aiResourceName `\n",
124+
" --resource-group $resourceGroup `\n",
125+
" --deployment-name \"text-embedding-3-small\" `\n",
126+
" --model-name \"text-embedding-3-small\" `\n",
127+
" --model-version \"1\" `\n",
128+
" --model-format OpenAI `\n",
129+
" --sku-capacity \"1\" `\n",
130+
" --sku-name \"Standard\" `\n"
131+
]
132+
},
133+
{
134+
"cell_type": "code",
135+
"execution_count": null,
136+
"metadata": {
137+
"dotnet_interactive": {
138+
"language": "pwsh"
139+
},
140+
"polyglot_notebook": {
141+
"kernelName": "pwsh"
142+
}
143+
},
144+
"outputs": [],
145+
"source": [
146+
"az cognitiveservices account deployment list `\n",
147+
" --name $aiResourceName `\n",
148+
" --resource-group $resourceGroup"
149+
]
150+
}
151+
],
152+
"metadata": {
153+
"kernelspec": {
154+
"display_name": ".NET (C#)",
155+
"language": "C#",
156+
"name": ".net-csharp"
157+
},
158+
"polyglot_notebook": {
159+
"kernelInfo": {
160+
"defaultKernelName": "csharp",
161+
"items": [
162+
{
163+
"aliases": [],
164+
"languageName": "csharp",
165+
"name": "csharp"
166+
}
167+
]
168+
}
169+
}
170+
},
171+
"nbformat": 4,
172+
"nbformat_minor": 2
173+
}

src/_infra/get-connection-string.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
"source": [
3232
"using dotenv.net;\n",
3333
"\n",
34-
"var variables = DotEnv.Read(new DotEnvOptions(envFilePaths: new[] {\"../../.env\"}));\n",
34+
"var envs = DotEnv.Read(new DotEnvOptions(envFilePaths: new[] {\"../../.env\"}));\n",
3535
"\n",
36-
"if (!variables.TryGetValue(\"PLAYGROUND_CONNECTION_STRING\", out var connectionStringInput)\n",
36+
"if (!envs.TryGetValue(\"PLAYGROUND_CONNECTION_STRING\", out var connectionStringInput)\n",
3737
" || string.IsNullOrEmpty(connectionStringInput))\n",
3838
"{\n",
3939
" connectionStringInput = await Microsoft.DotNet.Interactive.Kernel.GetInputAsync(\"Please provide a connection string.\");\n",

src/_infra/setup-elastic-infrastructure.ipynb

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
11
{
22
"cells": [
3-
{
4-
"cell_type": "code",
5-
"execution_count": 1,
6-
"metadata": {
7-
"dotnet_interactive": {
8-
"language": "csharp"
9-
},
10-
"polyglot_notebook": {
11-
"kernelName": "csharp"
12-
}
13-
},
14-
"outputs": [],
15-
"source": [
16-
"#r \"nuget: Testcontainers.Elasticsearch\""
17-
]
18-
},
193
{
204
"cell_type": "markdown",
215
"metadata": {},
@@ -39,6 +23,8 @@
3923
},
4024
"outputs": [],
4125
"source": [
26+
"#r \"nuget: Testcontainers.Elasticsearch\"\n",
27+
"\n",
4228
"using Testcontainers.Elasticsearch;\n",
4329
"\n",
4430
"var elasticsearchContainer = new ElasticsearchBuilder()\n",

0 commit comments

Comments
 (0)