Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit70f3c14

Browse files
committed
WIP aoai apim post
1 parent5539116 commit70f3c14

File tree

3 files changed

+32
-32
lines changed

3 files changed

+32
-32
lines changed

‎_drafts/apim/00-organize-aoai-instances-with-apim.md‎renamed to ‎_drafts/apim/00-aoai-recipes-for-apim.md‎

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
title:Open AI recipes for Azure API Management Service
2+
title:AzureOpen AI recipes for Azure API Management Service
33
date:2025-01-01 10:00
44
tags:[Azure, networking, API manager, OpenAI ]
5-
excerpt:"xxx"
5+
excerpt:"A collection of recipes for API Management for those who need to expose one or more instances of Azure OpenAI"
66

77
header:
8-
overlay_image:https://live.staticflickr.com/65535/52755090506_6cf0808a3c_h.jpg
9-
caption:"Photo credit: [**nicola since 1972**](https://www.flickr.com/photos/15216811@N06/52755090506)"
8+
overlay_image:https://live.staticflickr.com/65535/54308248466_dc89a5f3d7_h.jpg
9+
caption:"Photo credit: [**nicola since 1972**](https://www.flickr.com/photos/15216811@N06/54308248466/)"
1010
---
1111

1212
Azure OpenAI Service provides REST API access to OpenAI's powerful language models including o1, o1-mini, GPT-4o, GPT-4o mini, GPT-4 Turbo with Vision, GPT-4, GPT-3.5-Turbo, and Embeddings model series. These models can be easily adapted to your specific task including but not limited to content generation, summarization, image understanding, semantic search, and natural language to code translation.
@@ -17,27 +17,30 @@ By using Azure API Manager in front of Azure Open AI instances, enterprises can
1717

1818
Combining Azure Open AI with Azure API Manager enables enterprises to efficiently distribute and manage their AI capabilities while maintaining high standards of security and performance.
1919

20-
----------------------------
20+
**In this post I show a collection of recipes for API Management that I have seen used by customers and partners who needed to expose one or more instances of Azure OpenAI.**
2121

22-
obiettivo di questa serie di post é quello di mostrate alcuni dei pattern da usare per esporre Azure Open AI attraversoAPIM.
22+
>In these posts we will focus on configuring policies and implementing some usage patterns with them. Network configuration and integration with an Enterprise-scale landing zone (ESLZ) is out of scope. For a walkthrough that guides the integration ofAPIM and AOAI in a hub & spoke context, you can also refer to[my article](https://github.com/nicolgit/hub-and-spoke-playground/blob/main/scenarios/aoai.md) available as part of[the hub-and-spoke playground project](https://github.com/nicolgit/hub-and-spoke-playground).
2323
24-
In this context, the following architecturea and implementation in Azure Architecture Center are**developed** and**maintained** by Azure Pattern and Practices team. I suggest yout to bookmark them for further information.
24+
>The following architecture and implementation in Azure Architecture Center are**developed** and**maintained** by the Azure Patterns and Practices team. I suggest you bookmark them for further information:
25+
>*https://learn.microsoft.com/en-us/azure/architecture/ai-ml/architecture/azure-openai-baseline-landing-zone
26+
>*https://github.com/Azure-Samples/azure-openai-chat-baseline-landing-zone
2527
26-
*https://learn.microsoft.com/en-us/azure/architecture/ai-ml/architecture/azure-openai-baseline-landing-zone
27-
*https://github.com/Azure-Samples/azure-openai-chat-baseline-landing-zone
28+
The lab used for these walk-throughs consists of the following resources:
2829

29-
in questi post ci focalizzeremo sulla configurazione delle policy e di implementazione di alcuni pattern di utilizzo con esse. La parte di configurazione della rete e l'integrazione con una ESLZ é out of scope. Per un walktrough che guidi l'integrazione di APIM ed AOAI in un contesto di hub & spoke, è possibile fare riferimento anche[al mio articolo](https://github.com/nicolgit/hub-and-spoke-playground/blob/main/scenarios/aoai.md) disponibile nell'ambito del progetto[the hub-and-spoke playground](https://github.com/nicolgit/hub-and-spoke-playground)
30-
31-
32-
Il laboratorio su cui lavoró prevede le seguenti risorse:
33-
34-
* Azure API Management service (developer SKU) enterpriseapim
30+
* Azure API Management service (developer SKU)`nicold-apim`
3531
* 2 x Azure OpenAI service (S0 SKU)`apimaoai01` and`apimaoai02`
3632

37-
come mostrato nello schema seguente:
38-
3933
![architecture](../../assets/post/2025/apim-aoai/00-architecture.png)
4034

35+
Here are the key recipes we'll cover in this article:
36+
37+
-[Add Azure Open AI as backend resource](#add-azure-open-ai-as-backend-resource)
38+
-[Show apim-001 endpoint as root API](#show-apim-001-endpoint-as-root-api)
39+
-[Implement throttling](#implement-throttling)
40+
-[Show in a Response header (_aoai-origin_) the host of the OpenAI API Called](#show-in-a-response-header-aoai-origin-the-host-of-the-openai-api-called)
41+
-[Round robin calls between 2 instances of Open AI](#round-robin-calls-between-2-instances-of-open-ai)
42+
-[Fallback on a second openAI instance for 30 secs. If the first send a 4xx error](#fallback-on-a-second-openai-instance-for-30-secs-if-the-first-send-a-4xx-error)
43+
4144
#Add Azure Open AI as backend resource
4245

4346
Go to API Management services >`nicold-apim` > Backends > Add
@@ -86,7 +89,7 @@ To test this endpoint go to: API Management Services > `nicold-apim` > APIs > Al
8689

8790
here also a powershell script to test this configuration:
8891

89-
```
92+
```ps1
9093
$openai = @{
9194
api_key = "my-api-key"
9295
api_base = "https://nicold-apim.azure-api.net/" # your endpoint
@@ -122,7 +125,7 @@ $responseObj.choices.message.content
122125
The following policy limits the access**at 10 requests per minute**. Paste the xml in: API Management Service >
123126
`nicold-apim` > APIs > All APIs >`/` > all operations > inbound processing > policies (code editor)
124127

125-
```
128+
```xml
126129
<policies>
127130
<inbound>
128131
<base />
@@ -143,20 +146,20 @@ The following policy limits the access **at 10 requests per minute**. Paste the
143146
```
144147

145148
To limit at 2 calls**per IP** in 60 seconds, use the following rate-limit xml:
146-
```
149+
```xml
147150
<rate-limit-by-keycalls="2"renewal-period="60"counter-key="@(context.Request.IpAddress)" />
148151
```
149152

150153
To limit at 2 calls per API KEY in 60 seconds, use the following rate-limit xml:
151-
```
154+
```xml
152155
<rate-limit-by-keycalls="2"renewal-period="60"counter-key="@(context.Request.Headers.GetValueOrDefault("api-key"))" />
153156
```
154157

155158
#Show in a Response header (_aoai-origin_) the host of the OpenAI API Called
156159

157160
Add the following XML in the**outbound** policy:
158161

159-
```
162+
```xml
160163
<outbound>
161164
<base />
162165
<set-headername="aoai-origin"exists-action="override">
@@ -169,7 +172,7 @@ Add the following XML in the **outbound** policy:
169172

170173
Use the following**inbound** policy:
171174

172-
```
175+
```xml
173176
<inbound>
174177
<base />
175178
<cache-lookup-valuekey="backend-rr"variable-name="backend-rr" />
@@ -241,3 +244,6 @@ TODEBUG!!!
241244

242245
* Azure APIM to scale AOAI -https://github.com/Azure/aoai-apim
243246
* Manage Azure OpenAI using APIM -https://github.com/microsoft/AzureOpenAI-with-APIM
247+
248+
249+
[def]:#recipes-list

‎_pages/photography-landing.md‎

Lines changed: 0 additions & 6 deletions
This file was deleted.

‎_posts/2025/2025-02-24-simple-aoai-powhershell-call.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
title:Azure OpenAI powershell chat-completition call sample
33
date:2025-02-24 10:00
44
tags:[Azure, powershell, OpenAI ]
5-
excerpt:"sampletocopy and paste"
5+
excerpt:"a powershell script that shows howtocall an Azure OpenAI chat completition endpoint API"
66

77
header:
88
overlay_image:https://live.staticflickr.com/65535/52755090506_6cf0808a3c_h.jpg
99
caption:"Photo credit: [**nicola since 1972**](https://www.flickr.com/photos/15216811@N06/52755090506)"
1010
---
1111

12-
The followingpowershellsamples shows how to call an Azure OpenAI chat completition endpoint API
12+
Apowershellscript that shows how to call an Azure OpenAI chat completition endpoint API
1313

14-
```
14+
```ps1
1515
# Azure OpenAI metadata variables
1616
$openai = @{
1717
api_key = "YOUR_APIKEY_HERE"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp