Skip to content

Commit 3095395

Browse files
committed
Merge branch 'agentic-retrieval' of https://github.com/haileytap/azure-search-python-samples into agentic-retrieval
2 parents 7706577 + 92f9bbc commit 3095395

File tree

10 files changed

+1602
-255
lines changed

10 files changed

+1602
-255
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
azure-identity
2+
dotenv
3+
azure-search-documents==11.6.0b12
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
AZURE_SEARCH_ENDPOINT=https://your-search-service.search.windows.net
2+
AZURE_SEARCH_INDEX_NAME=hotels-sample-index

Quickstart-Semantic-Search/semantic-search-quickstart.ipynb

Lines changed: 666 additions & 220 deletions
Large diffs are not rendered by default.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
azure-ai-projects==1.0.0b11
2+
azure-ai-agents==1.0.0
3+
azure-identity
4+
aiohttp
5+
ipykernel
6+
dotenv
7+
azure-search-documents==11.6.0b12
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
AZURE_SEARCH_ENDPOINT=https://your-search-service.search.windows.net
2+
AZURE_SEARCH_INDEX_NAME=vector-search-quickstart

Quickstart-Vector-Search/vector-search-quickstart.ipynb

Lines changed: 896 additions & 0 deletions
Large diffs are not rendered by default.

Quickstart/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ This sample is a Jupyter Python3 .ipynb file to perform the actions against the
4444

4545
## Next steps
4646

47-
You can learn more about Azure AI Search on the [official documentation site](https://docs.microsoft.com/azure/search).
47+
You can learn more about Azure AI Search on the [official documentation site](https://learn.microsoft.com/azure/search).

Quickstart/azure-search-quickstart.ipynb

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"metadata": {},
3030
"outputs": [],
3131
"source": [
32-
"! pip install azure-search-documents==11.6.0b1 --quiet\n",
32+
"! pip install azure-search-documents==11.6.0b12 --quiet\n",
3333
"! pip install azure-identity --quiet\n",
3434
"! pip install python-dotenv --quiet"
3535
]
@@ -43,7 +43,7 @@
4343
"# Provide variables\n",
4444
"search_endpoint: str = \"PUT-YOUR-SEARCH-ENDPOINT-HERE\"\n",
4545
"search_api_key: str = \"PUT-YOUR-SEARCH-API-KEY-HERE\"\n",
46-
"index_name: str = \"hotels-quickstart\""
46+
"index_name: str = \"hotels-quickstart-csharp\""
4747
]
4848
},
4949
{
@@ -80,7 +80,6 @@
8080
" SimpleField(name=\"HotelId\", type=SearchFieldDataType.String, key=True),\n",
8181
" SearchableField(name=\"HotelName\", type=SearchFieldDataType.String, sortable=True),\n",
8282
" SearchableField(name=\"Description\", type=SearchFieldDataType.String, analyzer_name=\"en.lucene\"),\n",
83-
" SearchableField(name=\"Description_fr\", type=SearchFieldDataType.String, analyzer_name=\"fr.lucene\"),\n",
8483
" SearchableField(name=\"Category\", type=SearchFieldDataType.String, facetable=True, filterable=True, sortable=True),\n",
8584
"\n",
8685
" SearchableField(name=\"Tags\", collection=True, type=SearchFieldDataType.String, facetable=True, filterable=True),\n",
@@ -126,13 +125,12 @@
126125
" {\n",
127126
" \"@search.action\": \"upload\",\n",
128127
" \"HotelId\": \"1\",\n",
129-
" \"HotelName\": \"Secret Point Motel\",\n",
130-
" \"Description\": \"The hotel is ideally located on the main commercial artery of the city in the heart of New York. A few minutes away is Time's Square and the historic centre of the city, as well as other places of interest that make New York one of America's most attractive and cosmopolitan cities.\",\n",
131-
" \"Description_fr\": \"L'hôtel est idéalement situé sur la principale artère commerciale de la ville en plein cœur de New York. A quelques minutes se trouve la place du temps et le centre historique de la ville, ainsi que d'autres lieux d'intérêt qui font de New York l'une des villes les plus attractives et cosmopolites de l'Amérique.\",\n",
128+
" \"HotelName\": \"Stay-Kay City Hotel\",\n",
129+
" \"Description\": \"This classic hotel is fully-refurbished and ideally located on the main commercial artery of the city in the heart of New York. A few minutes away is Times Square and the historic centre of the city, as well as other places of interest that make New York one of America's most attractive and cosmopolitan cities.\",\n",
132130
" \"Category\": \"Boutique\",\n",
133-
" \"Tags\": [ \"pool\", \"air conditioning\", \"concierge\" ],\n",
131+
" \"Tags\": [ \"view\", \"air conditioning\", \"concierge\" ],\n",
134132
" \"ParkingIncluded\": \"false\",\n",
135-
" \"LastRenovationDate\": \"1970-01-18T00:00:00Z\",\n",
133+
" \"LastRenovationDate\": \"2020-01-18T00:00:00Z\",\n",
136134
" \"Rating\": 3.60,\n",
137135
" \"Address\": {\n",
138136
" \"StreetAddress\": \"677 5th Ave\",\n",
@@ -145,13 +143,12 @@
145143
" {\n",
146144
" \"@search.action\": \"upload\",\n",
147145
" \"HotelId\": \"2\",\n",
148-
" \"HotelName\": \"Twin Dome Motel\",\n",
149-
" \"Description\": \"The hotel is situated in a nineteenth century plaza, which has been expanded and renovated to the highest architectural standards to create a modern, functional and first-class hotel in which art and unique historical elements coexist with the most modern comforts.\",\n",
150-
" \"Description_fr\": \"L'hôtel est situé dans une place du XIXe siècle, qui a été agrandie et rénovée aux plus hautes normes architecturales pour créer un hôtel moderne, fonctionnel et de première classe dans lequel l'art et les éléments historiques uniques coexistent avec le confort le plus moderne.\",\n",
146+
" \"HotelName\": \"Old Century Hotel\",\n",
147+
" \"Description\": \"The hotel is situated in a nineteenth century plaza, which has been expanded and renovated to the highest architectural standards to create a modern, functional and first-class hotel in which art and unique historical elements coexist with the most modern comforts. The hotel also regularly hosts events like wine tastings, beer dinners, and live music.\",\n",
151148
" \"Category\": \"Boutique\",\n",
152149
" \"Tags\": [ \"pool\", \"free wifi\", \"concierge\" ],\n",
153150
" \"ParkingIncluded\": \"false\",\n",
154-
" \"LastRenovationDate\": \"1979-02-18T00:00:00Z\",\n",
151+
" \"LastRenovationDate\": \"2019-02-18T00:00:00Z\",\n",
155152
" \"Rating\": 3.60,\n",
156153
" \"Address\": {\n",
157154
" \"StreetAddress\": \"140 University Town Center Dr\",\n",
@@ -164,11 +161,10 @@
164161
" {\n",
165162
" \"@search.action\": \"upload\",\n",
166163
" \"HotelId\": \"3\",\n",
167-
" \"HotelName\": \"Triple Landscape Hotel\",\n",
168-
" \"Description\": \"The Hotel stands out for its gastronomic excellence under the management of William Dough, who advises on and oversees all of the Hotel's restaurant services.\",\n",
169-
" \"Description_fr\": \"L'hôtel est situé dans une place du XIXe siècle, qui a été agrandie et rénovée aux plus hautes normes architecturales pour créer un hôtel moderne, fonctionnel et de première classe dans lequel l'art et les éléments historiques uniques coexistent avec le confort le plus moderne.\",\n",
170-
" \"Category\": \"Resort and Spa\",\n",
171-
" \"Tags\": [ \"air conditioning\", \"bar\", \"continental breakfast\" ],\n",
164+
" \"HotelName\": \"Gastronomic Landscape Hotel\",\n",
165+
" \"Description\": \"The Gastronomic Hotel stands out for its culinary excellence under the management of William Dough, who advises on and oversees all of the Hotel’s restaurant services.\",\n",
166+
" \"Category\": \"Suite\",\n",
167+
" \"Tags\": [ \"restaurant\", \"bar\", \"continental breakfast\" ],\n",
172168
" \"ParkingIncluded\": \"true\",\n",
173169
" \"LastRenovationDate\": \"2015-09-20T00:00:00Z\",\n",
174170
" \"Rating\": 4.80,\n",
@@ -183,13 +179,12 @@
183179
" {\n",
184180
" \"@search.action\": \"upload\",\n",
185181
" \"HotelId\": \"4\",\n",
186-
" \"HotelName\": \"Sublime Cliff Hotel\",\n",
187-
" \"Description\": \"Sublime Cliff Hotel is located in the heart of the historic center of Sublime in an extremely vibrant and lively area within short walking distance to the sites and landmarks of the city and is surrounded by the extraordinary beauty of churches, buildings, shops and monuments. Sublime Cliff is part of a lovingly restored 1800 palace.\",\n",
188-
" \"Description_fr\": \"Le sublime Cliff Hotel est situé au coeur du centre historique de sublime dans un quartier extrêmement animé et vivant, à courte distance de marche des sites et monuments de la ville et est entouré par l'extraordinaire beauté des églises, des bâtiments, des commerces et Monuments. Sublime Cliff fait partie d'un Palace 1800 restauré avec amour.\",\n",
182+
" \"HotelName\": \"Sublime Palace Hotel\",\n",
183+
" \"Description\": \"Sublime Palace Hotel is located in the heart of the historic center of Sublime in an extremely vibrant and lively area within short walking distance to the sites and landmarks of the city and is surrounded by the extraordinary beauty of churches, buildings, shops and monuments. Sublime Cliff is part of a lovingly restored 19th century resort, updated for every modern convenience.\",\n",
189184
" \"Category\": \"Boutique\",\n",
190-
" \"Tags\": [ \"concierge\", \"view\", \"24-hour front desk service\" ],\n",
185+
" \"Tags\": [ \"concierge\", \"view\", \"air conditioning\" ],\n",
191186
" \"ParkingIncluded\": \"true\",\n",
192-
" \"LastRenovationDate\": \"1960-02-06T00:00:00Z\",\n",
187+
" \"LastRenovationDate\": \"2020-02-06T00:00:00Z\",\n",
193188
" \"Rating\": 4.60,\n",
194189
" \"Address\": {\n",
195190
" \"StreetAddress\": \"7400 San Pedro Ave\",\n",
@@ -245,13 +240,14 @@
245240
"# Run an empty query (returns selected fields, all documents)\n",
246241
"results = search_client.search(query_type='simple',\n",
247242
" search_text=\"*\" ,\n",
248-
" select='HotelName,Description',\n",
243+
" select='HotelName,Description,Tags',\n",
249244
" include_total_count=True)\n",
250245
"\n",
251246
"print ('Total Documents Matching Query:', results.get_count())\n",
252247
"for result in results:\n",
253248
" print(result[\"@search.score\"])\n",
254249
" print(result[\"HotelName\"])\n",
250+
" print(result[\"Tags\"])\n",
255251
" print(f\"Description: {result['Description']}\")\n"
256252
]
257253
},
@@ -449,7 +445,7 @@
449445
],
450446
"metadata": {
451447
"kernelspec": {
452-
"display_name": "Python 3",
448+
"display_name": ".venv",
453449
"language": "python",
454450
"name": "python3"
455451
},
@@ -463,12 +459,7 @@
463459
"name": "python",
464460
"nbconvert_exporter": "python",
465461
"pygments_lexer": "ipython3",
466-
"version": "3.9.5"
467-
},
468-
"vscode": {
469-
"interpreter": {
470-
"hash": "9ff083f0c83558f9261023d47a77b9b3eb892c62cdbe066d046abcad1a5edb5c"
471-
}
462+
"version": "3.10.12"
472463
}
473464
},
474465
"nbformat": 4,

agentic-retrieval-pipeline-example/agent-example.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@
9090
"\n",
9191
"# The following variables from your .env file are used in this notebook\n",
9292
"project_endpoint = os.environ[\"PROJECT_ENDPOINT\"]\n",
93-
"agent_model = os.getenv(\"AGENT_MODEL\", \"gpt-4o-mini\")\n",
93+
"agent_model = os.getenv(\"AGENT_MODEL\", \"gpt-4.1-mini\")\n",
9494
"endpoint = os.environ[\"AZURE_SEARCH_ENDPOINT\"]\n",
9595
"credential = DefaultAzureCredential()\n",
9696
"token_provider = get_bearer_token_provider(credential, \"https://search.azure.com/.default\")\n",
9797
"index_name = os.getenv(\"AZURE_SEARCH_INDEX\", \"earth_at_night\")\n",
9898
"azure_openai_endpoint = os.environ[\"AZURE_OPENAI_ENDPOINT\"]\n",
99-
"azure_openai_gpt_deployment = os.getenv(\"AZURE_OPENAI_GPT_DEPLOYMENT\", \"gpt-4o-mini\")\n",
100-
"azure_openai_gpt_model = os.getenv(\"AZURE_OPENAI_GPT_MODEL\", \"gpt-4o-mini\")\n",
99+
"azure_openai_gpt_deployment = os.getenv(\"AZURE_OPENAI_GPT_DEPLOYMENT\", \"gpt-4.1-mini\")\n",
100+
"azure_openai_gpt_model = os.getenv(\"AZURE_OPENAI_GPT_MODEL\", \"gpt-4.1-mini\")\n",
101101
"azure_openai_embedding_deployment = os.getenv(\"AZURE_OPENAI_EMBEDDING_DEPLOYMENT\", \"text-embedding-3-large\")\n",
102102
"azure_openai_embedding_model = os.getenv(\"AZURE_OPENAI_EMBEDDING_MODEL\", \"text-embedding-3-large\")\n",
103103
"agent_name = os.getenv(\"AZURE_SEARCH_AGENT_NAME\", \"earth-search-agent\")"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PROJECT_ENDPOINT=https://your-foundry-resource.services.ai.azure.com/api/projects/your-foundry-project
22
AZURE_OPENAI_ENDPOINT=https://your-openai-service.openai.azure.com
3-
AZURE_OPENAI_GPT_DEPLOYMENT=gpt-4o-mini
3+
AZURE_OPENAI_GPT_DEPLOYMENT=gpt-4.1-mini
44
AZURE_SEARCH_ENDPOINT=https://your-search-service.search.windows.net
55
AZURE_SEARCH_INDEX_NAME=earth_at_night

0 commit comments

Comments
 (0)