From 822d9de81287254958c08fe074d4ad96413a2760 Mon Sep 17 00:00:00 2001 From: Ashera Silva Date: Mon, 28 Oct 2024 15:13:01 +0530 Subject: [PATCH 1/3] Add note for AI API creation step --- .../design/create-api/create-ai-api/create-an-ai-api.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/en/docs/design/create-api/create-ai-api/create-an-ai-api.md b/en/docs/design/create-api/create-ai-api/create-an-ai-api.md index e405d745cf..9edc6c4a94 100644 --- a/en/docs/design/create-api/create-ai-api/create-an-ai-api.md +++ b/en/docs/design/create-api/create-ai-api/create-an-ai-api.md @@ -52,7 +52,13 @@ The overview page of the newly created API appears. #### b. Fill **API Key** for Production and Sandbox Endpoints. -**API Key format:** `Bearer ` +!!! Note + APIM supports three AI/LLM vendors by default. The supported authorization approach for each is mentioned below: + - **MistralAI**: `Authorization` header + - **AzureOpenAI**: `api-key` header + - **OpenAI**: `Authorization` header + + Note that we prepend "Bearer " to the header value that you provide when it comes to MistralAI and OpenAI since they are expecting an Authorization header. [![API Key Configurations]({{base_path}}/assets/img/learn/ai-api-auth.png){: style="width:90%"}]({{base_path}}/assets/img/learn/ai-api-auth.png) From 70bf8439427c78dec0f59b76c3a540e12dc2d5e6 Mon Sep 17 00:00:00 2001 From: Ashera Silva Date: Mon, 28 Oct 2024 15:39:17 +0530 Subject: [PATCH 2/3] Restructure AI API content --- .../create-ai-api/create-an-ai-api.md | 69 ++++++++++--------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/en/docs/design/create-api/create-ai-api/create-an-ai-api.md b/en/docs/design/create-api/create-ai-api/create-an-ai-api.md index 9edc6c4a94..c66a1a6608 100644 --- a/en/docs/design/create-api/create-ai-api/create-an-ai-api.md +++ b/en/docs/design/create-api/create-ai-api/create-an-ai-api.md @@ -1,45 +1,46 @@ # Create an AI API -AI APIs enable seamless integration of artificial intelligence services into applications through the WSO2 API Manager. By using the AI API feature, users can select specific AI vendors that best suit their needs. WSO2 API Manager provides built-in support for leading AI vendors like OpenAI, Mistral, and Azure AI, while also allowing configuration of custom AI vendors to create AI APIs. +AI APIs enable seamless integration of artificial intelligence services into applications through the WSO2 API Manager. By using the AI API feature, users can select specific AI vendors that best suit their needs. WSO2 API Manager provides built-in support for leading AI vendors like **OpenAI**, **Mistral**, and **Azure AI**, while also allowing configuration of custom AI vendors to create AI APIs. -Follow the instructions below to create a REST API using the basic flow: +Follow the instructions below to create an AI API using the basic flow: -### 1. Sign in to the WSO2 API Publisher. +### Step 1: Create an AI API -`https://:9443/publisher` +1. Sign in to the API Publisher Portal. -Example: `https://localhost:9443/publisher` + `https://:9443/publisher` -
-

Note

-

The Create API button will only appear for a user who has the creator role permission.

-
- + Example: `https://localhost:9443/publisher` -### 2. Click **Create API** and then click **AI API**. +
+

Note

+

The Create API button will only appear for a user who has the creator role permission.

+
+ -[![Select AI API]({{base_path}}/assets/img/learn/select-ai-api.png){: style="width:90%"}]({{base_path}}/assets/img/learn/select-ai-api.png) +2. Click **Create API** and then click **AI API**. -### 3. Select **AI Provider** and **AI Provider API Version**. + [![Select AI API]({{base_path}}/assets/img/learn/select-ai-api.png){: style="width:90%"}]({{base_path}}/assets/img/learn/select-ai-api.png) -[![Select AI Service Provider and Version]({{base_path}}/assets/img/learn/create-ai-api.png){: style="width:90%"}]({{base_path}}/assets/img/learn/create-ai-api.png) +3. Select the desired **AI Provider** and the relevant **AI Provider API Version** and click Next. -
-

Note

-

The available AI service providers and versions will appear on relevant dropdowns. In adition to inbuild AI service vendors, you can also configure custom AI service vendors.

-
+ [![Select AI Service Provider and Version]({{base_path}}/assets/img/learn/create-ai-api.png){: style="width:90%"}]({{base_path}}/assets/img/learn/create-ai-api.png) -### 4. Configure AI API details. +
+

Note

+

The available AI service providers and versions will appear on relevant dropdowns. In adition to inbuild AI service vendors, you can also configure custom AI service vendors.

+
+ +4. Configure AI API details. -
FieldSample value
NameMistralAIAPI
Version0.0.2
Context

mistralaiapi

The API context is used by the Gateway to identify the API. Therefore, the API context must be unique. This context is the API's root context when invoking the API through the Gateway.

You can define the API's version as a parameter of its context by adding the {version} into the context. For example, {version}/mistralaiapi. The API Manager assigns the actual version of the API to the {version} parameter internally. For example, https://localhost:8243/0.0.2/mistralaiapi. Note that the version appears before the context, allowing you to group your APIs based on the versions.

Endpoint

https://api.mistral.ai

The endpoint of the AI service vendor is automatically added as the production and sandbox endpoints.

+
FieldSample value
NameMistralAIAPI
Version0.0.2
Context

mistralaiapi

The API context is used by the Gateway to identify the API. Therefore, the API context must be unique. This context is the API's root context when invoking the API through the Gateway.

You can define the API's version as a parameter of its context by adding the {version} into the context. For example, {version}/mistralaiapi. The API Manager assigns the actual version of the API to the {version} parameter internally. For example, https://localhost:8243/0.0.2/mistralaiapi. Note that the version appears before the context, allowing you to group your APIs based on the versions.

Endpoint

https://api.mistral.ai

The endpoint of the AI service vendor is automatically added as the production and sandbox endpoints.

-### 5. Click **Create** to create the API. +5. Click **Create** to create the API. The overview page of the newly created API appears. -### 6. Go to **API Configurations**, and click **Endpoints**. +### Step 2: Obtain API Key from AI Service Vendor -#### a. Get an API Key from the AI Service Vendor.

Example: Mistral AI

@@ -50,19 +51,23 @@ The overview page of the newly created API appears.
-#### b. Fill **API Key** for Production and Sandbox Endpoints. +### Step 3: Configure Sandbox and Production Endpoint + +1. Go to **API Configurations**, and click **Endpoints**. + +2. Fill **API Key** for Production and Sandbox Endpoints using the key which was obtained from Step 2. -!!! Note - APIM supports three AI/LLM vendors by default. The supported authorization approach for each is mentioned below: - - **MistralAI**: `Authorization` header - - **AzureOpenAI**: `api-key` header - - **OpenAI**: `Authorization` header + !!! Note + APIM supports three AI/LLM vendors by default. The supported authorization approach for each is mentioned below: + - **MistralAI**: `Authorization` header + - **AzureOpenAI**: `api-key` header + - **OpenAI**: `Authorization` header - Note that we prepend "Bearer " to the header value that you provide when it comes to MistralAI and OpenAI since they are expecting an Authorization header. + Note that we prepend "Bearer " to the header value that you provide when it comes to MistralAI and OpenAI since they are expecting an Authorization header. -[![API Key Configurations]({{base_path}}/assets/img/learn/ai-api-auth.png){: style="width:90%"}]({{base_path}}/assets/img/learn/ai-api-auth.png) + [![API Key Configurations]({{base_path}}/assets/img/learn/ai-api-auth.png){: style="width:90%"}]({{base_path}}/assets/img/learn/ai-api-auth.png) -#### c. Click **Save**. +3. Click **Save**. Now, you have successfully created an AI API. Next, [deploy the API]({{base_path}}/deploy-and-publish/deploy-on-gateway/deploy-api/deploy-an-api/), [test the API]({{base_path}}/design/create-api/create-rest-api/test-a-rest-api/), and finally [publish the API]({{base_path}}/deploy-and-publish/publish-on-dev-portal/publish-an-api). From 0707e1f9f21d0368d6edd26dbbff3577641bd48e Mon Sep 17 00:00:00 2001 From: Ashera Silva Date: Mon, 28 Oct 2024 15:43:37 +0530 Subject: [PATCH 3/3] Fix rate limiting link --- en/docs/design/create-api/create-ai-api/create-an-ai-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/docs/design/create-api/create-ai-api/create-an-ai-api.md b/en/docs/design/create-api/create-ai-api/create-an-ai-api.md index c66a1a6608..eedb237796 100644 --- a/en/docs/design/create-api/create-ai-api/create-an-ai-api.md +++ b/en/docs/design/create-api/create-ai-api/create-an-ai-api.md @@ -77,7 +77,7 @@ Learn more on the concepts that you need to know when creating a REST API: - [API Security]({{base_path}}/design/api-security/api-authentication/secure-apis-using-oauth2-tokens/) -- [Rate Limiting]({{base_path}}/design/rate-limiting/introducing-throttling-use-cases/) +- [Rate Limiting for AI APIs]({{base_path}}/design/rate-limiting/rate-limiting-for-ai-apis/) - [Life Cycle Management]({{base_path}}/design/lifecycle-management/api-lifecycle/) - [API Visibility]({{base_path}}/design/advanced-topics/control-api-visibility-and-subscription-availability-in-developer-portal/)